Bug 392829. Clean up nsLineLayout code that's not used (or at least used differently). r+sr+a=dbaron

git-svn-id: svn://10.0.0.236/trunk@237043 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
roc+%cs.cmu.edu
2007-10-02 02:36:26 +00:00
parent fd38fb09eb
commit 6351387599
4 changed files with 20 additions and 129 deletions

View File

@@ -128,7 +128,7 @@ BRFrame::Reflow(nsPresContext* aPresContext,
// Note that the compatibility mode check excludes AlmostStandards
// mode, since this is the inline box model. See bug 161691.
if ( ll->CanPlaceFloatNow() ||
ll->GetCompatMode() == eCompatibility_FullStandards ) {
aPresContext->CompatibilityMode() == eCompatibility_FullStandards ) {
// If we can place a float on the line now it means that the
// line is effectively empty (there may be zero sized compressed
// white-space frames on the line, but they are to be ignored).

View File

@@ -101,7 +101,6 @@ nsLineLayout::nsLineLayout(nsPresContext* aPresContext,
mForceBreakContent(nsnull),
mLastOptionalBreakContentOffset(-1),
mForceBreakContentOffset(-1),
mTrailingTextFrame(nsnull),
mBlockRS(nsnull),/* XXX temporary */
mMinLineHeight(0),
mTextIndent(0)
@@ -115,9 +114,7 @@ nsLineLayout::nsLineLayout(nsPresContext* aPresContext,
mStyleText = aOuterReflowState->frame->GetStyleText();
mTextAlign = mStyleText->mTextAlign;
mLineNumber = 0;
mColumn = 0;
mFlags = 0; // default all flags to false except those that follow here...
SetFlag(LL_ENDSINWHITESPACE, PR_TRUE);
mPlacedFloats = 0;
mTotalPlacedFrames = 0;
mTopEdge = 0;
@@ -137,8 +134,6 @@ nsLineLayout::nsLineLayout(nsPresContext* aPresContext,
SetFlag(LL_GOTLINEBOX, PR_TRUE);
mLineBox = *aLine;
}
mCompatMode = mPresContext->CompatibilityMode();
}
nsLineLayout::~nsLineLayout()
@@ -201,10 +196,6 @@ nsLineLayout::BeginLineReflow(nscoord aX, nscoord aY,
mSpansAllocated = mSpansFreed = mFramesAllocated = mFramesFreed = 0;
#endif
mColumn = 0;
SetFlag(LL_ENDSINWHITESPACE, PR_TRUE);
SetFlag(LL_UNDERSTANDSNWHITESPACE, PR_FALSE);
SetFlag(LL_FIRSTLETTERSTYLEOK, PR_FALSE);
SetFlag(LL_ISTOPOFPAGE, aIsTopOfPage);
SetFlag(LL_UPDATEDBAND, PR_FALSE);
@@ -813,7 +804,6 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame,
aFrame, availSize);
reflowState.mLineLayout = this;
reflowState.mFlags.mIsTopOfPage = GetFlag(LL_ISTOPOFPAGE);
SetFlag(LL_UNDERSTANDSNWHITESPACE, PR_FALSE);
mTextJustificationNumSpaces = 0;
mTextJustificationNumLetters = 0;
@@ -1044,8 +1034,7 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame,
}
if (!continuingTextRun) {
SetFlag(LL_INWORD, PR_FALSE);
mTrailingTextFrame = nsnull;
SetHasTrailingTextFrame(PR_FALSE);
if (!psd->mNoWrap && (!CanPlaceFloatNow() || placedFloat)) {
// record soft break opportunity after this content that can't be
// part of a text run. This is not a text frame so we know
@@ -1323,13 +1312,6 @@ nsLineLayout::PlaceFrame(PerFrameData* pfd, nsHTMLReflowMetrics& aMetrics)
// Advance to next X coordinate
psd->mX = pfd->mBounds.XMost() + (ltr ? pfd->mMargin.right : pfd->mMargin.left);
// If the frame is a not aware of white-space and it takes up some
// width, disable leading white-space compression for the next frame
// to be reflowed.
if ((!GetFlag(LL_UNDERSTANDSNWHITESPACE)) && pfd->mBounds.width) {
SetFlag(LL_ENDSINWHITESPACE, PR_FALSE);
}
// Count the number of non-empty frames on the line...
if (!emptyFrame) {
mTotalPlacedFrames++;
@@ -1621,7 +1603,7 @@ nsLineLayout::VerticalAlignFrames(PerSpanData* psd)
nsFrame::ListTag(stdout, spanFrame);
printf(": preMode=%s strictMode=%s w/h=%d,%d emptyContinuation=%s",
preMode ? "yes" : "no",
InStrictMode() ? "yes" : "no",
mPresContext->CompatibilityMode() != eCompatibility_NavQuirks ? "yes" : "no",
spanFramePFD->mBounds.width, spanFramePFD->mBounds.height,
emptyContinuation ? "yes" : "no");
if (psd != mRootSpan) {
@@ -1672,7 +1654,8 @@ nsLineLayout::VerticalAlignFrames(PerSpanData* psd)
// checks don't make sense for them.
// XXXldb This should probably just use nsIFrame::IsSelfEmpty, assuming that
// it agrees with this code. (If it doesn't agree, it probably should.)
if ((emptyContinuation || mCompatMode != eCompatibility_FullStandards) &&
if ((emptyContinuation ||
mPresContext->CompatibilityMode() != eCompatibility_FullStandards) &&
((psd == mRootSpan) ||
((0 == spanFramePFD->mBorderPadding.top) &&
(0 == spanFramePFD->mBorderPadding.right) &&
@@ -2012,7 +1995,7 @@ nsLineLayout::VerticalAlignFrames(PerSpanData* psd)
yBottom = yTop + logicalHeight;
}
if (!preMode &&
GetCompatMode() != eCompatibility_FullStandards &&
mPresContext->CompatibilityMode() != eCompatibility_FullStandards &&
!logicalHeight) {
// Check if it's a BR frame that is not alone on its line (it
// is given a height of zero to indicate this), and if so reset

View File

@@ -77,14 +77,6 @@ public:
mLineNumber = aLineNumber;
}
PRInt32 GetColumn() {
return mColumn;
}
void SetColumn(PRInt32 aNewColumn) {
mColumn = aNewColumn;
}
PRInt32 GetLineNumber() const {
return mLineNumber;
}
@@ -144,9 +136,6 @@ public:
// Supporting methods and data for flags
protected:
#define LL_ENDSINWHITESPACE 0x00000001
#define LL_UNDERSTANDSNWHITESPACE 0x00000002
#define LL_INWORD 0x00000004
#define LL_FIRSTLETTERSTYLEOK 0x00000008
#define LL_ISTOPOFPAGE 0x00000010
#define LL_UPDATEDBAND 0x00000020
@@ -154,14 +143,8 @@ protected:
#define LL_LASTFLOATWASLETTERFRAME 0x00000080
#define LL_CANPLACEFLOAT 0x00000100
#define LL_LINEENDSINBR 0x00000200
// The "soft-break" flag differs from the "hard-break" flag of <br>. The
// "soft-break" means that a whitespace has been trimmed at the end of the line,
// and therefore its width has not been accounted for (this width can actually be
// large, e.g., if a large word-spacing is set). LL should not be misled into
// placing something where the whitespace was trimmed. See bug 329987.
#define LL_LINEENDSINSOFTBR 0x00000400
#define LL_HASTRAILINGTEXTFRAME 0x00000400
#define LL_NEEDBACKUP 0x00000800
#define LL_LASTTEXTFRAME_WRAPPINGENABLED 0x00001000
#define LL_INFIRSTLINE 0x00002000
#define LL_GOTLINEBOX 0x00004000
#define LL_LASTFLAG LL_GOTLINEBOX
@@ -190,20 +173,7 @@ protected:
public:
// Support methods for white-space compression and word-wrapping
// during line reflow
void SetEndsInWhiteSpace(PRBool aState) {
SetFlag(LL_ENDSINWHITESPACE, aState);
}
PRBool GetEndsInWhiteSpace() const {
return GetFlag(LL_ENDSINWHITESPACE);
}
void SetUnderstandsWhiteSpace(PRBool aSetting) {
SetFlag(LL_UNDERSTANDSNWHITESPACE, aSetting);
}
// Support methods for word-wrapping during line reflow
void SetTextJustificationWeights(PRInt32 aNumSpaces, PRInt32 aNumLetters) {
mTextJustificationNumSpaces = aNumSpaces;
@@ -224,26 +194,6 @@ public:
SetFlag(LL_LINEENDSINBR, aOn);
}
PRBool GetLineEndsInSoftBR() const
{
return GetFlag(LL_LINEENDSINSOFTBR);
}
void SetLineEndsInSoftBR(PRBool aOn)
{
SetFlag(LL_LINEENDSINSOFTBR, aOn);
}
PRBool InStrictMode() const
{
return mCompatMode != eCompatibility_NavQuirks;
}
nsCompatibility GetCompatMode() const
{
return mCompatMode;
}
//----------------------------------------
// Inform the line-layout about the presence of a floating frame
// XXX get rid of this: use get-frame-type?
@@ -255,36 +205,17 @@ public:
return mBlockRS->AddFloat(*this, aFrame, PR_FALSE, aReflowStatus);
}
/**
* InWord is true when the last text frame reflowed ended in non-whitespace
* (so it has content that might form a word with subsequent text).
*
* If GetTrailingTextFrame is null then InWord will be false.
*/
PRBool InWord() {
return GetFlag(LL_INWORD);
}
void SetInWord(PRBool aInWord) {
SetFlag(LL_INWORD, aInWord);
}
/**
* If the last content placed on the line (not counting inline containers)
* was text, and can form a contiguous text flow with the next content to be
* placed, and is not just a frame of all-skipped whitespace, this is the
* frame for that last content ... otherwise it's null.
*
* @param aWrappingEnabled whether that text had word-wrapping enabled
* (white-space:normal or -moz-pre-wrap)
* placed, and is not just a frame of all-skipped whitespace, this flag is
* true.
*/
nsIFrame* GetTrailingTextFrame(PRBool* aWrappingEnabled) const {
*aWrappingEnabled = GetFlag(LL_LASTTEXTFRAME_WRAPPINGENABLED);
return mTrailingTextFrame;
PRBool HasTrailingTextFrame() const {
return GetFlag(LL_HASTRAILINGTEXTFRAME);
}
void SetTrailingTextFrame(nsIFrame* aFrame, PRBool aWrappingEnabled)
{
mTrailingTextFrame = aFrame;
SetFlag(LL_LASTTEXTFRAME_WRAPPINGENABLED, aWrappingEnabled);
void SetHasTrailingTextFrame(PRBool aHasTrailingTextFrame) {
SetFlag(LL_HASTRAILINGTEXTFRAME, aHasTrailingTextFrame);
}
//----------------------------------------
@@ -297,10 +228,6 @@ public:
SetFlag(LL_FIRSTLETTERSTYLEOK, aSetting);
}
void SetFirstLetterFrame(nsIFrame* aFrame) {
mFirstLetterFrame = aFrame;
}
PRBool GetInFirstLine() const {
return GetFlag(LL_INFIRSTLINE);
}
@@ -422,13 +349,10 @@ protected:
PRInt32 mLastOptionalBreakContentOffset;
PRInt32 mForceBreakContentOffset;
nsIFrame* mTrailingTextFrame;
// XXX remove this when landing bug 154892 (splitting absolute positioned frames)
friend class nsInlineFrame;
nsBlockReflowState* mBlockRS;/* XXX hack! */
nsCompatibility mCompatMode;
nscoord mMinLineHeight;
PRUint8 mTextAlign;
@@ -440,9 +364,7 @@ protected:
// This state varies during the reflow of a line but is line
// "global" state not span "local" state.
nsIFrame* mFirstLetterFrame;
PRInt32 mLineNumber;
PRInt32 mColumn;
PRInt32 mTextJustificationNumSpaces;
PRInt32 mTextJustificationNumLetters;

View File

@@ -3595,7 +3595,6 @@ static void DrawSelectionDecorations(gfxContext* aContext, SelectionType aType,
gfxFloat aAscent, const gfxFont::Metrics& aFontMetrics, PRBool aIsRTL)
{
gfxSize size(aWidth, aFontMetrics.underlineSize);
gfxFloat offset = aFontMetrics.underlineOffset;
switch (aType) {
case nsISelectionController::SELECTION_SPELLCHECK: {
@@ -5135,16 +5134,8 @@ nsTextFrame::Reflow(nsPresContext* aPresContext,
needTightBoundingBox = PR_TRUE;
}
#endif
PRBool suppressInitialBreak = PR_FALSE;
if (!lineLayout.LineIsBreakable()) {
suppressInitialBreak = PR_TRUE;
} else {
PRBool trailingTextFrameCanWrap;
nsIFrame* lastTextFrame = lineLayout.GetTrailingTextFrame(&trailingTextFrameCanWrap);
if (!lastTextFrame) {
suppressInitialBreak = PR_TRUE;
}
}
PRBool suppressInitialBreak = !lineLayout.LineIsBreakable() ||
!lineLayout.HasTrailingTextFrame();
PRInt32 limitLength = length;
PRInt32 forceBreak = lineLayout.GetForcedBreakPosition(mContent);
@@ -5291,15 +5282,11 @@ nsTextFrame::Reflow(nsPresContext* aPresContext,
// Clean up, update state
/////////////////////////////////////////////////////////////////////
lineLayout.SetUnderstandsWhiteSpace(PR_TRUE);
if (charsFit > 0) {
PRBool endsInWhitespace = IsTrimmableSpace(frag, offset + charsFit - 1);
lineLayout.SetInWord(!endsInWhitespace);
lineLayout.SetEndsInWhiteSpace(endsInWhitespace);
PRBool wrapping = textStyle->WhiteSpaceCanWrap();
lineLayout.SetTrailingTextFrame(this, wrapping);
lineLayout.SetHasTrailingTextFrame(PR_TRUE);
if (charsFit == length) {
if (endsInWhitespace && wrapping) {
if (textStyle->WhiteSpaceCanWrap() &&
IsTrimmableSpace(frag, offset + charsFit - 1)) {
// Record a potential break after final breakable whitespace
lineLayout.NotifyOptionalBreakPosition(mContent, offset + length,
textMetrics.mAdvanceWidth <= aReflowState.availableWidth);
@@ -5313,8 +5300,7 @@ nsTextFrame::Reflow(nsPresContext* aPresContext,
// Don't allow subsequent text frame to break-before. All our text is
// being skipped (usually whitespace, could be discarded Unicode control
// characters).
lineLayout.SetEndsInWhiteSpace(PR_FALSE);
lineLayout.SetTrailingTextFrame(nsnull, PR_FALSE);
lineLayout.SetHasTrailingTextFrame(PR_FALSE);
}
if (completedFirstLetter) {
lineLayout.SetFirstLetterStyleOK(PR_FALSE);