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

Unified Diff: third_party/WebKit/Source/core/layout/VisualRectMappingTest.cpp

Issue 2241663002: Take CSS Clip and contain: paint into account when computing visual rects. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: none Created 4 years, 4 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/layout/VisualRectMappingTest.cpp
diff --git a/third_party/WebKit/Source/core/layout/VisualRectMappingTest.cpp b/third_party/WebKit/Source/core/layout/VisualRectMappingTest.cpp
index 108057412e85130fab08d87a5ebe3b6da766b062..a0ec91f8f141f9f0dd68799d42da8ed32e9224b5 100644
--- a/third_party/WebKit/Source/core/layout/VisualRectMappingTest.cpp
+++ b/third_party/WebKit/Source/core/layout/VisualRectMappingTest.cpp
@@ -578,4 +578,40 @@ TEST_F(VisualRectMappingTest, ContainerOfAbsoluteAbovePaintInvalidationContainer
checkPaintInvalidationStateRectMapping(rect, absoluteOverflowRect, *absolute, layoutView(), *stackingContext);
}
+TEST_F(VisualRectMappingTest, CSSClip)
+{
+ setBodyInnerHTML(
+ "<div id='container' style='position: absolute; top: 0px; left: 0px; clip: rect(0px, 200px, 200px, 0px)'>"
+ " <div id='target' style='width: 400px; height: 400px'></div>"
+ " </div>"
+ "</div>");
+
+ LayoutBox* target = toLayoutBox(getLayoutObjectByElementId("target"));
+
+ LayoutRect targetOverflowRect = target->localOverflowRectForPaintInvalidation();
+ EXPECT_EQ(LayoutRect(0, 0, 400, 400), targetOverflowRect);
+ LayoutRect rect = targetOverflowRect;
+ EXPECT_TRUE(target->mapToVisualRectInAncestorSpace(&layoutView(), rect));
+ EXPECT_EQ(LayoutRect(0, 0, 200, 200), rect);
+ checkPaintInvalidationStateRectMapping(rect, targetOverflowRect, *target, layoutView(), layoutView());
+}
+
+TEST_F(VisualRectMappingTest, ContainPaint)
+{
+ setBodyInnerHTML(
+ "<div id='container' style='position: absolute; top: 0px; left: 0px; width: 200px; height: 200px; contain: paint'>"
+ " <div id='target' style='width: 400px; height: 400px'></div>"
+ " </div>"
+ "</div>");
+
+ LayoutBox* target = toLayoutBox(getLayoutObjectByElementId("target"));
+
+ LayoutRect targetOverflowRect = target->localOverflowRectForPaintInvalidation();
+ EXPECT_EQ(LayoutRect(0, 0, 400, 400), targetOverflowRect);
+ LayoutRect rect = targetOverflowRect;
+ EXPECT_TRUE(target->mapToVisualRectInAncestorSpace(&layoutView(), rect));
+ EXPECT_EQ(LayoutRect(0, 0, 200, 200), rect);
+ checkPaintInvalidationStateRectMapping(rect, targetOverflowRect, *target, layoutView(), layoutView());
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698