From c54256c90a4c041fd23baca2716bdeb9e64fc37d Mon Sep 17 00:00:00 2001 From: "rbs%maths.uq.edu.au" Date: Tue, 19 Oct 2004 07:12:55 +0000 Subject: [PATCH] Improves linebreak behavior at inter-tag boundaries, patch by Hideo Saito , r+sr=rbs git-svn-id: svn://10.0.0.236/trunk@164020 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/layout/generic/nsLineLayout.cpp | 6 ++++-- mozilla/layout/generic/nsTextFrame.cpp | 4 +++- mozilla/layout/html/base/src/nsLineLayout.cpp | 6 ++++-- mozilla/layout/html/base/src/nsTextFrame.cpp | 4 +++- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/mozilla/layout/generic/nsLineLayout.cpp b/mozilla/layout/generic/nsLineLayout.cpp index 91a88aac01f..3360baabb93 100644 --- a/mozilla/layout/generic/nsLineLayout.cpp +++ b/mozilla/layout/generic/nsLineLayout.cpp @@ -1482,8 +1482,10 @@ nsLineLayout::PlaceFrame(PerFrameData* pfd, nsHTMLReflowMetrics& aMetrics) SetFlag(LL_ENDSINWHITESPACE, PR_FALSE); } - // Count the number of frames on the line... - mTotalPlacedFrames++; + // Count the number of non-empty frames on the line... + if (!emptyFrame) { + mTotalPlacedFrames++; + } 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. diff --git a/mozilla/layout/generic/nsTextFrame.cpp b/mozilla/layout/generic/nsTextFrame.cpp index de9fdd50702..a5cd8a6cb9a 100644 --- a/mozilla/layout/generic/nsTextFrame.cpp +++ b/mozilla/layout/generic/nsTextFrame.cpp @@ -4584,7 +4584,7 @@ nsTextFrame::MeasureText(nsPresContext* aPresContext, aTs.mNormalFont->GetMaxDescent(aTextData.mDescent); } PRBool firstWordDone = PR_FALSE; - for (;;firstThing = PR_FALSE) { + for (;;) { #ifdef IBMBIDI if (nextBidi && (mContentLength <= 0) ) { if (textRun.IsBuffering()) { @@ -4690,6 +4690,7 @@ nsTextFrame::MeasureText(nsPresContext* aPresContext, mState |= TEXT_SKIP_LEADING_WS; continue; } + firstThing = PR_FALSE; // NOTE: Even if the textRun absorbs the whitespace below, we still // want to remember that we're breakable. @@ -4746,6 +4747,7 @@ nsTextFrame::MeasureText(nsPresContext* aPresContext, } //(aTextData.mMeasureText) } else { + firstThing = PR_FALSE; aTextData.mSkipWhitespace = PR_FALSE; if (aTextData.mFirstLetterOK) { diff --git a/mozilla/layout/html/base/src/nsLineLayout.cpp b/mozilla/layout/html/base/src/nsLineLayout.cpp index 91a88aac01f..3360baabb93 100644 --- a/mozilla/layout/html/base/src/nsLineLayout.cpp +++ b/mozilla/layout/html/base/src/nsLineLayout.cpp @@ -1482,8 +1482,10 @@ nsLineLayout::PlaceFrame(PerFrameData* pfd, nsHTMLReflowMetrics& aMetrics) SetFlag(LL_ENDSINWHITESPACE, PR_FALSE); } - // Count the number of frames on the line... - mTotalPlacedFrames++; + // Count the number of non-empty frames on the line... + if (!emptyFrame) { + mTotalPlacedFrames++; + } 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. diff --git a/mozilla/layout/html/base/src/nsTextFrame.cpp b/mozilla/layout/html/base/src/nsTextFrame.cpp index de9fdd50702..a5cd8a6cb9a 100644 --- a/mozilla/layout/html/base/src/nsTextFrame.cpp +++ b/mozilla/layout/html/base/src/nsTextFrame.cpp @@ -4584,7 +4584,7 @@ nsTextFrame::MeasureText(nsPresContext* aPresContext, aTs.mNormalFont->GetMaxDescent(aTextData.mDescent); } PRBool firstWordDone = PR_FALSE; - for (;;firstThing = PR_FALSE) { + for (;;) { #ifdef IBMBIDI if (nextBidi && (mContentLength <= 0) ) { if (textRun.IsBuffering()) { @@ -4690,6 +4690,7 @@ nsTextFrame::MeasureText(nsPresContext* aPresContext, mState |= TEXT_SKIP_LEADING_WS; continue; } + firstThing = PR_FALSE; // NOTE: Even if the textRun absorbs the whitespace below, we still // want to remember that we're breakable. @@ -4746,6 +4747,7 @@ nsTextFrame::MeasureText(nsPresContext* aPresContext, } //(aTextData.mMeasureText) } else { + firstThing = PR_FALSE; aTextData.mSkipWhitespace = PR_FALSE; if (aTextData.mFirstLetterOK) {