| 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 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 571 | 571 |
| 572 LayoutRect absoluteOverflowRect = absolute->localOverflowRectForPaintInvalid
ation(); | 572 LayoutRect absoluteOverflowRect = absolute->localOverflowRectForPaintInvalid
ation(); |
| 573 EXPECT_EQ(LayoutRect(0, 0, 50, 50), absoluteOverflowRect); | 573 EXPECT_EQ(LayoutRect(0, 0, 50, 50), absoluteOverflowRect); |
| 574 LayoutRect rect = absoluteOverflowRect; | 574 LayoutRect rect = absoluteOverflowRect; |
| 575 EXPECT_TRUE(absolute->mapToVisualRectInAncestorSpace(stackingContext, rect))
; | 575 EXPECT_TRUE(absolute->mapToVisualRectInAncestorSpace(stackingContext, rect))
; |
| 576 // -172 = top(50) - y_offset_of_stacking_context(222) | 576 // -172 = top(50) - y_offset_of_stacking_context(222) |
| 577 EXPECT_EQ(LayoutRect(50, -172, 50, 50), rect); | 577 EXPECT_EQ(LayoutRect(50, -172, 50, 50), rect); |
| 578 checkPaintInvalidationStateRectMapping(rect, absoluteOverflowRect, *absolute
, layoutView(), *stackingContext); | 578 checkPaintInvalidationStateRectMapping(rect, absoluteOverflowRect, *absolute
, layoutView(), *stackingContext); |
| 579 } | 579 } |
| 580 | 580 |
| 581 TEST_F(VisualRectMappingTest, CSSClip) |
| 582 { |
| 583 setBodyInnerHTML( |
| 584 "<div id='container' style='position: absolute; top: 0px; left: 0px; cli
p: rect(0px, 200px, 200px, 0px)'>" |
| 585 " <div id='target' style='width: 400px; height: 400px'></div>" |
| 586 " </div>" |
| 587 "</div>"); |
| 588 |
| 589 LayoutBox* target = toLayoutBox(getLayoutObjectByElementId("target")); |
| 590 |
| 591 LayoutRect targetOverflowRect = target->localOverflowRectForPaintInvalidatio
n(); |
| 592 EXPECT_EQ(LayoutRect(0, 0, 400, 400), targetOverflowRect); |
| 593 LayoutRect rect = targetOverflowRect; |
| 594 EXPECT_TRUE(target->mapToVisualRectInAncestorSpace(&layoutView(), rect)); |
| 595 EXPECT_EQ(LayoutRect(0, 0, 200, 200), rect); |
| 596 checkPaintInvalidationStateRectMapping(rect, targetOverflowRect, *target, la
youtView(), layoutView()); |
| 597 } |
| 598 |
| 599 TEST_F(VisualRectMappingTest, ContainPaint) |
| 600 { |
| 601 setBodyInnerHTML( |
| 602 "<div id='container' style='position: absolute; top: 0px; left: 0px; wid
th: 200px; height: 200px; contain: paint'>" |
| 603 " <div id='target' style='width: 400px; height: 400px'></div>" |
| 604 " </div>" |
| 605 "</div>"); |
| 606 |
| 607 LayoutBox* target = toLayoutBox(getLayoutObjectByElementId("target")); |
| 608 |
| 609 LayoutRect targetOverflowRect = target->localOverflowRectForPaintInvalidatio
n(); |
| 610 EXPECT_EQ(LayoutRect(0, 0, 400, 400), targetOverflowRect); |
| 611 LayoutRect rect = targetOverflowRect; |
| 612 EXPECT_TRUE(target->mapToVisualRectInAncestorSpace(&layoutView(), rect)); |
| 613 EXPECT_EQ(LayoutRect(0, 0, 200, 200), rect); |
| 614 checkPaintInvalidationStateRectMapping(rect, targetOverflowRect, *target, la
youtView(), layoutView()); |
| 615 } |
| 616 |
| 581 } // namespace blink | 617 } // namespace blink |
| OLD | NEW |