| Index: third_party/WebKit/Source/core/paint/PaintInvalidationTest.cpp
|
| diff --git a/third_party/WebKit/Source/core/paint/PaintInvalidationTest.cpp b/third_party/WebKit/Source/core/paint/PaintInvalidationTest.cpp
|
| index dcb42f70643e61b7f68c0198020f2553144a6bc8..bb81647a22feaa082fc2445e440f71236e95386e 100644
|
| --- a/third_party/WebKit/Source/core/paint/PaintInvalidationTest.cpp
|
| +++ b/third_party/WebKit/Source/core/paint/PaintInvalidationTest.cpp
|
| @@ -202,6 +202,49 @@ TEST_P(PaintInvalidationTest, DelayedFullPaintInvalidation) {
|
| GetDocument().View()->SetTracksPaintInvalidations(false);
|
| };
|
|
|
| +TEST_P(PaintInvalidationTest, SVGHiddenContainer) {
|
| + EnableCompositing();
|
| + SetBodyInnerHTML(
|
| + "<svg style='position: absolute; top: 100px; left: 100px'>"
|
| + " <mask id='mask'>"
|
| + " <g transform='scale(2)'>"
|
| + " <rect id='mask-rect' x='11' y='22' width='33' height='44'/>"
|
| + " </g>"
|
| + " </mask>"
|
| + " <rect id='real-rect' x='55' y='66' width='7' height='8'"
|
| + " mask='url(#mask)'/>"
|
| + "</svg>");
|
| +
|
| + // mask_rect's visual rect is in coordinates of the mask.
|
| + auto* mask_rect = GetLayoutObjectByElementId("mask-rect");
|
| + EXPECT_EQ(LayoutRect(22, 44, 66, 88), mask_rect->VisualRect());
|
| +
|
| + // real_rect's visual rect is in coordinates of its paint invalidation
|
| + // container (the view).
|
| + auto* real_rect = GetLayoutObjectByElementId("real-rect");
|
| + EXPECT_EQ(LayoutRect(155, 166, 7, 8), real_rect->VisualRect());
|
| +
|
| + GetDocument().View()->SetTracksPaintInvalidations(true);
|
| + ToElement(mask_rect->GetNode())->setAttribute("x", "20");
|
| + GetDocument().View()->UpdateAllLifecyclePhasesExceptPaint();
|
| + EXPECT_EQ(LayoutRect(40, 44, 66, 88), mask_rect->VisualRect());
|
| + EXPECT_EQ(LayoutRect(155, 166, 7, 8), real_rect->VisualRect());
|
| +
|
| + // Should invalidate raster for real_rect only.
|
| + const auto& raster_invalidations =
|
| + GetRasterInvalidationTracking()->invalidations;
|
| + ASSERT_EQ(1u, raster_invalidations.size());
|
| + EXPECT_EQ(IntRect(155, 166, 7, 8), raster_invalidations[0].rect);
|
| + EXPECT_EQ(PaintInvalidationReason::kFull, raster_invalidations[0].reason);
|
| + EXPECT_EQ(PaintInvalidationReason::kFull,
|
| + real_rect->GetPaintInvalidationReason());
|
| +
|
| + // Should still invalidate DisplayItemClient of mask_rect.
|
| + EXPECT_EQ(PaintInvalidationReason::kFull,
|
| + mask_rect->GetPaintInvalidationReason());
|
| + GetDocument().View()->SetTracksPaintInvalidations(false);
|
| +}
|
| +
|
| } // namespace
|
|
|
| } // namespace blink
|
|
|