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

Unified 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: Rebase 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintLayerPainter.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/paint/PaintLayerPainterTest.cpp
diff --git a/third_party/WebKit/Source/core/paint/PaintLayerPainterTest.cpp b/third_party/WebKit/Source/core/paint/PaintLayerPainterTest.cpp
index f86257cd78c06c18ce6477960d5fa58305258c30..02c7a778645ece7cfc98e861afcd4f8ab997b7da 100644
--- a/third_party/WebKit/Source/core/paint/PaintLayerPainterTest.cpp
+++ b/third_party/WebKit/Source/core/paint/PaintLayerPainterTest.cpp
@@ -242,4 +242,46 @@ TEST_P(PaintLayerPainterTest, CachedSubsequenceOnStyleChangeWithInterestRectClip
TestDisplayItem(htmlLayer, DisplayItem::EndSubsequence));
}
+TEST_P(PaintLayerPainterTest, PaintPhaseOutline)
+{
+ AtomicString styleWithoutOutline = "width: 50px; height: 50px; background-color: green";
+ AtomicString styleWithOutline = "outline: 1px solid blue; " + styleWithoutOutline;
+ setBodyInnerHTML(
+ "<div id='self-painting-layer' style='position: absolute'>"
+ " <div id='non-self-painting-layer' style='overflow: hidden'>"
+ " <div>"
+ " <div id='outline'></div>"
+ " </div>"
+ " </div>"
+ "</div>");
+ LayoutObject& outlineDiv = *document().getElementById("outline")->layoutObject();
+ toHTMLElement(outlineDiv.node())->setAttribute(HTMLNames::styleAttr, styleWithoutOutline);
+ document().view()->updateAllLifecyclePhases();
+
+ LayoutBlock& selfPaintingLayerObject = *toLayoutBlock(document().getElementById("self-painting-layer")->layoutObject());
+ PaintLayer& selfPaintingLayer = *selfPaintingLayerObject.layer();
+ ASSERT_TRUE(selfPaintingLayer.isSelfPaintingLayer());
+ PaintLayer& nonSelfPaintingLayer = *toLayoutBoxModelObject(document().getElementById("non-self-painting-layer")->layoutObject())->layer();
+ ASSERT_FALSE(nonSelfPaintingLayer.isSelfPaintingLayer());
+ ASSERT_TRUE(&nonSelfPaintingLayer == outlineDiv.enclosingLayer());
+
+ EXPECT_FALSE(selfPaintingLayer.needsPaintPhaseDescendantOutlines());
+ EXPECT_FALSE(nonSelfPaintingLayer.needsPaintPhaseDescendantOutlines());
+
+ // Outline on the self-painting-layer node itself doesn't affect PaintPhaseDescendantOutlines.
+ toHTMLElement(selfPaintingLayerObject.node())->setAttribute(HTMLNames::styleAttr, "position: absolute; outline: 1px solid green");
+ document().view()->updateAllLifecyclePhases();
+ EXPECT_FALSE(selfPaintingLayer.needsPaintPhaseDescendantOutlines());
+ EXPECT_FALSE(nonSelfPaintingLayer.needsPaintPhaseDescendantOutlines());
+ EXPECT_TRUE(displayItemListContains(rootPaintController().displayItemList(), selfPaintingLayerObject, DisplayItem::paintPhaseToDrawingType(PaintPhaseSelfOutlineOnly)));
+
+ // needsPaintPhaseDescendantOutlines should be set when any descendant on the same layer has outline.
+ toHTMLElement(outlineDiv.node())->setAttribute(HTMLNames::styleAttr, styleWithOutline);
+ updateLifecyclePhasesBeforePaint();
+ EXPECT_TRUE(selfPaintingLayer.needsPaintPhaseDescendantOutlines());
+ EXPECT_FALSE(nonSelfPaintingLayer.needsPaintPhaseDescendantOutlines());
+ paint();
+ EXPECT_TRUE(displayItemListContains(rootPaintController().displayItemList(), outlineDiv, DisplayItem::paintPhaseToDrawingType(PaintPhaseSelfOutlineOnly)));
+}
+
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintLayerPainter.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698