Commit 2d405bad authored by timothy_horton@apple.com's avatar timothy_horton@apple.com
Browse files

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:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154412 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 69483c7a
2013-08-21 Tim Horton <timothy_horton@apple.com>
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 <ap@apple.com>
 
https://bugs.webkit.org/show_bug.cgi?id=111650
......@@ -18,6 +18,8 @@ Expected to be obscured:
'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 @@ Expected to not be obscured:
'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
......@@ -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="resources/plugin-page.html" style="width: 100px; height: 100px;" class="shouldBeObscured"></iframe>
<iframe id="largeIFrame" src="resources/plugin-page.html" style="width: 500px; height: 500px;" class="shouldNotBeObscured"></iframe>
<div id="log"></div>
</body>
</html>
\ No newline at end of file
2013-08-21 Tim Horton <timothy_horton@apple.com>
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 <akling@apple.com>
 
<https://webkit.org/b/120132> Frame::navigationScheduler() should return a reference.
......@@ -407,45 +407,47 @@ bool RenderEmbeddedObject::isReplacementObscured() const
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;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment