From e7c20bae8043b6465edbaef44a98125e3d92ad5a Mon Sep 17 00:00:00 2001 From: "gavin%gavinsharp.com" Date: Wed, 17 Oct 2007 17:03:09 +0000 Subject: [PATCH] Back out the patch for bug 399159 because it's suspected of having caused the Tp regression --- layout/generic/nsTextFrameThebes.cpp | 53 ++++++++++------------------ 1 file changed, 19 insertions(+), 34 deletions(-) diff --git a/layout/generic/nsTextFrameThebes.cpp b/layout/generic/nsTextFrameThebes.cpp index 2be61819930..416a413e316 100644 --- a/layout/generic/nsTextFrameThebes.cpp +++ b/layout/generic/nsTextFrameThebes.cpp @@ -1971,8 +1971,7 @@ public: * Count the number of justifiable characters in the given DOM range */ PRUint32 ComputeJustifiableCharacters(PRInt32 aOffset, PRInt32 aLength); - void FindJustificationRange(gfxSkipCharsIterator* aStart, - gfxSkipCharsIterator* aEnd); + void FindEndOfJustificationRange(gfxSkipCharsIterator* aIter); const nsStyleText* GetStyleText() { return mTextStyle; } nsTextFrame* GetFrame() { return mFrame; } @@ -2144,8 +2143,8 @@ PropertyProvider::GetSpacingInternal(PRUint32 aStart, PRUint32 aLength, // Scan non-skipped characters and adjust justifiable chars, adding // justification space on either side of the cluster PRBool isCJK = IsChineseJapaneseLangGroup(mFrame); - gfxSkipCharsIterator justificationStart(mStart), justificationEnd(mStart); - FindJustificationRange(&justificationStart, &justificationEnd); + gfxSkipCharsIterator justificationEnd(mStart); + FindEndOfJustificationRange(&justificationEnd); nsSkipCharsRunIterator run(start, nsSkipCharsRunIterator::LENGTH_UNSKIPPED_ONLY, aLength); @@ -2161,8 +2160,7 @@ PropertyProvider::GetSpacingInternal(PRUint32 aStart, PRUint32 aLength, FindClusterEnd(mTextRun, run.GetOriginalOffset() + run.GetRunLength(), &iter); PRUint32 clusterLastChar = iter.GetSkippedOffset(); // Only apply justification to characters before justificationEnd - if (clusterFirstChar >= justificationStart.GetSkippedOffset() && - clusterLastChar < justificationEnd.GetSkippedOffset()) { + if (clusterLastChar < justificationEnd.GetSkippedOffset()) { aSpacing[clusterFirstChar - aStart].mBefore += halfJustificationSpace; aSpacing[clusterLastChar - aStart].mAfter += halfJustificationSpace; } @@ -2333,31 +2331,18 @@ static PRUint32 GetSkippedDistance(const gfxSkipCharsIterator& aStart, } void -PropertyProvider::FindJustificationRange(gfxSkipCharsIterator* aStart, - gfxSkipCharsIterator* aEnd) +PropertyProvider::FindEndOfJustificationRange(gfxSkipCharsIterator* aIter) { - NS_ASSERTION(aStart && aEnd, "aStart or/and aEnd is null"); - aStart->SetOriginalOffset(mStart.GetOriginalOffset()); - aEnd->SetOriginalOffset(mStart.GetOriginalOffset() + mLength); - - // Ignore first cluster at start of line for justification purposes - if (mFrame->GetStateBits() & TEXT_START_OF_LINE) { - while (aStart->GetOriginalOffset() < aEnd->GetOriginalOffset()) { - aStart->AdvanceOriginal(1); - if (!aStart->IsOriginalCharSkipped() && - mTextRun->IsClusterStart(aStart->GetSkippedOffset())) - break; - } - } + aIter->SetOriginalOffset(mStart.GetOriginalOffset() + mLength); // Ignore trailing cluster at end of line for justification purposes - if (mFrame->GetStateBits() & TEXT_END_OF_LINE) { - while (aEnd->GetOriginalOffset() > aStart->GetOriginalOffset()) { - aEnd->AdvanceOriginal(-1); - if (!aEnd->IsOriginalCharSkipped() && - mTextRun->IsClusterStart(aEnd->GetSkippedOffset())) - break; - } + if (!(mFrame->GetStateBits() & TEXT_END_OF_LINE)) + return; + while (aIter->GetOriginalOffset() > mStart.GetOriginalOffset()) { + aIter->AdvanceOriginal(-1); + if (!aIter->IsOriginalCharSkipped() && + mTextRun->IsClusterStart(aIter->GetSkippedOffset())) + break; } } @@ -2368,14 +2353,14 @@ PropertyProvider::SetupJustificationSpacing() mTextStyle->WhiteSpaceIsSignificant()) return; - gfxSkipCharsIterator start(mStart), end(mStart); + gfxSkipCharsIterator end(mStart); end.AdvanceOriginal(mLength); gfxSkipCharsIterator realEnd(end); - FindJustificationRange(&start, &end); + FindEndOfJustificationRange(&end); PRInt32 justifiableCharacters = - ComputeJustifiableCharacters(start.GetOriginalOffset(), - end.GetOriginalOffset() - start.GetOriginalOffset()); + ComputeJustifiableCharacters(mStart.GetOriginalOffset(), + end.GetOriginalOffset() - mStart.GetOriginalOffset()); if (justifiableCharacters == 0) { // Nothing to do, nothing is justifiable and we shouldn't have any // justification space assigned @@ -5481,8 +5466,8 @@ nsTextFrame::TrimTrailingWhiteSpace(nsPresContext* aPresContext, PropertyProvider provider(mTextRun, textStyle, frag, this, start, contentLength, nsnull, 0); PRBool isCJK = IsChineseJapaneseLangGroup(this); - gfxSkipCharsIterator justificationStart(iter), justificationEnd(iter); - provider.FindJustificationRange(&justificationStart, &justificationEnd); + gfxSkipCharsIterator justificationEnd(iter); + provider.FindEndOfJustificationRange(&justificationEnd); PRInt32 i; for (i = justificationEnd.GetOriginalOffset(); i < trimmed.GetEnd(); ++i) {