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 15 matching lines...) Expand all Loading... |
26 object.containerForPaintInvalidation(); | 26 object.containerForPaintInvalidation(); |
27 object.mapToVisualRectInAncestorSpace(&paintInvalidationContainer, rect); | 27 object.mapToVisualRectInAncestorSpace(&paintInvalidationContainer, rect); |
28 if (rect.isEmpty() && object.visualRect().isEmpty()) | 28 if (rect.isEmpty() && object.visualRect().isEmpty()) |
29 return; | 29 return; |
30 // The following condition can be false if paintInvalidationContainer is | 30 // The following condition can be false if paintInvalidationContainer is |
31 // a LayoutView and compositing is not enabled. | 31 // a LayoutView and compositing is not enabled. |
32 if (paintInvalidationContainer.isPaintInvalidationContainer()) { | 32 if (paintInvalidationContainer.isPaintInvalidationContainer()) { |
33 PaintLayer::mapRectInPaintInvalidationContainerToBacking( | 33 PaintLayer::mapRectInPaintInvalidationContainerToBacking( |
34 paintInvalidationContainer, rect); | 34 paintInvalidationContainer, rect); |
35 } | 35 } |
36 EXPECT_EQ(rect, object.visualRect()); | 36 EXPECT_EQ(enclosingIntRect(rect), enclosingIntRect(object.visualRect())); |
37 } | 37 } |
38 }; | 38 }; |
39 | 39 |
40 TEST_F(VisualRectMappingTest, LayoutText) { | 40 TEST_F(VisualRectMappingTest, LayoutText) { |
41 setBodyInnerHTML( | 41 setBodyInnerHTML( |
42 "<style>body { margin: 0; }</style>" | 42 "<style>body { margin: 0; }</style>" |
43 "<div id='container' style='overflow: scroll; width: 50px; height: 50px'>" | 43 "<div id='container' style='overflow: scroll; width: 50px; height: 50px'>" |
44 " <span><img style='width: 20px; height: 100px'></span>" | 44 " <span><img style='width: 20px; height: 100px'></span>" |
45 " text text text text text text text" | 45 " text text text text text text text" |
46 "</div>"); | 46 "</div>"); |
(...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
668 | 668 |
669 LayoutRect targetLocalVisualRect = target->localVisualRect(); | 669 LayoutRect targetLocalVisualRect = target->localVisualRect(); |
670 EXPECT_EQ(LayoutRect(0, 0, 400, 400), targetLocalVisualRect); | 670 EXPECT_EQ(LayoutRect(0, 0, 400, 400), targetLocalVisualRect); |
671 LayoutRect rect = targetLocalVisualRect; | 671 LayoutRect rect = targetLocalVisualRect; |
672 EXPECT_TRUE(target->mapToVisualRectInAncestorSpace(&layoutView(), rect)); | 672 EXPECT_TRUE(target->mapToVisualRectInAncestorSpace(&layoutView(), rect)); |
673 EXPECT_EQ(LayoutRect(0, 0, 200, 200), rect); | 673 EXPECT_EQ(LayoutRect(0, 0, 200, 200), rect); |
674 EXPECT_EQ(rect, target->visualRect()); | 674 EXPECT_EQ(rect, target->visualRect()); |
675 } | 675 } |
676 | 676 |
677 } // namespace blink | 677 } // namespace blink |
OLD | NEW |