Bug 936670 - Position text rendered runs by the first non-trimmed character in the run. r=longsonr

This commit is contained in:
Cameron McCormack 2013-11-17 18:32:56 +11:00
parent 6a434aebfc
commit 1edaabc32a
4 changed files with 18 additions and 5 deletions

View File

@ -0,0 +1,6 @@
<svg xmlns="http://www.w3.org/2000/svg">
<path d="M 100,100 l 4,8 h -8 z" fill="red"/>
<g transform="translate(100,100)" style="text-anchor: end; font: 16px sans-serif">
<text>hello</text>
</g>
</svg>

After

Width:  |  Height:  |  Size: 211 B

View File

@ -0,0 +1,6 @@
<svg xmlns="http://www.w3.org/2000/svg">
<path d="M 100,100 l 4,8 h -8 z" fill="red"/>
<g transform="translate(100,100)" style="text-anchor: end; font: 16px sans-serif">
<text> hello</text>
</g>
</svg>

After

Width:  |  Height:  |  Size: 212 B

View File

@ -1779,6 +1779,7 @@ fuzzy(1,10000) fuzzy-if(Android&&AndroidVersion>=15,5,10000) == 902330-1.html 90
fuzzy-if(Android,8,400) == 906199-1.html 906199-1-ref.html
== 921716-1.html 921716-1-ref.html
fuzzy-if(cocoaWidget,1,40) == 928607-1.html 928607-1-ref.html
== 936670-1.svg 936670-1-ref.svg
== 931853.html 931853-ref.html
== 931853-quirks.html 931853-quirks-ref.html
== 931464-1.html 931464-1-ref.html

View File

@ -1937,11 +1937,6 @@ TextRenderedRunIterator::Next()
charIndex = mTextElementCharIndex;
// Get the position and rotation of the character that begins this
// rendered run.
pt = Root()->mPositions[mTextElementCharIndex].mPosition;
rotate = Root()->mPositions[mTextElementCharIndex].mAngle;
// Find the end of the rendered run, by looking through the
// nsSVGTextFrame2's positions array until we find one that is recorded
// as a run boundary.
@ -1983,6 +1978,11 @@ TextRenderedRunIterator::Next()
TrimOffsets(offset, length, trimmedOffsets);
charIndex += offset - untrimmedOffset;
// Get the position and rotation of the character that begins this
// rendered run.
pt = Root()->mPositions[charIndex].mPosition;
rotate = Root()->mPositions[charIndex].mAngle;
// Determine if we should skip this rendered run.
bool skip = !mFrameIterator.IsWithinSubtree() ||
Root()->mPositions[mTextElementCharIndex].mHidden;