From 1253348a577f74322b6a29ec58662b3e7e03fedd Mon Sep 17 00:00:00 2001 From: "dbaron%dbaron.org" Date: Sun, 28 Sep 2003 22:56:08 +0000 Subject: [PATCH] Remove LL_TEXTSTARTSWITHNBSP, since it's a partial and broken solution to the problem, and it's in the wrong place. b=187899 r+sr=roc git-svn-id: svn://10.0.0.236/trunk@147413 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/layout/generic/nsLineLayout.cpp | 12 ------------ mozilla/layout/generic/nsLineLayout.h | 6 ------ mozilla/layout/generic/nsTextFrame.cpp | 8 -------- mozilla/layout/html/base/src/nsLineLayout.cpp | 12 ------------ mozilla/layout/html/base/src/nsLineLayout.h | 6 ------ mozilla/layout/html/base/src/nsTextFrame.cpp | 8 -------- 6 files changed, 52 deletions(-) diff --git a/mozilla/layout/generic/nsLineLayout.cpp b/mozilla/layout/generic/nsLineLayout.cpp index 023ecd01b11..dd3c02cc35c 100644 --- a/mozilla/layout/generic/nsLineLayout.cpp +++ b/mozilla/layout/generic/nsLineLayout.cpp @@ -262,7 +262,6 @@ nsLineLayout::BeginLineReflow(nscoord aX, nscoord aY, SetFlag(LL_ENDSINWHITESPACE, PR_TRUE); SetFlag(LL_UNDERSTANDSNWHITESPACE, PR_FALSE); - SetFlag(LL_TEXTSTARTSWITHNBSP, PR_FALSE); SetFlag(LL_FIRSTLETTERSTYLEOK, PR_FALSE); SetFlag(LL_ISTOPOFPAGE, aIsTopOfPage); SetFlag(LL_UPDATEDBAND, PR_FALSE); @@ -932,7 +931,6 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame, reflowState.mLineLayout = this; reflowState.mFlags.mIsTopOfPage = GetFlag(LL_ISTOPOFPAGE); SetFlag(LL_UNDERSTANDSNWHITESPACE, PR_FALSE); - SetFlag(LL_TEXTSTARTSWITHNBSP, PR_FALSE); mTextJustificationNumSpaces = 0; mTextJustificationNumLetters = 0; @@ -1262,7 +1260,6 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame, else { PushFrame(aFrame); } - SetFlag(LL_TEXTSTARTSWITHNBSP, PR_FALSE); // reset for next time #ifdef REALLY_NOISY_REFLOW nsFrame::IndentBy(stdout, mSpanDepth); @@ -1520,15 +1517,6 @@ nsLineLayout::CanPlaceFrame(PerFrameData* pfd, return PR_TRUE; } - // Yet another special check. If the text happens to have started - // with a non-breaking space, then we make it sticky on its left - // edge...Which means that whatever piece of text we just formatted - // will be the piece that fits (the text frame logic knows to stop - // when it runs out of room). - if (pfd->GetFlag(PFD_ISNONEMPTYTEXTFRAME) && GetFlag(LL_TEXTSTARTSWITHNBSP)) { - return PR_TRUE; - } - #ifdef NOISY_CAN_PLACE_FRAME printf(" ==> didn't fit\n"); #endif diff --git a/mozilla/layout/generic/nsLineLayout.h b/mozilla/layout/generic/nsLineLayout.h index 71467b7a9e4..580d4c0d8ce 100644 --- a/mozilla/layout/generic/nsLineLayout.h +++ b/mozilla/layout/generic/nsLineLayout.h @@ -131,7 +131,6 @@ public: protected: #define LL_ENDSINWHITESPACE 0x00000001 #define LL_UNDERSTANDSNWHITESPACE 0x00000002 -#define LL_TEXTSTARTSWITHNBSP 0x00000004 #define LL_FIRSTLETTERSTYLEOK 0x00000008 #define LL_ISTOPOFPAGE 0x00000010 #define LL_UPDATEDBAND 0x00000020 @@ -185,11 +184,6 @@ public: mTextJustificationNumLetters = aNumLetters; } - - void SetTextStartsWithNBSP(PRBool aYes) { - SetFlag(LL_TEXTSTARTSWITHNBSP, aYes); - } - void RecordWordFrame(nsIFrame* aWordFrame) { mWordFrames.Push(aWordFrame); } diff --git a/mozilla/layout/generic/nsTextFrame.cpp b/mozilla/layout/generic/nsTextFrame.cpp index fdf4e5d4344..49f758ceeed 100644 --- a/mozilla/layout/generic/nsTextFrame.cpp +++ b/mozilla/layout/generic/nsTextFrame.cpp @@ -4594,7 +4594,6 @@ nsTextFrame::MeasureText(nsIPresContext* aPresContext, nscoord prevMaxWordWidth = 0, prevAscent = 0, prevDescent = 0; PRInt32 lastWordLen = 0; PRUnichar* lastWordPtr = nsnull; - PRBool textStartsWithNBSP = PR_FALSE; PRBool endsInWhitespace = PR_FALSE; PRBool endsInNewline = PR_FALSE; PRBool justDidFirstLetter = PR_FALSE; @@ -4813,12 +4812,6 @@ nsTextFrame::MeasureText(nsIPresContext* aPresContext, } //(aTextData.mMeasureText) } else { - // See if the first thing in the section of text is a - // non-breaking space (html nbsp entity). If it is then make - // note of that fact for the line layout logic. - if (aTextData.mWrapping && firstThing && (firstChar == ' ')) { - textStartsWithNBSP = PR_TRUE; - } aTextData.mSkipWhitespace = PR_FALSE; if (aTextData.mFirstLetterOK) { @@ -5186,7 +5179,6 @@ nsTextFrame::MeasureText(nsIPresContext* aPresContext, // effect the current setting of the ends-in-whitespace flag. lineLayout.SetColumn(column); lineLayout.SetUnderstandsWhiteSpace(PR_TRUE); - lineLayout.SetTextStartsWithNBSP(textStartsWithNBSP); if (0 != aTextData.mX) { lineLayout.SetEndsInWhiteSpace(endsInWhitespace); } diff --git a/mozilla/layout/html/base/src/nsLineLayout.cpp b/mozilla/layout/html/base/src/nsLineLayout.cpp index 023ecd01b11..dd3c02cc35c 100644 --- a/mozilla/layout/html/base/src/nsLineLayout.cpp +++ b/mozilla/layout/html/base/src/nsLineLayout.cpp @@ -262,7 +262,6 @@ nsLineLayout::BeginLineReflow(nscoord aX, nscoord aY, SetFlag(LL_ENDSINWHITESPACE, PR_TRUE); SetFlag(LL_UNDERSTANDSNWHITESPACE, PR_FALSE); - SetFlag(LL_TEXTSTARTSWITHNBSP, PR_FALSE); SetFlag(LL_FIRSTLETTERSTYLEOK, PR_FALSE); SetFlag(LL_ISTOPOFPAGE, aIsTopOfPage); SetFlag(LL_UPDATEDBAND, PR_FALSE); @@ -932,7 +931,6 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame, reflowState.mLineLayout = this; reflowState.mFlags.mIsTopOfPage = GetFlag(LL_ISTOPOFPAGE); SetFlag(LL_UNDERSTANDSNWHITESPACE, PR_FALSE); - SetFlag(LL_TEXTSTARTSWITHNBSP, PR_FALSE); mTextJustificationNumSpaces = 0; mTextJustificationNumLetters = 0; @@ -1262,7 +1260,6 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame, else { PushFrame(aFrame); } - SetFlag(LL_TEXTSTARTSWITHNBSP, PR_FALSE); // reset for next time #ifdef REALLY_NOISY_REFLOW nsFrame::IndentBy(stdout, mSpanDepth); @@ -1520,15 +1517,6 @@ nsLineLayout::CanPlaceFrame(PerFrameData* pfd, return PR_TRUE; } - // Yet another special check. If the text happens to have started - // with a non-breaking space, then we make it sticky on its left - // edge...Which means that whatever piece of text we just formatted - // will be the piece that fits (the text frame logic knows to stop - // when it runs out of room). - if (pfd->GetFlag(PFD_ISNONEMPTYTEXTFRAME) && GetFlag(LL_TEXTSTARTSWITHNBSP)) { - return PR_TRUE; - } - #ifdef NOISY_CAN_PLACE_FRAME printf(" ==> didn't fit\n"); #endif diff --git a/mozilla/layout/html/base/src/nsLineLayout.h b/mozilla/layout/html/base/src/nsLineLayout.h index 71467b7a9e4..580d4c0d8ce 100644 --- a/mozilla/layout/html/base/src/nsLineLayout.h +++ b/mozilla/layout/html/base/src/nsLineLayout.h @@ -131,7 +131,6 @@ public: protected: #define LL_ENDSINWHITESPACE 0x00000001 #define LL_UNDERSTANDSNWHITESPACE 0x00000002 -#define LL_TEXTSTARTSWITHNBSP 0x00000004 #define LL_FIRSTLETTERSTYLEOK 0x00000008 #define LL_ISTOPOFPAGE 0x00000010 #define LL_UPDATEDBAND 0x00000020 @@ -185,11 +184,6 @@ public: mTextJustificationNumLetters = aNumLetters; } - - void SetTextStartsWithNBSP(PRBool aYes) { - SetFlag(LL_TEXTSTARTSWITHNBSP, aYes); - } - void RecordWordFrame(nsIFrame* aWordFrame) { mWordFrames.Push(aWordFrame); } diff --git a/mozilla/layout/html/base/src/nsTextFrame.cpp b/mozilla/layout/html/base/src/nsTextFrame.cpp index fdf4e5d4344..49f758ceeed 100644 --- a/mozilla/layout/html/base/src/nsTextFrame.cpp +++ b/mozilla/layout/html/base/src/nsTextFrame.cpp @@ -4594,7 +4594,6 @@ nsTextFrame::MeasureText(nsIPresContext* aPresContext, nscoord prevMaxWordWidth = 0, prevAscent = 0, prevDescent = 0; PRInt32 lastWordLen = 0; PRUnichar* lastWordPtr = nsnull; - PRBool textStartsWithNBSP = PR_FALSE; PRBool endsInWhitespace = PR_FALSE; PRBool endsInNewline = PR_FALSE; PRBool justDidFirstLetter = PR_FALSE; @@ -4813,12 +4812,6 @@ nsTextFrame::MeasureText(nsIPresContext* aPresContext, } //(aTextData.mMeasureText) } else { - // See if the first thing in the section of text is a - // non-breaking space (html nbsp entity). If it is then make - // note of that fact for the line layout logic. - if (aTextData.mWrapping && firstThing && (firstChar == ' ')) { - textStartsWithNBSP = PR_TRUE; - } aTextData.mSkipWhitespace = PR_FALSE; if (aTextData.mFirstLetterOK) { @@ -5186,7 +5179,6 @@ nsTextFrame::MeasureText(nsIPresContext* aPresContext, // effect the current setting of the ends-in-whitespace flag. lineLayout.SetColumn(column); lineLayout.SetUnderstandsWhiteSpace(PR_TRUE); - lineLayout.SetTextStartsWithNBSP(textStartsWithNBSP); if (0 != aTextData.mX) { lineLayout.SetEndsInWhiteSpace(endsInWhitespace); }