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

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

Issue 2810503002: Only store previous clip rects for PaintLayers that support subsequences. (Closed)
Patch Set: none Created 3 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
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 814eec7b96dbfe350848ce90fbba512a53e04f65..520bd6290e2ad240d92e1bdb8e5b31353f450094 100644
--- a/third_party/WebKit/Source/core/paint/PrePaintTreeWalkTest.cpp
+++ b/third_party/WebKit/Source/core/paint/PrePaintTreeWalkTest.cpp
@@ -8,6 +8,7 @@
#include "core/paint/ObjectPaintProperties.h"
#include "core/paint/PaintLayer.h"
#include "core/paint/PaintPropertyTreePrinter.h"
+#include "core/paint/PrePaintTreeWalk.h"
#include "platform/graphics/paint/GeometryMapper.h"
#include "platform/graphics/paint/ScrollPaintPropertyNode.h"
#include "platform/graphics/paint/TransformPaintPropertyNode.h"
@@ -52,6 +53,11 @@ class PrePaintTreeWalkTest
return frame_view->ScrollTranslation();
}
+ protected:
+ PaintLayer* GetPaintLayerByElementId(const char* id) {
+ return ToLayoutBoxModelObject(GetLayoutObjectByElementId(id))->Layer();
+ }
+
private:
void SetUp() override {
Settings::SetMockScrollbarsEnabled(true);
@@ -212,8 +218,8 @@ TEST_P(PrePaintTreeWalkTest, ClearSubsequenceCachingClipChangePosAbs) {
"</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'>"
+ " <div id='child' style='overflow: hidden; position: relative;"
+ " z-index: 0; width: 50px; height: 50px'>"
" content"
" </div>"
"</div>");
@@ -261,4 +267,32 @@ TEST_P(PrePaintTreeWalkTest, ClearSubsequenceCachingClipChangePosFixed) {
EXPECT_TRUE(child_paint_layer->NeedsRepaint());
}
+TEST_P(PrePaintTreeWalkTest, ClipRects) {
+ SetBodyInnerHTML(
+ "<div id='parent' style='isolation: isolate'>"
+ " <div id='child' style='position: relative'>"
+ " <div id='grandchild' style='isolation: isolate'>"
+ " <div style='position: relative'></div>"
+ " </div>"
+ " </div>"
+ "</div>");
+
+ auto* parent = GetPaintLayerByElementId("parent");
+ auto* child = GetPaintLayerByElementId("child");
+ auto* grandchild = GetPaintLayerByElementId("grandchild");
+
+ EXPECT_TRUE(parent->PreviousPaintingClipRects());
+ EXPECT_FALSE(child->PreviousPaintingClipRects());
+ EXPECT_TRUE(grandchild->PreviousPaintingClipRects());
+
+ grandchild->ClearPreviousPaintingClipRects();
+ GetDocument().View()->UpdateAllLifecyclePhases();
+ // Still no rects, because the walk early-outed at the LayoutView.
+ EXPECT_FALSE(grandchild->PreviousPaintingClipRects());
+
+ GetDocument().View()->GetLayoutView()->SetNeedsPaintPropertyUpdate();
+ GetDocument().View()->UpdateAllLifecyclePhases();
+ EXPECT_TRUE(grandchild->PreviousPaintingClipRects());
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698