Index: third_party/WebKit/Source/core/layout/LayoutObjectTest.cpp |
diff --git a/third_party/WebKit/Source/core/layout/LayoutObjectTest.cpp b/third_party/WebKit/Source/core/layout/LayoutObjectTest.cpp |
index 6afcf09eac39739903251250f7a6a2dd26f23a95..b91d7cb3681b5233ceafa888ce72d657eb9f5840 100644 |
--- a/third_party/WebKit/Source/core/layout/LayoutObjectTest.cpp |
+++ b/third_party/WebKit/Source/core/layout/LayoutObjectTest.cpp |
@@ -107,5 +107,21 @@ TEST_F(LayoutObjectTest, ContainingBlockAbsoluteLayoutObjectShouldNotBeNonStatic |
EXPECT_EQ(layoutObject->containingBlock(), bodyLayoutObject); |
} |
+TEST_F(LayoutObjectTest, MapToVisibleRectInContainerSpace) |
+{ |
+ setBodyInnerHTML( |
+ "<div id='container' style='overflow: scroll; will-change: transform; width: 50px; height: 50px'>" |
+ " <span><img style='width: 20px; height: 100px'></span>" |
+ " text text text text text text text" |
+ "</div>"); |
+ LayoutBlock* container = toLayoutBlock(document().getElementById("container")->layoutObject()); |
+ LayoutText* text = toLayoutText(container->lastChild()); |
+ |
+ container->setScrollTop(50); |
+ LayoutRect rect(0, 60, 20, 20); |
+ text->mapToVisibleRectInContainerSpace(container, rect, nullptr); |
+ EXPECT_TRUE(rect == LayoutRect(0, 10, 20, 20)); |
+} |
+ |
} |