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

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

Issue 1892473002: Update PaintLayer::needsPaintPhaseXXX flags when add/remove layer on style change (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2704
Patch Set: Created 4 years, 8 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/PaintLayer.cpp ('k') | third_party/WebKit/Source/core/paint/README.md » ('j') | 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 b7f4bbf5360885993e32400844c53bf5372d60fe..3ff56a1a50d338d786a12badc5b414b429f3e855 100644
--- a/third_party/WebKit/Source/core/paint/PaintLayerPainterTest.cpp
+++ b/third_party/WebKit/Source/core/paint/PaintLayerPainterTest.cpp
@@ -364,7 +364,7 @@ TEST_P(PaintLayerPainterTest, PaintPhaseBlockBackground)
TEST_P(PaintLayerPainterTest, PaintPhasesUpdateOnLayerRemoval)
{
setBodyInnerHTML(
- "<div id='layer' style='opacity: 0.5'>"
+ "<div id='layer' style='position: relative'>"
" <div style='height: 100px'>"
" <div style='height: 20px; outline: 1px solid red; background-color: green'>outline and background</div>"
" <div style='float: left'>float</div>"
@@ -383,7 +383,7 @@ TEST_P(PaintLayerPainterTest, PaintPhasesUpdateOnLayerRemoval)
EXPECT_FALSE(htmlLayer.needsPaintPhaseFloat());
EXPECT_FALSE(htmlLayer.needsPaintPhaseDescendantBlockBackgrounds());
- toHTMLElement(layerDiv.node())->setAttribute(HTMLNames::styleAttr, "opacity: 1");
+ toHTMLElement(layerDiv.node())->setAttribute(HTMLNames::styleAttr, "");
document().view()->updateAllLifecyclePhases();
EXPECT_FALSE(layerDiv.hasLayer());
@@ -392,4 +392,32 @@ TEST_P(PaintLayerPainterTest, PaintPhasesUpdateOnLayerRemoval)
EXPECT_TRUE(htmlLayer.needsPaintPhaseDescendantBlockBackgrounds());
}
+TEST_P(PaintLayerPainterTest, PaintPhasesUpdateOnLayerAddition)
+{
+ setBodyInnerHTML(
+ "<div id='will-be-layer'>"
+ " <div style='height: 100px'>"
+ " <div style='height: 20px; outline: 1px solid red; background-color: green'>outline and background</div>"
+ " <div style='float: left'>float</div>"
+ " </div>"
+ "</div>");
+
+ LayoutBlock& layerDiv = *toLayoutBlock(document().getElementById("will-be-layer")->layoutObject());
+ EXPECT_FALSE(layerDiv.hasLayer());
+
+ PaintLayer& htmlLayer = *toLayoutBlock(document().documentElement()->layoutObject())->layer();
+ EXPECT_TRUE(htmlLayer.needsPaintPhaseDescendantOutlines());
+ EXPECT_TRUE(htmlLayer.needsPaintPhaseFloat());
+ EXPECT_TRUE(htmlLayer.needsPaintPhaseDescendantBlockBackgrounds());
+
+ toHTMLElement(layerDiv.node())->setAttribute(HTMLNames::styleAttr, "position: relative");
+ document().view()->updateAllLifecyclePhases();
+ ASSERT_TRUE(layerDiv.hasLayer());
+ PaintLayer& layer = *layerDiv.layer();
+ ASSERT_TRUE(layer.isSelfPaintingLayer());
+ EXPECT_TRUE(layer.needsPaintPhaseDescendantOutlines());
+ EXPECT_TRUE(layer.needsPaintPhaseFloat());
+ EXPECT_TRUE(layer.needsPaintPhaseDescendantBlockBackgrounds());
+}
+
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintLayer.cpp ('k') | third_party/WebKit/Source/core/paint/README.md » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698