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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 "height: 100px'></span>text text text"); | 134 "height: 100px'></span>text text text"); |
135 document().view()->updateAllLifecyclePhases(); | 135 document().view()->updateAllLifecyclePhases(); |
136 | 136 |
137 LayoutBlock* frameContainer = | 137 LayoutBlock* frameContainer = |
138 toLayoutBlock(getLayoutObjectByElementId("frameContainer")); | 138 toLayoutBlock(getLayoutObjectByElementId("frameContainer")); |
139 LayoutBlock* frameBody = toLayoutBlock(frameDocument.body()->layoutObject()); | 139 LayoutBlock* frameBody = toLayoutBlock(frameDocument.body()->layoutObject()); |
140 LayoutText* frameText = toLayoutText(frameBody->lastChild()); | 140 LayoutText* frameText = toLayoutText(frameBody->lastChild()); |
141 | 141 |
142 // This case involves clipping: frame height is 50, y-coordinate of result rec
t is 13, | 142 // This case involves clipping: frame height is 50, y-coordinate of result rec
t is 13, |
143 // so height should be clipped to (50 - 13) == 37. | 143 // so height should be clipped to (50 - 13) == 37. |
144 frameDocument.view()->setScrollPosition(DoublePoint(0, 47), | 144 frameDocument.view()->setScrollOffset(ScrollOffset(0, 47), |
145 ProgrammaticScroll); | 145 ProgrammaticScroll); |
146 LayoutRect originalRect(4, 60, 20, 80); | 146 LayoutRect originalRect(4, 60, 20, 80); |
147 LayoutRect rect = originalRect; | 147 LayoutRect rect = originalRect; |
148 EXPECT_TRUE(frameText->mapToVisualRectInAncestorSpace(frameContainer, rect)); | 148 EXPECT_TRUE(frameText->mapToVisualRectInAncestorSpace(frameContainer, rect)); |
149 EXPECT_EQ(rect, LayoutRect(4, 13, 20, 37)); | 149 EXPECT_EQ(rect, LayoutRect(4, 13, 20, 37)); |
150 | 150 |
151 rect = originalRect; | 151 rect = originalRect; |
152 EXPECT_TRUE(frameText->mapToVisualRectInAncestorSpace(&layoutView(), rect)); | 152 EXPECT_TRUE(frameText->mapToVisualRectInAncestorSpace(&layoutView(), rect)); |
153 EXPECT_EQ(rect, LayoutRect(4, 13, 20, 37)); | 153 EXPECT_EQ(rect, LayoutRect(4, 13, 20, 37)); |
154 checkPaintInvalidationStateRectMapping(rect, originalRect, *frameText, | 154 checkPaintInvalidationStateRectMapping(rect, originalRect, *frameText, |
155 layoutView(), layoutView()); | 155 layoutView(), layoutView()); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 "style='width:100px;height:100px;'></div>"); | 201 "style='width:100px;height:100px;'></div>"); |
202 document().view()->updateAllLifecyclePhases(); | 202 document().view()->updateAllLifecyclePhases(); |
203 | 203 |
204 LayoutBlock* frameContainer = | 204 LayoutBlock* frameContainer = |
205 toLayoutBlock(getLayoutObjectByElementId("frameContainer")); | 205 toLayoutBlock(getLayoutObjectByElementId("frameContainer")); |
206 LayoutBlock* frameBody = toLayoutBlock(frameDocument.body()->layoutObject()); | 206 LayoutBlock* frameBody = toLayoutBlock(frameDocument.body()->layoutObject()); |
207 LayoutBlock* frameDiv = toLayoutBlock(frameBody->lastChild()); | 207 LayoutBlock* frameDiv = toLayoutBlock(frameBody->lastChild()); |
208 | 208 |
209 // This part is copied from the LayoutView test, just to ensure that the mappe
d | 209 // This part is copied from the LayoutView test, just to ensure that the mappe
d |
210 // rect is valid before display:none is set on the iframe. | 210 // rect is valid before display:none is set on the iframe. |
211 frameDocument.view()->setScrollPosition(DoublePoint(0, 47), | 211 frameDocument.view()->setScrollOffset(ScrollOffset(0, 47), |
212 ProgrammaticScroll); | 212 ProgrammaticScroll); |
213 LayoutRect originalRect(4, 60, 20, 80); | 213 LayoutRect originalRect(4, 60, 20, 80); |
214 LayoutRect rect = originalRect; | 214 LayoutRect rect = originalRect; |
215 EXPECT_TRUE(frameDiv->mapToVisualRectInAncestorSpace(frameContainer, rect)); | 215 EXPECT_TRUE(frameDiv->mapToVisualRectInAncestorSpace(frameContainer, rect)); |
216 EXPECT_EQ(rect, LayoutRect(4, 13, 20, 37)); | 216 EXPECT_EQ(rect, LayoutRect(4, 13, 20, 37)); |
217 | 217 |
218 Element* frameElement = document().getElementById("frame"); | 218 Element* frameElement = document().getElementById("frame"); |
219 frameElement->setInlineStyleProperty(CSSPropertyDisplay, "none"); | 219 frameElement->setInlineStyleProperty(CSSPropertyDisplay, "none"); |
220 document().view()->updateAllLifecyclePhases(); | 220 document().view()->updateAllLifecyclePhases(); |
221 | 221 |
222 rect = originalRect; | 222 rect = originalRect; |
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
689 target->localOverflowRectForPaintInvalidation(); | 689 target->localOverflowRectForPaintInvalidation(); |
690 EXPECT_EQ(LayoutRect(0, 0, 400, 400), targetOverflowRect); | 690 EXPECT_EQ(LayoutRect(0, 0, 400, 400), targetOverflowRect); |
691 LayoutRect rect = targetOverflowRect; | 691 LayoutRect rect = targetOverflowRect; |
692 EXPECT_TRUE(target->mapToVisualRectInAncestorSpace(&layoutView(), rect)); | 692 EXPECT_TRUE(target->mapToVisualRectInAncestorSpace(&layoutView(), rect)); |
693 EXPECT_EQ(LayoutRect(0, 0, 200, 200), rect); | 693 EXPECT_EQ(LayoutRect(0, 0, 200, 200), rect); |
694 checkPaintInvalidationStateRectMapping(rect, targetOverflowRect, *target, | 694 checkPaintInvalidationStateRectMapping(rect, targetOverflowRect, *target, |
695 layoutView(), layoutView()); | 695 layoutView(), layoutView()); |
696 } | 696 } |
697 | 697 |
698 } // namespace blink | 698 } // namespace blink |
OLD | NEW |