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

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

Issue 2322073006: Turn off the old compositing path for SPv2. (Closed)
Patch Set: none 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/LayoutBlock.h" 5 #include "core/layout/LayoutBlock.h"
6 #include "core/layout/LayoutInline.h" 6 #include "core/layout/LayoutInline.h"
7 #include "core/layout/compositing/CompositedLayerMapping.h" 7 #include "core/layout/compositing/CompositedLayerMapping.h"
8 #include "core/paint/PaintControllerPaintTest.h" 8 #include "core/paint/PaintControllerPaintTest.h"
9 #include "platform/graphics/GraphicsContext.h" 9 #include "platform/graphics/GraphicsContext.h"
10 #include "platform/testing/RuntimeEnabledFeaturesTestHelpers.h" 10 #include "platform/testing/RuntimeEnabledFeaturesTestHelpers.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 document().view()->updateAllLifecyclePhases(); 48 document().view()->updateAllLifecyclePhases();
49 49
50 PaintLayer& htmlLayer = *toLayoutBoxModelObject(document().documentElement() ->layoutObject())->layer(); 50 PaintLayer& htmlLayer = *toLayoutBoxModelObject(document().documentElement() ->layoutObject())->layer();
51 LayoutObject& container1 = *document().getElementById("container1")->layoutO bject(); 51 LayoutObject& container1 = *document().getElementById("container1")->layoutO bject();
52 PaintLayer& container1Layer = *toLayoutBoxModelObject(container1).layer(); 52 PaintLayer& container1Layer = *toLayoutBoxModelObject(container1).layer();
53 LayoutObject& content1 = *document().getElementById("content1")->layoutObjec t(); 53 LayoutObject& content1 = *document().getElementById("content1")->layoutObjec t();
54 LayoutObject& container2 = *document().getElementById("container2")->layoutO bject(); 54 LayoutObject& container2 = *document().getElementById("container2")->layoutO bject();
55 PaintLayer& container2Layer = *toLayoutBoxModelObject(container2).layer(); 55 PaintLayer& container2Layer = *toLayoutBoxModelObject(container2).layer();
56 LayoutObject& content2 = *document().getElementById("content2")->layoutObjec t(); 56 LayoutObject& content2 = *document().getElementById("content2")->layoutObjec t();
57 57
58 EXPECT_DISPLAY_LIST(rootPaintController().getDisplayItemList(), 11, 58 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
59 TestDisplayItem(layoutView(), documentBackgroundType), 59 EXPECT_DISPLAY_LIST(rootPaintController().getDisplayItemList(), 15,
60 TestDisplayItem(htmlLayer, DisplayItem::kSubsequence), 60 TestDisplayItem(layoutView(), DisplayItem::kClipFrameToVisibleConten tRect),
61 TestDisplayItem(container1Layer, DisplayItem::kSubsequence), 61 TestDisplayItem(*layoutView().layer(), DisplayItem::kSubsequence),
62 TestDisplayItem(container1, backgroundType), 62 TestDisplayItem(layoutView(), documentBackgroundType),
63 TestDisplayItem(content1, backgroundType), 63 TestDisplayItem(htmlLayer, DisplayItem::kSubsequence),
64 TestDisplayItem(container1Layer, DisplayItem::kEndSubsequence), 64 TestDisplayItem(container1Layer, DisplayItem::kSubsequence),
65 TestDisplayItem(container2Layer, DisplayItem::kSubsequence), 65 TestDisplayItem(container1, backgroundType),
66 TestDisplayItem(container2, backgroundType), 66 TestDisplayItem(content1, backgroundType),
67 TestDisplayItem(content2, backgroundType), 67 TestDisplayItem(container1Layer, DisplayItem::kEndSubsequence),
68 TestDisplayItem(container2Layer, DisplayItem::kEndSubsequence), 68 TestDisplayItem(container2Layer, DisplayItem::kSubsequence),
69 TestDisplayItem(htmlLayer, DisplayItem::kEndSubsequence)); 69 TestDisplayItem(container2, backgroundType),
70 TestDisplayItem(content2, backgroundType),
71 TestDisplayItem(container2Layer, DisplayItem::kEndSubsequence),
72 TestDisplayItem(htmlLayer, DisplayItem::kEndSubsequence),
73 TestDisplayItem(*layoutView().layer(), DisplayItem::kEndSubsequence) ,
74 TestDisplayItem(layoutView(), DisplayItem::clipTypeToEndClipType(Dis playItem::kClipFrameToVisibleContentRect)));
75 } else {
76 EXPECT_DISPLAY_LIST(rootPaintController().getDisplayItemList(), 11,
77 TestDisplayItem(layoutView(), documentBackgroundType),
78 TestDisplayItem(htmlLayer, DisplayItem::kSubsequence),
79 TestDisplayItem(container1Layer, DisplayItem::kSubsequence),
80 TestDisplayItem(container1, backgroundType),
81 TestDisplayItem(content1, backgroundType),
82 TestDisplayItem(container1Layer, DisplayItem::kEndSubsequence),
83 TestDisplayItem(container2Layer, DisplayItem::kSubsequence),
84 TestDisplayItem(container2, backgroundType),
85 TestDisplayItem(content2, backgroundType),
86 TestDisplayItem(container2Layer, DisplayItem::kEndSubsequence),
87 TestDisplayItem(htmlLayer, DisplayItem::kEndSubsequence));
88 }
70 89
71 toHTMLElement(content1.node())->setAttribute(HTMLNames::styleAttr, "position : absolute; width: 100px; height: 100px; background-color: green"); 90 toHTMLElement(content1.node())->setAttribute(HTMLNames::styleAttr, "position : absolute; width: 100px; height: 100px; background-color: green");
72 document().view()->updateAllLifecyclePhasesExceptPaint(); 91 document().view()->updateAllLifecyclePhasesExceptPaint();
73 EXPECT_TRUE(paintWithoutCommit()); 92 EXPECT_TRUE(paintWithoutCommit());
74 93
75 EXPECT_EQ(6, numCachedNewItems()); 94 EXPECT_EQ(6, numCachedNewItems());
76 95
77 commit(); 96 commit();
78 97
79 EXPECT_DISPLAY_LIST(rootPaintController().getDisplayItemList(), 11, 98 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
80 TestDisplayItem(layoutView(), documentBackgroundType), 99 EXPECT_DISPLAY_LIST(rootPaintController().getDisplayItemList(), 15,
81 TestDisplayItem(htmlLayer, DisplayItem::kSubsequence), 100 TestDisplayItem(layoutView(), DisplayItem::kClipFrameToVisibleConten tRect),
82 TestDisplayItem(container1Layer, DisplayItem::kSubsequence), 101 TestDisplayItem(*layoutView().layer(), DisplayItem::kSubsequence),
83 TestDisplayItem(container1, backgroundType), 102 TestDisplayItem(layoutView(), documentBackgroundType),
84 TestDisplayItem(content1, backgroundType), 103 TestDisplayItem(htmlLayer, DisplayItem::kSubsequence),
85 TestDisplayItem(container1Layer, DisplayItem::kEndSubsequence), 104 TestDisplayItem(container1Layer, DisplayItem::kSubsequence),
86 TestDisplayItem(container2Layer, DisplayItem::kSubsequence), 105 TestDisplayItem(container1, backgroundType),
87 TestDisplayItem(container2, backgroundType), 106 TestDisplayItem(content1, backgroundType),
88 TestDisplayItem(content2, backgroundType), 107 TestDisplayItem(container1Layer, DisplayItem::kEndSubsequence),
89 TestDisplayItem(container2Layer, DisplayItem::kEndSubsequence), 108 TestDisplayItem(container2Layer, DisplayItem::kSubsequence),
90 TestDisplayItem(htmlLayer, DisplayItem::kEndSubsequence)); 109 TestDisplayItem(container2, backgroundType),
110 TestDisplayItem(content2, backgroundType),
111 TestDisplayItem(container2Layer, DisplayItem::kEndSubsequence),
112 TestDisplayItem(htmlLayer, DisplayItem::kEndSubsequence),
113 TestDisplayItem(*layoutView().layer(), DisplayItem::kEndSubsequence) ,
114 TestDisplayItem(layoutView(), DisplayItem::clipTypeToEndClipType(Dis playItem::kClipFrameToVisibleContentRect)));
115 } else {
116 EXPECT_DISPLAY_LIST(rootPaintController().getDisplayItemList(), 11,
117 TestDisplayItem(layoutView(), documentBackgroundType),
118 TestDisplayItem(htmlLayer, DisplayItem::kSubsequence),
119 TestDisplayItem(container1Layer, DisplayItem::kSubsequence),
120 TestDisplayItem(container1, backgroundType),
121 TestDisplayItem(content1, backgroundType),
122 TestDisplayItem(container1Layer, DisplayItem::kEndSubsequence),
123 TestDisplayItem(container2Layer, DisplayItem::kSubsequence),
124 TestDisplayItem(container2, backgroundType),
125 TestDisplayItem(content2, backgroundType),
126 TestDisplayItem(container2Layer, DisplayItem::kEndSubsequence),
127 TestDisplayItem(htmlLayer, DisplayItem::kEndSubsequence));
128 }
91 } 129 }
92 130
93 TEST_P(PaintLayerPainterTest, CachedSubsequenceOnInterestRectChange) 131 TEST_P(PaintLayerPainterTest, CachedSubsequenceOnInterestRectChange)
94 { 132 {
95 // TODO(wangxianzhu): SPv2 deals with interest rect differently, so disable this test for SPv2 temporarily. 133 // TODO(wangxianzhu): SPv2 deals with interest rect differently, so disable this test for SPv2 temporarily.
96 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) 134 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled())
97 return; 135 return;
98 136
99 setBodyInnerHTML( 137 setBodyInnerHTML(
100 "<div id='container1' style='position: relative; z-index: 1; width: 200p x; height: 200px; background-color: blue'>" 138 "<div id='container1' style='position: relative; z-index: 1; width: 200p x; height: 200px; background-color: blue'>"
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 paint(&interestRect); 228 paint(&interestRect);
191 229
192 PaintLayer& htmlLayer = *toLayoutBoxModelObject(document().documentElement() ->layoutObject())->layer(); 230 PaintLayer& htmlLayer = *toLayoutBoxModelObject(document().documentElement() ->layoutObject())->layer();
193 LayoutObject& container1 = *document().getElementById("container1")->layoutO bject(); 231 LayoutObject& container1 = *document().getElementById("container1")->layoutO bject();
194 PaintLayer& container1Layer = *toLayoutBoxModelObject(container1).layer(); 232 PaintLayer& container1Layer = *toLayoutBoxModelObject(container1).layer();
195 LayoutObject& content1 = *document().getElementById("content1")->layoutObjec t(); 233 LayoutObject& content1 = *document().getElementById("content1")->layoutObjec t();
196 LayoutObject& container2 = *document().getElementById("container2")->layoutO bject(); 234 LayoutObject& container2 = *document().getElementById("container2")->layoutO bject();
197 PaintLayer& container2Layer = *toLayoutBoxModelObject(container2).layer(); 235 PaintLayer& container2Layer = *toLayoutBoxModelObject(container2).layer();
198 LayoutObject& content2 = *document().getElementById("content2")->layoutObjec t(); 236 LayoutObject& content2 = *document().getElementById("content2")->layoutObjec t();
199 237
200 EXPECT_DISPLAY_LIST(rootPaintController().getDisplayItemList(), 11, 238 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
201 TestDisplayItem(layoutView(), documentBackgroundType), 239 EXPECT_DISPLAY_LIST(rootPaintController().getDisplayItemList(), 15,
202 TestDisplayItem(htmlLayer, DisplayItem::kSubsequence), 240 TestDisplayItem(layoutView(), DisplayItem::kClipFrameToVisibleConten tRect),
203 TestDisplayItem(container1Layer, DisplayItem::kSubsequence), 241 TestDisplayItem(*layoutView().layer(), DisplayItem::kSubsequence),
204 TestDisplayItem(container1, backgroundType), 242 TestDisplayItem(layoutView(), documentBackgroundType),
205 TestDisplayItem(content1, backgroundType), 243 TestDisplayItem(htmlLayer, DisplayItem::kSubsequence),
206 TestDisplayItem(container1Layer, DisplayItem::kEndSubsequence), 244 TestDisplayItem(container1Layer, DisplayItem::kSubsequence),
207 TestDisplayItem(container2Layer, DisplayItem::kSubsequence), 245 TestDisplayItem(container1, backgroundType),
208 TestDisplayItem(container2, backgroundType), 246 TestDisplayItem(content1, backgroundType),
209 TestDisplayItem(content2, backgroundType), 247 TestDisplayItem(container1Layer, DisplayItem::kEndSubsequence),
210 TestDisplayItem(container2Layer, DisplayItem::kEndSubsequence), 248 TestDisplayItem(container2Layer, DisplayItem::kSubsequence),
211 TestDisplayItem(htmlLayer, DisplayItem::kEndSubsequence)); 249 TestDisplayItem(container2, backgroundType),
250 TestDisplayItem(content2, backgroundType),
251 TestDisplayItem(container2Layer, DisplayItem::kEndSubsequence),
252 TestDisplayItem(htmlLayer, DisplayItem::kEndSubsequence),
253 TestDisplayItem(*layoutView().layer(), DisplayItem::kEndSubsequence) ,
254 TestDisplayItem(layoutView(), DisplayItem::clipTypeToEndClipType(Dis playItem::kClipFrameToVisibleContentRect)));
255 } else {
256 EXPECT_DISPLAY_LIST(rootPaintController().getDisplayItemList(), 11,
257 TestDisplayItem(layoutView(), documentBackgroundType),
258 TestDisplayItem(htmlLayer, DisplayItem::kSubsequence),
259 TestDisplayItem(container1Layer, DisplayItem::kSubsequence),
260 TestDisplayItem(container1, backgroundType),
261 TestDisplayItem(content1, backgroundType),
262 TestDisplayItem(container1Layer, DisplayItem::kEndSubsequence),
263 TestDisplayItem(container2Layer, DisplayItem::kSubsequence),
264 TestDisplayItem(container2, backgroundType),
265 TestDisplayItem(content2, backgroundType),
266 TestDisplayItem(container2Layer, DisplayItem::kEndSubsequence),
267 TestDisplayItem(htmlLayer, DisplayItem::kEndSubsequence));
268 }
212 269
213 toHTMLElement(content1.node())->setAttribute(HTMLNames::styleAttr, "position : absolute; width: 100px; height: 100px; background-color: green"); 270 toHTMLElement(content1.node())->setAttribute(HTMLNames::styleAttr, "position : absolute; width: 100px; height: 100px; background-color: green");
214 document().view()->updateAllLifecyclePhasesExceptPaint(); 271 document().view()->updateAllLifecyclePhasesExceptPaint();
215 EXPECT_TRUE(paintWithoutCommit(&interestRect)); 272 EXPECT_TRUE(paintWithoutCommit(&interestRect));
216 273
217 EXPECT_EQ(6, numCachedNewItems()); 274 EXPECT_EQ(6, numCachedNewItems());
218 275
219 commit(); 276 commit();
220 277
221 EXPECT_DISPLAY_LIST(rootPaintController().getDisplayItemList(), 11, 278 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
222 TestDisplayItem(layoutView(), documentBackgroundType), 279 EXPECT_DISPLAY_LIST(rootPaintController().getDisplayItemList(), 15,
223 TestDisplayItem(htmlLayer, DisplayItem::kSubsequence), 280 TestDisplayItem(layoutView(), DisplayItem::kClipFrameToVisibleConten tRect),
224 TestDisplayItem(container1Layer, DisplayItem::kSubsequence), 281 TestDisplayItem(*layoutView().layer(), DisplayItem::kSubsequence),
225 TestDisplayItem(container1, backgroundType), 282 TestDisplayItem(layoutView(), documentBackgroundType),
226 TestDisplayItem(content1, backgroundType), 283 TestDisplayItem(htmlLayer, DisplayItem::kSubsequence),
227 TestDisplayItem(container1Layer, DisplayItem::kEndSubsequence), 284 TestDisplayItem(container1Layer, DisplayItem::kSubsequence),
228 TestDisplayItem(container2Layer, DisplayItem::kSubsequence), 285 TestDisplayItem(container1, backgroundType),
229 TestDisplayItem(container2, backgroundType), 286 TestDisplayItem(content1, backgroundType),
230 TestDisplayItem(content2, backgroundType), 287 TestDisplayItem(container1Layer, DisplayItem::kEndSubsequence),
231 TestDisplayItem(container2Layer, DisplayItem::kEndSubsequence), 288 TestDisplayItem(container2Layer, DisplayItem::kSubsequence),
232 TestDisplayItem(htmlLayer, DisplayItem::kEndSubsequence)); 289 TestDisplayItem(container2, backgroundType),
290 TestDisplayItem(content2, backgroundType),
291 TestDisplayItem(container2Layer, DisplayItem::kEndSubsequence),
292 TestDisplayItem(htmlLayer, DisplayItem::kEndSubsequence),
293 TestDisplayItem(*layoutView().layer(), DisplayItem::kEndSubsequence) ,
294 TestDisplayItem(layoutView(), DisplayItem::clipTypeToEndClipType(Dis playItem::kClipFrameToVisibleContentRect)));
295 } else {
296 EXPECT_DISPLAY_LIST(rootPaintController().getDisplayItemList(), 11,
297 TestDisplayItem(layoutView(), documentBackgroundType),
298 TestDisplayItem(htmlLayer, DisplayItem::kSubsequence),
299 TestDisplayItem(container1Layer, DisplayItem::kSubsequence),
300 TestDisplayItem(container1, backgroundType),
301 TestDisplayItem(content1, backgroundType),
302 TestDisplayItem(container1Layer, DisplayItem::kEndSubsequence),
303 TestDisplayItem(container2Layer, DisplayItem::kSubsequence),
304 TestDisplayItem(container2, backgroundType),
305 TestDisplayItem(content2, backgroundType),
306 TestDisplayItem(container2Layer, DisplayItem::kEndSubsequence),
307 TestDisplayItem(htmlLayer, DisplayItem::kEndSubsequence));
308 }
233 } 309 }
234 310
235 TEST_P(PaintLayerPainterTest, PaintPhaseOutline) 311 TEST_P(PaintLayerPainterTest, PaintPhaseOutline)
236 { 312 {
237 AtomicString styleWithoutOutline = "width: 50px; height: 50px; background-co lor: green"; 313 AtomicString styleWithoutOutline = "width: 50px; height: 50px; background-co lor: green";
238 AtomicString styleWithOutline = "outline: 1px solid blue; " + styleWithoutOu tline; 314 AtomicString styleWithOutline = "outline: 1px solid blue; " + styleWithoutOu tline;
239 setBodyInnerHTML( 315 setBodyInnerHTML(
240 "<div id='self-painting-layer' style='position: absolute'>" 316 "<div id='self-painting-layer' style='position: absolute'>"
241 " <div id='non-self-painting-layer' style='overflow: hidden'>" 317 " <div id='non-self-painting-layer' style='overflow: hidden'>"
242 " <div>" 318 " <div>"
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
543 PaintLayer& layer = *table.layer(); 619 PaintLayer& layer = *table.layer();
544 EXPECT_TRUE(layer.isSelfPaintingLayer()); 620 EXPECT_TRUE(layer.isSelfPaintingLayer());
545 EXPECT_FALSE(layer.needsPaintPhaseDescendantBlockBackgrounds()); 621 EXPECT_FALSE(layer.needsPaintPhaseDescendantBlockBackgrounds());
546 622
547 toHTMLElement(table.node())->setAttribute(HTMLNames::styleAttr, "position: r elative; border-collapse: collapse"); 623 toHTMLElement(table.node())->setAttribute(HTMLNames::styleAttr, "position: r elative; border-collapse: collapse");
548 document().view()->updateAllLifecyclePhases(); 624 document().view()->updateAllLifecyclePhases();
549 EXPECT_TRUE(layer.needsPaintPhaseDescendantBlockBackgrounds()); 625 EXPECT_TRUE(layer.needsPaintPhaseDescendantBlockBackgrounds());
550 } 626 }
551 627
552 } // namespace blink 628 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698