From 44f599fd12e175c0b2cf8163ab1f81679fc85f42 Mon Sep 17 00:00:00 2001 From: "dbaron%dbaron.org" Date: Tue, 4 May 2004 23:56:25 +0000 Subject: [PATCH] Remove hacks no longer needed since text inputs became reflow roots (instead of using the IncrementalDamageConstrained hack. b=241833 r+sr=rbs --- layout/generic/nsBlockFrame.cpp | 16 +-------- layout/generic/nsLineBox.h | 12 +------ layout/generic/nsLineLayout.cpp | 47 --------------------------- layout/html/base/src/nsBlockFrame.cpp | 16 +-------- layout/html/base/src/nsLineBox.h | 12 +------ layout/html/base/src/nsLineLayout.cpp | 47 --------------------------- 6 files changed, 4 insertions(+), 146 deletions(-) diff --git a/layout/generic/nsBlockFrame.cpp b/layout/generic/nsBlockFrame.cpp index 02a41c295c9..be7272ea3bd 100644 --- a/layout/generic/nsBlockFrame.cpp +++ b/layout/generic/nsBlockFrame.cpp @@ -1833,17 +1833,6 @@ nsBlockFrame::FindLineFor(nsIFrame* aFrame) return line_end; } -// SEC: added GetCurrentLine() for bug 45152 -// we need a way for line layout to know what line is being reflowed, -// but we don't want to expose the innards of nsBlockReflowState. -nsresult -nsBlockFrame::GetCurrentLine(nsBlockReflowState *aState, nsLineBox ** aOutCurrentLine) -{ - if (!aState || !aOutCurrentLine) return NS_ERROR_FAILURE; - *aOutCurrentLine = aState->mCurrentLine; - return NS_OK; -} - /** * Propagate reflow "damage" from from earlier lines to the current * line. The reflow damage comes from the following sources: @@ -2454,10 +2443,7 @@ nsBlockFrame::ReflowLine(nsBlockReflowState& aState, // We don't really know what changed in the line, so use the union // of the old and new combined areas - // SEC: added "aLine->IsForceInvalidate()" for bug 45152 - if (aDamageDirtyArea || aLine->IsForceInvalidate()) { - aLine->SetForceInvalidate(PR_FALSE); // doing the invalidate now, force flag to off - + if (aDamageDirtyArea) { nsRect dirtyRect; dirtyRect.UnionRect(oldCombinedArea, aLine->GetCombinedArea()); #ifdef NOISY_BLOCK_INVALIDATE diff --git a/layout/generic/nsLineBox.h b/layout/generic/nsLineBox.h index 68a8dd3b89d..04ed06a6019 100644 --- a/layout/generic/nsLineBox.h +++ b/layout/generic/nsLineBox.h @@ -273,15 +273,6 @@ public: return mFlags.mLineWrapped; } - // mLineWrapped bit - void SetForceInvalidate(PRBool aOn) { - NS_ASSERTION((PR_FALSE==aOn || PR_TRUE==aOn), "somebody is playing fast and loose with bools and bits!"); - mFlags.mForceInvalidate = aOn; - } - PRBool IsForceInvalidate() const { - return mFlags.mForceInvalidate; - } - // mResizeReflowOptimizationDisabled bit void DisableResizeReflowOptimization() { mFlags.mResizeReflowOptimizationDisabled = PR_TRUE; @@ -420,11 +411,10 @@ public: PRUint32 mImpactedByFloat : 1; PRUint32 mHasPercentageChild : 1; PRUint32 mLineWrapped: 1; - PRUint32 mForceInvalidate: 1; // default 0 = means this line handles it's own invalidation. 1 = always invalidate this entire line PRUint32 mResizeReflowOptimizationDisabled: 1; // default 0 = means that the opt potentially applies to this line. 1 = never skip reflowing this line for a resize reflow PRUint32 mBreakType : 4; - PRUint32 mChildCount : 20; + PRUint32 mChildCount : 21; }; struct ExtraData { diff --git a/layout/generic/nsLineLayout.cpp b/layout/generic/nsLineLayout.cpp index fc2edbffa9c..d8f8e3da562 100644 --- a/layout/generic/nsLineLayout.cpp +++ b/layout/generic/nsLineLayout.cpp @@ -40,7 +40,6 @@ * ***** END LICENSE BLOCK ***** */ #include "nsCOMPtr.h" #include "nsLineLayout.h" -#include "nsBlockFrame.h" #include "nsInlineFrame.h" #include "nsStyleConsts.h" #include "nsHTMLContainerFrame.h" @@ -997,40 +996,6 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame, return rv; } - // SEC: added this next block for bug 45152 - // text frames don't know how to invalidate themselves on initial reflow. Do it for them here. - // This only shows up in textareas, so do a quick check to see if we're inside one - if (eReflowReason_Initial == reflowState.reason) - { - if (nsLayoutAtoms::textFrame == frameType) - { // aFrame is a text frame, see if it's inside a text control - // although this is a bit slow, the frame tree shouldn't be too deep, it's only called - // for the text frame's initial reflow (once in the text frame's lifetime) - // and we don't make any expensive calls. - // Doing it this way shields us from knowing anything about the frame structure inside a text control. - PRBool inTextControl = PR_FALSE; - for (nsIFrame *parentFrame = aFrame->GetParent(); parentFrame; - parentFrame = parentFrame->GetParent()) - { - if (nsLayoutAtoms::textInputFrame == parentFrame->GetType()) - { - inTextControl = PR_TRUE; // found it - break; - } - } - if (inTextControl) - { - nsLineBox *currentLine=nsnull; - // use localResult because a failure here should not be propagated to my caller - nsresult localResult = nsBlockFrame::GetCurrentLine(mBlockRS, ¤tLine); - if (NS_SUCCEEDED(localResult) && currentLine) { - currentLine->SetForceInvalidate(PR_TRUE); - } - } - } - } - // end fix for bug 45152 - pfd->mJustificationNumSpaces = mTextJustificationNumSpaces; pfd->mJustificationNumLetters = mTextJustificationNumLetters; @@ -2860,18 +2825,6 @@ nsLineLayout::HorizontalAlignFrames(nsRect& aLineBounds, case NS_STYLE_TEXT_ALIGN_RIGHT: case NS_STYLE_TEXT_ALIGN_MOZ_RIGHT: - { - // fix for bug 50758 - // right-aligned text in a text control doesn't know how to paint itself - // so we force the invalidate here. Getting the current line is quick, - // and at worst we're invalidating more of the line (and just that line) than we need to. - nsLineBox *currentLine=nsnull; - // use localResult because a failure here should not be propagated to my caller - nsresult localResult = nsBlockFrame::GetCurrentLine(mBlockRS, ¤tLine); - if (NS_SUCCEEDED(localResult) && currentLine) { - currentLine->SetForceInvalidate(PR_TRUE); - } - } dx = remainingWidth; break; diff --git a/layout/html/base/src/nsBlockFrame.cpp b/layout/html/base/src/nsBlockFrame.cpp index 02a41c295c9..be7272ea3bd 100644 --- a/layout/html/base/src/nsBlockFrame.cpp +++ b/layout/html/base/src/nsBlockFrame.cpp @@ -1833,17 +1833,6 @@ nsBlockFrame::FindLineFor(nsIFrame* aFrame) return line_end; } -// SEC: added GetCurrentLine() for bug 45152 -// we need a way for line layout to know what line is being reflowed, -// but we don't want to expose the innards of nsBlockReflowState. -nsresult -nsBlockFrame::GetCurrentLine(nsBlockReflowState *aState, nsLineBox ** aOutCurrentLine) -{ - if (!aState || !aOutCurrentLine) return NS_ERROR_FAILURE; - *aOutCurrentLine = aState->mCurrentLine; - return NS_OK; -} - /** * Propagate reflow "damage" from from earlier lines to the current * line. The reflow damage comes from the following sources: @@ -2454,10 +2443,7 @@ nsBlockFrame::ReflowLine(nsBlockReflowState& aState, // We don't really know what changed in the line, so use the union // of the old and new combined areas - // SEC: added "aLine->IsForceInvalidate()" for bug 45152 - if (aDamageDirtyArea || aLine->IsForceInvalidate()) { - aLine->SetForceInvalidate(PR_FALSE); // doing the invalidate now, force flag to off - + if (aDamageDirtyArea) { nsRect dirtyRect; dirtyRect.UnionRect(oldCombinedArea, aLine->GetCombinedArea()); #ifdef NOISY_BLOCK_INVALIDATE diff --git a/layout/html/base/src/nsLineBox.h b/layout/html/base/src/nsLineBox.h index 68a8dd3b89d..04ed06a6019 100644 --- a/layout/html/base/src/nsLineBox.h +++ b/layout/html/base/src/nsLineBox.h @@ -273,15 +273,6 @@ public: return mFlags.mLineWrapped; } - // mLineWrapped bit - void SetForceInvalidate(PRBool aOn) { - NS_ASSERTION((PR_FALSE==aOn || PR_TRUE==aOn), "somebody is playing fast and loose with bools and bits!"); - mFlags.mForceInvalidate = aOn; - } - PRBool IsForceInvalidate() const { - return mFlags.mForceInvalidate; - } - // mResizeReflowOptimizationDisabled bit void DisableResizeReflowOptimization() { mFlags.mResizeReflowOptimizationDisabled = PR_TRUE; @@ -420,11 +411,10 @@ public: PRUint32 mImpactedByFloat : 1; PRUint32 mHasPercentageChild : 1; PRUint32 mLineWrapped: 1; - PRUint32 mForceInvalidate: 1; // default 0 = means this line handles it's own invalidation. 1 = always invalidate this entire line PRUint32 mResizeReflowOptimizationDisabled: 1; // default 0 = means that the opt potentially applies to this line. 1 = never skip reflowing this line for a resize reflow PRUint32 mBreakType : 4; - PRUint32 mChildCount : 20; + PRUint32 mChildCount : 21; }; struct ExtraData { diff --git a/layout/html/base/src/nsLineLayout.cpp b/layout/html/base/src/nsLineLayout.cpp index fc2edbffa9c..d8f8e3da562 100644 --- a/layout/html/base/src/nsLineLayout.cpp +++ b/layout/html/base/src/nsLineLayout.cpp @@ -40,7 +40,6 @@ * ***** END LICENSE BLOCK ***** */ #include "nsCOMPtr.h" #include "nsLineLayout.h" -#include "nsBlockFrame.h" #include "nsInlineFrame.h" #include "nsStyleConsts.h" #include "nsHTMLContainerFrame.h" @@ -997,40 +996,6 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame, return rv; } - // SEC: added this next block for bug 45152 - // text frames don't know how to invalidate themselves on initial reflow. Do it for them here. - // This only shows up in textareas, so do a quick check to see if we're inside one - if (eReflowReason_Initial == reflowState.reason) - { - if (nsLayoutAtoms::textFrame == frameType) - { // aFrame is a text frame, see if it's inside a text control - // although this is a bit slow, the frame tree shouldn't be too deep, it's only called - // for the text frame's initial reflow (once in the text frame's lifetime) - // and we don't make any expensive calls. - // Doing it this way shields us from knowing anything about the frame structure inside a text control. - PRBool inTextControl = PR_FALSE; - for (nsIFrame *parentFrame = aFrame->GetParent(); parentFrame; - parentFrame = parentFrame->GetParent()) - { - if (nsLayoutAtoms::textInputFrame == parentFrame->GetType()) - { - inTextControl = PR_TRUE; // found it - break; - } - } - if (inTextControl) - { - nsLineBox *currentLine=nsnull; - // use localResult because a failure here should not be propagated to my caller - nsresult localResult = nsBlockFrame::GetCurrentLine(mBlockRS, ¤tLine); - if (NS_SUCCEEDED(localResult) && currentLine) { - currentLine->SetForceInvalidate(PR_TRUE); - } - } - } - } - // end fix for bug 45152 - pfd->mJustificationNumSpaces = mTextJustificationNumSpaces; pfd->mJustificationNumLetters = mTextJustificationNumLetters; @@ -2860,18 +2825,6 @@ nsLineLayout::HorizontalAlignFrames(nsRect& aLineBounds, case NS_STYLE_TEXT_ALIGN_RIGHT: case NS_STYLE_TEXT_ALIGN_MOZ_RIGHT: - { - // fix for bug 50758 - // right-aligned text in a text control doesn't know how to paint itself - // so we force the invalidate here. Getting the current line is quick, - // and at worst we're invalidating more of the line (and just that line) than we need to. - nsLineBox *currentLine=nsnull; - // use localResult because a failure here should not be propagated to my caller - nsresult localResult = nsBlockFrame::GetCurrentLine(mBlockRS, ¤tLine); - if (NS_SUCCEEDED(localResult) && currentLine) { - currentLine->SetForceInvalidate(PR_TRUE); - } - } dx = remainingWidth; break;