| 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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 rect = targetOverflowRect; | 205 rect = targetOverflowRect; |
| 206 EXPECT_TRUE(target->mapToVisualRectInAncestorSpace(container, rect)); | 206 EXPECT_TRUE(target->mapToVisualRectInAncestorSpace(container, rect)); |
| 207 // 100 is the physical x location of target in container. | 207 // 100 is the physical x location of target in container. |
| 208 EXPECT_EQ(LayoutRect(100, 0, 140, 110), rect); | 208 EXPECT_EQ(LayoutRect(100, 0, 140, 110), rect); |
| 209 rect = targetOverflowRect; | 209 rect = targetOverflowRect; |
| 210 EXPECT_TRUE(target->mapToVisualRectInAncestorSpace(&layoutView(), rect)); | 210 EXPECT_TRUE(target->mapToVisualRectInAncestorSpace(&layoutView(), rect)); |
| 211 EXPECT_EQ(LayoutRect(322, 111, 140, 110), rect); | 211 EXPECT_EQ(LayoutRect(322, 111, 140, 110), rect); |
| 212 checkPaintInvalidationStateRectMapping(rect, targetOverflowRect, *target, la
youtView(), layoutView()); | 212 checkPaintInvalidationStateRectMapping(rect, targetOverflowRect, *target, la
youtView(), layoutView()); |
| 213 | 213 |
| 214 LayoutRect containerOverflowRect = container->localOverflowRectForPaintInval
idation(); | 214 LayoutRect containerOverflowRect = container->localOverflowRectForPaintInval
idation(); |
| 215 EXPECT_EQ(LayoutRect(-40, 0, 240, 110), containerOverflowRect); | 215 EXPECT_EQ(LayoutRect(0, 0, 200, 100), containerOverflowRect); |
| 216 rect = containerOverflowRect; | 216 rect = containerOverflowRect; |
| 217 EXPECT_TRUE(container->mapToVisualRectInAncestorSpace(container, rect)); | 217 EXPECT_TRUE(container->mapToVisualRectInAncestorSpace(container, rect)); |
| 218 EXPECT_EQ(LayoutRect(0, 0, 240, 110), rect); | 218 EXPECT_EQ(LayoutRect(0, 0, 200, 100), rect); |
| 219 rect = containerOverflowRect; | 219 rect = containerOverflowRect; |
| 220 EXPECT_TRUE(container->mapToVisualRectInAncestorSpace(&layoutView(), rect)); | 220 EXPECT_TRUE(container->mapToVisualRectInAncestorSpace(&layoutView(), rect)); |
| 221 EXPECT_EQ(LayoutRect(222, 111, 240, 110), rect); | 221 EXPECT_EQ(LayoutRect(222, 111, 200, 100), rect); |
| 222 checkPaintInvalidationStateRectMapping(rect, containerOverflowRect, *contain
er, layoutView(), layoutView()); | 222 checkPaintInvalidationStateRectMapping(rect, containerOverflowRect, *contain
er, layoutView(), layoutView()); |
| 223 } | 223 } |
| 224 | 224 |
| 225 TEST_F(VisualRectMappingTest, ContainerOverflowScroll) | 225 TEST_F(VisualRectMappingTest, ContainerOverflowScroll) |
| 226 { | 226 { |
| 227 setBodyInnerHTML( | 227 setBodyInnerHTML( |
| 228 "<div id='container' style='position: absolute; top: 111px; left: 222px;
" | 228 "<div id='container' style='position: absolute; top: 111px; left: 222px;
" |
| 229 " border: 10px solid red; overflow: scroll; width: 50px; height: 80px
;'>" | 229 " border: 10px solid red; overflow: scroll; width: 50px; height: 80px
;'>" |
| 230 " <div id='target' style='box-shadow: 40px 20px black; width: 100px;
height: 90px'></div>" | 230 " <div id='target' style='box-shadow: 40px 20px black; width: 100px;
height: 90px'></div>" |
| 231 "</div>"); | 231 "</div>"); |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 513 LayoutRect absoluteOverflowRect = absolute->localOverflowRectForPaintInvalid
ation(); | 513 LayoutRect absoluteOverflowRect = absolute->localOverflowRectForPaintInvalid
ation(); |
| 514 EXPECT_EQ(LayoutRect(0, 0, 50, 50), absoluteOverflowRect); | 514 EXPECT_EQ(LayoutRect(0, 0, 50, 50), absoluteOverflowRect); |
| 515 LayoutRect rect = absoluteOverflowRect; | 515 LayoutRect rect = absoluteOverflowRect; |
| 516 EXPECT_TRUE(absolute->mapToVisualRectInAncestorSpace(stackingContext, rect))
; | 516 EXPECT_TRUE(absolute->mapToVisualRectInAncestorSpace(stackingContext, rect))
; |
| 517 // -172 = top(50) - y_offset_of_stacking_context(222) | 517 // -172 = top(50) - y_offset_of_stacking_context(222) |
| 518 EXPECT_EQ(LayoutRect(50, -172, 50, 50), rect); | 518 EXPECT_EQ(LayoutRect(50, -172, 50, 50), rect); |
| 519 checkPaintInvalidationStateRectMapping(rect, absoluteOverflowRect, *absolute
, layoutView(), *stackingContext); | 519 checkPaintInvalidationStateRectMapping(rect, absoluteOverflowRect, *absolute
, layoutView(), *stackingContext); |
| 520 } | 520 } |
| 521 | 521 |
| 522 } // namespace blink | 522 } // namespace blink |
| OLD | NEW |