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

Side by Side 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: sdflj 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 unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/layout/LayoutTestHelper.h" 5 #include "core/layout/LayoutTestHelper.h"
6 #include "core/layout/LayoutTreeAsText.h" 6 #include "core/layout/LayoutTreeAsText.h"
7 #include "core/layout/api/LayoutViewItem.h" 7 #include "core/layout/api/LayoutViewItem.h"
8 #include "core/paint/ObjectPaintProperties.h" 8 #include "core/paint/ObjectPaintProperties.h"
9 #include "platform/graphics/paint/GeometryMapper.h" 9 #include "platform/graphics/paint/GeometryMapper.h"
10 #include "platform/graphics/paint/TransformPaintPropertyNode.h" 10 #include "platform/graphics/paint/TransformPaintPropertyNode.h"
(...skipping 1068 matching lines...) Expand 10 before | Expand all | Expand 10 after
1079 ObjectPaintProperties* fixedProperties = document().getElementById("fixed")- >layoutObject()->objectPaintProperties(); 1079 ObjectPaintProperties* fixedProperties = document().getElementById("fixed")- >layoutObject()->objectPaintProperties();
1080 // The residual subpixel adjustment should still be (-0.3,0). 1080 // The residual subpixel adjustment should still be (-0.3,0).
1081 EXPECT_EQ(subpixelAccumulation, fixedProperties->localBorderBoxProperties()- >paintOffset); 1081 EXPECT_EQ(subpixelAccumulation, fixedProperties->localBorderBoxProperties()- >paintOffset);
1082 1082
1083 // d should be painted starting at subpixelAccumulation + (0.7,0) = (0.4,0). 1083 // d should be painted starting at subpixelAccumulation + (0.7,0) = (0.4,0).
1084 LayoutPoint dPaintOffset = subpixelAccumulation + LayoutPoint(FloatPoint(0.7 , 0)); 1084 LayoutPoint dPaintOffset = subpixelAccumulation + LayoutPoint(FloatPoint(0.7 , 0));
1085 ObjectPaintProperties* dProperties = document().getElementById("d")->layoutO bject()->objectPaintProperties(); 1085 ObjectPaintProperties* dProperties = document().getElementById("d")->layoutO bject()->objectPaintProperties();
1086 EXPECT_EQ(dPaintOffset, dProperties->localBorderBoxProperties()->paintOffset ); 1086 EXPECT_EQ(dPaintOffset, dProperties->localBorderBoxProperties()->paintOffset );
1087 } 1087 }
1088 1088
1089 TEST_F(PaintPropertyTreeBuilderTest, SvgPixelSnappingShouldResetPaintOffset)
1090 {
1091 setBodyInnerHTML(
1092 "<svg id='svg' style='position: relative; left: 0.1px; transform: matrix (1, 0, 0, 1, 0, 0);'>"
1093 " <rect id='rect' transform='translate(1, 1)'/>"
1094 "</svg>");
1095
1096 LayoutObject& svgWithTransform = *document().getElementById("svg")->layoutOb ject();
1097 ObjectPaintProperties* svgWithTransformProperties = svgWithTransform.objectP aintProperties();
1098 EXPECT_EQ(TransformationMatrix(), svgWithTransformProperties->transform()->m atrix());
1099 EXPECT_EQ(LayoutPoint(FloatPoint(0.1, 0)), svgWithTransformProperties->local BorderBoxProperties()->paintOffset);
1100 EXPECT_EQ(nullptr, svgWithTransformProperties->svgLocalToBorderBoxTransform( ));
1101
1102 LayoutObject& rectWithTransform = *document().getElementById("rect")->layout Object();
1103 ObjectPaintProperties* rectWithTransformProperties = rectWithTransform.objec tPaintProperties();
1104 EXPECT_EQ(TransformationMatrix().translate(1, 1), rectWithTransformPropertie s->transform()->matrix());
1105
1106 // Ensure there is no PaintOffset transform between the rect and the svg's t ransform.
1107 EXPECT_EQ(svgWithTransformProperties->transform(), rectWithTransformProperti es->transform()->parent());
1108 }
1109
1089 } // namespace blink 1110 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698