Bug 862158 - Propagate implied SVG text rotate="" values over the top of inherited implied values. r=longsonr

This commit is contained in:
Cameron McCormack 2013-04-16 16:43:28 +10:00
parent e8d125eaf7
commit cd8836d173
5 changed files with 30 additions and 8 deletions

View File

@ -324,6 +324,7 @@ skip-if(B2G) random-if(/^Windows\x20NT\x205\.1/.test(http.oscpu)) == tspan-rotat
skip-if(B2G) random-if(/^Windows\x20NT\x205\.1/.test(http.oscpu)) == tspan-rotate-04.svg tspan-rotate-ref.svg # Bug 629718 for random failure on WinXP # bug 773482 skip-if(B2G) random-if(/^Windows\x20NT\x205\.1/.test(http.oscpu)) == tspan-rotate-04.svg tspan-rotate-ref.svg # Bug 629718 for random failure on WinXP # bug 773482
random-if(/^Windows\x20NT\x205\.1/.test(http.oscpu)) == tspan-rotate-05.svg tspan-rotate-ref.svg # Bug 629718 for random failure on WinXP random-if(/^Windows\x20NT\x205\.1/.test(http.oscpu)) == tspan-rotate-05.svg tspan-rotate-ref.svg # Bug 629718 for random failure on WinXP
skip-if(B2G) random-if(/^Windows\x20NT\x205\.1/.test(http.oscpu)) == tspan-rotate-06.svg tspan-rotate-ref.svg # Bug 629718 for random failure on WinXP # bug 773482 skip-if(B2G) random-if(/^Windows\x20NT\x205\.1/.test(http.oscpu)) == tspan-rotate-06.svg tspan-rotate-ref.svg # Bug 629718 for random failure on WinXP # bug 773482
== tspan-rotate-07.svg tspan-rotate-07-ref.svg
== tspan-rotate-textPath-01.svg tspan-rotate-textPath-01-ref.svg == tspan-rotate-textPath-01.svg tspan-rotate-textPath-01-ref.svg
skip-if(B2G) == tspan-xy-01.svg tspan-xy-ref.svg # bug 773482 skip-if(B2G) == tspan-xy-01.svg tspan-xy-ref.svg # bug 773482
skip-if(B2G) == tspan-xy-02.svg tspan-xy-ref.svg # bug 773482 skip-if(B2G) == tspan-xy-02.svg tspan-xy-ref.svg # bug 773482

View File

@ -0,0 +1,8 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<svg xmlns="http://www.w3.org/2000/svg">
<!-- From https://bugzilla.mozilla.org/show_bug.cgi?id=862158 -->
<text x="100" y="100" style="font: 32px sans-serif" rotate="45 0">A B</text>
</svg>

After

Width:  |  Height:  |  Size: 313 B

View File

@ -0,0 +1,8 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<svg xmlns="http://www.w3.org/2000/svg">
<!-- From https://bugzilla.mozilla.org/show_bug.cgi?id=862158 -->
<text x="100" y="100" style="font: 32px sans-serif"><tspan rotate="45">A </tspan>B</text>
</svg>

After

Width:  |  Height:  |  Size: 326 B

View File

@ -4128,8 +4128,11 @@ nsSVGTextFrame2::ResolvePositions(nsIContent* aContent,
j++; j++;
} }
// Propagate final rotate="" value to the end of this element. // Propagate final rotate="" value to the end of this element.
while (j < count) { while (j < count &&
(!mPositions[aIndex + j].IsAngleSpecified() ||
mPositions[aIndex + j].mAngleImplied)) {
mPositions[aIndex + j].mAngle = mPositions[aIndex + j - 1].mAngle; mPositions[aIndex + j].mAngle = mPositions[aIndex + j - 1].mAngle;
mPositions[aIndex + j].mAngleImplied = true;
j++; j++;
} }
} }
@ -4661,11 +4664,7 @@ nsSVGTextFrame2::DoGlyphPositioning()
} }
// Fill in unspecified rotation values. // Fill in unspecified rotation values.
if (!mPositions[i].IsAngleSpecified()) { if (!mPositions[i].IsAngleSpecified()) {
mPositions[i].mAngle = mPositions[i - 1].mAngle; mPositions[i].mAngle = 0.0f;
if (mPositions[i].mAngle != 0.0f) {
// Any non-zero rotation must begin a run boundary.
mPositions[i].mRunBoundary = true;
}
} }
} }

View File

@ -47,7 +47,8 @@ struct CharPosition
mUnaddressable(false), mUnaddressable(false),
mClusterOrLigatureGroupMiddle(false), mClusterOrLigatureGroupMiddle(false),
mRunBoundary(false), mRunBoundary(false),
mStartOfChunk(false) mStartOfChunk(false),
mAngleImplied(false)
{ {
} }
@ -58,7 +59,8 @@ struct CharPosition
mUnaddressable(false), mUnaddressable(false),
mClusterOrLigatureGroupMiddle(false), mClusterOrLigatureGroupMiddle(false),
mRunBoundary(false), mRunBoundary(false),
mStartOfChunk(false) mStartOfChunk(false),
mAngleImplied(false)
{ {
} }
@ -102,6 +104,10 @@ struct CharPosition
// an anchored chunk begins here // an anchored chunk begins here
bool mStartOfChunk; bool mStartOfChunk;
// whether the angle value was implied due to the repetition of the final
// value in a rotate="" attribute
bool mAngleImplied;
private: private:
static gfxFloat UnspecifiedCoord() static gfxFloat UnspecifiedCoord()
{ {