Title: [154412] trunk
Revision
154412
Author
[email protected]
Date
2013-08-21 14:03:49 -0700 (Wed, 21 Aug 2013)

Log Message

isReplacementObscured is wrong when the indicator is clipped by an iframe
https://bugs.webkit.org/show_bug.cgi?id=120031
<rdar://problem/14606819>

Reviewed by Simon Fraser.

Hit-test for plugin obscurity in the root document. To do this, we also need
to convert the indicator rectangle into root view coordinates before
hit testing its edges.

This resolves the case where an iframe which clips its content was reporting
the indicator as not obscured, despite the fact that it was obscured from the
point of view of the user.

Updated test plugins/unavailable-plugin-indicator-obscurity.html

* rendering/RenderEmbeddedObject.cpp:
(WebCore::RenderEmbeddedObject::isReplacementObscured):

Update the unavailable plugin indicator test to also ensure that plugins are
correctly known to be obscured when contained within and clipped by an <iframe>.

* plugins/unavailable-plugin-indicator-obscurity-expected.txt:
* plugins/unavailable-plugin-indicator-obscurity.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (154411 => 154412)


--- trunk/LayoutTests/ChangeLog	2013-08-21 21:00:50 UTC (rev 154411)
+++ trunk/LayoutTests/ChangeLog	2013-08-21 21:03:49 UTC (rev 154412)
@@ -1,3 +1,17 @@
+2013-08-21  Tim Horton  <[email protected]>
+
+        isReplacementObscured is wrong when the indicator is clipped by an iframe
+        https://bugs.webkit.org/show_bug.cgi?id=120031
+        <rdar://problem/14606819>
+
+        Reviewed by Simon Fraser.
+
+        Update the unavailable plugin indicator test to also ensure that plugins are
+        correctly known to be obscured when contained within and clipped by an <iframe>.
+
+        * plugins/unavailable-plugin-indicator-obscurity-expected.txt:
+        * plugins/unavailable-plugin-indicator-obscurity.html:
+
 2013-08-21  Alexey Proskuryakov  <[email protected]>
 
         https://bugs.webkit.org/show_bug.cgi?id=111650

Modified: trunk/LayoutTests/plugins/unavailable-plugin-indicator-obscurity-expected.txt (154411 => 154412)


--- trunk/LayoutTests/plugins/unavailable-plugin-indicator-obscurity-expected.txt	2013-08-21 21:00:50 UTC (rev 154411)
+++ trunk/LayoutTests/plugins/unavailable-plugin-indicator-obscurity-expected.txt	2013-08-21 21:03:49 UTC (rev 154412)
@@ -18,6 +18,8 @@
 'offScreenTopLeft' was obscured: true (expected true; PASS)
 'offScreenTop' was obscured: true (expected true; PASS)
 'offScreenLeft' was obscured: true (expected true; PASS)
+'overflowScrollObscured' was obscured: true (expected true; PASS)
+'smallIFrame' was obscured: true (expected true; PASS)
 
 Expected to not be obscured:
 'large' was obscured: false (expected false; PASS)
@@ -25,6 +27,7 @@
 'notClippedByParent' was obscured: false (expected false; PASS)
 'topQuarterObscured' was obscured: false (expected false; PASS)
 'bottomQuarterObscured' was obscured: false (expected false; PASS)
+'largeIFrame' was obscured: false (expected false; PASS)
 
 Passed all tests: false
 

Modified: trunk/LayoutTests/plugins/unavailable-plugin-indicator-obscurity.html (154411 => 154412)


--- trunk/LayoutTests/plugins/unavailable-plugin-indicator-obscurity.html	2013-08-21 21:00:50 UTC (rev 154411)
+++ trunk/LayoutTests/plugins/unavailable-plugin-indicator-obscurity.html	2013-08-21 21:03:49 UTC (rev 154412)
@@ -18,12 +18,17 @@
         var expectedObscuredPlugins = document.getElementsByClassName(className);
         for (var i = 0; i < expectedObscuredPlugins.length; i++) {
             var plugin = expectedObscuredPlugins[i];
+            var pluginName = plugin.id;
+
+            if (plugin.tagName == "IFRAME")
+                plugin = plugin.contentDocument.getElementById("testPlugin");
+
             var obscured = internals.isPluginUnavailabilityIndicatorObscured(plugin);
             var passed = expectedObscured == obscured;
             if (!passed)
                 failedAnyTest = true;
 
-            log("'" + plugin.id + "' was obscured: " + obscured + " (expected " + expectedObscured + "; " + (passed ? "PASS" : "FAIL") + ")");
+            log("'" + pluginName + "' was obscured: " + obscured + " (expected " + expectedObscured + "; " + (passed ? "PASS" : "FAIL") + ")");
         };
 
         return failedAnyTest;
@@ -155,6 +160,15 @@
         <embed id="offScreenTop" class="shouldBeObscured" type="application/x-webkit-test-netscape" style="position: absolute; top: -1000px; left: 0;"></embed>
         <embed id="offScreenLeft" class="shouldBeObscured" type="application/x-webkit-test-netscape" style="position: absolute; top: 0; left: -1000px;"></embed>
 
+        <!-- Obscured by overflow clipping -->
+        <div style="overflow: scroll; width: 100px; height: 100px;">
+            <embed id="overflowScrollObscured" class="shouldBeObscured" type="application/x-webkit-test-netscape"></embed>
+        </div>
+
+        <!-- Obscured by iframe clipping -->
+        <iframe id="smallIFrame" src="" style="width: 100px; height: 100px;" class="shouldBeObscured"></iframe>
+        <iframe id="largeIFrame" src="" style="width: 500px; height: 500px;" class="shouldNotBeObscured"></iframe>
+
         <div id="log"></div>
     </body>
 </html>
\ No newline at end of file

Modified: trunk/Source/WebCore/ChangeLog (154411 => 154412)


--- trunk/Source/WebCore/ChangeLog	2013-08-21 21:00:50 UTC (rev 154411)
+++ trunk/Source/WebCore/ChangeLog	2013-08-21 21:03:49 UTC (rev 154412)
@@ -1,3 +1,24 @@
+2013-08-21  Tim Horton  <[email protected]>
+
+        isReplacementObscured is wrong when the indicator is clipped by an iframe
+        https://bugs.webkit.org/show_bug.cgi?id=120031
+        <rdar://problem/14606819>
+
+        Reviewed by Simon Fraser.
+
+        Hit-test for plugin obscurity in the root document. To do this, we also need
+        to convert the indicator rectangle into root view coordinates before
+        hit testing its edges.
+
+        This resolves the case where an iframe which clips its content was reporting
+        the indicator as not obscured, despite the fact that it was obscured from the
+        point of view of the user.
+
+        Updated test plugins/unavailable-plugin-indicator-obscurity.html
+
+        * rendering/RenderEmbeddedObject.cpp:
+        (WebCore::RenderEmbeddedObject::isReplacementObscured):
+
 2013-08-21  Andreas Kling  <[email protected]>
 
         <https://webkit.org/b/120132> Frame::navigationScheduler() should return a reference.

Modified: trunk/Source/WebCore/rendering/RenderEmbeddedObject.cpp (154411 => 154412)


--- trunk/Source/WebCore/rendering/RenderEmbeddedObject.cpp	2013-08-21 21:00:50 UTC (rev 154411)
+++ trunk/Source/WebCore/rendering/RenderEmbeddedObject.cpp	2013-08-21 21:03:49 UTC (rev 154412)
@@ -407,45 +407,47 @@
     if (rect.isEmpty())
         return true;
 
-    RenderView* docRenderer = document()->renderView();
-    ASSERT(docRenderer);
-    if (!docRenderer)
+    RenderView* rootRenderView = document()->topDocument()->renderView();
+    ASSERT(rootRenderView);
+    if (!rootRenderView)
         return true;
+
+    IntRect rootViewRect = frameView()->convertToRootView(pixelSnappedIntRect(rect));
     
-    HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::Active | HitTestRequest::IgnoreClipping | HitTestRequest::DisallowShadowContent);
+    HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::Active | HitTestRequest::IgnoreClipping | HitTestRequest::DisallowShadowContent | HitTestRequest::AllowChildFrameContent);
     HitTestResult result;
     HitTestLocation location;
     
-    LayoutUnit x = rect.x();
-    LayoutUnit y = rect.y();
-    LayoutUnit width = rect.width();
-    LayoutUnit height = rect.height();
+    LayoutUnit x = rootViewRect.x();
+    LayoutUnit y = rootViewRect.y();
+    LayoutUnit width = rootViewRect.width();
+    LayoutUnit height = rootViewRect.height();
     
     // Hit test the center and near the corners of the replacement text to ensure
     // it is visible and is not masked by other elements.
     bool hit = false;
     location = LayoutPoint(x + width / 2, y + height / 2);
-    hit = docRenderer->hitTest(request, location, result);
+    hit = rootRenderView->hitTest(request, location, result);
     if (!hit || result.innerNode() != node())
         return true;
     
     location = LayoutPoint(x, y);
-    hit = docRenderer->hitTest(request, location, result);
+    hit = rootRenderView->hitTest(request, location, result);
     if (!hit || result.innerNode() != node())
         return true;
     
     location = LayoutPoint(x + width, y);
-    hit = docRenderer->hitTest(request, location, result);
+    hit = rootRenderView->hitTest(request, location, result);
     if (!hit || result.innerNode() != node())
         return true;
     
     location = LayoutPoint(x + width, y + height);
-    hit = docRenderer->hitTest(request, location, result);
+    hit = rootRenderView->hitTest(request, location, result);
     if (!hit || result.innerNode() != node())
         return true;
     
     location = LayoutPoint(x, y + height);
-    hit = docRenderer->hitTest(request, location, result);
+    hit = rootRenderView->hitTest(request, location, result);
     if (!hit || result.innerNode() != node())
         return true;
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to