Bug 207477. Clean up nsBlockFrame, and don't suppress invalidation in nsBlockFrame::ReflowLine if it's a resize reflow. r+sr=dbaron

This commit is contained in:
roc+%cs.cmu.edu 2003-07-15 00:04:43 +00:00
Родитель c624b882e2
Коммит e44d55b8cc
8 изменённых файлов: 36 добавлений и 62 удалений

Просмотреть файл

@ -1359,7 +1359,7 @@ nsBlockFrame::ComputeFinalSize(const nsHTMLReflowState& aReflowState,
if (gNoisyMaxElementWidth) {
IndentBy(stdout, gNoiseIndent);
printf ("nsBlockFrame::CFS: %p returning MEW %d\n",
this, aMetrics.mMaxElementWidth);
NS_STATIC_CAST(void*, this), aMetrics.mMaxElementWidth);
}
#endif
}
@ -2063,11 +2063,11 @@ nsBlockFrame::ReflowDirtyLines(nsBlockReflowState& aState)
}
#endif
// Check whether this is an incremental reflow
PRBool incrementalReflow = aState.mReflowState.reason ==
eReflowReason_Incremental ||
aState.mReflowState.reason ==
eReflowReason_Dirty;
// Check whether we need to do invalidation for the child block
PRBool doInvalidate =
aState.mReflowState.reason == eReflowReason_Incremental ||
aState.mReflowState.reason == eReflowReason_Dirty ||
aState.mReflowState.reason == eReflowReason_Resize;
// the amount by which we will slide the current line if it is not
// dirty
@ -2177,8 +2177,7 @@ nsBlockFrame::ReflowDirtyLines(nsBlockReflowState& aState)
// Reflow the dirty line. If it's an incremental reflow, then force
// it to invalidate the dirty area if necessary
PRBool forceInvalidate = incrementalReflow && !aState.GetFlag(BRS_DAMAGECONSTRAINED);
rv = ReflowLine(aState, line, &keepGoing, forceInvalidate);
rv = ReflowLine(aState, line, &keepGoing, doInvalidate);
if (NS_FAILED(rv)) {
return rv;
}
@ -2311,8 +2310,7 @@ nsBlockFrame::ReflowDirtyLines(nsBlockReflowState& aState)
// line to be created; see SplitLine's callers for examples of
// when this happens).
while (line != end_lines()) {
rv = ReflowLine(aState, line, &keepGoing,
incrementalReflow /* force invalidate */);
rv = ReflowLine(aState, line, &keepGoing, doInvalidate);
if (NS_FAILED(rv)) {
return rv;
}
@ -2549,7 +2547,8 @@ nsBlockFrame::ReflowLine(nsBlockReflowState& aState,
if (gNoisyMaxElementWidth) {
IndentBy(stdout, gNoiseIndent);
printf("nsBlockFrame::ReflowLine block %p line %p setting aLine.mMaxElementWidth to %d\n",
this, NS_STATIC_CAST(void*, aLine.get()), aLine->mMaxElementWidth);
NS_STATIC_CAST(void*, this), NS_STATIC_CAST(void*, aLine.get()),
aLine->mMaxElementWidth);
}
#endif
aState.UpdateMaxElementWidth(aLine->mMaxElementWidth);
@ -3190,10 +3189,6 @@ nsBlockFrame::ReflowBlockFrame(nsBlockReflowState& aState,
aState.IsAdjacentWithTop(), computedOffsets,
blockHtmlRS, frameReflowStatus);
if (brc.BlockShouldInvalidateItself() && !mRect.IsEmpty()) {
Invalidate(aState.mPresContext, mRect);
}
// Remove the frame from the reflow tree.
if (aState.mReflowState.path)
aState.mReflowState.path->RemoveChild(frame);
@ -4221,7 +4216,8 @@ nsBlockFrame::PlaceLine(nsBlockReflowState& aState,
if (gNoisyMaxElementWidth) {
IndentBy(stdout, gNoiseIndent);
printf ("nsBlockFrame::PlaceLine: %p setting MEW for line %p to %d\n",
this, NS_STATIC_CAST(void*, aLine.get()), maxElementWidth);
NS_STATIC_CAST(void*, this), NS_STATIC_CAST(void*, aLine.get()),
maxElementWidth);
}
#endif
}
@ -4318,7 +4314,8 @@ nsBlockFrame::PostPlaceLine(nsBlockReflowState& aState,
if (gNoisyMaxElementWidth) {
IndentBy(stdout, gNoiseIndent);
printf ("nsBlockFrame::PostPlaceLine: %p setting line %p MEW %d\n",
this, aLine, aMaxElementWidth);
NS_STATIC_CAST(void*, this), NS_STATIC_CAST(void*, aLine),
aMaxElementWidth);
}
#endif
}
@ -4329,7 +4326,8 @@ nsBlockFrame::PostPlaceLine(nsBlockReflowState& aState,
if (aState.GetFlag(BRS_UNCONSTRAINEDWIDTH)) {
#ifdef NOISY_MAXIMUM_WIDTH
printf("nsBlockFrame::PostPlaceLine during UC Reflow of block %p line %p caching max width %d\n",
this, aLine, aLine->mBounds.XMost());
NS_STATIC_CAST(void*, this), NS_STATIC_CAST(void*, aLine),
aLine->mBounds.XMost());
#endif
aLine->mMaximumWidth = aLine->mBounds.XMost();
}
@ -5176,10 +5174,6 @@ nsBlockFrame::ReflowFloater(nsBlockReflowState& aState,
}
}
if (brc.BlockShouldInvalidateItself() && !mRect.IsEmpty()) {
Invalidate(aState.mPresContext, mRect);
}
// Remove the floater from the reflow tree.
if (aState.mReflowState.path)
aState.mReflowState.path->RemoveChild(floater);

Просмотреть файл

@ -70,8 +70,7 @@ nsBlockReflowContext::nsBlockReflowContext(nsIPresContext* aPresContext,
mOuterReflowState(aParentRS),
mMetrics(aComputeMaxElementWidth),
mIsTable(PR_FALSE),
mComputeMaximumWidth(aComputeMaximumWidth),
mBlockShouldInvalidateItself(PR_FALSE)
mComputeMaximumWidth(aComputeMaximumWidth)
{
mStyleBorder = nsnull;
mStyleMargin = nsnull;

Просмотреть файл

@ -101,10 +101,6 @@ public:
return mMetrics.mMaximumWidth;
}
PRBool BlockShouldInvalidateItself() const {
return mBlockShouldInvalidateItself;
}
static void ComputeCollapsedTopMargin(nsIPresContext* aPresContext,
nsHTMLReflowState& aRS,
/* inout */ nsCollapsingMargin& aMargin);
@ -131,7 +127,6 @@ protected:
nsCollapsingMargin mTopMargin;
PRPackedBool mIsTable;
PRPackedBool mComputeMaximumWidth;
PRPackedBool mBlockShouldInvalidateItself;
};
#endif /* nsBlockReflowContext_h___ */

Просмотреть файл

@ -236,8 +236,7 @@ public:
#define BRS_APPLYTOPMARGIN 0x00000080 // See ShouldApplyTopMargin
#define BRS_COMPUTEMAXELEMENTWIDTH 0x00000100
#define BRS_COMPUTEMAXWIDTH 0x00000200
#define BRS_DAMAGECONSTRAINED 0x00000400 // is the target of an incremental reflow command inside a text control
#define BRS_LASTFLAG BRS_DAMAGECONSTRAINED
#define BRS_LASTFLAG BRS_COMPUTEMAXWIDTH
PRInt16 mFlags;

Просмотреть файл

@ -1359,7 +1359,7 @@ nsBlockFrame::ComputeFinalSize(const nsHTMLReflowState& aReflowState,
if (gNoisyMaxElementWidth) {
IndentBy(stdout, gNoiseIndent);
printf ("nsBlockFrame::CFS: %p returning MEW %d\n",
this, aMetrics.mMaxElementWidth);
NS_STATIC_CAST(void*, this), aMetrics.mMaxElementWidth);
}
#endif
}
@ -2063,11 +2063,11 @@ nsBlockFrame::ReflowDirtyLines(nsBlockReflowState& aState)
}
#endif
// Check whether this is an incremental reflow
PRBool incrementalReflow = aState.mReflowState.reason ==
eReflowReason_Incremental ||
aState.mReflowState.reason ==
eReflowReason_Dirty;
// Check whether we need to do invalidation for the child block
PRBool doInvalidate =
aState.mReflowState.reason == eReflowReason_Incremental ||
aState.mReflowState.reason == eReflowReason_Dirty ||
aState.mReflowState.reason == eReflowReason_Resize;
// the amount by which we will slide the current line if it is not
// dirty
@ -2177,8 +2177,7 @@ nsBlockFrame::ReflowDirtyLines(nsBlockReflowState& aState)
// Reflow the dirty line. If it's an incremental reflow, then force
// it to invalidate the dirty area if necessary
PRBool forceInvalidate = incrementalReflow && !aState.GetFlag(BRS_DAMAGECONSTRAINED);
rv = ReflowLine(aState, line, &keepGoing, forceInvalidate);
rv = ReflowLine(aState, line, &keepGoing, doInvalidate);
if (NS_FAILED(rv)) {
return rv;
}
@ -2311,8 +2310,7 @@ nsBlockFrame::ReflowDirtyLines(nsBlockReflowState& aState)
// line to be created; see SplitLine's callers for examples of
// when this happens).
while (line != end_lines()) {
rv = ReflowLine(aState, line, &keepGoing,
incrementalReflow /* force invalidate */);
rv = ReflowLine(aState, line, &keepGoing, doInvalidate);
if (NS_FAILED(rv)) {
return rv;
}
@ -2549,7 +2547,8 @@ nsBlockFrame::ReflowLine(nsBlockReflowState& aState,
if (gNoisyMaxElementWidth) {
IndentBy(stdout, gNoiseIndent);
printf("nsBlockFrame::ReflowLine block %p line %p setting aLine.mMaxElementWidth to %d\n",
this, NS_STATIC_CAST(void*, aLine.get()), aLine->mMaxElementWidth);
NS_STATIC_CAST(void*, this), NS_STATIC_CAST(void*, aLine.get()),
aLine->mMaxElementWidth);
}
#endif
aState.UpdateMaxElementWidth(aLine->mMaxElementWidth);
@ -3190,10 +3189,6 @@ nsBlockFrame::ReflowBlockFrame(nsBlockReflowState& aState,
aState.IsAdjacentWithTop(), computedOffsets,
blockHtmlRS, frameReflowStatus);
if (brc.BlockShouldInvalidateItself() && !mRect.IsEmpty()) {
Invalidate(aState.mPresContext, mRect);
}
// Remove the frame from the reflow tree.
if (aState.mReflowState.path)
aState.mReflowState.path->RemoveChild(frame);
@ -4221,7 +4216,8 @@ nsBlockFrame::PlaceLine(nsBlockReflowState& aState,
if (gNoisyMaxElementWidth) {
IndentBy(stdout, gNoiseIndent);
printf ("nsBlockFrame::PlaceLine: %p setting MEW for line %p to %d\n",
this, NS_STATIC_CAST(void*, aLine.get()), maxElementWidth);
NS_STATIC_CAST(void*, this), NS_STATIC_CAST(void*, aLine.get()),
maxElementWidth);
}
#endif
}
@ -4318,7 +4314,8 @@ nsBlockFrame::PostPlaceLine(nsBlockReflowState& aState,
if (gNoisyMaxElementWidth) {
IndentBy(stdout, gNoiseIndent);
printf ("nsBlockFrame::PostPlaceLine: %p setting line %p MEW %d\n",
this, aLine, aMaxElementWidth);
NS_STATIC_CAST(void*, this), NS_STATIC_CAST(void*, aLine),
aMaxElementWidth);
}
#endif
}
@ -4329,7 +4326,8 @@ nsBlockFrame::PostPlaceLine(nsBlockReflowState& aState,
if (aState.GetFlag(BRS_UNCONSTRAINEDWIDTH)) {
#ifdef NOISY_MAXIMUM_WIDTH
printf("nsBlockFrame::PostPlaceLine during UC Reflow of block %p line %p caching max width %d\n",
this, aLine, aLine->mBounds.XMost());
NS_STATIC_CAST(void*, this), NS_STATIC_CAST(void*, aLine),
aLine->mBounds.XMost());
#endif
aLine->mMaximumWidth = aLine->mBounds.XMost();
}
@ -5176,10 +5174,6 @@ nsBlockFrame::ReflowFloater(nsBlockReflowState& aState,
}
}
if (brc.BlockShouldInvalidateItself() && !mRect.IsEmpty()) {
Invalidate(aState.mPresContext, mRect);
}
// Remove the floater from the reflow tree.
if (aState.mReflowState.path)
aState.mReflowState.path->RemoveChild(floater);

Просмотреть файл

@ -70,8 +70,7 @@ nsBlockReflowContext::nsBlockReflowContext(nsIPresContext* aPresContext,
mOuterReflowState(aParentRS),
mMetrics(aComputeMaxElementWidth),
mIsTable(PR_FALSE),
mComputeMaximumWidth(aComputeMaximumWidth),
mBlockShouldInvalidateItself(PR_FALSE)
mComputeMaximumWidth(aComputeMaximumWidth)
{
mStyleBorder = nsnull;
mStyleMargin = nsnull;

Просмотреть файл

@ -101,10 +101,6 @@ public:
return mMetrics.mMaximumWidth;
}
PRBool BlockShouldInvalidateItself() const {
return mBlockShouldInvalidateItself;
}
static void ComputeCollapsedTopMargin(nsIPresContext* aPresContext,
nsHTMLReflowState& aRS,
/* inout */ nsCollapsingMargin& aMargin);
@ -131,7 +127,6 @@ protected:
nsCollapsingMargin mTopMargin;
PRPackedBool mIsTable;
PRPackedBool mComputeMaximumWidth;
PRPackedBool mBlockShouldInvalidateItself;
};
#endif /* nsBlockReflowContext_h___ */

Просмотреть файл

@ -236,8 +236,7 @@ public:
#define BRS_APPLYTOPMARGIN 0x00000080 // See ShouldApplyTopMargin
#define BRS_COMPUTEMAXELEMENTWIDTH 0x00000100
#define BRS_COMPUTEMAXWIDTH 0x00000200
#define BRS_DAMAGECONSTRAINED 0x00000400 // is the target of an incremental reflow command inside a text control
#define BRS_LASTFLAG BRS_DAMAGECONSTRAINED
#define BRS_LASTFLAG BRS_COMPUTEMAXWIDTH
PRInt16 mFlags;