From 16af9cfadf4704f900b6b4105d8dbb82970f92c7 Mon Sep 17 00:00:00 2001 From: "roc+@cs.cmu.edu" Date: Sun, 2 Dec 2007 18:20:22 -0800 Subject: [PATCH] Backing out fix for bug 404624 because I think it's causing a mochitest to assert --- layout/generic/nsTextFrameThebes.cpp | 23 ++++------------------- 1 file changed, 4 insertions(+), 19 deletions(-) diff --git a/layout/generic/nsTextFrameThebes.cpp b/layout/generic/nsTextFrameThebes.cpp index a31911ff9e29..35f1dac6e3c8 100644 --- a/layout/generic/nsTextFrameThebes.cpp +++ b/layout/generic/nsTextFrameThebes.cpp @@ -1941,8 +1941,6 @@ static PRBool IsInBounds(const gfxSkipCharsIterator& aStart, PRInt32 aContentLen PRUint32 aOffset, PRUint32 aLength) { if (aStart.GetSkippedOffset() > aOffset) return PR_FALSE; - if (aContentLength == PR_INT32_MAX) - return PR_TRUE; gfxSkipCharsIterator iter(aStart); iter.AdvanceOriginal(aContentLength); return iter.GetSkippedOffset() >= aOffset + aLength; @@ -1954,11 +1952,6 @@ public: /** * Use this constructor for reflow, when we don't know what text is * really mapped by the frame and we have a lot of other data around. - * - * @param aLength can be PR_INT32_MAX to indicate we cover all the text - * associated with aFrame up to where its flow chain ends in the given - * textrun. If PR_INT32_MAX is passed, justification and hyphen-related methods - * cannot be called, nor can GetOriginalLength(). */ PropertyProvider(gfxTextRun* aTextRun, const nsStyleText* aTextStyle, const nsTextFragment* aFrag, nsTextFrame* aFrame, @@ -2032,10 +2025,7 @@ public: // (for the static provider) const gfxSkipCharsIterator& GetStart() { return mStart; } // May return PR_INT32_MAX if that was given to the constructor - PRUint32 GetOriginalLength() { - NS_ASSERTION(mLength != PR_INT32_MAX, "Length not known"); - return mLength; - } + PRUint32 GetOriginalLength() { return mLength; } const nsTextFragment* GetFragment() { return mFrag; } gfxFontGroup* GetFontGroup() { @@ -2061,7 +2051,7 @@ protected: gfxSkipCharsIterator mStart; // Offset in original and transformed string gfxSkipCharsIterator mTempIterator; nsTArray* mTabWidths; // widths for each transformed string character - PRInt32 mLength; // DOM string length, may be PR_INT32_MAX + PRInt32 mLength; // DOM string length gfxFloat mWordSpacing; // space for each whitespace char gfxFloat mLetterSpacing; // space for each letter gfxFloat mJustificationSpacing; @@ -2332,7 +2322,6 @@ PropertyProvider::GetHyphenationBreaks(PRUint32 aStart, PRUint32 aLength, PRPackedBool* aBreakBefore) { NS_PRECONDITION(IsInBounds(mStart, mLength, aStart, aLength), "Range out of bounds"); - NS_PRECONDITION(mLength != PR_INT32_MAX, "Can't call this with undefined length"); if (!mTextStyle->WhiteSpaceCanWrap()) { memset(aBreakBefore, PR_FALSE, aLength); @@ -2392,9 +2381,7 @@ void PropertyProvider::FindJustificationRange(gfxSkipCharsIterator* aStart, gfxSkipCharsIterator* aEnd) { - NS_PRECONDITION(mLength != PR_INT32_MAX, "Can't call this with undefined length"); NS_ASSERTION(aStart && aEnd, "aStart or/and aEnd is null"); - aStart->SetOriginalOffset(mStart.GetOriginalOffset()); aEnd->SetOriginalOffset(mStart.GetOriginalOffset() + mLength); @@ -2422,8 +2409,6 @@ PropertyProvider::FindJustificationRange(gfxSkipCharsIterator* aStart, void PropertyProvider::SetupJustificationSpacing() { - NS_PRECONDITION(mLength != PR_INT32_MAX, "Can't call this with undefined length"); - if (NS_STYLE_TEXT_ALIGN_JUSTIFY != mTextStyle->mTextAlign || mTextStyle->WhiteSpaceIsSignificant()) return; @@ -4858,7 +4843,7 @@ nsTextFrame::AddInlineMinWidthForFlow(nsIRenderingContext *aRenderingContext, // OK since we can't really handle tabs for intrinsic sizing anyway. const nsTextFragment* frag = mContent->GetText(); PropertyProvider provider(mTextRun, GetStyleText(), frag, this, - iter, PR_INT32_MAX, nsnull, 0); + iter, GetInFlowContentLength(), nsnull, 0); PRBool collapseWhitespace = !provider.GetStyleText()->WhiteSpaceIsSignificant(); PRUint32 start = @@ -4958,7 +4943,7 @@ nsTextFrame::AddInlinePrefWidthForFlow(nsIRenderingContext *aRenderingContext, // Pass null for the line container. This will disable tab spacing, but that's // OK since we can't really handle tabs for intrinsic sizing anyway. PropertyProvider provider(mTextRun, GetStyleText(), mContent->GetText(), this, - iter, PR_INT32_MAX, nsnull, 0); + iter, GetInFlowContentLength(), nsnull, 0); PRBool collapseWhitespace = !provider.GetStyleText()->WhiteSpaceIsSignificant(); PRUint32 start =