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

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

Issue 2513293002: Revert of Avoid special handling of LayoutSVGForeignObject about its paint offset (Closed)
Patch Set: Rebase (with good parts kept) Created 4 years, 1 month 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 506986cc883f36bbcaa8c61bb21199a55307516f..ca46d9b7ae0f0643ff5ef6bdb0ac29013deb050d 100644
--- a/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilderTest.cpp
+++ b/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilderTest.cpp
@@ -1678,8 +1678,7 @@ 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.6' y='5.2'"
- " transform='translate(1.5, 1.5) scale(2)'>"
+ " <foreignObject id=foreign x='3.5' y='5.4' transform='translate(1,1)'>"
" <div id=div style='position: absolute; left: 5.6px; top: 7.3px'>"
" </div>"
" </foreignObject>"
@@ -1695,22 +1694,19 @@ TEST_P(PaintPropertyTreeBuilderTest, SvgRootAndForeignObjectPixelSnapping) {
EXPECT_EQ(TransformationMatrix().translate(9, 8),
svgProperties->svgLocalToBorderBoxTransform()->matrix());
- 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());
+ const auto* foreignObjectProperties =
+ getLayoutObjectByElementId("foreign")->paintProperties();
EXPECT_EQ(nullptr, foreignObjectProperties->paintOffsetTranslation());
- EXPECT_EQ(LayoutPoint(),
+ // Paint offset of foreignObject should be originated from SVG root and
+ // snapped to pixels.
+ EXPECT_EQ(LayoutPoint(4, 5),
foreignObjectProperties->localBorderBoxProperties()->paintOffset);
const auto* divProperties =
getLayoutObjectByElementId("div")->paintProperties();
- // Paint offsets of contents of the foreign object originate from (0, 0).
- EXPECT_EQ(LayoutPoint(LayoutUnit(5.6), LayoutUnit(7.3)),
+ // Paint offset of descendant of foreignObject accumulates on paint offset of
+ // foreignObject.
+ EXPECT_EQ(LayoutPoint(LayoutUnit(4 + 5.6), LayoutUnit(5 + 7.3)),
divProperties->localBorderBoxProperties()->paintOffset);
}

Powered by Google App Engine
This is Rietveld 408576698