summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--layout/base/nsDisplayList.cpp10
-rw-r--r--layout/reftests/svg/css-transform-svg-ref.html10
-rw-r--r--layout/reftests/svg/css-transform-svg.html13
-rw-r--r--layout/reftests/svg/reftest.list1
-rw-r--r--layout/reftests/w3c-css/submitted/images3/reftest.list8
5 files changed, 36 insertions, 6 deletions
diff --git a/layout/base/nsDisplayList.cpp b/layout/base/nsDisplayList.cpp
index e35e027e30..cd0c623df9 100644
--- a/layout/base/nsDisplayList.cpp
+++ b/layout/base/nsDisplayList.cpp
@@ -5917,6 +5917,12 @@ nsDisplayTransform::GetResultingTransformMatrixInternal(const FrameTransformProp
frame && frame->IsSVGTransformed(&svgTransform, &transformFromSVGParent);
bool hasTransformFromSVGParent =
hasSVGTransforms && !transformFromSVGParent.IsIdentity();
+
+ // An SVG frame should not have its translation rounded.
+ // Note it's possible that the SVG frame doesn't have an SVG
+ // transform but only has a CSS transform.
+ bool shouldRound = !(frame && frame->IsFrameOfType(nsIFrame::eSVG));
+
/* Transformed frames always have a transform, or are preserving 3d (and might still have perspective!) */
if (aProperties.mTransformList) {
result = nsStyleTransformMatrix::ReadTransforms(aProperties.mTransformList->mHead,
@@ -5994,7 +6000,7 @@ nsDisplayTransform::GetResultingTransformMatrixInternal(const FrameTransformProp
// Otherwise we need to manually translate into our parent's coordinate
// space.
if (frame->IsTransformed()) {
- nsLayoutUtils::PostTranslate(result, frame->GetPosition(), aAppUnitsPerPixel, !hasSVGTransforms);
+ nsLayoutUtils::PostTranslate(result, frame->GetPosition(), aAppUnitsPerPixel, shouldRound);
}
Matrix4x4 parent =
GetResultingTransformMatrixInternal(props,
@@ -6005,7 +6011,7 @@ nsDisplayTransform::GetResultingTransformMatrixInternal(const FrameTransformProp
}
if (aFlags & OFFSET_BY_ORIGIN) {
- nsLayoutUtils::PostTranslate(result, aOrigin, aAppUnitsPerPixel, !hasSVGTransforms);
+ nsLayoutUtils::PostTranslate(result, aOrigin, aAppUnitsPerPixel, shouldRound);
}
return result;
diff --git a/layout/reftests/svg/css-transform-svg-ref.html b/layout/reftests/svg/css-transform-svg-ref.html
new file mode 100644
index 0000000000..6167442e74
--- /dev/null
+++ b/layout/reftests/svg/css-transform-svg-ref.html
@@ -0,0 +1,10 @@
+<!--
+ Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/
+-->
+<style>
+</style>
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20">
+ <rect id="a" x="0.49" y="0.51" width="2.5" height="2.5"/>
+ <rect id="b" x="3.5" y="3.5" width="2.5" height="2.5"/>
+</svg>
diff --git a/layout/reftests/svg/css-transform-svg.html b/layout/reftests/svg/css-transform-svg.html
new file mode 100644
index 0000000000..c1c63a8397
--- /dev/null
+++ b/layout/reftests/svg/css-transform-svg.html
@@ -0,0 +1,13 @@
+<!--
+ Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/
+-->
+<style>
+#a {
+ transform: scaleY(1);
+}
+</style>
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20">
+ <rect id="a" x="0.49" y="0.51" width="2.5" height="2.5"/>
+ <rect id="b" x="3.5" y="3.5" width="2.5" height="2.5"/>
+</svg>
diff --git a/layout/reftests/svg/reftest.list b/layout/reftests/svg/reftest.list
index 0966286816..a23ab420f3 100644
--- a/layout/reftests/svg/reftest.list
+++ b/layout/reftests/svg/reftest.list
@@ -371,6 +371,7 @@ fuzzy-if(skiaContent,1,610) == textPath-03.svg pass.svg
== text-white-space-01.svg text-white-space-01-ref.svg
== thin-stroke-01.svg pass.svg
== zero-stroke-01.svg pass.svg
+== css-transform-svg.html css-transform-svg-ref.html
== tspan-dxdy-01.svg tspan-dxdy-ref.svg
== tspan-dxdy-02.svg tspan-dxdy-ref.svg
== tspan-dxdy-03.svg tspan-dxdy-ref.svg
diff --git a/layout/reftests/w3c-css/submitted/images3/reftest.list b/layout/reftests/w3c-css/submitted/images3/reftest.list
index 3834b0713f..4cf42177c0 100644
--- a/layout/reftests/w3c-css/submitted/images3/reftest.list
+++ b/layout/reftests/w3c-css/submitted/images3/reftest.list
@@ -182,11 +182,11 @@ fails == object-position-png-002c.html object-position-png-002-ref.html # bug 11
== object-position-png-002i.html object-position-png-002-ref.html
== object-position-png-002o.html object-position-png-002-ref.html
== object-position-png-002p.html object-position-png-002-ref.html
-fails == object-position-svg-001e.html object-position-svg-001-ref.html # bug 1103286
+== object-position-svg-001e.html object-position-svg-001-ref.html # bug 1103286
== object-position-svg-001i.html object-position-svg-001-ref.html
-fails == object-position-svg-001o.html object-position-svg-001-ref.html # bug 1103286
+== object-position-svg-001o.html object-position-svg-001-ref.html # bug 1103286
== object-position-svg-001p.html object-position-svg-001-ref.html
-fails == object-position-svg-002e.html object-position-svg-002-ref.html # bug 1103286
+== object-position-svg-002e.html object-position-svg-002-ref.html # bug 1103286
== object-position-svg-002i.html object-position-svg-002-ref.html
-fails == object-position-svg-002o.html object-position-svg-002-ref.html # bug 1103286
+== object-position-svg-002o.html object-position-svg-002-ref.html # bug 1103286
== object-position-svg-002p.html object-position-svg-002-ref.html