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

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
« 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 8ac78561ce11f68e0ecaa375269c69c1165f7fa2..90c58ca18472f8524ffb724bb05259a4503039cc 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"
@@ -20,16 +21,18 @@
namespace blink {
-typedef bool TestParamRootLayerScrolling;
+typedef std::pair<bool, bool> SlimmingPaintAndRootLayerScrolling;
class PrePaintTreeWalkTest
- : public ::testing::WithParamInterface<TestParamRootLayerScrolling>,
+ : public ::testing::WithParamInterface<SlimmingPaintAndRootLayerScrolling>,
private ScopedSlimmingPaintV2ForTest,
+ private ScopedSlimmingPaintInvalidationForTest,
private ScopedRootLayerScrollingForTest,
public RenderingTest {
public:
PrePaintTreeWalkTest()
- : ScopedSlimmingPaintV2ForTest(true),
- ScopedRootLayerScrollingForTest(GetParam()),
+ : ScopedSlimmingPaintV2ForTest(GetParam().second),
+ ScopedSlimmingPaintInvalidationForTest(true),
+ ScopedRootLayerScrollingForTest(GetParam().first),
RenderingTest(EmptyLocalFrameClient::Create()) {}
const TransformPaintPropertyNode* FramePreTranslation() {
@@ -52,6 +55,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);
@@ -67,7 +75,15 @@ class PrePaintTreeWalkTest
}
};
-INSTANTIATE_TEST_CASE_P(All, PrePaintTreeWalkTest, ::testing::Bool());
+SlimmingPaintAndRootLayerScrolling g_prepaint_foo[] = {
+ SlimmingPaintAndRootLayerScrolling(false, false),
+ SlimmingPaintAndRootLayerScrolling(true, false),
+ SlimmingPaintAndRootLayerScrolling(false, true),
+ SlimmingPaintAndRootLayerScrolling(true, true)};
+
+INSTANTIATE_TEST_CASE_P(All,
+ PrePaintTreeWalkTest,
+ ::testing::ValuesIn(g_prepaint_foo));
TEST_P(PrePaintTreeWalkTest, PropertyTreesRebuiltWithBorderInvalidation) {
SetBodyInnerHTML(
@@ -135,6 +151,9 @@ TEST_P(PrePaintTreeWalkTest, PropertyTreesRebuiltWithCSSTransformInvalidation) {
}
TEST_P(PrePaintTreeWalkTest, PropertyTreesRebuiltWithOpacityInvalidation) {
+ // In SPv1 mode, we don't need or store property tree nodes for effects.
+ if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled())
+ return;
SetBodyInnerHTML(
"<style>"
" .opacityA { opacity: 0.9; }"
@@ -212,8 +231,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 +280,60 @@ 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());
+
+ grandchild->GetLayoutObject().SetNeedsPaintPropertyUpdate();
+ GetDocument().View()->UpdateAllLifecyclePhases();
+ EXPECT_TRUE(grandchild->PreviousPaintingClipRects());
+}
+
+TEST_P(PrePaintTreeWalkTest, VisualRectClipForceSubtree) {
+ SetBodyInnerHTML(
+ "<style>"
+ " #parent { height: 75px; position: relative; width: 100px; }"
+ "</style>"
+ "<div id='parent' style='height: 100px;'>"
+ " <div id='child' style='overflow: hidden; width: 100%; height: 100%; "
+ " position: relative'>"
+ " <div>"
+ " <div id='grandchild' style='width: 50px; height: 200px; '>"
+ " </div>"
+ " </div>"
+ " </div>"
+ "</div>");
+
+ auto* grandchild = GetLayoutObjectByElementId("grandchild");
+
+ GetDocument().GetElementById("parent")->removeAttribute("style");
+ GetDocument().View()->UpdateAllLifecyclePhases();
+
+ // In SPv2 mode, VisualRects are in the space of the containing transform
+ // node without applying any ancestor property nodes, including clip.
+ if (RuntimeEnabledFeatures::slimmingPaintV2Enabled())
+ EXPECT_EQ(200, grandchild->VisualRect().Height());
+ else
+ EXPECT_EQ(75, grandchild->VisualRect().Height());
+}
+
} // 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