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

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

Issue 2671853003: [SPInvalidation] Use GeometryMapper in PaintLayerClipper for paint. (Closed)
Patch Set: Merge branch 'master' into paintlayerclipper Created 3 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
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 6786b278c57df143b46b22fddc1fee3e67fb56af..241735cd6acc14c98b2b20d976283af5ec8294e0 100644
--- a/third_party/WebKit/Source/core/paint/PaintLayerClipperTest.cpp
+++ b/third_party/WebKit/Source/core/paint/PaintLayerClipperTest.cpp
@@ -58,7 +58,11 @@ TEST_P(PaintLayerClipperTest, LayoutSVGRoot) {
context.setIgnoreOverflowClip();
LayoutRect layerBounds;
ClipRect backgroundRect, foregroundRect;
- targetPaintLayer->clipper().calculateRects(
+
+ PaintLayer::GeometryMapperOption option = PaintLayer::DoNotUseGeometryMapper;
+ if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled())
+ option = PaintLayer::UseGeometryMapper;
+ targetPaintLayer->clipper(option).calculateRects(
context, LayoutRect(LayoutRect::infiniteIntRect()), layerBounds,
backgroundRect, foregroundRect);
EXPECT_EQ(LayoutRect(8, 8, 200, 300), backgroundRect.rect());
@@ -81,7 +85,11 @@ TEST_P(PaintLayerClipperTest, ControlClip) {
context.setIgnoreOverflowClip();
LayoutRect layerBounds;
ClipRect backgroundRect, foregroundRect;
- targetPaintLayer->clipper().calculateRects(
+
+ PaintLayer::GeometryMapperOption option = PaintLayer::DoNotUseGeometryMapper;
+ if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled())
+ option = PaintLayer::UseGeometryMapper;
+ targetPaintLayer->clipper(option).calculateRects(
context, LayoutRect(LayoutRect::infiniteIntRect()), layerBounds,
backgroundRect, foregroundRect);
#if OS(MACOSX)
@@ -119,7 +127,11 @@ TEST_P(PaintLayerClipperTest, RoundedClip) {
LayoutRect layerBounds;
ClipRect backgroundRect, foregroundRect;
- targetPaintLayer->clipper().calculateRects(
+
+ PaintLayer::GeometryMapperOption option = PaintLayer::DoNotUseGeometryMapper;
+ if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled())
+ option = PaintLayer::UseGeometryMapper;
+ targetPaintLayer->clipper(option).calculateRects(
context, LayoutRect(LayoutRect::infiniteIntRect()), layerBounds,
backgroundRect, foregroundRect);
@@ -154,7 +166,11 @@ TEST_P(PaintLayerClipperTest, RoundedClipNested) {
LayoutRect layerBounds;
ClipRect backgroundRect, foregroundRect;
- childPaintLayer->clipper().calculateRects(
+
+ PaintLayer::GeometryMapperOption option = PaintLayer::DoNotUseGeometryMapper;
+ if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled())
+ option = PaintLayer::UseGeometryMapper;
+ childPaintLayer->clipper(option).calculateRects(
context, LayoutRect(LayoutRect::infiniteIntRect()), layerBounds,
backgroundRect, foregroundRect);
@@ -183,7 +199,11 @@ TEST_P(PaintLayerClipperTest, ControlClipSelect) {
context.setIgnoreOverflowClip();
LayoutRect layerBounds;
ClipRect backgroundRect, foregroundRect;
- targetPaintLayer->clipper().calculateRects(
+
+ PaintLayer::GeometryMapperOption option = PaintLayer::DoNotUseGeometryMapper;
+ if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled())
+ option = PaintLayer::UseGeometryMapper;
+ targetPaintLayer->clipper(option).calculateRects(
context, LayoutRect(LayoutRect::infiniteIntRect()), layerBounds,
backgroundRect, foregroundRect);
// The control clip for a select excludes the area for the down arrow.
@@ -211,7 +231,11 @@ TEST_P(PaintLayerClipperTest, LayoutSVGRootChild) {
ClipRectsContext context(document().layoutView()->layer(), UncachedClipRects);
LayoutRect layerBounds;
ClipRect backgroundRect, foregroundRect;
- targetPaintLayer->clipper().calculateRects(
+
+ PaintLayer::GeometryMapperOption option = PaintLayer::DoNotUseGeometryMapper;
+ if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled())
+ option = PaintLayer::UseGeometryMapper;
+ targetPaintLayer->clipper(option).calculateRects(
context, LayoutRect(LayoutRect::infiniteIntRect()), layerBounds,
backgroundRect, foregroundRect);
EXPECT_EQ(LayoutRect(8, 8, 200, 300), backgroundRect.rect());
@@ -232,16 +256,21 @@ TEST_P(PaintLayerClipperTest, ContainPaintClip) {
ClipRectsContext context(layer, PaintingClipRectsIgnoringOverflowClip);
LayoutRect layerBounds;
ClipRect backgroundRect, foregroundRect;
- layer->clipper().calculateRects(context, infiniteRect, layerBounds,
- backgroundRect, foregroundRect);
+
+ PaintLayer::GeometryMapperOption option = PaintLayer::DoNotUseGeometryMapper;
+ if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled())
+ option = PaintLayer::UseGeometryMapper;
+ layer->clipper(option).calculateRects(context, infiniteRect, layerBounds,
+ backgroundRect, foregroundRect);
EXPECT_GE(backgroundRect.rect().size().width().toInt(), 33554422);
EXPECT_GE(backgroundRect.rect().size().height().toInt(), 33554422);
EXPECT_EQ(backgroundRect.rect(), foregroundRect.rect());
EXPECT_EQ(LayoutRect(0, 0, 200, 200), layerBounds);
ClipRectsContext contextClip(layer, PaintingClipRects);
- layer->clipper().calculateRects(contextClip, infiniteRect, layerBounds,
- backgroundRect, foregroundRect);
+
+ layer->clipper(option).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);
@@ -262,15 +291,20 @@ TEST_P(PaintLayerClipperTest, NestedContainPaintClip) {
PaintingClipRectsIgnoringOverflowClip);
LayoutRect layerBounds;
ClipRect backgroundRect, foregroundRect;
- layer->clipper().calculateRects(context, infiniteRect, layerBounds,
- backgroundRect, foregroundRect);
+
+ PaintLayer::GeometryMapperOption option = PaintLayer::DoNotUseGeometryMapper;
+ if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled())
+ option = PaintLayer::UseGeometryMapper;
+ layer->clipper(option).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);
+
+ layer->clipper(option).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);
@@ -294,10 +328,13 @@ TEST_P(PaintLayerClipperTest, LocalClipRectFixedUnderTransform) {
PaintLayer* fixed =
toLayoutBoxModelObject(getLayoutObjectByElementId("fixed"))->layer();
+ PaintLayer::GeometryMapperOption option = PaintLayer::DoNotUseGeometryMapper;
+ if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled())
+ option = PaintLayer::UseGeometryMapper;
EXPECT_EQ(LayoutRect(0, 0, 100, 100),
- transformed->clipper().localClipRect(*transformed));
+ transformed->clipper(option).localClipRect(*transformed));
EXPECT_EQ(LayoutRect(0, 50, 100, 100),
- fixed->clipper().localClipRect(*transformed));
+ fixed->clipper(option).localClipRect(*transformed));
}
TEST_P(PaintLayerClipperTest, ClearClipRectsRecursive) {
@@ -327,7 +364,10 @@ TEST_P(PaintLayerClipperTest, ClearClipRectsRecursive) {
EXPECT_TRUE(parent->clipRectsCache());
EXPECT_TRUE(child->clipRectsCache());
- parent->clipper().clearClipRectsIncludingDescendants();
+ PaintLayer::GeometryMapperOption option = PaintLayer::DoNotUseGeometryMapper;
+ if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled())
+ option = PaintLayer::UseGeometryMapper;
+ parent->clipper(option).clearClipRectsIncludingDescendants();
EXPECT_FALSE(parent->clipRectsCache());
EXPECT_FALSE(child->clipRectsCache());
@@ -360,7 +400,10 @@ TEST_P(PaintLayerClipperTest, ClearClipRectsRecursiveChild) {
EXPECT_TRUE(parent->clipRectsCache());
EXPECT_TRUE(child->clipRectsCache());
- child->clipper().clearClipRectsIncludingDescendants();
+ PaintLayer::GeometryMapperOption option = PaintLayer::DoNotUseGeometryMapper;
+ if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled())
+ option = PaintLayer::UseGeometryMapper;
+ child->clipper(option).clearClipRectsIncludingDescendants();
EXPECT_TRUE(parent->clipRectsCache());
EXPECT_FALSE(child->clipRectsCache());
@@ -369,7 +412,7 @@ TEST_P(PaintLayerClipperTest, ClearClipRectsRecursiveChild) {
TEST_P(PaintLayerClipperTest, ClearClipRectsRecursiveOneType) {
// SPv2 will re-use a global GeometryMapper, so this
// logic does not apply.
- if (RuntimeEnabledFeatures::slimmingPaintV2Enabled())
+ if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled())
return;
setBodyInnerHTML(
@@ -395,7 +438,10 @@ TEST_P(PaintLayerClipperTest, ClearClipRectsRecursiveOneType) {
EXPECT_TRUE(parent->clipRectsCache()->get(AbsoluteClipRects).root);
EXPECT_TRUE(child->clipRectsCache()->get(AbsoluteClipRects).root);
- parent->clipper().clearClipRectsIncludingDescendants(AbsoluteClipRects);
+ PaintLayer::GeometryMapperOption option = PaintLayer::DoNotUseGeometryMapper;
+ if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled())
+ option = PaintLayer::UseGeometryMapper;
+ parent->clipper(option).clearClipRectsIncludingDescendants(AbsoluteClipRects);
EXPECT_TRUE(parent->clipRectsCache());
EXPECT_TRUE(child->clipRectsCache());
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintLayerClipper.cpp ('k') | third_party/WebKit/Source/core/paint/PaintLayerPainter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698