OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/paint/PaintLayer.h" | 5 #include "core/paint/PaintLayer.h" |
6 | 6 |
7 #include "core/html/HTMLIFrameElement.h" | 7 #include "core/html/HTMLIFrameElement.h" |
8 #include "core/layout/LayoutBoxModelObject.h" | 8 #include "core/layout/LayoutBoxModelObject.h" |
9 #include "core/layout/LayoutTestHelper.h" | 9 #include "core/layout/LayoutTestHelper.h" |
10 #include "core/layout/LayoutView.h" | 10 #include "core/layout/LayoutView.h" |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 " <div style='width: 1000px; height: 500px; background: lightgray'>" | 67 " <div style='width: 1000px; height: 500px; background: lightgray'>" |
68 " </div>" | 68 " </div>" |
69 "</div>"); | 69 "</div>"); |
70 | 70 |
71 PaintLayer* parentLayer = | 71 PaintLayer* parentLayer = |
72 toLayoutBoxModelObject(getLayoutObjectByElementId("parent"))->layer(); | 72 toLayoutBoxModelObject(getLayoutObjectByElementId("parent"))->layer(); |
73 EXPECT_EQ(LayoutRect(0, 0, 784, 500), | 73 EXPECT_EQ(LayoutRect(0, 0, 784, 500), |
74 parentLayer->boundingBoxForCompositing()); | 74 parentLayer->boundingBoxForCompositing()); |
75 } | 75 } |
76 | 76 |
| 77 TEST_P(PaintLayerTest, RootLayerCompositedBounds) { |
| 78 setBodyInnerHTML( |
| 79 "<style> body { width: 1000px; height: 1000px; margin: 0 } </style>"); |
| 80 EXPECT_EQ(RuntimeEnabledFeatures::rootLayerScrollingEnabled() |
| 81 ? LayoutRect(0, 0, 800, 600) |
| 82 : LayoutRect(0, 0, 1000, 1000), |
| 83 layoutView().layer()->boundingBoxForCompositing()); |
| 84 } |
| 85 |
77 TEST_P(PaintLayerTest, PaintingExtentReflection) { | 86 TEST_P(PaintLayerTest, PaintingExtentReflection) { |
78 setBodyInnerHTML( | 87 setBodyInnerHTML( |
79 "<div id='target' style='background-color: blue; position: absolute;" | 88 "<div id='target' style='background-color: blue; position: absolute;" |
80 " width: 110px; height: 120px; top: 40px; left: 60px;" | 89 " width: 110px; height: 120px; top: 40px; left: 60px;" |
81 " -webkit-box-reflect: below 3px'>" | 90 " -webkit-box-reflect: below 3px'>" |
82 "</div>"); | 91 "</div>"); |
83 | 92 |
84 PaintLayer* layer = | 93 PaintLayer* layer = |
85 toLayoutBoxModelObject(getLayoutObjectByElementId("target"))->layer(); | 94 toLayoutBoxModelObject(getLayoutObjectByElementId("target"))->layer(); |
86 EXPECT_EQ( | 95 EXPECT_EQ( |
(...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
715 EXPECT_EQ(LayoutPoint(-150, 50), spanner->location()); | 724 EXPECT_EQ(LayoutPoint(-150, 50), spanner->location()); |
716 EXPECT_EQ(LayoutPoint(100, 100), extraLayer->location()); | 725 EXPECT_EQ(LayoutPoint(100, 100), extraLayer->location()); |
717 // -60 = 2nd-column-x(40) - scroll-offset-x(200) + x-location(100) | 726 // -60 = 2nd-column-x(40) - scroll-offset-x(200) + x-location(100) |
718 // 20 = y-location(100) - column-height(80) | 727 // 20 = y-location(100) - column-height(80) |
719 EXPECT_EQ(LayoutPoint(-60, 20), | 728 EXPECT_EQ(LayoutPoint(-60, 20), |
720 extraLayer->visualOffsetFromAncestor(columns)); | 729 extraLayer->visualOffsetFromAncestor(columns)); |
721 EXPECT_EQ(LayoutPoint(-150, 50), spanner->visualOffsetFromAncestor(columns)); | 730 EXPECT_EQ(LayoutPoint(-150, 50), spanner->visualOffsetFromAncestor(columns)); |
722 } | 731 } |
723 | 732 |
724 } // namespace blink | 733 } // namespace blink |
OLD | NEW |