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

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

Issue 1651153003: [SPv2] Adds pre-computed paint property context to PaintLayer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: added tests. revised comments. renamed to recordTreeContextIfNeeded. 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
Index: third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilderTest.cpp
diff --git a/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilderTest.cpp b/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilderTest.cpp
index 966a2be1b21d81145c8963a81ddb82a4cf11296d..80739b21dd38ea5093f9e711d7881c31d04a785e 100644
--- a/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilderTest.cpp
+++ b/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilderTest.cpp
@@ -134,7 +134,7 @@ TEST_F(PaintPropertyTreeBuilderTest, FrameScrollingTraditional)
LayoutView* layoutView = document().layoutView();
ObjectPaintProperties* layoutViewProperties = layoutView->objectPaintProperties();
- EXPECT_EQ(nullptr, layoutViewProperties);
+ EXPECT_EQ(nullptr, layoutViewProperties->scrollTranslation());
}
// TODO(trchen): Settings::rootLayerScrolls cannot be switched after main frame being created.
@@ -276,7 +276,9 @@ TEST_F(PaintPropertyTreeBuilderTest, EffectNodesAcrossStackingContext)
EXPECT_EQ(nullptr, nodeWithOpacityProperties->transform());
LayoutObject& childWithStackingContext = *document().getElementById("childWithStackingContext")->layoutObject();
- EXPECT_EQ(nullptr, childWithStackingContext.objectPaintProperties());
+ ObjectPaintProperties* childWithStackingContextProperties = childWithStackingContext.objectPaintProperties();
+ EXPECT_EQ(nullptr, childWithStackingContextProperties->effect());
+ EXPECT_EQ(nullptr, childWithStackingContextProperties->transform());
LayoutObject& grandChildWithOpacity = *document().getElementById("grandChildWithOpacity")->layoutObject();
ObjectPaintProperties* grandChildWithOpacityProperties = grandChildWithOpacity.objectPaintProperties();
@@ -574,4 +576,52 @@ TEST_F(PaintPropertyTreeBuilderTest, TransformNodesAcrossSubframes)
EXPECT_EQ(TransformationMatrix().translate3d(4, 5, 6), innerDivWithTransformProperties->transform()->matrix());
}
+TEST_F(PaintPropertyTreeBuilderTest, TreeContextClipByNonStackingContext)
+{
+ // This test verifies the tree builder correctly computes and records the property tree context
+ // for a (pseudo) stacking context that is scrolled by a containing block that is not one of
+ // the painting ancestors.
+ setBodyInnerHTML(
+ "<style>body { margin: 0; }</style>"
+ "<div id='scroller' style='overflow:scroll; width:400px; height:300px;'>"
+ " <div id='child' style='position:relative;'></div>"
+ " <div style='height:10000px;'></div>"
+ "</div>"
+ );
+
+ LayoutObject& scroller = *document().getElementById("scroller")->layoutObject();
+ ObjectPaintProperties* scrollerProperties = scroller.objectPaintProperties();
+ LayoutObject& child = *document().getElementById("child")->layoutObject();
+ ObjectPaintProperties* childProperties = child.objectPaintProperties();
+
+ EXPECT_EQ(scrollerProperties->overflowClip(), childProperties->propertyTreeContext()->properties.clip);
+ EXPECT_EQ(scrollerProperties->scrollTranslation(), childProperties->propertyTreeContext()->properties.transform);
+ EXPECT_EQ(nullptr, childProperties->propertyTreeContext()->properties.effect);
+}
+
+TEST_F(PaintPropertyTreeBuilderTest, TreeContextUnclipFromParentStackingContext)
+{
+ // This test verifies the tree builder correctly computes and records the property tree context
+ // for a (pseudo) stacking context that has a scrolling painting ancestor that is not its
+ // containing block (thus should not be scrolled by it).
+
+ setBodyInnerHTML(
+ "<style>body { margin: 0; }</style>"
+ "<div id='scroller' style='overflow:scroll; opacity:0.5;'>"
+ " <div id='child' style='position:absolute; left:0; top:0;'></div>"
+ " <div style='height:10000px;'></div>"
+ "</div>"
+ );
+
+ FrameView* frameView = document().view();
+ LayoutObject& scroller = *document().getElementById("scroller")->layoutObject();
+ ObjectPaintProperties* scrollerProperties = scroller.objectPaintProperties();
+ LayoutObject& child = *document().getElementById("child")->layoutObject();
+ ObjectPaintProperties* childProperties = child.objectPaintProperties();
+
+ EXPECT_EQ(frameView->contentClip(), childProperties->propertyTreeContext()->properties.clip);
+ EXPECT_EQ(frameView->scrollTranslation(), childProperties->propertyTreeContext()->properties.transform);
+ EXPECT_EQ(scrollerProperties->effect(), childProperties->propertyTreeContext()->properties.effect);
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698