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

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

Issue 1584493002: Skip PaintPhaseDescendantOutlinesOnly if no descendent outlines in the layer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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/compositing/CompositedLayerMapping.h" 5 #include "core/layout/compositing/CompositedLayerMapping.h"
6 #include "core/paint/PaintControllerPaintTest.h" 6 #include "core/paint/PaintControllerPaintTest.h"
7 #include "platform/graphics/GraphicsContext.h" 7 #include "platform/graphics/GraphicsContext.h"
8 8
9 namespace blink { 9 namespace blink {
10 10
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 TestDisplayItem(container1, backgroundType), 235 TestDisplayItem(container1, backgroundType),
236 TestDisplayItem(content1, backgroundType), 236 TestDisplayItem(content1, backgroundType),
237 TestDisplayItem(container1Layer, DisplayItem::EndSubsequence), 237 TestDisplayItem(container1Layer, DisplayItem::EndSubsequence),
238 TestDisplayItem(container2Layer, DisplayItem::Subsequence), 238 TestDisplayItem(container2Layer, DisplayItem::Subsequence),
239 TestDisplayItem(container2, backgroundType), 239 TestDisplayItem(container2, backgroundType),
240 TestDisplayItem(content2, backgroundType), 240 TestDisplayItem(content2, backgroundType),
241 TestDisplayItem(container2Layer, DisplayItem::EndSubsequence), 241 TestDisplayItem(container2Layer, DisplayItem::EndSubsequence),
242 TestDisplayItem(htmlLayer, DisplayItem::EndSubsequence)); 242 TestDisplayItem(htmlLayer, DisplayItem::EndSubsequence));
243 } 243 }
244 244
245 TEST_P(PaintLayerPainterTest, PaintPhaseOutline)
246 {
247 AtomicString styleWithoutOutline = "width: 50px; height: 50px; background-co lor: green";
248 AtomicString styleWithOutline = "outline: 1px solid blue; " + styleWithoutOu tline;
249 setBodyInnerHTML(
250 "<div id='self-painting-layer' style='position: absolute'>"
251 " <div id='non-self-painting-layer' style='overflow: hidden'>"
252 " <div>"
253 " <div id='outline'></div>"
254 " </div>"
255 " </div>"
256 "</div>");
257 LayoutObject& outlineDiv = *document().getElementById("outline")->layoutObje ct();
258 toHTMLElement(outlineDiv.node())->setAttribute(HTMLNames::styleAttr, styleWi thoutOutline);
259 document().view()->updateAllLifecyclePhases();
260
261 LayoutBlock& selfPaintingLayerObject = *toLayoutBlock(document().getElementB yId("self-painting-layer")->layoutObject());
262 PaintLayer& selfPaintingLayer = *selfPaintingLayerObject.layer();
263 ASSERT_TRUE(selfPaintingLayer.isSelfPaintingLayer());
264 PaintLayer& nonSelfPaintingLayer = *toLayoutBoxModelObject(document().getEle mentById("non-self-painting-layer")->layoutObject())->layer();
265 ASSERT_FALSE(nonSelfPaintingLayer.isSelfPaintingLayer());
266 ASSERT_TRUE(&nonSelfPaintingLayer == outlineDiv.enclosingLayer());
267 ASSERT_TRUE(&selfPaintingLayer == outlineDiv.enclosingLayer()->enclosingSelf PaintingLayer());
268
269 EXPECT_FALSE(selfPaintingLayer.needsPaintPhaseChildOutlines());
270 EXPECT_FALSE(nonSelfPaintingLayer.needsPaintPhaseChildOutlines());
271
272 // needsPaintPhaseChildOutlines should be set when any descendant on the sam e layer has outline.
273 toHTMLElement(outlineDiv.node())->setAttribute(HTMLNames::styleAttr, styleWi thOutline);
274 updateLifecyclePhasesBeforePaint();
275 EXPECT_TRUE(selfPaintingLayer.needsPaintPhaseChildOutlines());
276 EXPECT_FALSE(nonSelfPaintingLayer.needsPaintPhaseChildOutlines());
277 paint();
278 EXPECT_TRUE(displayItemListContains(rootPaintController().displayItemList(), outlineDiv, DisplayItem::paintPhaseToDrawingType(PaintPhaseSelfOutline)));
279
280 // needsPaintPhaseChildOutlines shold be reset after an empty painting of th e phase.
281 toHTMLElement(outlineDiv.node())->setAttribute(HTMLNames::styleAttr, styleWi thoutOutline);
282 document().view()->updateAllLifecyclePhases();
283 EXPECT_FALSE(selfPaintingLayer.needsPaintPhaseChildOutlines());
284 EXPECT_FALSE(nonSelfPaintingLayer.needsPaintPhaseChildOutlines());
285
286 // Outline on the self-painting-layer node itself doesn't affect PaintPhaseC hildOutlines.
287 toHTMLElement(selfPaintingLayerObject.node())->setAttribute(HTMLNames::style Attr, "position: absolute; outline: 1px solid green");
288 document().view()->updateAllLifecyclePhases();
289 EXPECT_FALSE(selfPaintingLayer.needsPaintPhaseChildOutlines());
290 EXPECT_FALSE(nonSelfPaintingLayer.needsPaintPhaseChildOutlines());
291 EXPECT_TRUE(displayItemListContains(rootPaintController().displayItemList(), selfPaintingLayerObject, DisplayItem::paintPhaseToDrawingType(PaintPhaseSelfOut line)));
292 }
293
245 } // namespace blink 294 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698