Bug 1523343 - Should not round translation for SVG frame r=longsonr

When computing transform matrix, translation in SVG should not be rounded.
Checking !IsSVGTransformed() isn't the correct way, since an SVG frame may
have CSS transform applied.

Differential Revision: https://phabricator.services.mozilla.com/D26271

--HG--
extra : moz-landing-system : lando
This commit is contained in:
violet 2019-04-05 09:03:52 +00:00
Родитель f2025f0566
Коммит 14a3ded377
4 изменённых файлов: 32 добавлений и 2 удалений

Просмотреть файл

@ -7783,6 +7783,12 @@ Matrix4x4 nsDisplayTransform::GetResultingTransformMatrixInternal(
bool hasSVGTransforms =
frame &&
frame->IsSVGTransformed(&svgTransform, &parentsChildrenOnlyTransform);
// 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.HasTransform()) {
@ -7852,7 +7858,7 @@ Matrix4x4 nsDisplayTransform::GetResultingTransformMatrixInternal(
// space.
if (frame->IsTransformed()) {
nsLayoutUtils::PostTranslate(result, frame->GetPosition(),
aAppUnitsPerPixel, !hasSVGTransforms);
aAppUnitsPerPixel, shouldRound);
}
Matrix4x4 parent = GetResultingTransformMatrixInternal(
props, nsPoint(0, 0), aAppUnitsPerPixel, flags, nullptr);
@ -7861,7 +7867,7 @@ Matrix4x4 nsDisplayTransform::GetResultingTransformMatrixInternal(
if (aFlags & OFFSET_BY_ORIGIN) {
nsLayoutUtils::PostTranslate(result, aOrigin, aAppUnitsPerPixel,
!hasSVGTransforms);
shouldRound);
}
return result;

Просмотреть файл

@ -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>

Просмотреть файл

@ -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>

Просмотреть файл

@ -490,6 +490,7 @@ random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == textPath-line-01.svg tex
== thin-stroke-01.svg pass.svg
== transform-outer-svg-01.svg transform-outer-svg-01-ref.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