[Win] Popup menu displayed at incorrect position when page is scrolled and device...
authorpeavo@outlook.com <peavo@outlook.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 18 Aug 2015 19:03:18 +0000 (19:03 +0000)
committerpeavo@outlook.com <peavo@outlook.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 18 Aug 2015 19:03:18 +0000 (19:03 +0000)
https://bugs.webkit.org/show_bug.cgi?id=148130

Reviewed by Alex Christensen.

Scale WebView coordinates with device scale factor.

* platform/win/PopupMenuWin.cpp:
(WebCore::PopupMenuWin::calculatePositionAndSize):

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

Source/WebCore/ChangeLog
Source/WebCore/platform/win/PopupMenuWin.cpp

index f413718..8762eea 100644 (file)
@@ -1,3 +1,15 @@
+2015-08-18  Per Arne Vollan  <peavo@outlook.com>
+
+        [Win] Popup menu displayed at incorrect position when page is scrolled and device scale factor != 1.
+        https://bugs.webkit.org/show_bug.cgi?id=148130
+
+        Reviewed by Alex Christensen.
+
+        Scale WebView coordinates with device scale factor.
+
+        * platform/win/PopupMenuWin.cpp:
+        (WebCore::PopupMenuWin::calculatePositionAndSize):
+
 2015-08-18  Javier Fernandez  <jfernandez@igalia.com>
 
         [CSS Grid Layout] Do not stretch always grid items with auto width
index 842c3cc..4df7e5e 100644 (file)
@@ -313,11 +313,9 @@ void PopupMenuWin::calculatePositionAndSize(const IntRect& r, FrameView* v)
     // r is in absolute document coordinates, but we want to be in screen coordinates.
 
     // First, move to WebView coordinates
-    IntRect rScaled = r;
-    Page* page = v->frame().page();
-    if (page)
-        rScaled.scale(page->deviceScaleFactor());
-    IntRect rScreenCoords(v->contentsToWindow(rScaled.location()), rScaled.size());
+    IntRect rScreenCoords(v->contentsToWindow(r.location()), r.size());
+    if (Page* page = v->frame().page())
+        rScreenCoords.scale(page->deviceScaleFactor());
 
     // Then, translate to screen coordinates
     POINT location(rScreenCoords.location());