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

Unified Diff: third_party/WebKit/Source/core/paint/PaintLayerPainterTest.cpp

Issue 1581593003: Skip PaintPhaseFloat if no floats in a layer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@OutlinePhase
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 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 a1985fac0d2298996c16373e7f982b6eb6d111f7..281f82bd518d21908b5da5e292a0dc0dc11a80a3 100644
--- a/third_party/WebKit/Source/core/paint/PaintLayerPainterTest.cpp
+++ b/third_party/WebKit/Source/core/paint/PaintLayerPainterTest.cpp
@@ -291,4 +291,45 @@ TEST_P(PaintLayerPainterTest, PaintPhaseOutline)
EXPECT_TRUE(displayItemListContains(rootPaintController().displayItemList(), selfPaintingLayerObject, DisplayItem::paintPhaseToDrawingType(PaintPhaseSelfOutlineOnly)));
}
+TEST_P(PaintLayerPainterTest, PaintPhaseFloat)
+{
+ AtomicString styleWithoutFloat = "width: 50px; height: 50px; background-color: green";
+ AtomicString styleWithFloat = "float: left; " + styleWithoutFloat;
+ setBodyInnerHTML(
+ "<div id='self-painting-layer' style='position: absolute'>"
+ " <div id='non-self-painting-layer' style='overflow: hidden'>"
+ " <div>"
+ " <div id='float'></div>"
+ " </div>"
+ " </div>"
+ "</div>");
+ LayoutObject& floatDiv = *document().getElementById("float")->layoutObject();
+ toHTMLElement(floatDiv.node())->setAttribute(HTMLNames::styleAttr, styleWithoutFloat);
+ 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 == floatDiv.enclosingLayer());
+ ASSERT_TRUE(&selfPaintingLayer == floatDiv.enclosingLayer()->enclosingSelfPaintingLayer());
+
+ EXPECT_FALSE(selfPaintingLayer.needsPaintPhaseFloat());
+ EXPECT_FALSE(nonSelfPaintingLayer.needsPaintPhaseFloat());
+
+ // needsPaintPhaseFloat should be set when any descendant on the same layer has float.
+ toHTMLElement(floatDiv.node())->setAttribute(HTMLNames::styleAttr, styleWithFloat);
+ updateLifecyclePhasesBeforePaint();
+ EXPECT_TRUE(selfPaintingLayer.needsPaintPhaseFloat());
+ EXPECT_FALSE(nonSelfPaintingLayer.needsPaintPhaseFloat());
+ paint();
+
+ // needsPaintPhaseFloat shold be reset after an empty painting of the phase.
+ toHTMLElement(floatDiv.node())->setAttribute(HTMLNames::styleAttr, styleWithoutFloat);
+ document().view()->updateAllLifecyclePhases();
+ EXPECT_FALSE(selfPaintingLayer.needsPaintPhaseFloat());
chrishtr 2016/01/22 01:51:46 Remove this part of the unittest.
Xianzhu 2016/01/22 17:29:45 Done.
+ EXPECT_FALSE(nonSelfPaintingLayer.needsPaintPhaseFloat());
+}
+
} // 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