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/LayoutTreeAsText.h" | 6 #include "core/layout/LayoutTreeAsText.h" |
7 #include "core/layout/api/LayoutViewItem.h" | 7 #include "core/layout/api/LayoutViewItem.h" |
8 #include "core/paint/ObjectPaintProperties.h" | 8 #include "core/paint/ObjectPaintProperties.h" |
9 #include "core/paint/PaintPropertyTreePrinter.h" | 9 #include "core/paint/PaintPropertyTreePrinter.h" |
10 #include "platform/graphics/paint/GeometryMapper.h" | 10 #include "platform/graphics/paint/GeometryMapper.h" |
| 11 #include "platform/graphics/paint/ScrollPaintPropertyNode.h" |
11 #include "platform/graphics/paint/TransformPaintPropertyNode.h" | 12 #include "platform/graphics/paint/TransformPaintPropertyNode.h" |
12 #include "platform/testing/RuntimeEnabledFeaturesTestHelpers.h" | 13 #include "platform/testing/RuntimeEnabledFeaturesTestHelpers.h" |
13 #include "platform/testing/UnitTestHelpers.h" | 14 #include "platform/testing/UnitTestHelpers.h" |
14 #include "platform/text/TextStream.h" | 15 #include "platform/text/TextStream.h" |
15 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
16 #include "wtf/HashMap.h" | 17 #include "wtf/HashMap.h" |
17 #include "wtf/Vector.h" | 18 #include "wtf/Vector.h" |
18 | 19 |
19 namespace blink { | 20 namespace blink { |
20 | 21 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 } | 72 } |
72 | 73 |
73 const ClipPaintPropertyNode* frameContentClip() | 74 const ClipPaintPropertyNode* frameContentClip() |
74 { | 75 { |
75 FrameView* frameView = document().view(); | 76 FrameView* frameView = document().view(); |
76 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) | 77 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) |
77 return frameView->layoutView()->objectPaintProperties()->overflowCli
p(); | 78 return frameView->layoutView()->objectPaintProperties()->overflowCli
p(); |
78 return frameView->contentClip(); | 79 return frameView->contentClip(); |
79 } | 80 } |
80 | 81 |
| 82 const ScrollPaintPropertyNode* frameScroll() |
| 83 { |
| 84 FrameView* frameView = document().view(); |
| 85 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) |
| 86 return frameView->layoutView()->objectPaintProperties()->scroll(); |
| 87 return frameView->scroll(); |
| 88 } |
| 89 |
81 private: | 90 private: |
82 void SetUp() override | 91 void SetUp() override |
83 { | 92 { |
84 Settings::setMockScrollbarsEnabled(true); | 93 Settings::setMockScrollbarsEnabled(true); |
85 | 94 |
86 RenderingTest::SetUp(); | 95 RenderingTest::SetUp(); |
87 enableCompositing(); | 96 enableCompositing(); |
88 } | 97 } |
89 | 98 |
90 void TearDown() override | 99 void TearDown() override |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 loadTestData("position-and-scroll.html"); | 175 loadTestData("position-and-scroll.html"); |
167 | 176 |
168 Element* scroller = document().getElementById("scroller"); | 177 Element* scroller = document().getElementById("scroller"); |
169 scroller->scrollTo(0, 100); | 178 scroller->scrollTo(0, 100); |
170 FrameView* frameView = document().view(); | 179 FrameView* frameView = document().view(); |
171 frameView->updateAllLifecyclePhases(); | 180 frameView->updateAllLifecyclePhases(); |
172 const ObjectPaintProperties* scrollerProperties = scroller->layoutObject()->
objectPaintProperties(); | 181 const ObjectPaintProperties* scrollerProperties = scroller->layoutObject()->
objectPaintProperties(); |
173 EXPECT_EQ(TransformationMatrix().translate(0, -100), scrollerProperties->scr
ollTranslation()->matrix()); | 182 EXPECT_EQ(TransformationMatrix().translate(0, -100), scrollerProperties->scr
ollTranslation()->matrix()); |
174 EXPECT_EQ(frameScrollTranslation(), scrollerProperties->scrollTranslation()-
>parent()); | 183 EXPECT_EQ(frameScrollTranslation(), scrollerProperties->scrollTranslation()-
>parent()); |
175 EXPECT_EQ(frameScrollTranslation(), scrollerProperties->overflowClip()->loca
lTransformSpace()); | 184 EXPECT_EQ(frameScrollTranslation(), scrollerProperties->overflowClip()->loca
lTransformSpace()); |
| 185 EXPECT_EQ(frameScroll(), scrollerProperties->scroll()->parent()); |
176 EXPECT_EQ(FloatRoundedRect(120, 340, 400, 300), scrollerProperties->overflow
Clip()->clipRect()); | 186 EXPECT_EQ(FloatRoundedRect(120, 340, 400, 300), scrollerProperties->overflow
Clip()->clipRect()); |
177 EXPECT_EQ(frameContentClip(), scrollerProperties->overflowClip()->parent()); | 187 EXPECT_EQ(frameContentClip(), scrollerProperties->overflowClip()->parent()); |
178 // http://crbug.com/638415 | 188 // http://crbug.com/638415 |
179 if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { | 189 if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { |
180 CHECK_EXACT_VISUAL_RECT(LayoutRect(120, 340, 400, 300), scroller->layout
Object(), frameView->layoutView()); | 190 CHECK_EXACT_VISUAL_RECT(LayoutRect(120, 340, 400, 300), scroller->layout
Object(), frameView->layoutView()); |
181 } | 191 } |
182 | 192 |
183 // The relative-positioned element should have accumulated box offset (exclu
de scrolling), | 193 // The relative-positioned element should have accumulated box offset (exclu
de scrolling), |
184 // and should be affected by ancestor scroll transforms. | 194 // and should be affected by ancestor scroll transforms. |
185 Element* relPos = document().getElementById("rel-pos"); | 195 Element* relPos = document().getElementById("rel-pos"); |
(...skipping 1522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1708 const ObjectPaintProperties* svgWithViewBoxProperties = svgWithViewBox.objec
tPaintProperties(); | 1718 const ObjectPaintProperties* svgWithViewBoxProperties = svgWithViewBox.objec
tPaintProperties(); |
1709 | 1719 |
1710 EXPECT_EQ(frameScrollTranslation(), svgWithViewBoxProperties->localBorderBox
Properties()->propertyTreeState.transform); | 1720 EXPECT_EQ(frameScrollTranslation(), svgWithViewBoxProperties->localBorderBox
Properties()->propertyTreeState.transform); |
1711 | 1721 |
1712 PropertyTreeState contentsProperties; | 1722 PropertyTreeState contentsProperties; |
1713 svgWithViewBoxProperties->getContentsProperties(contentsProperties); | 1723 svgWithViewBoxProperties->getContentsProperties(contentsProperties); |
1714 EXPECT_EQ(svgWithViewBoxProperties->svgLocalToBorderBoxTransform(), contents
Properties.transform); | 1724 EXPECT_EQ(svgWithViewBoxProperties->svgLocalToBorderBoxTransform(), contents
Properties.transform); |
1715 } | 1725 } |
1716 | 1726 |
1717 } // namespace blink | 1727 } // namespace blink |
OLD | NEW |