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

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

Issue 2668823002: Invalidate subsequence caching & empty paint phases if clips changed. (Closed)
Patch Set: none Created 3 years, 10 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/PrePaintTreeWalk.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/PrePaintTreeWalkTest.cpp
diff --git a/third_party/WebKit/Source/core/paint/PrePaintTreeWalkTest.cpp b/third_party/WebKit/Source/core/paint/PrePaintTreeWalkTest.cpp
index c3c47464cabcb6e4b3d6826c4cfcd78da3daa76b..dcb708f990eaf5aa06aad56843d162f46e70e3f9 100644
--- a/third_party/WebKit/Source/core/paint/PrePaintTreeWalkTest.cpp
+++ b/third_party/WebKit/Source/core/paint/PrePaintTreeWalkTest.cpp
@@ -6,6 +6,7 @@
#include "core/layout/LayoutTreeAsText.h"
#include "core/layout/api/LayoutViewItem.h"
#include "core/paint/ObjectPaintProperties.h"
+#include "core/paint/PaintLayer.h"
#include "core/paint/PaintPropertyTreePrinter.h"
#include "platform/graphics/paint/GeometryMapper.h"
#include "platform/graphics/paint/ScrollPaintPropertyNode.h"
@@ -152,4 +153,110 @@ TEST_P(PrePaintTreeWalkTest, PropertyTreesRebuiltWithOpacityInvalidation) {
EXPECT_EQ(0.4f, transparentProperties->effect()->opacity());
}
+TEST_P(PrePaintTreeWalkTest, ClearSubsequenceCachingClipChange) {
+ setBodyInnerHTML(
+ "<style>"
+ " .clip { overflow: hidden }"
+ "</style>"
+ "<div id='parent' style='transform: translateZ(0); width: 100px;"
+ " height: 100px;'>"
+ " <div id='child' style='isolation: isolate'>"
+ " content"
+ " </div>"
+ "</div>");
+
+ auto* parent = document().getElementById("parent");
+ auto* child = document().getElementById("child");
+ auto* childPaintLayer =
+ toLayoutBoxModelObject(child->layoutObject())->layer();
+ EXPECT_FALSE(childPaintLayer->needsRepaint());
+ EXPECT_FALSE(childPaintLayer->needsPaintPhaseFloat());
+
+ parent->setAttribute(HTMLNames::classAttr, "clip");
+ document().view()->updateAllLifecyclePhasesExceptPaint();
+
+ EXPECT_TRUE(childPaintLayer->needsRepaint());
+}
+
+TEST_P(PrePaintTreeWalkTest, ClearSubsequenceCachingClipChange2DTransform) {
+ setBodyInnerHTML(
+ "<style>"
+ " .clip { overflow: hidden }"
+ "</style>"
+ "<div id='parent' style='transform: translateX(0); width: 100px;"
+ " height: 100px;'>"
+ " <div id='child' style='isolation: isolate'>"
+ " content"
+ " </div>"
+ "</div>");
+
+ auto* parent = document().getElementById("parent");
+ auto* child = document().getElementById("child");
+ auto* childPaintLayer =
+ toLayoutBoxModelObject(child->layoutObject())->layer();
+ EXPECT_FALSE(childPaintLayer->needsRepaint());
+ EXPECT_FALSE(childPaintLayer->needsPaintPhaseFloat());
+
+ parent->setAttribute(HTMLNames::classAttr, "clip");
+ document().view()->updateAllLifecyclePhasesExceptPaint();
+
+ EXPECT_TRUE(childPaintLayer->needsRepaint());
+}
+
+TEST_P(PrePaintTreeWalkTest, ClearSubsequenceCachingClipChangePosAbs) {
+ setBodyInnerHTML(
+ "<style>"
+ " .clip { overflow: hidden }"
+ "</style>"
+ "<div id='parent' style='transform: translateZ(0); width: 100px;"
+ " height: 100px; position: absolute'>"
+ " <div id='child' style='overflow: hidden; z-index: 0; width: 50px;"
+ " height: 50px'>"
+ " content"
+ " </div>"
+ "</div>");
+
+ auto* parent = document().getElementById("parent");
+ auto* child = document().getElementById("child");
+ auto* childPaintLayer =
+ toLayoutBoxModelObject(child->layoutObject())->layer();
+ EXPECT_FALSE(childPaintLayer->needsRepaint());
+ EXPECT_FALSE(childPaintLayer->needsPaintPhaseFloat());
+
+ // This changes clips for absolute-positioned descendants of "child" but not
+ // normal-position ones, which are already clipped to 50x50.
+ parent->setAttribute(HTMLNames::classAttr, "clip");
+ document().view()->updateAllLifecyclePhasesExceptPaint();
+
+ EXPECT_TRUE(childPaintLayer->needsRepaint());
+}
+
+TEST_P(PrePaintTreeWalkTest, ClearSubsequenceCachingClipChangePosFixed) {
+ setBodyInnerHTML(
+ "<style>"
+ " .clip { overflow: hidden }"
+ "</style>"
+ "<div id='parent' style='transform: translateZ(0); width: 100px;"
+ " height: 100px; trans'>"
+ " <div id='child' style='overflow: hidden; z-index: 0;"
+ " position: absolute; width: 50px; height: 50px'>"
+ " content"
+ " </div>"
+ "</div>");
+
+ auto* parent = document().getElementById("parent");
+ auto* child = document().getElementById("child");
+ auto* childPaintLayer =
+ toLayoutBoxModelObject(child->layoutObject())->layer();
+ EXPECT_FALSE(childPaintLayer->needsRepaint());
+ EXPECT_FALSE(childPaintLayer->needsPaintPhaseFloat());
+
+ // This changes clips for absolute-positioned descendants of "child" but not
+ // normal-position ones, which are already clipped to 50x50.
+ parent->setAttribute(HTMLNames::classAttr, "clip");
+ document().view()->updateAllLifecyclePhasesExceptPaint();
+
+ EXPECT_TRUE(childPaintLayer->needsRepaint());
+}
+
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/paint/PrePaintTreeWalk.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698