[WinCairo] Video position is incorrect when located inside a frame.
authorpeavo@outlook.com <peavo@outlook.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 17 Mar 2015 21:29:21 +0000 (21:29 +0000)
committerpeavo@outlook.com <peavo@outlook.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 17 Mar 2015 21:29:21 +0000 (21:29 +0000)
https://bugs.webkit.org/show_bug.cgi?id=142784

Reviewed by Brent Fulgham.

We need to take the enclosing frame's position into account, when finding the video position.

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

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

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

index 5030b98..edb7581 100644 (file)
@@ -1,3 +1,15 @@
+2015-03-17  Per Arne Vollan  <peavo@outlook.com>
+
+        [WinCairo] Video position is incorrect when located inside a frame.
+        https://bugs.webkit.org/show_bug.cgi?id=142784
+
+        Reviewed by Brent Fulgham.
+
+        We need to take the enclosing frame's position into account, when finding the video position.
+
+        * platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp:
+        (WebCore::MediaPlayerPrivateMediaFoundation::setSize):
+
 2015-03-17  Benjamin Poulain  <bpoulain@apple.com>
 
         Compile character ranges targeting the same state as range check in the bytecode
index 75df1b3..d798f5a 100644 (file)
@@ -204,18 +204,21 @@ void MediaPlayerPrivateMediaFoundation::setSize(const IntSize& size)
         return;
 
     LayoutSize scrollOffset;
+    IntPoint positionInWindow(m_lastPaintRect.location());
 
     FrameView* view = nullptr;
     if (m_player && m_player->cachedResourceLoader() && m_player->cachedResourceLoader()->document())
         view = m_player->cachedResourceLoader()->document()->view();
-    if (view)
+
+    if (view) {
         scrollOffset = view->scrollOffsetForFixedPosition();
+        positionInWindow = view->convertToContainingWindow(m_lastPaintRect.location());
+    }
 
-    int xPos = -scrollOffset.width().toInt() + m_lastPaintRect.x();
-    int yPos = -scrollOffset.height().toInt() + m_lastPaintRect.y();
+    positionInWindow.move(-scrollOffset.width().toInt(), -scrollOffset.height().toInt());
 
     if (m_hwndVideo && !m_lastPaintRect.isEmpty())
-        ::MoveWindow(m_hwndVideo, xPos, yPos, m_size.width(), m_size.height(), FALSE);
+        ::MoveWindow(m_hwndVideo, positionInWindow.x(), positionInWindow.y(), m_size.width(), m_size.height(), FALSE);
 
     RECT rc = { 0, 0, m_size.width(), m_size.height() };
     m_videoDisplay->SetVideoPosition(nullptr, &rc);