Bug 897342 - Don't try to adjust text for textLength="" when there is no opportunity to do so. r=jwatt

This commit is contained in:
Cameron McCormack 2013-07-24 21:47:07 +10:00
parent 2c280a433a
commit 1954a52d54
3 changed files with 8 additions and 2 deletions

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg"><text textLength="50" lengthAdjust="spacingAndGlyphs">&#x200D;</text></svg>

After

Width:  |  Height:  |  Size: 116 B

View File

@ -173,3 +173,4 @@ load 890782-1.svg
load 890783-1.svg
load 893510-1.svg
load 895311-1.svg
load 897342-1.svg

View File

@ -4820,7 +4820,9 @@ nsSVGTextFrame2::DoGlyphPositioning()
switch (lengthAdjust) {
case SVG_LENGTHADJUST_SPACINGANDGLYPHS:
// Scale the glyphs and their positions.
mLengthAdjustScaleFactor = expectedTextLength / actualTextLength;
if (actualTextLength > 0) {
mLengthAdjustScaleFactor = expectedTextLength / actualTextLength;
}
break;
default:
@ -4832,7 +4834,9 @@ nsSVGTextFrame2::DoGlyphPositioning()
adjustableSpaces++;
}
}
adjustment = (expectedTextLength - actualTextLength) / adjustableSpaces;
if (adjustableSpaces) {
adjustment = (expectedTextLength - actualTextLength) / adjustableSpaces;
}
break;
}
}