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

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: renamed the cache. revised comments. Created 4 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/PaintPropertyTreeBuilder.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/PaintPropertyTreeBuilderTest.cpp
diff --git a/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilderTest.cpp b/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilderTest.cpp
index 966a2be1b21d81145c8963a81ddb82a4cf11296d..d7e91ef0a23ad3a038dcb805b60bd915e547b2b5 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->localBorderBoxProperties()->properties.clip);
+ EXPECT_EQ(scrollerProperties->scrollTranslation(), childProperties->localBorderBoxProperties()->properties.transform);
+ EXPECT_EQ(nullptr, childProperties->localBorderBoxProperties()->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->localBorderBoxProperties()->properties.clip);
+ EXPECT_EQ(frameView->scrollTranslation(), childProperties->localBorderBoxProperties()->properties.transform);
+ EXPECT_EQ(scrollerProperties->effect(), childProperties->localBorderBoxProperties()->properties.effect);
+}
+
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698