| 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..1aaf564c6292f7fc865e5285effbfdb3d7091504 100644
|
| --- a/third_party/WebKit/Source/core/paint/PaintLayerClipperTest.cpp
|
| +++ b/third_party/WebKit/Source/core/paint/PaintLayerClipperTest.cpp
|
| @@ -58,9 +58,10 @@ TEST_P(PaintLayerClipperTest, LayoutSVGRoot) {
|
| context.setIgnoreOverflowClip();
|
| LayoutRect layerBounds;
|
| ClipRect backgroundRect, foregroundRect;
|
| - targetPaintLayer->clipper().calculateRects(
|
| - context, LayoutRect(LayoutRect::infiniteIntRect()), layerBounds,
|
| - backgroundRect, foregroundRect);
|
| + targetPaintLayer
|
| + ->clipper(RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled())
|
| + .calculateRects(context, LayoutRect(LayoutRect::infiniteIntRect()),
|
| + layerBounds, backgroundRect, foregroundRect);
|
| EXPECT_EQ(LayoutRect(8, 8, 200, 300), backgroundRect.rect());
|
| EXPECT_EQ(LayoutRect(8, 8, 200, 300), foregroundRect.rect());
|
| EXPECT_EQ(LayoutRect(8, 8, 200, 300), layerBounds);
|
| @@ -81,9 +82,10 @@ TEST_P(PaintLayerClipperTest, ControlClip) {
|
| context.setIgnoreOverflowClip();
|
| LayoutRect layerBounds;
|
| ClipRect backgroundRect, foregroundRect;
|
| - targetPaintLayer->clipper().calculateRects(
|
| - context, LayoutRect(LayoutRect::infiniteIntRect()), layerBounds,
|
| - backgroundRect, foregroundRect);
|
| + targetPaintLayer
|
| + ->clipper(RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled())
|
| + .calculateRects(context, LayoutRect(LayoutRect::infiniteIntRect()),
|
| + layerBounds, backgroundRect, foregroundRect);
|
| #if OS(MACOSX)
|
| // If the PaintLayer clips overflow, the background rect is intersected with
|
| // the PaintLayer bounds...
|
| @@ -119,9 +121,10 @@ TEST_P(PaintLayerClipperTest, RoundedClip) {
|
|
|
| LayoutRect layerBounds;
|
| ClipRect backgroundRect, foregroundRect;
|
| - targetPaintLayer->clipper().calculateRects(
|
| - context, LayoutRect(LayoutRect::infiniteIntRect()), layerBounds,
|
| - backgroundRect, foregroundRect);
|
| + targetPaintLayer
|
| + ->clipper(RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled())
|
| + .calculateRects(context, LayoutRect(LayoutRect::infiniteIntRect()),
|
| + layerBounds, backgroundRect, foregroundRect);
|
|
|
| // Only the foreground rect gets hasRadius set for overflow clipping
|
| // of descendants.
|
| @@ -154,9 +157,10 @@ TEST_P(PaintLayerClipperTest, RoundedClipNested) {
|
|
|
| LayoutRect layerBounds;
|
| ClipRect backgroundRect, foregroundRect;
|
| - childPaintLayer->clipper().calculateRects(
|
| - context, LayoutRect(LayoutRect::infiniteIntRect()), layerBounds,
|
| - backgroundRect, foregroundRect);
|
| + childPaintLayer
|
| + ->clipper(RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled())
|
| + .calculateRects(context, LayoutRect(LayoutRect::infiniteIntRect()),
|
| + layerBounds, backgroundRect, foregroundRect);
|
|
|
| EXPECT_EQ(LayoutRect(0, 0, 200, 300), backgroundRect.rect());
|
| EXPECT_TRUE(backgroundRect.hasRadius());
|
| @@ -183,9 +187,10 @@ TEST_P(PaintLayerClipperTest, ControlClipSelect) {
|
| context.setIgnoreOverflowClip();
|
| LayoutRect layerBounds;
|
| ClipRect backgroundRect, foregroundRect;
|
| - targetPaintLayer->clipper().calculateRects(
|
| - context, LayoutRect(LayoutRect::infiniteIntRect()), layerBounds,
|
| - backgroundRect, foregroundRect);
|
| + targetPaintLayer
|
| + ->clipper(RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled())
|
| + .calculateRects(context, LayoutRect(LayoutRect::infiniteIntRect()),
|
| + layerBounds, backgroundRect, foregroundRect);
|
| // The control clip for a select excludes the area for the down arrow.
|
| #if OS(MACOSX)
|
| EXPECT_EQ(LayoutRect(16, 9, 79, 13), foregroundRect.rect());
|
| @@ -211,9 +216,10 @@ TEST_P(PaintLayerClipperTest, LayoutSVGRootChild) {
|
| ClipRectsContext context(document().layoutView()->layer(), UncachedClipRects);
|
| LayoutRect layerBounds;
|
| ClipRect backgroundRect, foregroundRect;
|
| - targetPaintLayer->clipper().calculateRects(
|
| - context, LayoutRect(LayoutRect::infiniteIntRect()), layerBounds,
|
| - backgroundRect, foregroundRect);
|
| + targetPaintLayer
|
| + ->clipper(RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled())
|
| + .calculateRects(context, LayoutRect(LayoutRect::infiniteIntRect()),
|
| + layerBounds, backgroundRect, foregroundRect);
|
| EXPECT_EQ(LayoutRect(8, 8, 200, 300), backgroundRect.rect());
|
| EXPECT_EQ(LayoutRect(8, 8, 200, 300), foregroundRect.rect());
|
| EXPECT_EQ(LayoutRect(8, 8, 400, 0), layerBounds);
|
| @@ -232,16 +238,18 @@ TEST_P(PaintLayerClipperTest, ContainPaintClip) {
|
| ClipRectsContext context(layer, PaintingClipRectsIgnoringOverflowClip);
|
| LayoutRect layerBounds;
|
| ClipRect backgroundRect, foregroundRect;
|
| - layer->clipper().calculateRects(context, infiniteRect, layerBounds,
|
| - backgroundRect, foregroundRect);
|
| + layer->clipper(RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled())
|
| + .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(RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled())
|
| + .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 +270,17 @@ TEST_P(PaintLayerClipperTest, NestedContainPaintClip) {
|
| PaintingClipRectsIgnoringOverflowClip);
|
| LayoutRect layerBounds;
|
| ClipRect backgroundRect, foregroundRect;
|
| - layer->clipper().calculateRects(context, infiniteRect, layerBounds,
|
| - backgroundRect, foregroundRect);
|
| + layer->clipper(RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled())
|
| + .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(RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled())
|
| + .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 +304,15 @@ TEST_P(PaintLayerClipperTest, LocalClipRectFixedUnderTransform) {
|
| PaintLayer* fixed =
|
| toLayoutBoxModelObject(getLayoutObjectByElementId("fixed"))->layer();
|
|
|
| - EXPECT_EQ(LayoutRect(0, 0, 100, 100),
|
| - transformed->clipper().localClipRect(*transformed));
|
| - EXPECT_EQ(LayoutRect(0, 50, 100, 100),
|
| - fixed->clipper().localClipRect(*transformed));
|
| + EXPECT_EQ(
|
| + LayoutRect(0, 0, 100, 100),
|
| + transformed
|
| + ->clipper(RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled())
|
| + .localClipRect(*transformed));
|
| + EXPECT_EQ(
|
| + LayoutRect(0, 50, 100, 100),
|
| + fixed->clipper(RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled())
|
| + .localClipRect(*transformed));
|
| }
|
|
|
| TEST_P(PaintLayerClipperTest, ClearClipRectsRecursive) {
|
| @@ -327,7 +342,8 @@ TEST_P(PaintLayerClipperTest, ClearClipRectsRecursive) {
|
| EXPECT_TRUE(parent->clipRectsCache());
|
| EXPECT_TRUE(child->clipRectsCache());
|
|
|
| - parent->clipper().clearClipRectsIncludingDescendants();
|
| + parent->clipper(RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled())
|
| + .clearClipRectsIncludingDescendants();
|
|
|
| EXPECT_FALSE(parent->clipRectsCache());
|
| EXPECT_FALSE(child->clipRectsCache());
|
| @@ -360,7 +376,8 @@ TEST_P(PaintLayerClipperTest, ClearClipRectsRecursiveChild) {
|
| EXPECT_TRUE(parent->clipRectsCache());
|
| EXPECT_TRUE(child->clipRectsCache());
|
|
|
| - child->clipper().clearClipRectsIncludingDescendants();
|
| + child->clipper(RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled())
|
| + .clearClipRectsIncludingDescendants();
|
|
|
| EXPECT_TRUE(parent->clipRectsCache());
|
| EXPECT_FALSE(child->clipRectsCache());
|
| @@ -369,7 +386,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 +412,8 @@ TEST_P(PaintLayerClipperTest, ClearClipRectsRecursiveOneType) {
|
| EXPECT_TRUE(parent->clipRectsCache()->get(AbsoluteClipRects).root);
|
| EXPECT_TRUE(child->clipRectsCache()->get(AbsoluteClipRects).root);
|
|
|
| - parent->clipper().clearClipRectsIncludingDescendants(AbsoluteClipRects);
|
| + parent->clipper(RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled())
|
| + .clearClipRectsIncludingDescendants(AbsoluteClipRects);
|
|
|
| EXPECT_TRUE(parent->clipRectsCache());
|
| EXPECT_TRUE(child->clipRectsCache());
|
|
|