Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1456)

Unified Diff: third_party/WebKit/Source/core/layout/VisualRectMappingTest.cpp

Issue 2233513002: [mapToVisualRectInAncestorSpace] Check for detached iframes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@2785
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutView.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/layout/VisualRectMappingTest.cpp
diff --git a/third_party/WebKit/Source/core/layout/VisualRectMappingTest.cpp b/third_party/WebKit/Source/core/layout/VisualRectMappingTest.cpp
index 416f838353bb0cb319c2973c21e37aaac2de3f59..29dc0efb25fe40c7fc13992208b0c42f22d73d76 100644
--- a/third_party/WebKit/Source/core/layout/VisualRectMappingTest.cpp
+++ b/third_party/WebKit/Source/core/layout/VisualRectMappingTest.cpp
@@ -156,6 +156,39 @@ TEST_F(VisualRectMappingTest, LayoutViewSubpixelRounding)
EXPECT_EQ(LayoutRect(LayoutPoint(DoublePoint(0.5, 0)), LayoutSize(101, 100)), rect);
}
+TEST_F(VisualRectMappingTest, LayoutViewDisplayNone)
+{
+ document().setBaseURLOverride(KURL(ParsedURLString, "http://test.com"));
+ setBodyInnerHTML(
+ "<style>body { margin: 0; }</style>"
+ "<div id=frameContainer>"
+ " <iframe id=frame src='http://test.com' width='50' height='50' frameBorder='0'></iframe>"
+ "</div>");
+
+ Document& frameDocument = setupChildIframe("frame", "<style>body { margin: 0; }</style><div style='width:100px;height:100px;'></div>");
+ document().view()->updateAllLifecyclePhases();
+
+ LayoutBlock* frameContainer = toLayoutBlock(getLayoutObjectByElementId("frameContainer"));
+ LayoutBlock* frameBody = toLayoutBlock(frameDocument.body()->layoutObject());
+ LayoutBlock* frameDiv = toLayoutBlock(frameBody->lastChild());
+
+ // This part is copied from the LayoutView test, just to ensure that the mapped
+ // rect is valid before display:none is set on the iframe.
+ frameDocument.view()->setScrollPosition(DoublePoint(0, 47), ProgrammaticScroll);
+ LayoutRect originalRect(4, 60, 20, 80);
+ LayoutRect rect = originalRect;
+ EXPECT_TRUE(frameDiv->mapToVisualRectInAncestorSpace(frameContainer, rect));
+ EXPECT_EQ(rect, LayoutRect(4, 13, 20, 37));
+
+ Element* frameElement = document().getElementById("frame");
+ frameElement->setInlineStyleProperty(CSSPropertyDisplay, "none");
+ document().view()->updateAllLifecyclePhases();
+
+ rect = originalRect;
+ EXPECT_FALSE(frameDiv->mapToVisualRectInAncestorSpace(&layoutView(), rect));
+ EXPECT_EQ(rect, LayoutRect());
+}
+
TEST_F(VisualRectMappingTest, SelfFlippedWritingMode)
{
setBodyInnerHTML(
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutView.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698