Added a hack to only do incremental painting for the block whish is reflowing the html BODY; improved trace msgs; added code to collapse into nothingness empty blocks

This commit is contained in:
kipp 1998-06-04 17:49:15 +00:00
Родитель 0a142c521a
Коммит b3a0265470
6 изменённых файлов: 378 добавлений и 264 удалений

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

@ -148,6 +148,7 @@ nsBlockReflowState::Initialize(nsIPresContext* aPresContext,
mPrevPosBottomMargin = 0; mPrevPosBottomMargin = 0;
mPrevNegBottomMargin = 0; mPrevNegBottomMargin = 0;
mPrevMarginSynthetic = PR_FALSE;
mNextListOrdinal = -1; mNextListOrdinal = -1;
@ -672,7 +673,11 @@ nsBlockFrame::PlaceLine(nsBlockReflowState& aState,
// optimization cannot be done because this may be a nested block // optimization cannot be done because this may be a nested block
// that will be pushed to a new page by the containing block and the // that will be pushed to a new page by the containing block and the
// nested block can't know that during its reflow. // nested block can't know that during its reflow.
// XXX and actually, this only always works for the block which is a
// child of the body.
if (!aState.mPresContext->IsPaginated()) { if (!aState.mPresContext->IsPaginated()) {
nsIAtom* tag = mContent->GetTag();
if (nsHTMLAtoms::body == tag) {
nsIFrame* child = aLine->mFirstChild; nsIFrame* child = aLine->mFirstChild;
for (PRInt32 i = aLine->mChildCount; --i >= 0; ) { for (PRInt32 i = aLine->mChildCount; --i >= 0; ) {
nsFrameState state; nsFrameState state;
@ -688,6 +693,8 @@ nsBlockFrame::PlaceLine(nsBlockReflowState& aState,
Invalidate(aLine->mBounds); Invalidate(aLine->mBounds);
} }
} }
NS_IF_RELEASE(tag);
}
// Consume space and advance running values // Consume space and advance running values
aState.mY += aLine->mBounds.height; aState.mY += aLine->mBounds.height;
@ -1435,7 +1442,9 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext,
PostReflowCheck(aStatus); PostReflowCheck(aStatus);
} }
#endif #endif
NS_FRAME_TRACE_REFLOW_OUT("exit nsBlockFrame::Reflow", aStatus); NS_FRAME_TRACE_MSG(
("exit nsBlockFrame::Reflow: status=%d width=%d height=%d",
aStatus, aDesiredRect.width, aDesiredRect.height));
return rv; return rv;
} }
@ -1490,6 +1499,15 @@ void nsBlockFrame::ComputeDesiredRect(nsBlockReflowState& aState,
{ {
aDesiredRect.x = 0; aDesiredRect.x = 0;
aDesiredRect.y = 0; aDesiredRect.y = 0;
// Special check for zero sized content: If our content is zero
// sized then we collapse into nothingness.
if ((0 == aState.mKidXMost - aState.mBorderPadding.left) &&
(0 == aState.mY - aState.mBorderPadding.top)) {
aDesiredRect.width = 0;
aDesiredRect.height = 0;
}
else {
aDesiredRect.width = aState.mKidXMost + aState.mBorderPadding.right; aDesiredRect.width = aState.mKidXMost + aState.mBorderPadding.right;
if (!aState.mUnconstrainedWidth) { if (!aState.mUnconstrainedWidth) {
// Make sure we're at least as wide as the max size we were given // Make sure we're at least as wide as the max size we were given
@ -1529,6 +1547,7 @@ void nsBlockFrame::ComputeDesiredRect(nsBlockReflowState& aState,
} }
} }
} }
}
//---------------------------------------------------------------------- //----------------------------------------------------------------------

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

@ -148,6 +148,7 @@ nsBlockReflowState::Initialize(nsIPresContext* aPresContext,
mPrevPosBottomMargin = 0; mPrevPosBottomMargin = 0;
mPrevNegBottomMargin = 0; mPrevNegBottomMargin = 0;
mPrevMarginSynthetic = PR_FALSE;
mNextListOrdinal = -1; mNextListOrdinal = -1;
@ -672,7 +673,11 @@ nsBlockFrame::PlaceLine(nsBlockReflowState& aState,
// optimization cannot be done because this may be a nested block // optimization cannot be done because this may be a nested block
// that will be pushed to a new page by the containing block and the // that will be pushed to a new page by the containing block and the
// nested block can't know that during its reflow. // nested block can't know that during its reflow.
// XXX and actually, this only always works for the block which is a
// child of the body.
if (!aState.mPresContext->IsPaginated()) { if (!aState.mPresContext->IsPaginated()) {
nsIAtom* tag = mContent->GetTag();
if (nsHTMLAtoms::body == tag) {
nsIFrame* child = aLine->mFirstChild; nsIFrame* child = aLine->mFirstChild;
for (PRInt32 i = aLine->mChildCount; --i >= 0; ) { for (PRInt32 i = aLine->mChildCount; --i >= 0; ) {
nsFrameState state; nsFrameState state;
@ -688,6 +693,8 @@ nsBlockFrame::PlaceLine(nsBlockReflowState& aState,
Invalidate(aLine->mBounds); Invalidate(aLine->mBounds);
} }
} }
NS_IF_RELEASE(tag);
}
// Consume space and advance running values // Consume space and advance running values
aState.mY += aLine->mBounds.height; aState.mY += aLine->mBounds.height;
@ -1435,7 +1442,9 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext,
PostReflowCheck(aStatus); PostReflowCheck(aStatus);
} }
#endif #endif
NS_FRAME_TRACE_REFLOW_OUT("exit nsBlockFrame::Reflow", aStatus); NS_FRAME_TRACE_MSG(
("exit nsBlockFrame::Reflow: status=%d width=%d height=%d",
aStatus, aDesiredRect.width, aDesiredRect.height));
return rv; return rv;
} }
@ -1490,6 +1499,15 @@ void nsBlockFrame::ComputeDesiredRect(nsBlockReflowState& aState,
{ {
aDesiredRect.x = 0; aDesiredRect.x = 0;
aDesiredRect.y = 0; aDesiredRect.y = 0;
// Special check for zero sized content: If our content is zero
// sized then we collapse into nothingness.
if ((0 == aState.mKidXMost - aState.mBorderPadding.left) &&
(0 == aState.mY - aState.mBorderPadding.top)) {
aDesiredRect.width = 0;
aDesiredRect.height = 0;
}
else {
aDesiredRect.width = aState.mKidXMost + aState.mBorderPadding.right; aDesiredRect.width = aState.mKidXMost + aState.mBorderPadding.right;
if (!aState.mUnconstrainedWidth) { if (!aState.mUnconstrainedWidth) {
// Make sure we're at least as wide as the max size we were given // Make sure we're at least as wide as the max size we were given
@ -1529,6 +1547,7 @@ void nsBlockFrame::ComputeDesiredRect(nsBlockReflowState& aState,
} }
} }
} }
}
//---------------------------------------------------------------------- //----------------------------------------------------------------------

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

@ -148,6 +148,7 @@ nsBlockReflowState::Initialize(nsIPresContext* aPresContext,
mPrevPosBottomMargin = 0; mPrevPosBottomMargin = 0;
mPrevNegBottomMargin = 0; mPrevNegBottomMargin = 0;
mPrevMarginSynthetic = PR_FALSE;
mNextListOrdinal = -1; mNextListOrdinal = -1;
@ -672,7 +673,11 @@ nsBlockFrame::PlaceLine(nsBlockReflowState& aState,
// optimization cannot be done because this may be a nested block // optimization cannot be done because this may be a nested block
// that will be pushed to a new page by the containing block and the // that will be pushed to a new page by the containing block and the
// nested block can't know that during its reflow. // nested block can't know that during its reflow.
// XXX and actually, this only always works for the block which is a
// child of the body.
if (!aState.mPresContext->IsPaginated()) { if (!aState.mPresContext->IsPaginated()) {
nsIAtom* tag = mContent->GetTag();
if (nsHTMLAtoms::body == tag) {
nsIFrame* child = aLine->mFirstChild; nsIFrame* child = aLine->mFirstChild;
for (PRInt32 i = aLine->mChildCount; --i >= 0; ) { for (PRInt32 i = aLine->mChildCount; --i >= 0; ) {
nsFrameState state; nsFrameState state;
@ -688,6 +693,8 @@ nsBlockFrame::PlaceLine(nsBlockReflowState& aState,
Invalidate(aLine->mBounds); Invalidate(aLine->mBounds);
} }
} }
NS_IF_RELEASE(tag);
}
// Consume space and advance running values // Consume space and advance running values
aState.mY += aLine->mBounds.height; aState.mY += aLine->mBounds.height;
@ -1435,7 +1442,9 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext,
PostReflowCheck(aStatus); PostReflowCheck(aStatus);
} }
#endif #endif
NS_FRAME_TRACE_REFLOW_OUT("exit nsBlockFrame::Reflow", aStatus); NS_FRAME_TRACE_MSG(
("exit nsBlockFrame::Reflow: status=%d width=%d height=%d",
aStatus, aDesiredRect.width, aDesiredRect.height));
return rv; return rv;
} }
@ -1490,6 +1499,15 @@ void nsBlockFrame::ComputeDesiredRect(nsBlockReflowState& aState,
{ {
aDesiredRect.x = 0; aDesiredRect.x = 0;
aDesiredRect.y = 0; aDesiredRect.y = 0;
// Special check for zero sized content: If our content is zero
// sized then we collapse into nothingness.
if ((0 == aState.mKidXMost - aState.mBorderPadding.left) &&
(0 == aState.mY - aState.mBorderPadding.top)) {
aDesiredRect.width = 0;
aDesiredRect.height = 0;
}
else {
aDesiredRect.width = aState.mKidXMost + aState.mBorderPadding.right; aDesiredRect.width = aState.mKidXMost + aState.mBorderPadding.right;
if (!aState.mUnconstrainedWidth) { if (!aState.mUnconstrainedWidth) {
// Make sure we're at least as wide as the max size we were given // Make sure we're at least as wide as the max size we were given
@ -1529,6 +1547,7 @@ void nsBlockFrame::ComputeDesiredRect(nsBlockReflowState& aState,
} }
} }
} }
}
//---------------------------------------------------------------------- //----------------------------------------------------------------------

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

@ -148,6 +148,7 @@ nsBlockReflowState::Initialize(nsIPresContext* aPresContext,
mPrevPosBottomMargin = 0; mPrevPosBottomMargin = 0;
mPrevNegBottomMargin = 0; mPrevNegBottomMargin = 0;
mPrevMarginSynthetic = PR_FALSE;
mNextListOrdinal = -1; mNextListOrdinal = -1;
@ -672,7 +673,11 @@ nsBlockFrame::PlaceLine(nsBlockReflowState& aState,
// optimization cannot be done because this may be a nested block // optimization cannot be done because this may be a nested block
// that will be pushed to a new page by the containing block and the // that will be pushed to a new page by the containing block and the
// nested block can't know that during its reflow. // nested block can't know that during its reflow.
// XXX and actually, this only always works for the block which is a
// child of the body.
if (!aState.mPresContext->IsPaginated()) { if (!aState.mPresContext->IsPaginated()) {
nsIAtom* tag = mContent->GetTag();
if (nsHTMLAtoms::body == tag) {
nsIFrame* child = aLine->mFirstChild; nsIFrame* child = aLine->mFirstChild;
for (PRInt32 i = aLine->mChildCount; --i >= 0; ) { for (PRInt32 i = aLine->mChildCount; --i >= 0; ) {
nsFrameState state; nsFrameState state;
@ -688,6 +693,8 @@ nsBlockFrame::PlaceLine(nsBlockReflowState& aState,
Invalidate(aLine->mBounds); Invalidate(aLine->mBounds);
} }
} }
NS_IF_RELEASE(tag);
}
// Consume space and advance running values // Consume space and advance running values
aState.mY += aLine->mBounds.height; aState.mY += aLine->mBounds.height;
@ -1435,7 +1442,9 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext,
PostReflowCheck(aStatus); PostReflowCheck(aStatus);
} }
#endif #endif
NS_FRAME_TRACE_REFLOW_OUT("exit nsBlockFrame::Reflow", aStatus); NS_FRAME_TRACE_MSG(
("exit nsBlockFrame::Reflow: status=%d width=%d height=%d",
aStatus, aDesiredRect.width, aDesiredRect.height));
return rv; return rv;
} }
@ -1490,6 +1499,15 @@ void nsBlockFrame::ComputeDesiredRect(nsBlockReflowState& aState,
{ {
aDesiredRect.x = 0; aDesiredRect.x = 0;
aDesiredRect.y = 0; aDesiredRect.y = 0;
// Special check for zero sized content: If our content is zero
// sized then we collapse into nothingness.
if ((0 == aState.mKidXMost - aState.mBorderPadding.left) &&
(0 == aState.mY - aState.mBorderPadding.top)) {
aDesiredRect.width = 0;
aDesiredRect.height = 0;
}
else {
aDesiredRect.width = aState.mKidXMost + aState.mBorderPadding.right; aDesiredRect.width = aState.mKidXMost + aState.mBorderPadding.right;
if (!aState.mUnconstrainedWidth) { if (!aState.mUnconstrainedWidth) {
// Make sure we're at least as wide as the max size we were given // Make sure we're at least as wide as the max size we were given
@ -1529,6 +1547,7 @@ void nsBlockFrame::ComputeDesiredRect(nsBlockReflowState& aState,
} }
} }
} }
}
//---------------------------------------------------------------------- //----------------------------------------------------------------------

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

@ -148,6 +148,7 @@ nsBlockReflowState::Initialize(nsIPresContext* aPresContext,
mPrevPosBottomMargin = 0; mPrevPosBottomMargin = 0;
mPrevNegBottomMargin = 0; mPrevNegBottomMargin = 0;
mPrevMarginSynthetic = PR_FALSE;
mNextListOrdinal = -1; mNextListOrdinal = -1;
@ -672,7 +673,11 @@ nsBlockFrame::PlaceLine(nsBlockReflowState& aState,
// optimization cannot be done because this may be a nested block // optimization cannot be done because this may be a nested block
// that will be pushed to a new page by the containing block and the // that will be pushed to a new page by the containing block and the
// nested block can't know that during its reflow. // nested block can't know that during its reflow.
// XXX and actually, this only always works for the block which is a
// child of the body.
if (!aState.mPresContext->IsPaginated()) { if (!aState.mPresContext->IsPaginated()) {
nsIAtom* tag = mContent->GetTag();
if (nsHTMLAtoms::body == tag) {
nsIFrame* child = aLine->mFirstChild; nsIFrame* child = aLine->mFirstChild;
for (PRInt32 i = aLine->mChildCount; --i >= 0; ) { for (PRInt32 i = aLine->mChildCount; --i >= 0; ) {
nsFrameState state; nsFrameState state;
@ -688,6 +693,8 @@ nsBlockFrame::PlaceLine(nsBlockReflowState& aState,
Invalidate(aLine->mBounds); Invalidate(aLine->mBounds);
} }
} }
NS_IF_RELEASE(tag);
}
// Consume space and advance running values // Consume space and advance running values
aState.mY += aLine->mBounds.height; aState.mY += aLine->mBounds.height;
@ -1435,7 +1442,9 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext,
PostReflowCheck(aStatus); PostReflowCheck(aStatus);
} }
#endif #endif
NS_FRAME_TRACE_REFLOW_OUT("exit nsBlockFrame::Reflow", aStatus); NS_FRAME_TRACE_MSG(
("exit nsBlockFrame::Reflow: status=%d width=%d height=%d",
aStatus, aDesiredRect.width, aDesiredRect.height));
return rv; return rv;
} }
@ -1490,6 +1499,15 @@ void nsBlockFrame::ComputeDesiredRect(nsBlockReflowState& aState,
{ {
aDesiredRect.x = 0; aDesiredRect.x = 0;
aDesiredRect.y = 0; aDesiredRect.y = 0;
// Special check for zero sized content: If our content is zero
// sized then we collapse into nothingness.
if ((0 == aState.mKidXMost - aState.mBorderPadding.left) &&
(0 == aState.mY - aState.mBorderPadding.top)) {
aDesiredRect.width = 0;
aDesiredRect.height = 0;
}
else {
aDesiredRect.width = aState.mKidXMost + aState.mBorderPadding.right; aDesiredRect.width = aState.mKidXMost + aState.mBorderPadding.right;
if (!aState.mUnconstrainedWidth) { if (!aState.mUnconstrainedWidth) {
// Make sure we're at least as wide as the max size we were given // Make sure we're at least as wide as the max size we were given
@ -1529,6 +1547,7 @@ void nsBlockFrame::ComputeDesiredRect(nsBlockReflowState& aState,
} }
} }
} }
}
//---------------------------------------------------------------------- //----------------------------------------------------------------------

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

@ -148,6 +148,7 @@ nsBlockReflowState::Initialize(nsIPresContext* aPresContext,
mPrevPosBottomMargin = 0; mPrevPosBottomMargin = 0;
mPrevNegBottomMargin = 0; mPrevNegBottomMargin = 0;
mPrevMarginSynthetic = PR_FALSE;
mNextListOrdinal = -1; mNextListOrdinal = -1;
@ -672,7 +673,11 @@ nsBlockFrame::PlaceLine(nsBlockReflowState& aState,
// optimization cannot be done because this may be a nested block // optimization cannot be done because this may be a nested block
// that will be pushed to a new page by the containing block and the // that will be pushed to a new page by the containing block and the
// nested block can't know that during its reflow. // nested block can't know that during its reflow.
// XXX and actually, this only always works for the block which is a
// child of the body.
if (!aState.mPresContext->IsPaginated()) { if (!aState.mPresContext->IsPaginated()) {
nsIAtom* tag = mContent->GetTag();
if (nsHTMLAtoms::body == tag) {
nsIFrame* child = aLine->mFirstChild; nsIFrame* child = aLine->mFirstChild;
for (PRInt32 i = aLine->mChildCount; --i >= 0; ) { for (PRInt32 i = aLine->mChildCount; --i >= 0; ) {
nsFrameState state; nsFrameState state;
@ -688,6 +693,8 @@ nsBlockFrame::PlaceLine(nsBlockReflowState& aState,
Invalidate(aLine->mBounds); Invalidate(aLine->mBounds);
} }
} }
NS_IF_RELEASE(tag);
}
// Consume space and advance running values // Consume space and advance running values
aState.mY += aLine->mBounds.height; aState.mY += aLine->mBounds.height;
@ -1435,7 +1442,9 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext,
PostReflowCheck(aStatus); PostReflowCheck(aStatus);
} }
#endif #endif
NS_FRAME_TRACE_REFLOW_OUT("exit nsBlockFrame::Reflow", aStatus); NS_FRAME_TRACE_MSG(
("exit nsBlockFrame::Reflow: status=%d width=%d height=%d",
aStatus, aDesiredRect.width, aDesiredRect.height));
return rv; return rv;
} }
@ -1490,6 +1499,15 @@ void nsBlockFrame::ComputeDesiredRect(nsBlockReflowState& aState,
{ {
aDesiredRect.x = 0; aDesiredRect.x = 0;
aDesiredRect.y = 0; aDesiredRect.y = 0;
// Special check for zero sized content: If our content is zero
// sized then we collapse into nothingness.
if ((0 == aState.mKidXMost - aState.mBorderPadding.left) &&
(0 == aState.mY - aState.mBorderPadding.top)) {
aDesiredRect.width = 0;
aDesiredRect.height = 0;
}
else {
aDesiredRect.width = aState.mKidXMost + aState.mBorderPadding.right; aDesiredRect.width = aState.mKidXMost + aState.mBorderPadding.right;
if (!aState.mUnconstrainedWidth) { if (!aState.mUnconstrainedWidth) {
// Make sure we're at least as wide as the max size we were given // Make sure we're at least as wide as the max size we were given
@ -1529,6 +1547,7 @@ void nsBlockFrame::ComputeDesiredRect(nsBlockReflowState& aState,
} }
} }
} }
}
//---------------------------------------------------------------------- //----------------------------------------------------------------------