Changed block frame code to cache the max element width. This enables

us to ask for the maxElementSize when doing an incremental reflow
This commit is contained in:
troy%netscape.com 1999-08-28 00:39:55 +00:00
Родитель 3955d15317
Коммит ea250c6886
10 изменённых файлов: 64 добавлений и 24 удалений

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

@ -716,7 +716,7 @@ nsBlockReflowState::RecoverStateFrom(nsLineBox* aLine,
// in this line.
mPrevChild = aLine->LastChild();
// Recover mKidXMost
// Recover mKidXMost and max element width
nscoord xmost = aLine->mBounds.XMost();
if (xmost > mKidXMost) {
#ifdef DEBUG
@ -727,6 +727,9 @@ nsBlockReflowState::RecoverStateFrom(nsLineBox* aLine,
#endif
mKidXMost = xmost;
}
if (mComputeMaxElementSize) {
UpdateMaxElementSize(nsSize(aLine->mMaxElementWidth, aLine->mBounds.height));
}
// The line may have clear before semantics.
if (NS_STYLE_CLEAR_NONE != aLine->mBreakType) {
@ -1500,10 +1503,10 @@ nsBlockFrame::ComputeFinalSize(const nsHTMLReflowState& aReflowState,
// contents (CSS2 section XXX)
computedWidth = borderPadding.left + aState.mContentArea.width +
borderPadding.right;
// maxWidth = aState.mMaxElementSize.width +
// borderPadding.left + borderPadding.right;
}
else if (aState.mComputeMaxElementSize) {
// See if we should compute our max element size
if (aState.mComputeMaxElementSize) {
if (aState.mNoWrap) {
// When no-wrap is true the max-element-size.width is the
// width of the widest line plus the right border. Note that
@ -3648,6 +3651,9 @@ nsBlockFrame::PostPlaceLine(nsBlockReflowState& aState,
// Update max-element-size
if (aState.mComputeMaxElementSize) {
aState.UpdateMaxElementSize(aMaxElementSize);
// We also cache the max element width in the line. This is needed for
// incremental reflow
aLine->mMaxElementWidth = aMaxElementSize.width;
}
#if XXX_need_line_outside_children

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

@ -716,7 +716,7 @@ nsBlockReflowState::RecoverStateFrom(nsLineBox* aLine,
// in this line.
mPrevChild = aLine->LastChild();
// Recover mKidXMost
// Recover mKidXMost and max element width
nscoord xmost = aLine->mBounds.XMost();
if (xmost > mKidXMost) {
#ifdef DEBUG
@ -727,6 +727,9 @@ nsBlockReflowState::RecoverStateFrom(nsLineBox* aLine,
#endif
mKidXMost = xmost;
}
if (mComputeMaxElementSize) {
UpdateMaxElementSize(nsSize(aLine->mMaxElementWidth, aLine->mBounds.height));
}
// The line may have clear before semantics.
if (NS_STYLE_CLEAR_NONE != aLine->mBreakType) {
@ -1500,10 +1503,10 @@ nsBlockFrame::ComputeFinalSize(const nsHTMLReflowState& aReflowState,
// contents (CSS2 section XXX)
computedWidth = borderPadding.left + aState.mContentArea.width +
borderPadding.right;
// maxWidth = aState.mMaxElementSize.width +
// borderPadding.left + borderPadding.right;
}
else if (aState.mComputeMaxElementSize) {
// See if we should compute our max element size
if (aState.mComputeMaxElementSize) {
if (aState.mNoWrap) {
// When no-wrap is true the max-element-size.width is the
// width of the widest line plus the right border. Note that
@ -3648,6 +3651,9 @@ nsBlockFrame::PostPlaceLine(nsBlockReflowState& aState,
// Update max-element-size
if (aState.mComputeMaxElementSize) {
aState.UpdateMaxElementSize(aMaxElementSize);
// We also cache the max element width in the line. This is needed for
// incremental reflow
aLine->mMaxElementWidth = aMaxElementSize.width;
}
#if XXX_need_line_outside_children

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

@ -716,7 +716,7 @@ nsBlockReflowState::RecoverStateFrom(nsLineBox* aLine,
// in this line.
mPrevChild = aLine->LastChild();
// Recover mKidXMost
// Recover mKidXMost and max element width
nscoord xmost = aLine->mBounds.XMost();
if (xmost > mKidXMost) {
#ifdef DEBUG
@ -727,6 +727,9 @@ nsBlockReflowState::RecoverStateFrom(nsLineBox* aLine,
#endif
mKidXMost = xmost;
}
if (mComputeMaxElementSize) {
UpdateMaxElementSize(nsSize(aLine->mMaxElementWidth, aLine->mBounds.height));
}
// The line may have clear before semantics.
if (NS_STYLE_CLEAR_NONE != aLine->mBreakType) {
@ -1500,10 +1503,10 @@ nsBlockFrame::ComputeFinalSize(const nsHTMLReflowState& aReflowState,
// contents (CSS2 section XXX)
computedWidth = borderPadding.left + aState.mContentArea.width +
borderPadding.right;
// maxWidth = aState.mMaxElementSize.width +
// borderPadding.left + borderPadding.right;
}
else if (aState.mComputeMaxElementSize) {
// See if we should compute our max element size
if (aState.mComputeMaxElementSize) {
if (aState.mNoWrap) {
// When no-wrap is true the max-element-size.width is the
// width of the widest line plus the right border. Note that
@ -3648,6 +3651,9 @@ nsBlockFrame::PostPlaceLine(nsBlockReflowState& aState,
// Update max-element-size
if (aState.mComputeMaxElementSize) {
aState.UpdateMaxElementSize(aMaxElementSize);
// We also cache the max element width in the line. This is needed for
// incremental reflow
aLine->mMaxElementWidth = aMaxElementSize.width;
}
#if XXX_need_line_outside_children

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

@ -34,6 +34,7 @@ nsLineBox::nsLineBox(nsIFrame* aFrame, PRInt32 aCount, PRUint16 flags)
//XXX mCarriedOutTopMargin = 0;
mCarriedOutBottomMargin = 0;
mBreakType = NS_STYLE_CLEAR_NONE;
mMaxElementWidth = 0;
}
nsLineBox::~nsLineBox()

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

@ -192,6 +192,7 @@ public:
nscoord mCarriedOutBottomMargin;/* XXX switch to 16 bits */
nsVoidArray* mFloaters;
nsLineBox* mNext;
nscoord mMaxElementWidth; // width part of max-element-size
};
//----------------------------------------------------------------------

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

@ -716,7 +716,7 @@ nsBlockReflowState::RecoverStateFrom(nsLineBox* aLine,
// in this line.
mPrevChild = aLine->LastChild();
// Recover mKidXMost
// Recover mKidXMost and max element width
nscoord xmost = aLine->mBounds.XMost();
if (xmost > mKidXMost) {
#ifdef DEBUG
@ -727,6 +727,9 @@ nsBlockReflowState::RecoverStateFrom(nsLineBox* aLine,
#endif
mKidXMost = xmost;
}
if (mComputeMaxElementSize) {
UpdateMaxElementSize(nsSize(aLine->mMaxElementWidth, aLine->mBounds.height));
}
// The line may have clear before semantics.
if (NS_STYLE_CLEAR_NONE != aLine->mBreakType) {
@ -1500,10 +1503,10 @@ nsBlockFrame::ComputeFinalSize(const nsHTMLReflowState& aReflowState,
// contents (CSS2 section XXX)
computedWidth = borderPadding.left + aState.mContentArea.width +
borderPadding.right;
// maxWidth = aState.mMaxElementSize.width +
// borderPadding.left + borderPadding.right;
}
else if (aState.mComputeMaxElementSize) {
// See if we should compute our max element size
if (aState.mComputeMaxElementSize) {
if (aState.mNoWrap) {
// When no-wrap is true the max-element-size.width is the
// width of the widest line plus the right border. Note that
@ -3648,6 +3651,9 @@ nsBlockFrame::PostPlaceLine(nsBlockReflowState& aState,
// Update max-element-size
if (aState.mComputeMaxElementSize) {
aState.UpdateMaxElementSize(aMaxElementSize);
// We also cache the max element width in the line. This is needed for
// incremental reflow
aLine->mMaxElementWidth = aMaxElementSize.width;
}
#if XXX_need_line_outside_children

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

@ -716,7 +716,7 @@ nsBlockReflowState::RecoverStateFrom(nsLineBox* aLine,
// in this line.
mPrevChild = aLine->LastChild();
// Recover mKidXMost
// Recover mKidXMost and max element width
nscoord xmost = aLine->mBounds.XMost();
if (xmost > mKidXMost) {
#ifdef DEBUG
@ -727,6 +727,9 @@ nsBlockReflowState::RecoverStateFrom(nsLineBox* aLine,
#endif
mKidXMost = xmost;
}
if (mComputeMaxElementSize) {
UpdateMaxElementSize(nsSize(aLine->mMaxElementWidth, aLine->mBounds.height));
}
// The line may have clear before semantics.
if (NS_STYLE_CLEAR_NONE != aLine->mBreakType) {
@ -1500,10 +1503,10 @@ nsBlockFrame::ComputeFinalSize(const nsHTMLReflowState& aReflowState,
// contents (CSS2 section XXX)
computedWidth = borderPadding.left + aState.mContentArea.width +
borderPadding.right;
// maxWidth = aState.mMaxElementSize.width +
// borderPadding.left + borderPadding.right;
}
else if (aState.mComputeMaxElementSize) {
// See if we should compute our max element size
if (aState.mComputeMaxElementSize) {
if (aState.mNoWrap) {
// When no-wrap is true the max-element-size.width is the
// width of the widest line plus the right border. Note that
@ -3648,6 +3651,9 @@ nsBlockFrame::PostPlaceLine(nsBlockReflowState& aState,
// Update max-element-size
if (aState.mComputeMaxElementSize) {
aState.UpdateMaxElementSize(aMaxElementSize);
// We also cache the max element width in the line. This is needed for
// incremental reflow
aLine->mMaxElementWidth = aMaxElementSize.width;
}
#if XXX_need_line_outside_children

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

@ -716,7 +716,7 @@ nsBlockReflowState::RecoverStateFrom(nsLineBox* aLine,
// in this line.
mPrevChild = aLine->LastChild();
// Recover mKidXMost
// Recover mKidXMost and max element width
nscoord xmost = aLine->mBounds.XMost();
if (xmost > mKidXMost) {
#ifdef DEBUG
@ -727,6 +727,9 @@ nsBlockReflowState::RecoverStateFrom(nsLineBox* aLine,
#endif
mKidXMost = xmost;
}
if (mComputeMaxElementSize) {
UpdateMaxElementSize(nsSize(aLine->mMaxElementWidth, aLine->mBounds.height));
}
// The line may have clear before semantics.
if (NS_STYLE_CLEAR_NONE != aLine->mBreakType) {
@ -1500,10 +1503,10 @@ nsBlockFrame::ComputeFinalSize(const nsHTMLReflowState& aReflowState,
// contents (CSS2 section XXX)
computedWidth = borderPadding.left + aState.mContentArea.width +
borderPadding.right;
// maxWidth = aState.mMaxElementSize.width +
// borderPadding.left + borderPadding.right;
}
else if (aState.mComputeMaxElementSize) {
// See if we should compute our max element size
if (aState.mComputeMaxElementSize) {
if (aState.mNoWrap) {
// When no-wrap is true the max-element-size.width is the
// width of the widest line plus the right border. Note that
@ -3648,6 +3651,9 @@ nsBlockFrame::PostPlaceLine(nsBlockReflowState& aState,
// Update max-element-size
if (aState.mComputeMaxElementSize) {
aState.UpdateMaxElementSize(aMaxElementSize);
// We also cache the max element width in the line. This is needed for
// incremental reflow
aLine->mMaxElementWidth = aMaxElementSize.width;
}
#if XXX_need_line_outside_children

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

@ -34,6 +34,7 @@ nsLineBox::nsLineBox(nsIFrame* aFrame, PRInt32 aCount, PRUint16 flags)
//XXX mCarriedOutTopMargin = 0;
mCarriedOutBottomMargin = 0;
mBreakType = NS_STYLE_CLEAR_NONE;
mMaxElementWidth = 0;
}
nsLineBox::~nsLineBox()

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

@ -192,6 +192,7 @@ public:
nscoord mCarriedOutBottomMargin;/* XXX switch to 16 bits */
nsVoidArray* mFloaters;
nsLineBox* mNext;
nscoord mMaxElementWidth; // width part of max-element-size
};
//----------------------------------------------------------------------