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 dfc4dd7649571825a77990f8fc470fb8793b69ca..d814c3a67219f9b529b3e9d767446dc38134c944 100644 |
--- a/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilderTest.cpp |
+++ b/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilderTest.cpp |
@@ -1679,7 +1679,8 @@ TEST_P(PaintPropertyTreeBuilderTest, SvgPixelSnappingShouldResetPaintOffset) { |
TEST_P(PaintPropertyTreeBuilderTest, SvgRootAndForeignObjectPixelSnapping) { |
setBodyInnerHTML( |
"<svg id=svg style='position: relative; left: 0.6px; top: 0.3px'>" |
- " <foreignObject id=foreign x='3.5' y='5.4' transform='translate(1,1)'>" |
+ " <foreignObject id=foreign x='3.6' y='5.2'" |
+ " transform='translate(1.5, 1.5) scale(2)'>" |
" <div id=div style='position: absolute; left: 5.6px; top: 7.3px'>" |
" </div>" |
" </foreignObject>" |
@@ -1695,19 +1696,22 @@ TEST_P(PaintPropertyTreeBuilderTest, SvgRootAndForeignObjectPixelSnapping) { |
EXPECT_EQ(TransformationMatrix().translate(9, 8), |
svgProperties->svgLocalToBorderBoxTransform()->matrix()); |
- const auto* foreignObjectProperties = |
- getLayoutObjectByElementId("foreign")->paintProperties(); |
+ const auto* foreignObject = |
+ toLayoutBox(getLayoutObjectByElementId("foreign")); |
+ const auto* foreignObjectProperties = foreignObject->paintProperties(); |
+ // The offset of foreign object should be snapped to pixels before applying |
+ // the local transforms. |
+ EXPECT_EQ(TransformationMatrix().translate(1.5, 1.5).scale(2).translate(4, 5), |
+ foreignObjectProperties->transform()->matrix()); |
+ EXPECT_EQ(LayoutPoint(4, 5), foreignObject->location()); |
EXPECT_EQ(nullptr, foreignObjectProperties->paintOffsetTranslation()); |
- // Paint offset of foreignObject should be originated from SVG root and |
- // snapped to pixels. |
- EXPECT_EQ(LayoutPoint(4, 5), |
+ EXPECT_EQ(LayoutPoint(), |
foreignObjectProperties->localBorderBoxProperties()->paintOffset); |
const auto* divProperties = |
getLayoutObjectByElementId("div")->paintProperties(); |
- // Paint offset of descendant of foreignObject accumulates on paint offset of |
- // foreignObject. |
- EXPECT_EQ(LayoutPoint(LayoutUnit(4 + 5.6), LayoutUnit(5 + 7.3)), |
+ // Paint offsets of contents of the foreign object originate from (0, 0). |
+ EXPECT_EQ(LayoutPoint(LayoutUnit(5.6), LayoutUnit(7.3)), |
divProperties->localBorderBoxProperties()->paintOffset); |
} |