[Win][HighDPI] Video window placement is incorrect.
authorpeavo@outlook.com <peavo@outlook.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 8 Sep 2015 18:23:23 +0000 (18:23 +0000)
committerpeavo@outlook.com <peavo@outlook.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 8 Sep 2015 18:23:23 +0000 (18:23 +0000)
https://bugs.webkit.org/show_bug.cgi?id=148954

Reviewed by Alex Christensen.

We need to scale window dimensions with device scale factor.

* platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp:
(WebCore::MediaPlayerPrivateMediaFoundation::setSize):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@189498 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp

index 6a58c3b..8b07286 100644 (file)
@@ -1,3 +1,15 @@
+2015-09-08  Per Arne Vollan  <peavo@outlook.com>
+
+        [Win][HighDPI] Video window placement is incorrect.
+        https://bugs.webkit.org/show_bug.cgi?id=148954
+
+        Reviewed by Alex Christensen.
+
+        We need to scale window dimensions with device scale factor.
+
+        * platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp:
+        (WebCore::MediaPlayerPrivateMediaFoundation::setSize):
+
 2015-09-08  Gyuyoung Kim  <gyuyoung.kim@webkit.org>
 
         Reduce uses of PassRefPtr in fileapi
index b9d9fdb..249bb17 100644 (file)
@@ -234,8 +234,11 @@ void MediaPlayerPrivateMediaFoundation::setSize(const IntSize& size)
     IntPoint positionInWindow(m_lastPaintRect.location());
 
     FrameView* view = nullptr;
-    if (m_player && m_player->cachedResourceLoader() && m_player->cachedResourceLoader()->document())
+    float deviceScaleFactor = 1.0f;
+    if (m_player && m_player->cachedResourceLoader() && m_player->cachedResourceLoader()->document()) {
         view = m_player->cachedResourceLoader()->document()->view();
+        deviceScaleFactor = m_player->cachedResourceLoader()->document()->deviceScaleFactor();
+    }
 
     if (view) {
         scrollOffset = view->scrollOffsetForFixedPosition();
@@ -244,10 +247,15 @@ void MediaPlayerPrivateMediaFoundation::setSize(const IntSize& size)
 
     positionInWindow.move(-scrollOffset.width().toInt(), -scrollOffset.height().toInt());
 
+    int x = positionInWindow.x() * deviceScaleFactor;
+    int y = positionInWindow.y() * deviceScaleFactor;
+    int w = m_size.width() * deviceScaleFactor;
+    int h = m_size.height() * deviceScaleFactor;
+
     if (m_hwndVideo && !m_lastPaintRect.isEmpty())
-        ::MoveWindow(m_hwndVideo, positionInWindow.x(), positionInWindow.y(), m_size.width(), m_size.height(), FALSE);
+        ::MoveWindow(m_hwndVideo, x, y, w, h, FALSE);
 
-    RECT rc = { 0, 0, m_size.width(), m_size.height() };
+    RECT rc = { 0, 0, w, h };
     m_videoDisplay->SetVideoPosition(nullptr, &rc);
 }