Chromium Code Reviews| 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 1436b167804e8e542325d07661e7d8faafab1f89..dfef8a9313a57758958834cfa59b917d1f22838d 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><span><img style='width: 20px; height: 100px'></span>text text text"); |
|
chrishtr
2016/08/05 01:07:02
Replace the span + img with a simple div.
szager1
2016/08/05 01:27:21
The span is inline; you want me to replace with:
chrishtr
2016/08/05 03:13:34
The whole point of the test is to check that an em
|
| + document().view()->updateAllLifecyclePhases(); |
| + |
| + LayoutBlock* frameContainer = toLayoutBlock(getLayoutObjectByElementId("frameContainer")); |
| + LayoutBlock* frameBody = toLayoutBlock(frameDocument.body()->layoutObject()); |
| + LayoutText* frameText = toLayoutText(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(frameText->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(frameText->mapToVisualRectInAncestorSpace(&layoutView(), rect)); |
| + EXPECT_EQ(rect, LayoutRect()); |
| +} |
| + |
| TEST_F(VisualRectMappingTest, SelfFlippedWritingMode) |
| { |
| setBodyInnerHTML( |