diff options
author | Peter Varga <pvarga@inf.u-szeged.hu> | 2018-05-16 09:36:24 +0200 |
---|---|---|
committer | Peter Varga <pvarga@inf.u-szeged.hu> | 2018-05-17 08:32:30 +0000 |
commit | bab4ababd097fd90b227a5a1bca63343b97af091 (patch) | |
tree | 3765bf3196f10453a38d973fd8ed2916c33ddd9d /src | |
parent | 8476245d1a197d05f988ef87f17b7ccbbcbba878 (diff) |
Keep settings synchronized when RVH swaps
There can be more than one RenderViewHost assigned to a single
WebContents. This is the case when starting a page load results changing
processes. When applying settings during the load it updates only the old
RVH. This fix applies the settings to the new RVH too after the swap.
Task-number: QTBUG-66656
Change-Id: I833415b2a34f58e2a9a18c209a025c82b73aa65a
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/core/web_contents_delegate_qt.cpp | 11 | ||||
-rw-r--r-- | src/core/web_contents_delegate_qt.h | 1 |
2 files changed, 12 insertions, 0 deletions
diff --git a/src/core/web_contents_delegate_qt.cpp b/src/core/web_contents_delegate_qt.cpp index aae7f4a43..7f3ced8aa 100644 --- a/src/core/web_contents_delegate_qt.cpp +++ b/src/core/web_contents_delegate_qt.cpp @@ -527,6 +527,17 @@ void WebContentsDelegateQt::ActivateContents(content::WebContents* contents) contents->Focus(); } +void WebContentsDelegateQt::RenderViewHostChanged(content::RenderViewHost *old_host, content::RenderViewHost *new_host) +{ + Q_ASSERT(new_host); + + // The old RVH can be nullptr if it was shut down. + if (!old_host) + return; + + new_host->UpdateWebkitPreferences(old_host->GetWebkitPreferences()); +} + void WebContentsDelegateQt::RequestToLockMouse(content::WebContents *web_contents, bool user_gesture, bool last_unlocked_by_target) { Q_UNUSED(user_gesture); diff --git a/src/core/web_contents_delegate_qt.h b/src/core/web_contents_delegate_qt.h index 2ef87ccd8..43badf60e 100644 --- a/src/core/web_contents_delegate_qt.h +++ b/src/core/web_contents_delegate_qt.h @@ -139,6 +139,7 @@ public: void WasShown() override; void DidFirstVisuallyNonEmptyPaint() override; void ActivateContents(content::WebContents* contents) override; + void RenderViewHostChanged(content::RenderViewHost *old_host, content::RenderViewHost *new_host) override; void didFailLoad(const QUrl &url, int errorCode, const QString &errorDescription); void overrideWebPreferences(content::WebContents *, content::WebPreferences*); |