Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(15)

Side by Side Diff: third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilderTest.cpp

Issue 2258523006: Convert Settings::rootLayerScrolls to RuntimeEnabledFeatures (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase & fix mistake Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "platform/graphics/paint/GeometryMapper.h" 9 #include "platform/graphics/paint/GeometryMapper.h"
10 #include "platform/graphics/paint/TransformPaintPropertyNode.h" 10 #include "platform/graphics/paint/TransformPaintPropertyNode.h"
11 #include "platform/testing/UnitTestHelpers.h" 11 #include "platform/testing/UnitTestHelpers.h"
12 #include "platform/text/TextStream.h" 12 #include "platform/text/TextStream.h"
13 #include "testing/gtest/include/gtest/gtest.h" 13 #include "testing/gtest/include/gtest/gtest.h"
14 #include "wtf/HashMap.h" 14 #include "wtf/HashMap.h"
15 #include "wtf/Vector.h" 15 #include "wtf/Vector.h"
16 16
17 namespace blink { 17 namespace blink {
18 18
19 typedef bool TestParamRootLayerScrolling;
19 class PaintPropertyTreeBuilderTest 20 class PaintPropertyTreeBuilderTest
20 : public RenderingTest 21 : public RenderingTest
21 , public ::testing::WithParamInterface<FrameSettingOverrideFunction> { 22 , public ::testing::WithParamInterface<TestParamRootLayerScrolling> {
22 public: 23 public:
23 PaintPropertyTreeBuilderTest() 24 PaintPropertyTreeBuilderTest()
24 : RenderingTest(SingleChildFrameLoaderClient::create()) 25 : RenderingTest(SingleChildFrameLoaderClient::create())
25 , m_originalSlimmingPaintV2Enabled(RuntimeEnabledFeatures::slimmingPaint V2Enabled()) { } 26 , m_originalSlimmingPaintV2Enabled(RuntimeEnabledFeatures::slimmingPaint V2Enabled())
27 , m_originalRootLayerScrollingEnabled(RuntimeEnabledFeatures::rootLayerS crollingEnabled())
28 , m_enableRootLayerScrolling(GetParam())
29 {
30 RuntimeEnabledFeatures::setSlimmingPaintV2Enabled(true);
31 RuntimeEnabledFeatures::setRootLayerScrollingEnabled(m_enableRootLayerSc rolling);
32 }
33
34 ~PaintPropertyTreeBuilderTest()
35 {
36 CHECK_EQ(true, RuntimeEnabledFeatures::slimmingPaintV2Enabled());
37 CHECK_EQ(m_enableRootLayerScrolling, RuntimeEnabledFeatures::rootLayerSc rollingEnabled());
38 RuntimeEnabledFeatures::setRootLayerScrollingEnabled(m_originalRootLayer ScrollingEnabled);
esprehn 2016/08/25 23:59:24 We do this manually in a lot of places?
trchen 2016/08/26 00:15:11 Good point. I was tired of this too. I can make it
39 RuntimeEnabledFeatures::setSlimmingPaintV2Enabled(m_originalSlimmingPain tV2Enabled);
40 }
26 41
27 void loadTestData(const char* fileName) 42 void loadTestData(const char* fileName)
28 { 43 {
29 String fullPath = testing::blinkRootDir(); 44 String fullPath = testing::blinkRootDir();
30 fullPath.append("/Source/core/paint/test_data/"); 45 fullPath.append("/Source/core/paint/test_data/");
31 fullPath.append(fileName); 46 fullPath.append(fileName);
32 RefPtr<SharedBuffer> inputBuffer = testing::readFromFile(fullPath); 47 RefPtr<SharedBuffer> inputBuffer = testing::readFromFile(fullPath);
33 setBodyInnerHTML(String(inputBuffer->data(), inputBuffer->size())); 48 setBodyInnerHTML(String(inputBuffer->data(), inputBuffer->size()));
34 } 49 }
35 50
36 bool rootLayerScrolls()
37 {
38 return document().settings() && document().settings()->rootLayerScrolls( );
39 }
40
41 const TransformPaintPropertyNode* rootTransform() 51 const TransformPaintPropertyNode* rootTransform()
42 { 52 {
43 FrameView* frameView = document().view(); 53 FrameView* frameView = document().view();
44 if (rootLayerScrolls()) 54 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled())
45 return frameView->layoutView()->objectPaintProperties()->paintOffset Translation(); 55 return frameView->layoutView()->objectPaintProperties()->paintOffset Translation();
46 return frameView->rootTransform(); 56 return frameView->rootTransform();
47 } 57 }
48 58
49 const ClipPaintPropertyNode* rootClip() 59 const ClipPaintPropertyNode* rootClip()
50 { 60 {
51 if (rootLayerScrolls()) 61 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled())
52 return document().view()->layoutView()->objectPaintProperties()->loc alBorderBoxProperties()->propertyTreeState.clip.get(); 62 return document().view()->layoutView()->objectPaintProperties()->loc alBorderBoxProperties()->propertyTreeState.clip.get();
53 return document().view()->rootClip(); 63 return document().view()->rootClip();
54 } 64 }
55 65
56 const TransformPaintPropertyNode* framePreTranslation() 66 const TransformPaintPropertyNode* framePreTranslation()
57 { 67 {
58 FrameView* frameView = document().view(); 68 FrameView* frameView = document().view();
59 if (rootLayerScrolls()) 69 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled())
60 return frameView->layoutView()->objectPaintProperties()->paintOffset Translation(); 70 return frameView->layoutView()->objectPaintProperties()->paintOffset Translation();
61 return frameView->preTranslation(); 71 return frameView->preTranslation();
62 } 72 }
63 73
64 const TransformPaintPropertyNode* frameScrollTranslation() 74 const TransformPaintPropertyNode* frameScrollTranslation()
65 { 75 {
66 FrameView* frameView = document().view(); 76 FrameView* frameView = document().view();
67 if (rootLayerScrolls()) 77 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled())
68 return frameView->layoutView()->objectPaintProperties()->scrollTrans lation(); 78 return frameView->layoutView()->objectPaintProperties()->scrollTrans lation();
69 return frameView->scrollTranslation(); 79 return frameView->scrollTranslation();
70 } 80 }
71 81
72 const ClipPaintPropertyNode* frameContentClip() 82 const ClipPaintPropertyNode* frameContentClip()
73 { 83 {
74 FrameView* frameView = document().view(); 84 FrameView* frameView = document().view();
75 if (rootLayerScrolls()) 85 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled())
76 return frameView->layoutView()->objectPaintProperties()->overflowCli p(); 86 return frameView->layoutView()->objectPaintProperties()->overflowCli p();
77 return frameView->contentClip(); 87 return frameView->contentClip();
78 } 88 }
79 89
80 FrameSettingOverrideFunction settingOverrider() const override { return GetP aram(); }
81
82 private: 90 private:
83 void SetUp() override 91 void SetUp() override
84 { 92 {
85 RuntimeEnabledFeatures::setSlimmingPaintV2Enabled(true);
86 Settings::setMockScrollbarsEnabled(true); 93 Settings::setMockScrollbarsEnabled(true);
87 94
88 RenderingTest::SetUp(); 95 RenderingTest::SetUp();
89 enableCompositing(); 96 enableCompositing();
90 } 97 }
91 98
92 void TearDown() override 99 void TearDown() override
93 { 100 {
94 RenderingTest::TearDown(); 101 RenderingTest::TearDown();
95 102
96 Settings::setMockScrollbarsEnabled(false); 103 Settings::setMockScrollbarsEnabled(false);
97 RuntimeEnabledFeatures::setSlimmingPaintV2Enabled(m_originalSlimmingPain tV2Enabled);
98 } 104 }
99 105
100 bool m_originalSlimmingPaintV2Enabled; 106 bool m_originalSlimmingPaintV2Enabled;
107 bool m_originalRootLayerScrollingEnabled;
108 bool m_enableRootLayerScrolling;
101 }; 109 };
102 110
103 #define CHECK_VISUAL_RECT(expected, sourceLayoutObject, ancestorLayoutObject, sl opFactor) \ 111 #define CHECK_VISUAL_RECT(expected, sourceLayoutObject, ancestorLayoutObject, sl opFactor) \
104 do { \ 112 do { \
105 GeometryMapper geometryMapper; \ 113 GeometryMapper geometryMapper; \
106 LayoutRect source((sourceLayoutObject)->localOverflowRectForPaintInvalidatio n()); \ 114 LayoutRect source((sourceLayoutObject)->localOverflowRectForPaintInvalidatio n()); \
107 source.moveBy((sourceLayoutObject)->objectPaintProperties()->localBorderBoxP roperties()->paintOffset); \ 115 source.moveBy((sourceLayoutObject)->objectPaintProperties()->localBorderBoxP roperties()->paintOffset); \
108 bool success = false; \ 116 bool success = false; \
109 FloatRect actual = geometryMapper.mapToVisualRectInDestinationSpace( \ 117 FloatRect actual = geometryMapper.mapToVisualRectInDestinationSpace( \
110 FloatRect(source), \ 118 FloatRect(source), \
(...skipping 12 matching lines...) Expand all
123 SCOPED_TRACE(String::format("Old path rect: %s, Actual: %s, Inflated act ual: %s", slowPathRect.toString().ascii().data(), actual.toString().ascii().data (), inflatedActual.toString().ascii().data())); \ 131 SCOPED_TRACE(String::format("Old path rect: %s, Actual: %s, Inflated act ual: %s", slowPathRect.toString().ascii().data(), actual.toString().ascii().data (), inflatedActual.toString().ascii().data())); \
124 EXPECT_TRUE(slowPathRect.contains(LayoutRect(actual))); \ 132 EXPECT_TRUE(slowPathRect.contains(LayoutRect(actual))); \
125 EXPECT_TRUE(inflatedActual.contains(slowPathRect)); \ 133 EXPECT_TRUE(inflatedActual.contains(slowPathRect)); \
126 } else { \ 134 } else { \
127 EXPECT_EQ(slowPathRect, LayoutRect(actual)); \ 135 EXPECT_EQ(slowPathRect, LayoutRect(actual)); \
128 } \ 136 } \
129 } while (0) 137 } while (0)
130 138
131 #define CHECK_EXACT_VISUAL_RECT(expected, sourceLayoutObject, ancestorLayoutObje ct) CHECK_VISUAL_RECT(expected, sourceLayoutObject, ancestorLayoutObject, 0) 139 #define CHECK_EXACT_VISUAL_RECT(expected, sourceLayoutObject, ancestorLayoutObje ct) CHECK_VISUAL_RECT(expected, sourceLayoutObject, ancestorLayoutObject, 0)
132 140
133 INSTANTIATE_TEST_CASE_P(All, PaintPropertyTreeBuilderTest, ::testing::Values(nul lptr, &RootLayerScrollsFrameSettingOverride)); 141 INSTANTIATE_TEST_CASE_P(All, PaintPropertyTreeBuilderTest, ::testing::Bool());
134 142
135 TEST_P(PaintPropertyTreeBuilderTest, FixedPosition) 143 TEST_P(PaintPropertyTreeBuilderTest, FixedPosition)
136 { 144 {
137 loadTestData("fixed-position.html"); 145 loadTestData("fixed-position.html");
138 146
139 FrameView* frameView = document().view(); 147 FrameView* frameView = document().view();
140 148
141 // target1 is a fixed-position element inside an absolute-position scrolling element. 149 // target1 is a fixed-position element inside an absolute-position scrolling element.
142 // It should be attached under the viewport to skip scrolling and offset of the parent. 150 // It should be attached under the viewport to skip scrolling and offset of the parent.
143 Element* target1 = document().getElementById("target1"); 151 Element* target1 = document().getElementById("target1");
(...skipping 28 matching lines...) Expand all
172 scroller->scrollTo(0, 100); 180 scroller->scrollTo(0, 100);
173 FrameView* frameView = document().view(); 181 FrameView* frameView = document().view();
174 frameView->updateAllLifecyclePhases(); 182 frameView->updateAllLifecyclePhases();
175 const ObjectPaintProperties* scrollerProperties = scroller->layoutObject()-> objectPaintProperties(); 183 const ObjectPaintProperties* scrollerProperties = scroller->layoutObject()-> objectPaintProperties();
176 EXPECT_EQ(TransformationMatrix().translate(0, -100), scrollerProperties->scr ollTranslation()->matrix()); 184 EXPECT_EQ(TransformationMatrix().translate(0, -100), scrollerProperties->scr ollTranslation()->matrix());
177 EXPECT_EQ(frameScrollTranslation(), scrollerProperties->scrollTranslation()- >parent()); 185 EXPECT_EQ(frameScrollTranslation(), scrollerProperties->scrollTranslation()- >parent());
178 EXPECT_EQ(frameScrollTranslation(), scrollerProperties->overflowClip()->loca lTransformSpace()); 186 EXPECT_EQ(frameScrollTranslation(), scrollerProperties->overflowClip()->loca lTransformSpace());
179 EXPECT_EQ(FloatRoundedRect(120, 340, 400, 300), scrollerProperties->overflow Clip()->clipRect()); 187 EXPECT_EQ(FloatRoundedRect(120, 340, 400, 300), scrollerProperties->overflow Clip()->clipRect());
180 EXPECT_EQ(frameContentClip(), scrollerProperties->overflowClip()->parent()); 188 EXPECT_EQ(frameContentClip(), scrollerProperties->overflowClip()->parent());
181 // http://crbug.com/638415 189 // http://crbug.com/638415
182 if (!rootLayerScrolls()) { 190 if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled()) {
183 CHECK_EXACT_VISUAL_RECT(LayoutRect(120, 340, 400, 300), scroller->layout Object(), frameView->layoutView()); 191 CHECK_EXACT_VISUAL_RECT(LayoutRect(120, 340, 400, 300), scroller->layout Object(), frameView->layoutView());
184 } 192 }
185 193
186 // The relative-positioned element should have accumulated box offset (exclu de scrolling), 194 // The relative-positioned element should have accumulated box offset (exclu de scrolling),
187 // and should be affected by ancestor scroll transforms. 195 // and should be affected by ancestor scroll transforms.
188 Element* relPos = document().getElementById("rel-pos"); 196 Element* relPos = document().getElementById("rel-pos");
189 const ObjectPaintProperties* relPosProperties = relPos->layoutObject()->obje ctPaintProperties(); 197 const ObjectPaintProperties* relPosProperties = relPos->layoutObject()->obje ctPaintProperties();
190 EXPECT_EQ(TransformationMatrix().translate(680, 1120), relPosProperties->pai ntOffsetTranslation()->matrix()); 198 EXPECT_EQ(TransformationMatrix().translate(680, 1120), relPosProperties->pai ntOffsetTranslation()->matrix());
191 EXPECT_EQ(scrollerProperties->scrollTranslation(), relPosProperties->paintOf fsetTranslation()->parent()); 199 EXPECT_EQ(scrollerProperties->scrollTranslation(), relPosProperties->paintOf fsetTranslation()->parent());
192 EXPECT_EQ(relPosProperties->transform(), relPosProperties->overflowClip()->l ocalTransformSpace()); 200 EXPECT_EQ(relPosProperties->transform(), relPosProperties->overflowClip()->l ocalTransformSpace());
193 EXPECT_EQ(FloatRoundedRect(0, 0, 100, 200), relPosProperties->overflowClip() ->clipRect()); 201 EXPECT_EQ(FloatRoundedRect(0, 0, 100, 200), relPosProperties->overflowClip() ->clipRect());
194 EXPECT_EQ(scrollerProperties->overflowClip(), relPosProperties->overflowClip ()->parent()); 202 EXPECT_EQ(scrollerProperties->overflowClip(), relPosProperties->overflowClip ()->parent());
195 CHECK_EXACT_VISUAL_RECT(LayoutRect(), relPos->layoutObject(), frameView->lay outView()); 203 CHECK_EXACT_VISUAL_RECT(LayoutRect(), relPos->layoutObject(), frameView->lay outView());
196 204
197 // The absolute-positioned element should not be affected by non-positioned scroller at all. 205 // The absolute-positioned element should not be affected by non-positioned scroller at all.
198 Element* absPos = document().getElementById("abs-pos"); 206 Element* absPos = document().getElementById("abs-pos");
199 const ObjectPaintProperties* absPosProperties = absPos->layoutObject()->obje ctPaintProperties(); 207 const ObjectPaintProperties* absPosProperties = absPos->layoutObject()->obje ctPaintProperties();
200 EXPECT_EQ(TransformationMatrix().translate(123, 456), absPosProperties->pain tOffsetTranslation()->matrix()); 208 EXPECT_EQ(TransformationMatrix().translate(123, 456), absPosProperties->pain tOffsetTranslation()->matrix());
201 EXPECT_EQ(frameScrollTranslation(), absPosProperties->paintOffsetTranslation ()->parent()); 209 EXPECT_EQ(frameScrollTranslation(), absPosProperties->paintOffsetTranslation ()->parent());
202 EXPECT_EQ(absPosProperties->transform(), absPosProperties->overflowClip()->l ocalTransformSpace()); 210 EXPECT_EQ(absPosProperties->transform(), absPosProperties->overflowClip()->l ocalTransformSpace());
203 EXPECT_EQ(FloatRoundedRect(0, 0, 300, 400), absPosProperties->overflowClip() ->clipRect()); 211 EXPECT_EQ(FloatRoundedRect(0, 0, 300, 400), absPosProperties->overflowClip() ->clipRect());
204 EXPECT_EQ(frameContentClip(), absPosProperties->overflowClip()->parent()); 212 EXPECT_EQ(frameContentClip(), absPosProperties->overflowClip()->parent());
205 // http://crbug.com/638415 213 // http://crbug.com/638415
206 if (!rootLayerScrolls()) { 214 if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled()) {
207 CHECK_EXACT_VISUAL_RECT(LayoutRect(123, 456, 300, 400), absPos->layoutOb ject(), frameView->layoutView()); 215 CHECK_EXACT_VISUAL_RECT(LayoutRect(123, 456, 300, 400), absPos->layoutOb ject(), frameView->layoutView());
208 } 216 }
209 } 217 }
210 218
211 TEST_P(PaintPropertyTreeBuilderTest, FrameScrollingTraditional) 219 TEST_P(PaintPropertyTreeBuilderTest, FrameScrollingTraditional)
212 { 220 {
213 setBodyInnerHTML("<style> body { height: 10000px; } </style>"); 221 setBodyInnerHTML("<style> body { height: 10000px; } </style>");
214 222
215 document().domWindow()->scrollTo(0, 100); 223 document().domWindow()->scrollTo(0, 100);
216 224
217 FrameView* frameView = document().view(); 225 FrameView* frameView = document().view();
218 frameView->updateAllLifecyclePhases(); 226 frameView->updateAllLifecyclePhases();
219 EXPECT_EQ(TransformationMatrix(), framePreTranslation()->matrix()); 227 EXPECT_EQ(TransformationMatrix(), framePreTranslation()->matrix());
220 if (!rootLayerScrolls()) 228 if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled())
221 EXPECT_EQ(rootTransform(), framePreTranslation()->parent()); 229 EXPECT_EQ(rootTransform(), framePreTranslation()->parent());
222 EXPECT_EQ(nullptr, rootTransform()->parent()); 230 EXPECT_EQ(nullptr, rootTransform()->parent());
223 EXPECT_EQ(TransformationMatrix().translate(0, -100), frameScrollTranslation( )->matrix()); 231 EXPECT_EQ(TransformationMatrix().translate(0, -100), frameScrollTranslation( )->matrix());
224 EXPECT_EQ(framePreTranslation(), frameScrollTranslation()->parent()); 232 EXPECT_EQ(framePreTranslation(), frameScrollTranslation()->parent());
225 EXPECT_EQ(framePreTranslation(), frameContentClip()->localTransformSpace()); 233 EXPECT_EQ(framePreTranslation(), frameContentClip()->localTransformSpace());
226 EXPECT_EQ(FloatRoundedRect(0, 0, 800, 600), frameContentClip()->clipRect()); 234 EXPECT_EQ(FloatRoundedRect(0, 0, 800, 600), frameContentClip()->clipRect());
227 EXPECT_EQ(rootClip(), frameContentClip()->parent()); 235 EXPECT_EQ(rootClip(), frameContentClip()->parent());
228 if (!rootLayerScrolls()) 236 if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled())
229 EXPECT_EQ(nullptr, rootClip()->parent()); 237 EXPECT_EQ(nullptr, rootClip()->parent());
230 238
231 LayoutViewItem layoutViewItem = document().layoutViewItem(); 239 LayoutViewItem layoutViewItem = document().layoutViewItem();
232 const ObjectPaintProperties* layoutViewProperties = layoutViewItem.objectPai ntProperties(); 240 const ObjectPaintProperties* layoutViewProperties = layoutViewItem.objectPai ntProperties();
233 // http://crbug.com/638415 241 // http://crbug.com/638415
234 if (!rootLayerScrolls()) { 242 if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled()) {
235 EXPECT_EQ(nullptr, layoutViewProperties->scrollTranslation()); 243 EXPECT_EQ(nullptr, layoutViewProperties->scrollTranslation());
236 CHECK_EXACT_VISUAL_RECT(LayoutRect(8, 8, 784, 10000), document().body()- >layoutObject(), frameView->layoutView()); 244 CHECK_EXACT_VISUAL_RECT(LayoutRect(8, 8, 784, 10000), document().body()- >layoutObject(), frameView->layoutView());
237 } 245 }
238 } 246 }
239 247
240 TEST_P(PaintPropertyTreeBuilderTest, Perspective) 248 TEST_P(PaintPropertyTreeBuilderTest, Perspective)
241 { 249 {
242 loadTestData("perspective.html"); 250 loadTestData("perspective.html");
243 251
244 Element* perspective = document().getElementById("perspective"); 252 Element* perspective = document().getElementById("perspective");
(...skipping 16 matching lines...) Expand all
261 loadTestData("transform.html"); 269 loadTestData("transform.html");
262 270
263 Element* transform = document().getElementById("transform"); 271 Element* transform = document().getElementById("transform");
264 const ObjectPaintProperties* transformProperties = transform->layoutObject() ->objectPaintProperties(); 272 const ObjectPaintProperties* transformProperties = transform->layoutObject() ->objectPaintProperties();
265 EXPECT_EQ(TransformationMatrix().translate3d(123, 456, 789), transformProper ties->transform()->matrix()); 273 EXPECT_EQ(TransformationMatrix().translate3d(123, 456, 789), transformProper ties->transform()->matrix());
266 EXPECT_EQ(FloatPoint3D(200, 150, 0), transformProperties->transform()->origi n()); 274 EXPECT_EQ(FloatPoint3D(200, 150, 0), transformProperties->transform()->origi n());
267 EXPECT_EQ(transformProperties->paintOffsetTranslation(), transformProperties ->transform()->parent()); 275 EXPECT_EQ(transformProperties->paintOffsetTranslation(), transformProperties ->transform()->parent());
268 EXPECT_EQ(TransformationMatrix().translate(50, 100), transformProperties->pa intOffsetTranslation()->matrix()); 276 EXPECT_EQ(TransformationMatrix().translate(50, 100), transformProperties->pa intOffsetTranslation()->matrix());
269 EXPECT_EQ(frameScrollTranslation(), transformProperties->paintOffsetTranslat ion()->parent()); 277 EXPECT_EQ(frameScrollTranslation(), transformProperties->paintOffsetTranslat ion()->parent());
270 // http://crbug.com/638415 278 // http://crbug.com/638415
271 if (!rootLayerScrolls()) { 279 if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled()) {
272 CHECK_EXACT_VISUAL_RECT(LayoutRect(173, 556, 400, 300), transform->layou tObject(), document().view()->layoutView()); 280 CHECK_EXACT_VISUAL_RECT(LayoutRect(173, 556, 400, 300), transform->layou tObject(), document().view()->layoutView());
273 } 281 }
274 } 282 }
275 283
276 TEST_P(PaintPropertyTreeBuilderTest, RelativePositionInline) 284 TEST_P(PaintPropertyTreeBuilderTest, RelativePositionInline)
277 { 285 {
278 loadTestData("relative-position-inline.html"); 286 loadTestData("relative-position-inline.html");
279 287
280 Element* inlineBlock = document().getElementById("inline-block"); 288 Element* inlineBlock = document().getElementById("inline-block");
281 const ObjectPaintProperties* inlineBlockProperties = inlineBlock->layoutObje ct()->objectPaintProperties(); 289 const ObjectPaintProperties* inlineBlockProperties = inlineBlock->layoutObje ct()->objectPaintProperties();
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after
741 "</div>"); 749 "</div>");
742 Document& frameDocument = setupChildIframe("frame", 750 Document& frameDocument = setupChildIframe("frame",
743 "<style>body { margin: 0; }</style><div id='transform' style='transform: translate3d(4px, 5px, 6px); width: 100px; height: 200px'></div>"); 751 "<style>body { margin: 0; }</style><div id='transform' style='transform: translate3d(4px, 5px, 6px); width: 100px; height: 200px'></div>");
744 FrameView* frameView = document().view(); 752 FrameView* frameView = document().view();
745 frameView->updateAllLifecyclePhases(); 753 frameView->updateAllLifecyclePhases();
746 754
747 LayoutObject* divWithTransform = document().getElementById("divWithTransform ")->layoutObject(); 755 LayoutObject* divWithTransform = document().getElementById("divWithTransform ")->layoutObject();
748 const ObjectPaintProperties* divWithTransformProperties = divWithTransform-> objectPaintProperties(); 756 const ObjectPaintProperties* divWithTransformProperties = divWithTransform-> objectPaintProperties();
749 EXPECT_EQ(TransformationMatrix().translate3d(1, 2, 3), divWithTransformPrope rties->transform()->matrix()); 757 EXPECT_EQ(TransformationMatrix().translate3d(1, 2, 3), divWithTransformPrope rties->transform()->matrix());
750 // http://crbug.com/638415 758 // http://crbug.com/638415
751 if (!rootLayerScrolls()) { 759 if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled()) {
752 CHECK_EXACT_VISUAL_RECT(LayoutRect(1, 2, 800, 164), divWithTransform, fr ameView->layoutView()); 760 CHECK_EXACT_VISUAL_RECT(LayoutRect(1, 2, 800, 164), divWithTransform, fr ameView->layoutView());
753 } 761 }
754 762
755 LayoutObject* innerDivWithTransform = frameDocument.getElementById("transfor m")->layoutObject(); 763 LayoutObject* innerDivWithTransform = frameDocument.getElementById("transfor m")->layoutObject();
756 const ObjectPaintProperties* innerDivWithTransformProperties = innerDivWithT ransform->objectPaintProperties(); 764 const ObjectPaintProperties* innerDivWithTransformProperties = innerDivWithT ransform->objectPaintProperties();
757 auto* innerDivTransform = innerDivWithTransformProperties->transform(); 765 auto* innerDivTransform = innerDivWithTransformProperties->transform();
758 EXPECT_EQ(TransformationMatrix().translate3d(4, 5, 6), innerDivTransform->ma trix()); 766 EXPECT_EQ(TransformationMatrix().translate3d(4, 5, 6), innerDivTransform->ma trix());
759 CHECK_EXACT_VISUAL_RECT(LayoutRect(12, 14, 100, 145), innerDivWithTransform, frameView->layoutView()); 767 CHECK_EXACT_VISUAL_RECT(LayoutRect(12, 14, 100, 145), innerDivWithTransform, frameView->layoutView());
760 768
761 // Ensure that the inner div's transform is correctly rooted in the root fra me's transform tree. 769 // Ensure that the inner div's transform is correctly rooted in the root fra me's transform tree.
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
808 auto* iframeTransform = iframePreTranslation->parent(); 816 auto* iframeTransform = iframePreTranslation->parent();
809 EXPECT_EQ(TransformationMatrix().translate3d(4, 5, 6), iframeTransform->matr ix()); 817 EXPECT_EQ(TransformationMatrix().translate3d(4, 5, 6), iframeTransform->matr ix());
810 auto* iframePaintOffsetTranslation = iframeTransform->parent(); 818 auto* iframePaintOffsetTranslation = iframeTransform->parent();
811 EXPECT_EQ(TransformationMatrix().translate3d(7, 7, 0), iframePaintOffsetTran slation->matrix()); 819 EXPECT_EQ(TransformationMatrix().translate3d(7, 7, 0), iframePaintOffsetTran slation->matrix());
812 auto* divWithTransformTransform = iframePaintOffsetTranslation->parent(); 820 auto* divWithTransformTransform = iframePaintOffsetTranslation->parent();
813 EXPECT_EQ(TransformationMatrix().translate3d(1, 2, 3), divWithTransformTrans form->matrix()); 821 EXPECT_EQ(TransformationMatrix().translate3d(1, 2, 3), divWithTransformTrans form->matrix());
814 822
815 LayoutObject* divWithTransform = document().getElementById("divWithTransform ")->layoutObject(); 823 LayoutObject* divWithTransform = document().getElementById("divWithTransform ")->layoutObject();
816 EXPECT_EQ(divWithTransformTransform, divWithTransform->objectPaintProperties ()->transform()); 824 EXPECT_EQ(divWithTransformTransform, divWithTransform->objectPaintProperties ()->transform());
817 // http://crbug.com/638415 825 // http://crbug.com/638415
818 if (!rootLayerScrolls()) { 826 if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled()) {
819 CHECK_EXACT_VISUAL_RECT(LayoutRect(1, 2, 800, 248), divWithTransform, fr ameView->layoutView()); 827 CHECK_EXACT_VISUAL_RECT(LayoutRect(1, 2, 800, 248), divWithTransform, fr ameView->layoutView());
820 } 828 }
821 } 829 }
822 830
823 TEST_P(PaintPropertyTreeBuilderTest, TreeContextClipByNonStackingContext) 831 TEST_P(PaintPropertyTreeBuilderTest, TreeContextClipByNonStackingContext)
824 { 832 {
825 // This test verifies the tree builder correctly computes and records the pr operty tree context 833 // This test verifies the tree builder correctly computes and records the pr operty tree context
826 // for a (pseudo) stacking context that is scrolled by a containing block th at is not one of 834 // for a (pseudo) stacking context that is scrolled by a containing block th at is not one of
827 // the painting ancestors. 835 // the painting ancestors.
828 setBodyInnerHTML( 836 setBodyInnerHTML(
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
861 ); 869 );
862 870
863 LayoutObject& scroller = *document().getElementById("scroller")->layoutObjec t(); 871 LayoutObject& scroller = *document().getElementById("scroller")->layoutObjec t();
864 const ObjectPaintProperties* scrollerProperties = scroller.objectPaintProper ties(); 872 const ObjectPaintProperties* scrollerProperties = scroller.objectPaintProper ties();
865 LayoutObject& child = *document().getElementById("child")->layoutObject(); 873 LayoutObject& child = *document().getElementById("child")->layoutObject();
866 const ObjectPaintProperties* childProperties = child.objectPaintProperties() ; 874 const ObjectPaintProperties* childProperties = child.objectPaintProperties() ;
867 875
868 EXPECT_EQ(frameContentClip(), childProperties->localBorderBoxProperties()->p ropertyTreeState.clip); 876 EXPECT_EQ(frameContentClip(), childProperties->localBorderBoxProperties()->p ropertyTreeState.clip);
869 EXPECT_EQ(frameScrollTranslation(), childProperties->localBorderBoxPropertie s()->propertyTreeState.transform); 877 EXPECT_EQ(frameScrollTranslation(), childProperties->localBorderBoxPropertie s()->propertyTreeState.transform);
870 EXPECT_EQ(scrollerProperties->effect(), childProperties->localBorderBoxPrope rties()->propertyTreeState.effect); 878 EXPECT_EQ(scrollerProperties->effect(), childProperties->localBorderBoxPrope rties()->propertyTreeState.effect);
871 if (!rootLayerScrolls()) { 879 if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled()) {
872 CHECK_EXACT_VISUAL_RECT(LayoutRect(0, 0, 800, 10000), &scroller, documen t().view()->layoutView()); 880 CHECK_EXACT_VISUAL_RECT(LayoutRect(0, 0, 800, 10000), &scroller, documen t().view()->layoutView());
873 } 881 }
874 CHECK_EXACT_VISUAL_RECT(LayoutRect(0, 0, 100, 200), &child, document().view( )->layoutView()); 882 CHECK_EXACT_VISUAL_RECT(LayoutRect(0, 0, 100, 200), &child, document().view( )->layoutView());
875 } 883 }
876 884
877 TEST_P(PaintPropertyTreeBuilderTest, TableCellLayoutLocation) 885 TEST_P(PaintPropertyTreeBuilderTest, TableCellLayoutLocation)
878 { 886 {
879 // This test verifies that the border box space of a table cell is being cor rectly computed. 887 // This test verifies that the border box space of a table cell is being cor rectly computed.
880 // Table cells have weird location adjustment in our layout/paint implementa tion. 888 // Table cells have weird location adjustment in our layout/paint implementa tion.
881 setBodyInnerHTML( 889 setBodyInnerHTML(
(...skipping 706 matching lines...) Expand 10 before | Expand all | Expand 10 after
1588 EXPECT_EQ(cProperties, c->layoutObject()->objectPaintProperties()); 1596 EXPECT_EQ(cProperties, c->layoutObject()->objectPaintProperties());
1589 EXPECT_EQ(cTransformNode, cProperties->transform()); 1597 EXPECT_EQ(cTransformNode, cProperties->transform());
1590 EXPECT_EQ(bTransformNode, cTransformNode->parent()); 1598 EXPECT_EQ(bTransformNode, cTransformNode->parent());
1591 1599
1592 CHECK_EXACT_VISUAL_RECT(LayoutRect(33, 44, 50, 60), a->layoutObject(), frame View->layoutView()); 1600 CHECK_EXACT_VISUAL_RECT(LayoutRect(33, 44, 50, 60), a->layoutObject(), frame View->layoutView());
1593 CHECK_EXACT_VISUAL_RECT(LayoutRect(37, 49, 50, 20), b->layoutObject(), frame View->layoutView()); 1601 CHECK_EXACT_VISUAL_RECT(LayoutRect(37, 49, 50, 20), b->layoutObject(), frame View->layoutView());
1594 CHECK_EXACT_VISUAL_RECT(LayoutRect(114, 137, 10, 20), c->layoutObject(), fra meView->layoutView()); 1602 CHECK_EXACT_VISUAL_RECT(LayoutRect(114, 137, 10, 20), c->layoutObject(), fra meView->layoutView());
1595 } 1603 }
1596 1604
1597 } // namespace blink 1605 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698