Fix bug in WebPluginContainer::isRectTopmost() which gave the incorrect result for...
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 16 Apr 2012 17:43:23 +0000 (17:43 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 16 Apr 2012 17:43:23 +0000 (17:43 +0000)
https://bugs.webkit.org/show_bug.cgi?id=80606

Patch by Raymes Khoury <raymes@chromium.org> on 2012-04-16
Reviewed by Darin Fisher.

* src/WebPluginContainerImpl.cpp:
(WebKit::WebPluginContainerImpl::isRectTopmost):

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

Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/src/WebPluginContainerImpl.cpp

index 04ac5b9..8318df7 100644 (file)
@@ -1,3 +1,13 @@
+2012-04-16  Raymes Khoury  <raymes@chromium.org>
+
+        Fix bug in WebPluginContainer::isRectTopmost() which gave the incorrect result for a scrolled window.
+        https://bugs.webkit.org/show_bug.cgi?id=80606
+
+        Reviewed by Darin Fisher.
+
+        * src/WebPluginContainerImpl.cpp:
+        (WebKit::WebPluginContainerImpl::isRectTopmost):
+
 2012-04-15  Keishi Hattori  <keishi@webkit.org>
 
         Introduce MenuItemID to autofill popup
index f9e678d..f69ae5c 100644 (file)
@@ -453,10 +453,10 @@ bool WebPluginContainerImpl::isRectTopmost(const WebRect& rect)
 
     // hitTestResultAtPoint() takes a padding rectangle.
     // FIXME: We'll be off by 1 when the width or height is even.
-    IntRect windowRect = convertToContainingWindow(static_cast<IntRect>(rect));
-    LayoutPoint center = windowRect.center();
+    IntRect documentRect(x() + rect.x, y() + rect.y, rect.width, rect.height);
+    LayoutPoint center = documentRect.center();
     // Make the rect we're checking (the point surrounded by padding rects) contained inside the requested rect. (Note that -1/2 is 0.)
-    LayoutSize padding((windowRect.width() - 1) / 2, (windowRect.height() - 1) / 2);
+    LayoutSize padding((documentRect.width() - 1) / 2, (documentRect.height() - 1) / 2);
     HitTestResult result =
         page->mainFrame()->eventHandler()->hitTestResultAtPoint(center, false, false, DontHitTestScrollbars, HitTestRequest::ReadOnly | HitTestRequest::Active, padding);
     const HitTestResult::NodeSet& nodes = result.rectBasedTestResult();