1 diff -pruN -x '.moz*' -x .deps -x 'thunderbird*' -x '*.mk' -x 'config*' -x dist -x build -x toolkit -x '*o' -x '*a' -x '*html' -x 'firefox*' mozilla.orig/layout/generic/nsTextFrame.cpp mozilla/layout/generic/nsTextFrame.cpp
2 --- mozilla.orig/layout/generic/nsTextFrame.cpp 2006-12-20 12:15:38.000000000 +0900
3 +++ mozilla/layout/generic/nsTextFrame.cpp 2006-12-20 21:29:39.000000000 +0900
4 @@ -2973,15 +2973,16 @@ nsTextFrame::RenderString(nsIRenderingCo
6 nsIFontMetrics* lastFont = aTextStyle.mLastFont;
8 - PRUnichar* runStart = bp;
9 + PRUnichar* runStart = bp, *top = aBuffer;
10 nscoord charWidth, width = 0;
11 PRInt32 countSoFar = 0;
13 // Save the color we want to use for the text, since calls to
14 // PaintTextDecorations in this method will call SetColor() on the rendering
17 aRenderingContext.GetColor(textColor);
18 - for (; --aLength >= 0; aBuffer++) {
19 + for (offset = 0; offset < aLength; aBuffer++, offset++) {
20 nsIFontMetrics* nextFont;
21 nscoord glyphWidth = 0;
22 PRUnichar ch = *aBuffer;
23 @@ -3038,7 +3039,7 @@ nsTextFrame::RenderString(nsIRenderingCo
25 glyphWidth += aTextStyle.mSpaceWidth + aTextStyle.mWordSpacing + aTextStyle.mLetterSpacing;
27 - else if (IS_HIGH_SURROGATE(ch) && aLength > 0 &&
28 + else if (IS_HIGH_SURROGATE(ch) && (offset + 1) < aLength &&
29 IS_LOW_SURROGATE(*(aBuffer+1))) {
31 // special handling for surrogate pair
32 @@ -3046,7 +3047,7 @@ nsTextFrame::RenderString(nsIRenderingCo
33 glyphWidth += charWidth + aTextStyle.mLetterSpacing;
34 // copy the surrogate low
40 // put the width into the space buffer
41 @@ -3058,10 +3059,10 @@ nsTextFrame::RenderString(nsIRenderingCo
45 - aRenderingContext.GetWidth(ch, charWidth);
46 + aRenderingContext.GetRangeWidth(top, aLength, offset, offset + 1, (PRUint32&)charWidth);
47 glyphWidth += charWidth + aTextStyle.mLetterSpacing;
49 - if (justifying && (!isEndOfLine || aLength > 0)
50 + if (justifying && (!isEndOfLine || (offset + 1) < aLength)
51 && IsJustifiableCharacter(ch, isCJ)) {
52 glyphWidth += aTextStyle.mExtraSpacePerJustifiableCharacter;
53 if ((PRUint32)--aTextStyle.mNumJustifiableCharacterToRender