Bug 776327 - Subtract the start index from the length to get remaining characters of this fragment. r=jwatt
authorMats Palmgren <matspal@gmail.com>
Wed, 25 Jul 2012 16:04:23 +0200
changeset 100409 aed8e7564f579111064199905ddde9ed545dc5c9
parent 100408 38a8439f4c9df29d47e14ed8c397247ebb68ec9c
child 100410 83d701108e707db70cc5da71b3b4c6673b44cfaa
push id12481
push usermpalmgren@mozilla.com
push dateWed, 25 Jul 2012 14:04:39 +0000
treeherdermozilla-inbound@aed8e7564f57 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjwatt
bugs776327
milestone17.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 776327 - Subtract the start index from the length to get remaining characters of this fragment. r=jwatt
layout/svg/base/src/nsSVGTextContainerFrame.cpp
--- a/layout/svg/base/src/nsSVGTextContainerFrame.cpp
+++ b/layout/svg/base/src/nsSVGTextContainerFrame.cpp
@@ -213,17 +213,17 @@ float
 nsSVGTextContainerFrame::GetSubStringLength(PRUint32 charnum, PRUint32 nchars)
 {
   float length = 0.0f;
   nsISVGGlyphFragmentNode *node = GetFirstGlyphFragmentChildNode();
 
   while (node) {
     PRUint32 count = node->GetNumberOfChars();
     if (count > charnum) {
-      PRUint32 fragmentChars = NS_MIN(nchars, count);
+      PRUint32 fragmentChars = NS_MIN(nchars, count - charnum);
       float fragmentLength = node->GetSubStringLength(charnum, fragmentChars);
       length += fragmentLength;
       nchars -= fragmentChars;
       if (nchars == 0) break;
     }
     charnum -= NS_MIN(charnum, count);
     node = GetNextGlyphFragmentChildNode(node);
   }