updated on Wed Jan 11 20:01:35 UTC 2012
[aur-mirror.git] / firefox2 / firefox-1.5-pango-justified-range.patch
blob7614d0e03cdced5a9bd650e5266b0d56a59f6256
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;
7 PRInt32 pendingCount;
8 - PRUnichar* runStart = bp;
9 + PRUnichar* runStart = bp, *top = aBuffer;
10 nscoord charWidth, width = 0;
11 PRInt32 countSoFar = 0;
12 + PRUint32 offset;
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
15 // context.
16 nscolor textColor;
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
24 else if (ch == ' ') {
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
35 *bp++ = ch;
36 - --aLength;
37 + offset++;
38 aBuffer++;
39 ch = *aBuffer;
40 // put the width into the space buffer
41 @@ -3058,10 +3059,10 @@ nsTextFrame::RenderString(nsIRenderingCo
42 glyphWidth = 0;
44 else {
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