summaryrefslogtreecommitdiffstats
path: root/src/core/web_contents_delegate_qt.cpp
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2018-01-17 12:51:21 +0100
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2018-01-17 12:51:21 +0100
commit2c6e6b86ef0a6c63297f9d5daa41c294aaf31a9b (patch)
treea8bcb1c7cb5aaf8194eab09f8bc56b2659f13ea5 /src/core/web_contents_delegate_qt.cpp
parentaa527a2e553bea0514bc088bfc09105703fe87ba (diff)
parent819e00f71e37f5230b9b2c2ff756db4cc4cfda5e (diff)
Merge remote-tracking branch 'origin/5.10' into dev
Conflicts: .qmake.conf src/webengine/api/qquickwebengineview_p_p.h src/webenginewidgets/api/qwebenginepage_p.h tests/auto/quick/qmltests/data/TestWebEngineView.qml Change-Id: Id2acc92e8d0364bdaaf5a63ea2d2cb9cd533ade3
Diffstat (limited to 'src/core/web_contents_delegate_qt.cpp')
-rw-r--r--src/core/web_contents_delegate_qt.cpp25
1 files changed, 21 insertions, 4 deletions
diff --git a/src/core/web_contents_delegate_qt.cpp b/src/core/web_contents_delegate_qt.cpp
index 2086bea4b..7b765d99b 100644
--- a/src/core/web_contents_delegate_qt.cpp
+++ b/src/core/web_contents_delegate_qt.cpp
@@ -80,6 +80,16 @@
namespace QtWebEngineCore {
+static gfx::Rect rootViewToScreenRect(content::WebContents *web_contents, const gfx::Rect &anchor_in_root_view)
+{
+ RenderWidgetHostViewQt *rwhv = static_cast<RenderWidgetHostViewQt *>(web_contents->GetRenderWidgetHostView());
+ if (!rwhv)
+ return gfx::Rect();
+ content::ScreenInfo screenInfo;
+ rwhv->GetScreenInfo(&screenInfo);
+ return gfx::ScaleToEnclosingRect(anchor_in_root_view, 1 / screenInfo.device_scale_factor);
+}
+
// Maps the LogSeverity defines in base/logging.h to the web engines message levels.
static WebContentsAdapterClient::JavaScriptConsoleMessageLevel mapToJavascriptConsoleMessageLevel(int32_t messageLevel) {
if (messageLevel < 1)
@@ -336,6 +346,9 @@ void WebContentsDelegateQt::DidUpdateFaviconURL(const std::vector<content::Favic
faviconCandidates.append(toFaviconInfo(candidate));
}
+ // Favicon URL can be changed from JavaScript too. Thus we need to reset
+ // the current candidate icon list to not handle previous icon as a candidate.
+ m_faviconManager->resetCandidates();
m_faviconManager->update(faviconCandidates);
}
@@ -552,8 +565,10 @@ void WebContentsDelegateQt::launchExternalURL(const QUrl &url, ui::PageTransitio
void WebContentsDelegateQt::ShowValidationMessage(content::WebContents *web_contents, const gfx::Rect &anchor_in_root_view, const base::string16 &main_text, const base::string16 &sub_text)
{
- Q_UNUSED(web_contents);
- m_viewClient->showValidationMessage(toQt(anchor_in_root_view), toQt(main_text), toQt(sub_text));
+ gfx::Rect anchor = rootViewToScreenRect(web_contents, anchor_in_root_view);
+ if (anchor.IsEmpty())
+ return;
+ m_viewClient->showValidationMessage(toQt(anchor), toQt(main_text), toQt(sub_text));
}
void WebContentsDelegateQt::HideValidationMessage(content::WebContents *web_contents)
@@ -564,8 +579,10 @@ void WebContentsDelegateQt::HideValidationMessage(content::WebContents *web_cont
void WebContentsDelegateQt::MoveValidationMessage(content::WebContents *web_contents, const gfx::Rect &anchor_in_root_view)
{
- Q_UNUSED(web_contents);
- m_viewClient->moveValidationMessage(toQt(anchor_in_root_view));
+ gfx::Rect anchor = rootViewToScreenRect(web_contents, anchor_in_root_view);
+ if (anchor.IsEmpty())
+ return;
+ m_viewClient->moveValidationMessage(toQt(anchor));
}
void WebContentsDelegateQt::BeforeUnloadFired(content::WebContents *tab, bool proceed, bool *proceed_to_fire_unload)