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

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

Issue 2781693002: Apply CSS clip to foreground and background clip rects. (Closed)
Patch Set: none Created 3 years, 9 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 19ae3988e697a2c12509ca68ef72f648931f95f4..b868c3ca60069e9a3632b9fa4d4961be5b4cc3c6 100644
--- a/third_party/WebKit/Source/core/paint/PaintLayerClipperTest.cpp
+++ b/third_party/WebKit/Source/core/paint/PaintLayerClipperTest.cpp
@@ -15,11 +15,11 @@
namespace blink {
class PaintLayerClipperTest : public ::testing::WithParamInterface<bool>,
- private ScopedSlimmingPaintV2ForTest,
+ private ScopedSlimmingPaintInvalidationForTest,
public RenderingTest {
public:
PaintLayerClipperTest()
- : ScopedSlimmingPaintV2ForTest(GetParam()),
+ : ScopedSlimmingPaintInvalidationForTest(GetParam()),
RenderingTest(EmptyLocalFrameClient::create()) {}
void SetUp() override {
@@ -63,8 +63,16 @@ TEST_P(PaintLayerClipperTest, LayoutSVGRoot) {
targetPaintLayer->clipper(option).calculateRects(
context, LayoutRect(LayoutRect::infiniteIntRect()), layerBounds,
backgroundRect, foregroundRect);
- EXPECT_EQ(LayoutRect(FloatRect(8.25, 8.35, 200, 300)), backgroundRect.rect());
- EXPECT_EQ(LayoutRect(FloatRect(8.25, 8.35, 200, 300)), foregroundRect.rect());
+ // TODO(chrishtr): investigate why these differences exist.
+ if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) {
+ EXPECT_EQ(LayoutRect(FloatRect(8.25, 8.35, 200, 300)),
+ backgroundRect.rect());
+ EXPECT_EQ(LayoutRect(FloatRect(8.25, 8.35, 200, 300)),
+ foregroundRect.rect());
+ } else {
+ EXPECT_EQ(LayoutRect(FloatRect(8, 8, 200, 300)), backgroundRect.rect());
+ EXPECT_EQ(LayoutRect(FloatRect(8, 8, 200, 300)), foregroundRect.rect());
+ }
EXPECT_EQ(LayoutRect(8, 8, 200, 300), layerBounds);
}
@@ -447,4 +455,31 @@ TEST_P(PaintLayerClipperTest, ClearClipRectsRecursiveOneType) {
EXPECT_FALSE(parent->clipRectsCache()->get(AbsoluteClipRects).root);
}
+TEST_P(PaintLayerClipperTest, CSSClip) {
+ setBodyInnerHTML(
+ "<style>"
+ " #target { "
+ " width: 400px; height: 400px; position: absolute;"
+ " clip: rect(0, 50px, 100px, 0); "
+ " }"
+ "</style>"
+ "<div id='target'></div>");
+
+ PaintLayer* target =
+ toLayoutBoxModelObject(getLayoutObjectByElementId("target"))->layer();
+ ClipRectsContext context(target, UncachedClipRects);
+ PaintLayer::GeometryMapperOption option = PaintLayer::DoNotUseGeometryMapper;
+ if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled())
+ option = PaintLayer::UseGeometryMapper;
+ LayoutRect infiniteRect(LayoutRect::infiniteIntRect());
+ LayoutRect layerBounds(infiniteRect);
+ ClipRect backgroundRect(infiniteRect);
+ ClipRect foregroundRect(infiniteRect);
+ target->clipper(option).calculateRects(context, infiniteRect, layerBounds,
+ backgroundRect, foregroundRect);
+
+ EXPECT_EQ(LayoutRect(0, 0, 50, 100), backgroundRect.rect());
+ EXPECT_EQ(LayoutRect(0, 0, 50, 100), foregroundRect.rect());
+}
+
} // 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