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

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

Issue 2400063002: Don't clip contain:paint when requested to ignore clip (Closed)
Patch Set: Rebase Created 4 years, 2 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/PaintLayerClipper.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/PaintLayerClipperTest.cpp
diff --git a/third_party/WebKit/Source/core/paint/PaintLayerClipperTest.cpp b/third_party/WebKit/Source/core/paint/PaintLayerClipperTest.cpp
index 1bbe2523197d59283823becdf06f97ecedb15125..458d39df09ba361f836fda271898fe9946fabe23 100644
--- a/third_party/WebKit/Source/core/paint/PaintLayerClipperTest.cpp
+++ b/third_party/WebKit/Source/core/paint/PaintLayerClipperTest.cpp
@@ -61,4 +61,60 @@ TEST_F(PaintLayerClipperTest, LayoutSVGRootChild) {
EXPECT_EQ(LayoutRect(8, 8, 400, 0), layerBounds);
}
+TEST_F(PaintLayerClipperTest, ContainPaintClip) {
+ setBodyInnerHTML(
+ "<div id='target'"
+ " style='contain: paint; width: 200px; height: 200px; overflow: auto'>"
+ " <div style='height: 400px'></div>"
+ "</div>");
+
+ LayoutRect infiniteRect(LayoutRect::infiniteIntRect());
+ PaintLayer* layer =
+ toLayoutBoxModelObject(getLayoutObjectByElementId("target"))->layer();
+ ClipRectsContext context(layer, PaintingClipRectsIgnoringOverflowClip);
+ LayoutRect layerBounds;
+ ClipRect backgroundRect, foregroundRect;
+ layer->clipper().calculateRects(context, infiniteRect, layerBounds,
+ backgroundRect, foregroundRect);
+ EXPECT_EQ(infiniteRect, backgroundRect.rect());
+ EXPECT_EQ(infiniteRect, foregroundRect.rect());
+ EXPECT_EQ(LayoutRect(0, 0, 200, 200), layerBounds);
+
+ ClipRectsContext contextClip(layer, PaintingClipRects);
+ layer->clipper().calculateRects(contextClip, infiniteRect, layerBounds,
+ backgroundRect, foregroundRect);
+ EXPECT_EQ(LayoutRect(0, 0, 200, 200), backgroundRect.rect());
+ EXPECT_EQ(LayoutRect(0, 0, 200, 200), foregroundRect.rect());
+ EXPECT_EQ(LayoutRect(0, 0, 200, 200), layerBounds);
+}
+
+TEST_F(PaintLayerClipperTest, NestedContainPaintClip) {
+ setBodyInnerHTML(
+ "<div style='contain: paint; width: 200px; height: 200px; overflow: "
+ "auto'>"
+ " <div id='target' style='contain: paint; height: 400px'>"
+ " </div>"
+ "</div>");
+
+ LayoutRect infiniteRect(LayoutRect::infiniteIntRect());
+ PaintLayer* layer =
+ toLayoutBoxModelObject(getLayoutObjectByElementId("target"))->layer();
+ ClipRectsContext context(layer->parent(),
+ PaintingClipRectsIgnoringOverflowClip);
+ LayoutRect layerBounds;
+ ClipRect backgroundRect, foregroundRect;
+ layer->clipper().calculateRects(context, infiniteRect, layerBounds,
+ backgroundRect, foregroundRect);
+ EXPECT_EQ(LayoutRect(0, 0, 200, 400), backgroundRect.rect());
+ EXPECT_EQ(LayoutRect(0, 0, 200, 400), foregroundRect.rect());
+ EXPECT_EQ(LayoutRect(0, 0, 200, 400), layerBounds);
+
+ ClipRectsContext contextClip(layer->parent(), PaintingClipRects);
+ layer->clipper().calculateRects(contextClip, infiniteRect, layerBounds,
+ backgroundRect, foregroundRect);
+ EXPECT_EQ(LayoutRect(0, 0, 200, 200), backgroundRect.rect());
+ EXPECT_EQ(LayoutRect(0, 0, 200, 200), foregroundRect.rect());
+ EXPECT_EQ(LayoutRect(0, 0, 200, 400), layerBounds);
+}
+
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintLayerClipper.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698