Back out the patch for bug 399159 because it's suspected of having caused the Tp regression

This commit is contained in:
gavin%gavinsharp.com 2007-10-17 17:03:09 +00:00
Родитель 5793ff6c5c
Коммит e7c20bae80
1 изменённых файлов: 19 добавлений и 34 удалений

Просмотреть файл

@ -1971,8 +1971,7 @@ public:
* Count the number of justifiable characters in the given DOM range * Count the number of justifiable characters in the given DOM range
*/ */
PRUint32 ComputeJustifiableCharacters(PRInt32 aOffset, PRInt32 aLength); PRUint32 ComputeJustifiableCharacters(PRInt32 aOffset, PRInt32 aLength);
void FindJustificationRange(gfxSkipCharsIterator* aStart, void FindEndOfJustificationRange(gfxSkipCharsIterator* aIter);
gfxSkipCharsIterator* aEnd);
const nsStyleText* GetStyleText() { return mTextStyle; } const nsStyleText* GetStyleText() { return mTextStyle; }
nsTextFrame* GetFrame() { return mFrame; } nsTextFrame* GetFrame() { return mFrame; }
@ -2144,8 +2143,8 @@ PropertyProvider::GetSpacingInternal(PRUint32 aStart, PRUint32 aLength,
// Scan non-skipped characters and adjust justifiable chars, adding // Scan non-skipped characters and adjust justifiable chars, adding
// justification space on either side of the cluster // justification space on either side of the cluster
PRBool isCJK = IsChineseJapaneseLangGroup(mFrame); PRBool isCJK = IsChineseJapaneseLangGroup(mFrame);
gfxSkipCharsIterator justificationStart(mStart), justificationEnd(mStart); gfxSkipCharsIterator justificationEnd(mStart);
FindJustificationRange(&justificationStart, &justificationEnd); FindEndOfJustificationRange(&justificationEnd);
nsSkipCharsRunIterator nsSkipCharsRunIterator
run(start, nsSkipCharsRunIterator::LENGTH_UNSKIPPED_ONLY, aLength); run(start, nsSkipCharsRunIterator::LENGTH_UNSKIPPED_ONLY, aLength);
@ -2161,8 +2160,7 @@ PropertyProvider::GetSpacingInternal(PRUint32 aStart, PRUint32 aLength,
FindClusterEnd(mTextRun, run.GetOriginalOffset() + run.GetRunLength(), &iter); FindClusterEnd(mTextRun, run.GetOriginalOffset() + run.GetRunLength(), &iter);
PRUint32 clusterLastChar = iter.GetSkippedOffset(); PRUint32 clusterLastChar = iter.GetSkippedOffset();
// Only apply justification to characters before justificationEnd // Only apply justification to characters before justificationEnd
if (clusterFirstChar >= justificationStart.GetSkippedOffset() && if (clusterLastChar < justificationEnd.GetSkippedOffset()) {
clusterLastChar < justificationEnd.GetSkippedOffset()) {
aSpacing[clusterFirstChar - aStart].mBefore += halfJustificationSpace; aSpacing[clusterFirstChar - aStart].mBefore += halfJustificationSpace;
aSpacing[clusterLastChar - aStart].mAfter += halfJustificationSpace; aSpacing[clusterLastChar - aStart].mAfter += halfJustificationSpace;
} }
@ -2333,33 +2331,20 @@ static PRUint32 GetSkippedDistance(const gfxSkipCharsIterator& aStart,
} }
void void
PropertyProvider::FindJustificationRange(gfxSkipCharsIterator* aStart, PropertyProvider::FindEndOfJustificationRange(gfxSkipCharsIterator* aIter)
gfxSkipCharsIterator* aEnd)
{ {
NS_ASSERTION(aStart && aEnd, "aStart or/and aEnd is null"); aIter->SetOriginalOffset(mStart.GetOriginalOffset() + mLength);
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;
}
}
// Ignore trailing cluster at end of line for justification purposes // Ignore trailing cluster at end of line for justification purposes
if (mFrame->GetStateBits() & TEXT_END_OF_LINE) { if (!(mFrame->GetStateBits() & TEXT_END_OF_LINE))
while (aEnd->GetOriginalOffset() > aStart->GetOriginalOffset()) { return;
aEnd->AdvanceOriginal(-1); while (aIter->GetOriginalOffset() > mStart.GetOriginalOffset()) {
if (!aEnd->IsOriginalCharSkipped() && aIter->AdvanceOriginal(-1);
mTextRun->IsClusterStart(aEnd->GetSkippedOffset())) if (!aIter->IsOriginalCharSkipped() &&
mTextRun->IsClusterStart(aIter->GetSkippedOffset()))
break; break;
} }
} }
}
void void
PropertyProvider::SetupJustificationSpacing() PropertyProvider::SetupJustificationSpacing()
@ -2368,14 +2353,14 @@ PropertyProvider::SetupJustificationSpacing()
mTextStyle->WhiteSpaceIsSignificant()) mTextStyle->WhiteSpaceIsSignificant())
return; return;
gfxSkipCharsIterator start(mStart), end(mStart); gfxSkipCharsIterator end(mStart);
end.AdvanceOriginal(mLength); end.AdvanceOriginal(mLength);
gfxSkipCharsIterator realEnd(end); gfxSkipCharsIterator realEnd(end);
FindJustificationRange(&start, &end); FindEndOfJustificationRange(&end);
PRInt32 justifiableCharacters = PRInt32 justifiableCharacters =
ComputeJustifiableCharacters(start.GetOriginalOffset(), ComputeJustifiableCharacters(mStart.GetOriginalOffset(),
end.GetOriginalOffset() - start.GetOriginalOffset()); end.GetOriginalOffset() - mStart.GetOriginalOffset());
if (justifiableCharacters == 0) { if (justifiableCharacters == 0) {
// Nothing to do, nothing is justifiable and we shouldn't have any // Nothing to do, nothing is justifiable and we shouldn't have any
// justification space assigned // justification space assigned
@ -5481,8 +5466,8 @@ nsTextFrame::TrimTrailingWhiteSpace(nsPresContext* aPresContext,
PropertyProvider provider(mTextRun, textStyle, frag, this, start, contentLength, PropertyProvider provider(mTextRun, textStyle, frag, this, start, contentLength,
nsnull, 0); nsnull, 0);
PRBool isCJK = IsChineseJapaneseLangGroup(this); PRBool isCJK = IsChineseJapaneseLangGroup(this);
gfxSkipCharsIterator justificationStart(iter), justificationEnd(iter); gfxSkipCharsIterator justificationEnd(iter);
provider.FindJustificationRange(&justificationStart, &justificationEnd); provider.FindEndOfJustificationRange(&justificationEnd);
PRInt32 i; PRInt32 i;
for (i = justificationEnd.GetOriginalOffset(); i < trimmed.GetEnd(); ++i) { for (i = justificationEnd.GetOriginalOffset(); i < trimmed.GetEnd(); ++i) {