Chromium Code Reviews| 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 554ecb7f3b63121af4b03d6d6e3f2e46699292ac..f56793a13f7f90d59823aaf3442f7c279eaaa899 100644 |
| --- a/third_party/WebKit/Source/core/layout/LayoutObjectTest.cpp |
| +++ b/third_party/WebKit/Source/core/layout/LayoutObjectTest.cpp |
| @@ -203,4 +203,55 @@ TEST_F(LayoutObjectTest, LayoutViewMapToVisualRectInAncestorSpaceSubpixelRoundin |
| EXPECT_EQ(LayoutRect(LayoutPoint(DoublePoint(0.5, 0)), LayoutSize(101, 100)), rect); |
| } |
| +TEST_F(LayoutObjectTest, OverflowRectMappingWithSelfFlippedWritingMode) |
| +{ |
| + setBodyInnerHTML( |
| + "<div id='target' style='writing-mode: vertical-rl; box-shadow: 40px 20px black;" |
| + " width: 100px; height: 50px; position: absolute; top: 111px; left: 222px'>" |
| + "</div>"); |
| + |
| + LayoutBlock* target = toLayoutBlock(getLayoutObjectByElementId("target")); |
| + LayoutRect overflowRect = target->localOverflowRectForPaintInvalidation(); |
| + EXPECT_EQ(LayoutRect(-40, 0, 140, 70), overflowRect); |
| + LayoutRect rect = overflowRect; |
| + EXPECT_TRUE(target->mapToVisualRectInAncestorSpace(target, rect)); |
| + EXPECT_EQ(LayoutRect(0, 0, 140, 70), rect); |
| + rect = overflowRect; |
| + EXPECT_TRUE(target->mapToVisualRectInAncestorSpace(&layoutView(), rect)); |
| + EXPECT_EQ(LayoutRect(222, 111, 140, 70), rect); |
|
chrishtr
2016/04/01 00:42:09
Why is it offset by 222, 111? Isn't that the size
Xianzhu
2016/04/01 01:17:22
They are absolute position of 'target' ("position
chrishtr
2016/04/01 16:50:58
Oh right sorry.
|
| +} |
| + |
| +TEST_F(LayoutObjectTest, OverflowRectMappingWithContainerFlippedWritingMode) |
| +{ |
| + setBodyInnerHTML( |
| + "<div id='container' style='writing-mode: vertical-rl; position: absolute; top: 111px; left: 222px'>" |
| + " <div id='target' style='box-shadow: 40px 20px black; width: 100px; height: 90px'></div>" |
| + " <div style='width: 100px; height: 100px'></div>" |
| + "</div>"); |
| + |
| + LayoutBlock* target = toLayoutBlock(getLayoutObjectByElementId("target")); |
| + LayoutRect targetOverflowRect = target->localOverflowRectForPaintInvalidation(); |
| + EXPECT_EQ(LayoutRect(-40, 0, 140, 110), targetOverflowRect); |
| + LayoutRect rect = targetOverflowRect; |
| + EXPECT_TRUE(target->mapToVisualRectInAncestorSpace(target, rect)); |
| + EXPECT_EQ(LayoutRect(0, 0, 140, 110), rect); |
| + |
| + LayoutBlock* container = toLayoutBlock(getLayoutObjectByElementId("container")); |
| + rect = targetOverflowRect; |
| + EXPECT_TRUE(target->mapToVisualRectInAncestorSpace(container, rect)); |
| + EXPECT_EQ(LayoutRect(100, 0, 140, 110), rect); |
| + rect = targetOverflowRect; |
| + EXPECT_TRUE(target->mapToVisualRectInAncestorSpace(&layoutView(), rect)); |
| + EXPECT_EQ(LayoutRect(322, 111, 140, 110), rect); |
| + |
| + LayoutRect containerOverflowRect = container->localOverflowRectForPaintInvalidation(); |
| + EXPECT_EQ(LayoutRect(-40, 0, 240, 110), containerOverflowRect); |
| + rect = containerOverflowRect; |
| + EXPECT_TRUE(target->mapToVisualRectInAncestorSpace(container, rect)); |
| + EXPECT_EQ(LayoutRect(0, 0, 240, 110), rect); |
| + rect = containerOverflowRect; |
| + EXPECT_TRUE(target->mapToVisualRectInAncestorSpace(&layoutView(), rect)); |
| + EXPECT_EQ(LayoutRect(222, 111, 240, 110), rect); |
| +} |
| + |
| } // namespace blink |