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

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

Issue 2131803002: Ensure SVG PaintOffset is reset at the HTML/SVG boundary [spv2] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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/PaintPropertyTreeBuilderTest.cpp
diff --git a/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilderTest.cpp b/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilderTest.cpp
index 92b8bfa9016ba4dbf07b7bb1e9eee0a1bc5701fe..466906e8a5de97fb1bc32f72d39a4f0600b4dadd 100644
--- a/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilderTest.cpp
+++ b/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilderTest.cpp
@@ -1086,4 +1086,25 @@ TEST_F(PaintPropertyTreeBuilderTest, PaintOffsetWithPixelSnappingWithFixedPos)
EXPECT_EQ(dPaintOffset, dProperties->localBorderBoxProperties()->paintOffset);
}
+TEST_F(PaintPropertyTreeBuilderTest, SvgPixelSnappingShouldResetPaintOffset)
+{
+ setBodyInnerHTML(
+ "<svg id='svg' style='position: relative; left: 0.1px; transform: matrix(1, 0, 0, 1, 0, 0);'>"
+ " <rect id='rect' transform='translate(1, 1)'/>"
+ "</svg>");
+
+ LayoutObject& svgWithTransform = *document().getElementById("svg")->layoutObject();
+ ObjectPaintProperties* svgWithTransformProperties = svgWithTransform.objectPaintProperties();
+ EXPECT_EQ(TransformationMatrix(), svgWithTransformProperties->transform()->matrix());
+ EXPECT_EQ(LayoutPoint(FloatPoint(0.1, 0)), svgWithTransformProperties->localBorderBoxProperties()->paintOffset);
+ EXPECT_EQ(nullptr, svgWithTransformProperties->svgLocalToBorderBoxTransform());
+
+ LayoutObject& rectWithTransform = *document().getElementById("rect")->layoutObject();
+ ObjectPaintProperties* rectWithTransformProperties = rectWithTransform.objectPaintProperties();
+ EXPECT_EQ(TransformationMatrix().translate(1, 1), rectWithTransformProperties->transform()->matrix());
+
+ // Ensure there is no PaintOffset transform between the rect and the svg's transform.
+ EXPECT_EQ(svgWithTransformProperties->transform(), rectWithTransformProperties->transform()->parent());
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698