From 0b989b691c92e92360ea2174bac2acb04dd69924 Mon Sep 17 00:00:00 2001 From: "roc+@cs.cmu.edu" Date: Tue, 29 Jan 2008 23:35:05 -0800 Subject: [PATCH] Backing out 400813, sigh --- layout/generic/nsLineLayout.cpp | 20 +++++-------------- layout/generic/nsLineLayout.h | 1 - layout/generic/nsTextFrame.h | 12 ----------- layout/generic/nsTextFrameThebes.cpp | 8 ++------ layout/reftests/bugs/398144-1-ref.html | 3 +-- layout/reftests/bugs/reftest.list | 2 +- .../line-breaking/non-breakable-1-ref.html | 1 - .../line-breaking/non-breakable-1.html | 1 - 8 files changed, 9 insertions(+), 39 deletions(-) diff --git a/layout/generic/nsLineLayout.cpp b/layout/generic/nsLineLayout.cpp index e63cc73f103b..8f9d382ae82d 100644 --- a/layout/generic/nsLineLayout.cpp +++ b/layout/generic/nsLineLayout.cpp @@ -395,7 +395,6 @@ nsLineLayout::NewPerSpanData(PerSpanData** aResult) psd->mLastFrame = nsnull; psd->mContainsFloat = PR_FALSE; psd->mZeroEffectiveSpanBox = PR_FALSE; - psd->mHasNonemptyContent = PR_FALSE; #ifdef DEBUG mSpansAllocated++; @@ -888,11 +887,11 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame, else if (nsGkAtoms::textFrame == frameType) { // Note non-empty text-frames for inline frame compatibility hackery pfd->SetFlag(PFD_ISTEXTFRAME, PR_TRUE); - nsTextFrame* textFrame = static_cast(pfd->mFrame); - if (textFrame->HasNoncollapsedCharacters()) { - psd->mHasNonemptyContent = PR_TRUE; + // XXX An empty text frame at the end of the line seems not + // to have zero width. + if (metrics.width) { pfd->SetFlag(PFD_ISNONEMPTYTEXTFRAME, PR_TRUE); - nsIContent* content = textFrame->GetContent(); + nsIContent* content = pfd->mFrame->GetContent(); const nsTextFragment* frag = content->GetText(); if (frag) { @@ -922,13 +921,6 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame, } else if (nsGkAtoms::brFrame == frameType) { pfd->SetFlag(PFD_SKIPWHENTRIMMINGWHITESPACE, PR_TRUE); - psd->mHasNonemptyContent = PR_TRUE; - } else if (pfd->mSpan) { - if (pfd->mSpan->mHasNonemptyContent || !pfd->mFrame->IsSelfEmpty()) { - psd->mHasNonemptyContent = PR_TRUE; - } - } else { - psd->mHasNonemptyContent = PR_TRUE; } } @@ -1312,9 +1304,7 @@ nsLineLayout::PlaceFrame(PerFrameData* pfd, nsHTMLReflowMetrics& aMetrics) // Count the number of non-empty frames on the line... if (!emptyFrame) { mTotalPlacedFrames++; - NS_ASSERTION(psd->mHasNonemptyContent, "We should have detected this nonempty content"); } - // XXX roc why not just check !emptyFrame again here? if (psd->mX != psd->mLeftEdge || pfd->mBounds.x != psd->mLeftEdge) { // As soon as a frame placed on the line advances an X coordinate // of any span we can no longer place a float on the line. @@ -2067,7 +2057,7 @@ nsLineLayout::VerticalAlignFrames(PerSpanData* psd) } } if (applyMinLH) { - if (psd->mHasNonemptyContent || preMode || foundLI) { + if ((psd->mX != psd->mLeftEdge) || preMode || foundLI) { #ifdef NOISY_VERTICAL_ALIGN printf(" [span]==> adjusting min/maxY: currentValues: %d,%d", minY, maxY); #endif diff --git a/layout/generic/nsLineLayout.h b/layout/generic/nsLineLayout.h index 3b0352fdb80d..6b6855116a35 100644 --- a/layout/generic/nsLineLayout.h +++ b/layout/generic/nsLineLayout.h @@ -468,7 +468,6 @@ protected: PRPackedBool mChangedFrameDirection; PRPackedBool mZeroEffectiveSpanBox; PRPackedBool mContainsFloat; - PRPackedBool mHasNonemptyContent; nscoord mLeftEdge; nscoord mX; diff --git a/layout/generic/nsTextFrame.h b/layout/generic/nsTextFrame.h index ef5df3ffa9d3..419043807e66 100644 --- a/layout/generic/nsTextFrame.h +++ b/layout/generic/nsTextFrame.h @@ -58,10 +58,6 @@ class nsTextPaintStyle; class PropertyProvider; -// This state bit is set on frames that have some non-collapsed characters after -// reflow -#define TEXT_HAS_NONCOLLAPSED_CHARACTERS 0x02000000 - class nsTextFrame : public nsFrame { public: friend class nsContinuingTextFrame; @@ -193,14 +189,6 @@ public: */ PRBool IsAtEndOfLine() const; - /** - * Call this only after reflow the frame. Returns true if non-collapsed - * characters are present. - */ - PRBool HasNoncollapsedCharacters() const { - return (GetStateBits() & TEXT_HAS_NONCOLLAPSED_CHARACTERS) != 0; - } - #ifdef ACCESSIBILITY NS_IMETHOD GetAccessible(nsIAccessible** aAccessible); #endif diff --git a/layout/generic/nsTextFrameThebes.cpp b/layout/generic/nsTextFrameThebes.cpp index f10b87286e5b..cd9f50559d85 100644 --- a/layout/generic/nsTextFrameThebes.cpp +++ b/layout/generic/nsTextFrameThebes.cpp @@ -145,10 +145,7 @@ #define TEXT_REFLOW_FLAGS \ (TEXT_FIRST_LETTER|TEXT_START_OF_LINE|TEXT_END_OF_LINE|TEXT_HYPHEN_BREAK| \ - TEXT_TRIMMED_TRAILING_WHITESPACE|TEXT_HAS_NONCOLLAPSED_CHARACTERS) - -// defined in nsTextFrame.h -// #define TEXT_HAS_NONCOLLAPSED_CHARACTERS 0x02000000 + TEXT_TRIMMED_TRAILING_WHITESPACE) // Cache bits for IsEmpty(). // Set this bit if the textframe is known to be only collapsible whitespace. @@ -5516,7 +5513,6 @@ nsTextFrame::Reflow(nsPresContext* aPresContext, // frame to accumulate with trimmable width from this frame.) if (transformedCharsFit > 0) { lineLayout.SetTrimmableWidth(NSToCoordFloor(trimmableWidth)); - AddStateBits(TEXT_HAS_NONCOLLAPSED_CHARACTERS); } if (charsFit > 0 && charsFit == length && HasSoftHyphenBefore(frag, mTextRun, offset, end)) { @@ -5864,7 +5860,7 @@ nsIAtom* nsTextFrame::GetType() const { return nsGkAtoms::textFrame; -} +} /* virtual */ PRBool nsTextFrame::IsEmpty() diff --git a/layout/reftests/bugs/398144-1-ref.html b/layout/reftests/bugs/398144-1-ref.html index b9e09bedd348..41bd423a25c6 100644 --- a/layout/reftests/bugs/398144-1-ref.html +++ b/layout/reftests/bugs/398144-1-ref.html @@ -2,8 +2,7 @@
-
blank line
+
- diff --git a/layout/reftests/bugs/reftest.list b/layout/reftests/bugs/reftest.list index 2818c528d9c3..942fb75d31e6 100644 --- a/layout/reftests/bugs/reftest.list +++ b/layout/reftests/bugs/reftest.list @@ -680,7 +680,7 @@ random == 403134-1.html 403134-1-ref.html # bug 405377 != 409659-1b.html 409659-1-ref.html != 409659-1c.html 409659-1-ref.html == 409659-1d.html 409659-1-ref.html -== 400813-1.html 400813-1-ref.html +# == 400813-1.html 400813-1-ref.html == 412679-1.html 412679-1-ref.html == 412679-2.html 412679-2-ref.html == 411334-1.xml 411334-1-ref.xml diff --git a/layout/reftests/line-breaking/non-breakable-1-ref.html b/layout/reftests/line-breaking/non-breakable-1-ref.html index b8a1fb87b8ab..bfaf1528dc8e 100755 --- a/layout/reftests/line-breaking/non-breakable-1-ref.html +++ b/layout/reftests/line-breaking/non-breakable-1-ref.html @@ -1,4 +1,3 @@ - diff --git a/layout/reftests/line-breaking/non-breakable-1.html b/layout/reftests/line-breaking/non-breakable-1.html index 3ee9222c6871..f57b86a0152f 100755 --- a/layout/reftests/line-breaking/non-breakable-1.html +++ b/layout/reftests/line-breaking/non-breakable-1.html @@ -1,4 +1,3 @@ -