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

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

Issue 2883263003: Map visual rects of descendants under LayoutSVGHiddenContainer to the temporary root (Closed)
Patch Set: Created 3 years, 7 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/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

Powered by Google App Engine
This is Rietveld 408576698