OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "core/layout/LayoutTestHelper.h" | 5 #include "core/layout/LayoutTestHelper.h" |
6 #include "core/layout/LayoutView.h" | 6 #include "core/layout/LayoutView.h" |
7 #include "core/layout/PaintInvalidationState.h" | 7 #include "core/layout/PaintInvalidationState.h" |
8 #include "core/paint/PaintLayer.h" | 8 #include "core/paint/PaintLayer.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 | 10 |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 | 203 |
204 LayoutRect originalRect(4, 60, 20, 80); | 204 LayoutRect originalRect(4, 60, 20, 80); |
205 LayoutRect rect = originalRect; | 205 LayoutRect rect = originalRect; |
206 EXPECT_TRUE(frameDiv->mapToVisualRectInAncestorSpace(frameContainer, rect)); | 206 EXPECT_TRUE(frameDiv->mapToVisualRectInAncestorSpace(frameContainer, rect)); |
207 EXPECT_EQ(rect, LayoutRect(4, 13, 20, 37)); | 207 EXPECT_EQ(rect, LayoutRect(4, 13, 20, 37)); |
208 | 208 |
209 Element* frameElement = document().getElementById("frame"); | 209 Element* frameElement = document().getElementById("frame"); |
210 frameElement->setInlineStyleProperty(CSSPropertyDisplay, "none"); | 210 frameElement->setInlineStyleProperty(CSSPropertyDisplay, "none"); |
211 document().view()->updateAllLifecyclePhases(); | 211 document().view()->updateAllLifecyclePhases(); |
212 | 212 |
213 frameBody = toLayoutBlock(childDocument().body()->layoutObject()); | 213 rect = originalRect; |
214 EXPECT_EQ(nullptr, frameBody); | 214 EXPECT_FALSE(frameDiv->mapToVisualRectInAncestorSpace(&layoutView(), rect)); |
| 215 EXPECT_EQ(rect, LayoutRect()); |
215 } | 216 } |
216 | 217 |
217 TEST_F(VisualRectMappingTest, SelfFlippedWritingMode) { | 218 TEST_F(VisualRectMappingTest, SelfFlippedWritingMode) { |
218 setBodyInnerHTML( | 219 setBodyInnerHTML( |
219 "<div id='target' style='writing-mode: vertical-rl;" | 220 "<div id='target' style='writing-mode: vertical-rl;" |
220 " box-shadow: 40px 20px black; width: 100px; height: 50px;" | 221 " box-shadow: 40px 20px black; width: 100px; height: 50px;" |
221 " position: absolute; top: 111px; left: 222px'>" | 222 " position: absolute; top: 111px; left: 222px'>" |
222 "</div>"); | 223 "</div>"); |
223 | 224 |
224 LayoutBlock* target = toLayoutBlock(getLayoutObjectByElementId("target")); | 225 LayoutBlock* target = toLayoutBlock(getLayoutObjectByElementId("target")); |
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
693 EXPECT_TRUE(target->mapToVisualRectInAncestorSpace(&layoutView(), rect)); | 694 EXPECT_TRUE(target->mapToVisualRectInAncestorSpace(&layoutView(), rect)); |
694 EXPECT_EQ(LayoutRect(66, 55, 33, 44), rect); | 695 EXPECT_EQ(LayoutRect(66, 55, 33, 44), rect); |
695 EXPECT_EQ(rect, target->visualRect()); | 696 EXPECT_EQ(rect, target->visualRect()); |
696 | 697 |
697 rect = targetVisualRect; | 698 rect = targetVisualRect; |
698 EXPECT_TRUE(target->mapToVisualRectInAncestorSpace(span, rect)); | 699 EXPECT_TRUE(target->mapToVisualRectInAncestorSpace(span, rect)); |
699 EXPECT_EQ(LayoutRect(-200, -100, 33, 44), rect); | 700 EXPECT_EQ(LayoutRect(-200, -100, 33, 44), rect); |
700 } | 701 } |
701 | 702 |
702 } // namespace blink | 703 } // namespace blink |
OLD | NEW |