Bug 729996 - trailing spaces in text not properly ignored. r=dholbert

This commit is contained in:
Robert Longson 2012-02-24 10:20:53 +00:00
parent 0f3872effe
commit 51d8917573
4 changed files with 25 additions and 1 deletions

View File

@ -251,6 +251,7 @@ fails-if(Android) random-if(gtk2Widget) != text-language-01.xhtml text-language-
== text-layout-04.svg text-layout-04-ref.svg
== text-layout-05.svg text-layout-05-ref.svg
== text-layout-06.svg text-layout-06-ref.svg
== text-layout-07.svg text-layout-07-ref.svg
== text-scale-01.svg text-scale-01-ref.svg
== text-stroke-scaling-01.svg text-stroke-scaling-01-ref.svg
== stroke-dasharray-and-pathLength-01.svg pass.svg

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">
<text transform="translate(0, 31)" font-size="120" text-anchor="middle">
<tspan y="122.3" x="273">ABC</tspan></text>
</svg>

After

Width:  |  Height:  |  Size: 289 B

View File

@ -0,0 +1,9 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<svg xmlns="http://www.w3.org/2000/svg">
<text transform="translate(0, 31)" font-size="120" text-anchor="middle">
<tspan y="122.3" x="273">ABC</tspan>
</text>
</svg>

After

Width:  |  Height:  |  Size: 292 B

View File

@ -325,7 +325,13 @@ nsSVGTextFrame::SetWhitespaceHandling(nsSVGGlyphFrame *aFrame)
aFrame = aFrame->GetNextGlyphFrame();
}
lastNonWhitespaceFrame->SetTrimTrailingWhitespace(true);
// We're at the last non-whitespace frame so trim off the end
// and make sure we set one of the trim bits so that any
// further whitespace is compressed to nothing
while (aFrame) {
aFrame->SetTrimTrailingWhitespace(true);
aFrame = aFrame->GetNextGlyphFrame();
}
}
void