summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Tokarev <annulen@yandex.ru>2016-09-13 21:05:16 +0300
committerKonstantin Tokarev <annulen@yandex.ru>2017-03-20 20:20:28 +0000
commit8f0971a1425e5d322af576581e225e4d0e6e5313 (patch)
treebc9bca7d9518ee095884a2de3b577e85805c00e6
parenta52dd53ae4e1c33ee8400c65db3af868edd988b3 (diff)
downloadqtwebkit-8f0971a1425e5d322af576581e225e4d0e6e5313.tar.gz
Plugin positioning for windows needs to honor QT_SCALE_FACTOR
Change-Id: I20a896fea05f972e6cc1ebf8b716c7acb20b65d1 Reviewed-by: Konstantin Tokarev <annulen@yandex.ru>
-rw-r--r--Source/WebCore/plugins/win/PluginViewWin.cpp25
1 files changed, 22 insertions, 3 deletions
diff --git a/Source/WebCore/plugins/win/PluginViewWin.cpp b/Source/WebCore/plugins/win/PluginViewWin.cpp
index b225673ab..6a34dc33c 100644
--- a/Source/WebCore/plugins/win/PluginViewWin.cpp
+++ b/Source/WebCore/plugins/win/PluginViewWin.cpp
@@ -356,6 +356,20 @@ static inline bool isWebViewVisible(FrameView* view)
#endif // PLATFORM(QT)
}
+static inline IntRect toDevicePixelRatio(FrameView* view, const IntRect & rect)
+{
+#if PLATFORM(QT)
+ if (PlatformPageClient client = view->hostWindow()->platformPageClient()) {
+ if (QWindow* window = client->ownerWindow()) {
+ IntRect scaleRect = rect;
+ scaleRect.scale(window->devicePixelRatio());
+ return scaleRect;
+ }
+ }
+#endif
+ return rect;
+}
+
static inline IntPoint contentsToNativeWindow(FrameView* view, const IntPoint& point)
{
#if PLATFORM(QT)
@@ -465,6 +479,7 @@ void PluginView::updatePluginWidget()
#endif
m_clipRect = windowClipRect();
m_clipRect.move(-m_windowRect.x(), -m_windowRect.y());
+ IntRect scaledClipRect(toDevicePixelRatio(frameView, m_clipRect));
if (platformPluginWidget() && (!m_haveUpdatedPluginWidget || m_windowRect != oldWindowRect || m_clipRect != oldClipRect)) {
HRGN rgn;
@@ -479,17 +494,18 @@ void PluginView::updatePluginWidget()
rgn = ::CreateRectRgn(0, 0, 0, 0);
::SetWindowRgn(platformPluginWidget(), rgn, FALSE);
} else {
- rgn = ::CreateRectRgn(m_clipRect.x(), m_clipRect.y(), m_clipRect.maxX(), m_clipRect.maxY());
+ rgn = ::CreateRectRgn(scaledClipRect.x(), scaledClipRect.y(), scaledClipRect.maxX(), scaledClipRect.maxY());
::SetWindowRgn(platformPluginWidget(), rgn, TRUE);
}
if (!m_haveUpdatedPluginWidget || m_windowRect != oldWindowRect) {
IntRect nativeWindowRect = contentsToNativeWindow(frameView, frameRect());
+ nativeWindowRect = IntRect(toDevicePixelRatio(frameView, nativeWindowRect));
::MoveWindow(platformPluginWidget(), nativeWindowRect.x(), nativeWindowRect.y(), nativeWindowRect.width(), nativeWindowRect.height(), TRUE);
}
if (clipToZeroRect) {
- rgn = ::CreateRectRgn(m_clipRect.x(), m_clipRect.y(), m_clipRect.maxX(), m_clipRect.maxY());
+ rgn = ::CreateRectRgn(scaledClipRect.x(), scaledClipRect.y(), scaledClipRect.maxX(), scaledClipRect.maxY());
::SetWindowRgn(platformPluginWidget(), rgn, TRUE);
}
@@ -839,11 +855,14 @@ void PluginView::setParentVisible(bool visible)
}
}
-void PluginView::setNPWindowRect(const IntRect& rect)
+void PluginView::setNPWindowRect(const IntRect& winRect)
{
if (!m_isStarted)
return;
+ ASSERT(parent()->isFrameView());
+ IntRect rect(toDevicePixelRatio(toFrameView(parent()), winRect));
+
#if OS(WINCE)
IntRect r = toFrameView(parent())->contentsToWindow(rect);
m_npWindow.x = r.x();