r=troy; remove another 4 bytes from each block frame for a total of 10% today :-)

This commit is contained in:
kipp%netscape.com 1999-11-03 00:42:12 +00:00
Родитель bfb8a951ea
Коммит ec28ac0c5c
10 изменённых файлов: 64 добавлений и 82 удалений

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

@ -1195,9 +1195,6 @@ nsBlockFrame::List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) con
if (0 != mState) { if (0 != mState) {
fprintf(out, " [state=%08x]", mState); fprintf(out, " [state=%08x]", mState);
} }
if (0 != mFlags) {
fprintf(out, " [flags=%x]", mFlags);
}
PRInt32 numInlineLines = 0; PRInt32 numInlineLines = 0;
PRInt32 numBlockLines = 0; PRInt32 numBlockLines = 0;
if (nsnull != mLines) { if (nsnull != mLines) {
@ -1393,7 +1390,7 @@ nsBlockFrame::Reflow(nsIPresContext& aPresContext,
// Should we create a space manager? // Should we create a space manager?
nsCOMPtr<nsISpaceManager> spaceManager; nsCOMPtr<nsISpaceManager> spaceManager;
if (mFlags & NS_BLOCK_SPACE_MGR) { if (NS_BLOCK_SPACE_MGR & mState) {
nsSpaceManager* rawPtr = new nsSpaceManager(this); nsSpaceManager* rawPtr = new nsSpaceManager(this);
if (!rawPtr) { if (!rawPtr) {
return NS_ERROR_OUT_OF_MEMORY; return NS_ERROR_OUT_OF_MEMORY;
@ -1407,7 +1404,7 @@ nsBlockFrame::Reflow(nsIPresContext& aPresContext,
} }
nsBlockReflowState state(aReflowState, &aPresContext, this, aMetrics); nsBlockReflowState state(aReflowState, &aPresContext, this, aMetrics);
if (NS_BLOCK_MARGIN_ROOT & mFlags) { if (NS_BLOCK_MARGIN_ROOT & mState) {
state.mIsTopMarginRoot = PR_TRUE; state.mIsTopMarginRoot = PR_TRUE;
state.mIsBottomMarginRoot = PR_TRUE; state.mIsBottomMarginRoot = PR_TRUE;
} }
@ -1505,7 +1502,7 @@ nsBlockFrame::Reflow(nsIPresContext& aPresContext,
// Compute our final size // Compute our final size
ComputeFinalSize(aReflowState, state, aMetrics); ComputeFinalSize(aReflowState, state, aMetrics);
if (mFlags & NS_BLOCK_WRAP_SIZE) { if (NS_BLOCK_WRAP_SIZE & mState) {
// When the area frame is supposed to wrap around all in-flow // When the area frame is supposed to wrap around all in-flow
// children, make sure its big enough to include those that stick // children, make sure its big enough to include those that stick
// outside the box. // outside the box.
@ -1767,7 +1764,7 @@ nsBlockFrame::ComputeFinalSize(const nsHTMLReflowState& aReflowState,
// There are two options here. We either shrink wrap around our // There are two options here. We either shrink wrap around our
// contents or we fluff out to the maximum block width. Note: // contents or we fluff out to the maximum block width. Note:
// We always shrink wrap when given an unconstrained width. // We always shrink wrap when given an unconstrained width.
if ((0 == (NS_BLOCK_SHRINK_WRAP & mFlags)) && if ((0 == (NS_BLOCK_SHRINK_WRAP & mState)) &&
!aState.mUnconstrainedWidth && !aState.mUnconstrainedWidth &&
!compact) { !compact) {
// Set our width to the max width if we aren't already that // Set our width to the max width if we aren't already that
@ -5804,10 +5801,10 @@ nsBlockFrame::Init(nsIPresContext& aPresContext,
nsIFrame* aPrevInFlow) nsIFrame* aPrevInFlow)
{ {
if (aPrevInFlow) { if (aPrevInFlow) {
// Copy over the block/area frame flags // Copy over the block/area frame type flags
nsBlockFrame* blockFrame = (nsBlockFrame*)aPrevInFlow; nsBlockFrame* blockFrame = (nsBlockFrame*)aPrevInFlow;
SetFlags(blockFrame->mFlags); SetFlags(blockFrame->mState & NS_BLOCK_FLAGS_MASK);
} }
nsresult rv = nsBlockFrameSuper::Init(aPresContext, aContent, aParent, nsresult rv = nsBlockFrameSuper::Init(aPresContext, aContent, aParent,

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

@ -20,6 +20,7 @@
#define nsBlockFrame_h___ #define nsBlockFrame_h___
#include "nsHTMLContainerFrame.h" #include "nsHTMLContainerFrame.h"
#include "nsHTMLParts.h"
class nsBlockReflowState; class nsBlockReflowState;
class nsBulletFrame; class nsBulletFrame;
@ -36,11 +37,12 @@ class nsFirstLineFrame;
#define NS_BLOCK_FRAME_LAST_LIST_INDEX NS_BLOCK_FRAME_BULLET_LIST_INDEX #define NS_BLOCK_FRAME_LAST_LIST_INDEX NS_BLOCK_FRAME_BULLET_LIST_INDEX
/** /**
* Additional frame-state bits * Additional frame-state bits. There are more of these bits
* defined in nsHTMLParts.h (XXX: note: this should be cleaned up)
*/ */
#define NS_BLOCK_FRAME_HAS_OUTSIDE_BULLET 0x80000000 #define NS_BLOCK_FRAME_HAS_OUTSIDE_BULLET 0x80000000
#define NS_BLOCK_IS_HTML_PARAGRAPH 0x40000000 #define NS_BLOCK_IS_HTML_PARAGRAPH 0x40000000
#define NS_BLOCK_HAS_FIRST_LETTER_STYLE 0x10000000 #define NS_BLOCK_HAS_FIRST_LETTER_STYLE 0x20000000
#define nsBlockFrameSuper nsHTMLContainerFrame #define nsBlockFrameSuper nsHTMLContainerFrame
@ -144,7 +146,8 @@ protected:
nsIStyleContext* GetFirstLetterStyle(nsIPresContext* aPresContext); nsIStyleContext* GetFirstLetterStyle(nsIPresContext* aPresContext);
void SetFlags(PRUint32 aFlags) { void SetFlags(PRUint32 aFlags) {
mFlags = aFlags; mState &= ~NS_BLOCK_FLAGS_MASK;
mState |= aFlags;
} }
PRBool HaveOutsideBullet() const { PRBool HaveOutsideBullet() const {
@ -346,9 +349,6 @@ protected:
nsLineBox* mLines; nsLineBox* mLines;
// XXX subclass!
PRUint32 mFlags;
// Text run information // Text run information
nsTextRun* mTextRuns; nsTextRun* mTextRuns;

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

@ -1195,9 +1195,6 @@ nsBlockFrame::List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) con
if (0 != mState) { if (0 != mState) {
fprintf(out, " [state=%08x]", mState); fprintf(out, " [state=%08x]", mState);
} }
if (0 != mFlags) {
fprintf(out, " [flags=%x]", mFlags);
}
PRInt32 numInlineLines = 0; PRInt32 numInlineLines = 0;
PRInt32 numBlockLines = 0; PRInt32 numBlockLines = 0;
if (nsnull != mLines) { if (nsnull != mLines) {
@ -1393,7 +1390,7 @@ nsBlockFrame::Reflow(nsIPresContext& aPresContext,
// Should we create a space manager? // Should we create a space manager?
nsCOMPtr<nsISpaceManager> spaceManager; nsCOMPtr<nsISpaceManager> spaceManager;
if (mFlags & NS_BLOCK_SPACE_MGR) { if (NS_BLOCK_SPACE_MGR & mState) {
nsSpaceManager* rawPtr = new nsSpaceManager(this); nsSpaceManager* rawPtr = new nsSpaceManager(this);
if (!rawPtr) { if (!rawPtr) {
return NS_ERROR_OUT_OF_MEMORY; return NS_ERROR_OUT_OF_MEMORY;
@ -1407,7 +1404,7 @@ nsBlockFrame::Reflow(nsIPresContext& aPresContext,
} }
nsBlockReflowState state(aReflowState, &aPresContext, this, aMetrics); nsBlockReflowState state(aReflowState, &aPresContext, this, aMetrics);
if (NS_BLOCK_MARGIN_ROOT & mFlags) { if (NS_BLOCK_MARGIN_ROOT & mState) {
state.mIsTopMarginRoot = PR_TRUE; state.mIsTopMarginRoot = PR_TRUE;
state.mIsBottomMarginRoot = PR_TRUE; state.mIsBottomMarginRoot = PR_TRUE;
} }
@ -1505,7 +1502,7 @@ nsBlockFrame::Reflow(nsIPresContext& aPresContext,
// Compute our final size // Compute our final size
ComputeFinalSize(aReflowState, state, aMetrics); ComputeFinalSize(aReflowState, state, aMetrics);
if (mFlags & NS_BLOCK_WRAP_SIZE) { if (NS_BLOCK_WRAP_SIZE & mState) {
// When the area frame is supposed to wrap around all in-flow // When the area frame is supposed to wrap around all in-flow
// children, make sure its big enough to include those that stick // children, make sure its big enough to include those that stick
// outside the box. // outside the box.
@ -1767,7 +1764,7 @@ nsBlockFrame::ComputeFinalSize(const nsHTMLReflowState& aReflowState,
// There are two options here. We either shrink wrap around our // There are two options here. We either shrink wrap around our
// contents or we fluff out to the maximum block width. Note: // contents or we fluff out to the maximum block width. Note:
// We always shrink wrap when given an unconstrained width. // We always shrink wrap when given an unconstrained width.
if ((0 == (NS_BLOCK_SHRINK_WRAP & mFlags)) && if ((0 == (NS_BLOCK_SHRINK_WRAP & mState)) &&
!aState.mUnconstrainedWidth && !aState.mUnconstrainedWidth &&
!compact) { !compact) {
// Set our width to the max width if we aren't already that // Set our width to the max width if we aren't already that
@ -5804,10 +5801,10 @@ nsBlockFrame::Init(nsIPresContext& aPresContext,
nsIFrame* aPrevInFlow) nsIFrame* aPrevInFlow)
{ {
if (aPrevInFlow) { if (aPrevInFlow) {
// Copy over the block/area frame flags // Copy over the block/area frame type flags
nsBlockFrame* blockFrame = (nsBlockFrame*)aPrevInFlow; nsBlockFrame* blockFrame = (nsBlockFrame*)aPrevInFlow;
SetFlags(blockFrame->mFlags); SetFlags(blockFrame->mState & NS_BLOCK_FLAGS_MASK);
} }
nsresult rv = nsBlockFrameSuper::Init(aPresContext, aContent, aParent, nsresult rv = nsBlockFrameSuper::Init(aPresContext, aContent, aParent,

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

@ -1195,9 +1195,6 @@ nsBlockFrame::List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) con
if (0 != mState) { if (0 != mState) {
fprintf(out, " [state=%08x]", mState); fprintf(out, " [state=%08x]", mState);
} }
if (0 != mFlags) {
fprintf(out, " [flags=%x]", mFlags);
}
PRInt32 numInlineLines = 0; PRInt32 numInlineLines = 0;
PRInt32 numBlockLines = 0; PRInt32 numBlockLines = 0;
if (nsnull != mLines) { if (nsnull != mLines) {
@ -1393,7 +1390,7 @@ nsBlockFrame::Reflow(nsIPresContext& aPresContext,
// Should we create a space manager? // Should we create a space manager?
nsCOMPtr<nsISpaceManager> spaceManager; nsCOMPtr<nsISpaceManager> spaceManager;
if (mFlags & NS_BLOCK_SPACE_MGR) { if (NS_BLOCK_SPACE_MGR & mState) {
nsSpaceManager* rawPtr = new nsSpaceManager(this); nsSpaceManager* rawPtr = new nsSpaceManager(this);
if (!rawPtr) { if (!rawPtr) {
return NS_ERROR_OUT_OF_MEMORY; return NS_ERROR_OUT_OF_MEMORY;
@ -1407,7 +1404,7 @@ nsBlockFrame::Reflow(nsIPresContext& aPresContext,
} }
nsBlockReflowState state(aReflowState, &aPresContext, this, aMetrics); nsBlockReflowState state(aReflowState, &aPresContext, this, aMetrics);
if (NS_BLOCK_MARGIN_ROOT & mFlags) { if (NS_BLOCK_MARGIN_ROOT & mState) {
state.mIsTopMarginRoot = PR_TRUE; state.mIsTopMarginRoot = PR_TRUE;
state.mIsBottomMarginRoot = PR_TRUE; state.mIsBottomMarginRoot = PR_TRUE;
} }
@ -1505,7 +1502,7 @@ nsBlockFrame::Reflow(nsIPresContext& aPresContext,
// Compute our final size // Compute our final size
ComputeFinalSize(aReflowState, state, aMetrics); ComputeFinalSize(aReflowState, state, aMetrics);
if (mFlags & NS_BLOCK_WRAP_SIZE) { if (NS_BLOCK_WRAP_SIZE & mState) {
// When the area frame is supposed to wrap around all in-flow // When the area frame is supposed to wrap around all in-flow
// children, make sure its big enough to include those that stick // children, make sure its big enough to include those that stick
// outside the box. // outside the box.
@ -1767,7 +1764,7 @@ nsBlockFrame::ComputeFinalSize(const nsHTMLReflowState& aReflowState,
// There are two options here. We either shrink wrap around our // There are two options here. We either shrink wrap around our
// contents or we fluff out to the maximum block width. Note: // contents or we fluff out to the maximum block width. Note:
// We always shrink wrap when given an unconstrained width. // We always shrink wrap when given an unconstrained width.
if ((0 == (NS_BLOCK_SHRINK_WRAP & mFlags)) && if ((0 == (NS_BLOCK_SHRINK_WRAP & mState)) &&
!aState.mUnconstrainedWidth && !aState.mUnconstrainedWidth &&
!compact) { !compact) {
// Set our width to the max width if we aren't already that // Set our width to the max width if we aren't already that
@ -5804,10 +5801,10 @@ nsBlockFrame::Init(nsIPresContext& aPresContext,
nsIFrame* aPrevInFlow) nsIFrame* aPrevInFlow)
{ {
if (aPrevInFlow) { if (aPrevInFlow) {
// Copy over the block/area frame flags // Copy over the block/area frame type flags
nsBlockFrame* blockFrame = (nsBlockFrame*)aPrevInFlow; nsBlockFrame* blockFrame = (nsBlockFrame*)aPrevInFlow;
SetFlags(blockFrame->mFlags); SetFlags(blockFrame->mState & NS_BLOCK_FLAGS_MASK);
} }
nsresult rv = nsBlockFrameSuper::Init(aPresContext, aContent, aParent, nsresult rv = nsBlockFrameSuper::Init(aPresContext, aContent, aParent,

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

@ -241,12 +241,12 @@ NS_CreateHTMLElement(nsIHTMLContent** aResult,
// policies. // policies.
// Flags for block/area frames // Flags for block/area frames
#define NS_BLOCK_SHRINK_WRAP 0x1 #define NS_BLOCK_SHRINK_WRAP 0x00010000
#define NS_BLOCK_NO_AUTO_MARGINS 0x2 #define NS_BLOCK_NO_AUTO_MARGINS 0x00020000
#define NS_BLOCK_MARGIN_ROOT 0x4 #define NS_BLOCK_MARGIN_ROOT 0x00040000
#define NS_BLOCK_DOCUMENT_ROOT 0x8 #define NS_BLOCK_SPACE_MGR 0x00080000
#define NS_BLOCK_SPACE_MGR 0x10 #define NS_BLOCK_WRAP_SIZE 0x00100000
#define NS_BLOCK_WRAP_SIZE 0x20 #define NS_BLOCK_FLAGS_MASK 0x00ff0000
// Create a frame that supports "display: block" layout behavior // Create a frame that supports "display: block" layout behavior
extern nsresult NS_NewBlockFrame(nsIFrame** aNewFrame, extern nsresult NS_NewBlockFrame(nsIFrame** aNewFrame,
@ -261,7 +261,7 @@ NS_NewAttributeContent(nsIContent ** aResult);
// By default, area frames will extend // By default, area frames will extend
// their height to cover any children that "stick out". // their height to cover any children that "stick out".
extern nsresult NS_NewSelectsAreaFrame(nsIFrame** aNewFrame, extern nsresult NS_NewSelectsAreaFrame(nsIFrame** aNewFrame,
PRUint32 aFlags = NS_BLOCK_WRAP_SIZE); PRUint32 aFlags = NS_BLOCK_WRAP_SIZE);
// Create a basic area frame. By default, area frames will extend // Create a basic area frame. By default, area frames will extend
// their height to cover any children that "stick out". // their height to cover any children that "stick out".
@ -279,7 +279,7 @@ inline nsresult NS_NewTableCaptionFrame(nsIFrame** aNewFrame) {
// This type of AreaFrame is the document root, a margin root, and the // This type of AreaFrame is the document root, a margin root, and the
// initial containing block for absolutely positioned elements // initial containing block for absolutely positioned elements
inline nsresult NS_NewDocumentElementFrame(nsIFrame** aNewFrame) { inline nsresult NS_NewDocumentElementFrame(nsIFrame** aNewFrame) {
return NS_NewAreaFrame(aNewFrame, NS_BLOCK_SPACE_MGR|NS_BLOCK_DOCUMENT_ROOT|NS_BLOCK_MARGIN_ROOT); return NS_NewAreaFrame(aNewFrame, NS_BLOCK_SPACE_MGR|NS_BLOCK_MARGIN_ROOT);
} }
// This type of AreaFrame is a margin root, but does not shrink wrap // This type of AreaFrame is a margin root, but does not shrink wrap

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

@ -1195,9 +1195,6 @@ nsBlockFrame::List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) con
if (0 != mState) { if (0 != mState) {
fprintf(out, " [state=%08x]", mState); fprintf(out, " [state=%08x]", mState);
} }
if (0 != mFlags) {
fprintf(out, " [flags=%x]", mFlags);
}
PRInt32 numInlineLines = 0; PRInt32 numInlineLines = 0;
PRInt32 numBlockLines = 0; PRInt32 numBlockLines = 0;
if (nsnull != mLines) { if (nsnull != mLines) {
@ -1393,7 +1390,7 @@ nsBlockFrame::Reflow(nsIPresContext& aPresContext,
// Should we create a space manager? // Should we create a space manager?
nsCOMPtr<nsISpaceManager> spaceManager; nsCOMPtr<nsISpaceManager> spaceManager;
if (mFlags & NS_BLOCK_SPACE_MGR) { if (NS_BLOCK_SPACE_MGR & mState) {
nsSpaceManager* rawPtr = new nsSpaceManager(this); nsSpaceManager* rawPtr = new nsSpaceManager(this);
if (!rawPtr) { if (!rawPtr) {
return NS_ERROR_OUT_OF_MEMORY; return NS_ERROR_OUT_OF_MEMORY;
@ -1407,7 +1404,7 @@ nsBlockFrame::Reflow(nsIPresContext& aPresContext,
} }
nsBlockReflowState state(aReflowState, &aPresContext, this, aMetrics); nsBlockReflowState state(aReflowState, &aPresContext, this, aMetrics);
if (NS_BLOCK_MARGIN_ROOT & mFlags) { if (NS_BLOCK_MARGIN_ROOT & mState) {
state.mIsTopMarginRoot = PR_TRUE; state.mIsTopMarginRoot = PR_TRUE;
state.mIsBottomMarginRoot = PR_TRUE; state.mIsBottomMarginRoot = PR_TRUE;
} }
@ -1505,7 +1502,7 @@ nsBlockFrame::Reflow(nsIPresContext& aPresContext,
// Compute our final size // Compute our final size
ComputeFinalSize(aReflowState, state, aMetrics); ComputeFinalSize(aReflowState, state, aMetrics);
if (mFlags & NS_BLOCK_WRAP_SIZE) { if (NS_BLOCK_WRAP_SIZE & mState) {
// When the area frame is supposed to wrap around all in-flow // When the area frame is supposed to wrap around all in-flow
// children, make sure its big enough to include those that stick // children, make sure its big enough to include those that stick
// outside the box. // outside the box.
@ -1767,7 +1764,7 @@ nsBlockFrame::ComputeFinalSize(const nsHTMLReflowState& aReflowState,
// There are two options here. We either shrink wrap around our // There are two options here. We either shrink wrap around our
// contents or we fluff out to the maximum block width. Note: // contents or we fluff out to the maximum block width. Note:
// We always shrink wrap when given an unconstrained width. // We always shrink wrap when given an unconstrained width.
if ((0 == (NS_BLOCK_SHRINK_WRAP & mFlags)) && if ((0 == (NS_BLOCK_SHRINK_WRAP & mState)) &&
!aState.mUnconstrainedWidth && !aState.mUnconstrainedWidth &&
!compact) { !compact) {
// Set our width to the max width if we aren't already that // Set our width to the max width if we aren't already that
@ -5804,10 +5801,10 @@ nsBlockFrame::Init(nsIPresContext& aPresContext,
nsIFrame* aPrevInFlow) nsIFrame* aPrevInFlow)
{ {
if (aPrevInFlow) { if (aPrevInFlow) {
// Copy over the block/area frame flags // Copy over the block/area frame type flags
nsBlockFrame* blockFrame = (nsBlockFrame*)aPrevInFlow; nsBlockFrame* blockFrame = (nsBlockFrame*)aPrevInFlow;
SetFlags(blockFrame->mFlags); SetFlags(blockFrame->mState & NS_BLOCK_FLAGS_MASK);
} }
nsresult rv = nsBlockFrameSuper::Init(aPresContext, aContent, aParent, nsresult rv = nsBlockFrameSuper::Init(aPresContext, aContent, aParent,

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

@ -20,6 +20,7 @@
#define nsBlockFrame_h___ #define nsBlockFrame_h___
#include "nsHTMLContainerFrame.h" #include "nsHTMLContainerFrame.h"
#include "nsHTMLParts.h"
class nsBlockReflowState; class nsBlockReflowState;
class nsBulletFrame; class nsBulletFrame;
@ -36,11 +37,12 @@ class nsFirstLineFrame;
#define NS_BLOCK_FRAME_LAST_LIST_INDEX NS_BLOCK_FRAME_BULLET_LIST_INDEX #define NS_BLOCK_FRAME_LAST_LIST_INDEX NS_BLOCK_FRAME_BULLET_LIST_INDEX
/** /**
* Additional frame-state bits * Additional frame-state bits. There are more of these bits
* defined in nsHTMLParts.h (XXX: note: this should be cleaned up)
*/ */
#define NS_BLOCK_FRAME_HAS_OUTSIDE_BULLET 0x80000000 #define NS_BLOCK_FRAME_HAS_OUTSIDE_BULLET 0x80000000
#define NS_BLOCK_IS_HTML_PARAGRAPH 0x40000000 #define NS_BLOCK_IS_HTML_PARAGRAPH 0x40000000
#define NS_BLOCK_HAS_FIRST_LETTER_STYLE 0x10000000 #define NS_BLOCK_HAS_FIRST_LETTER_STYLE 0x20000000
#define nsBlockFrameSuper nsHTMLContainerFrame #define nsBlockFrameSuper nsHTMLContainerFrame
@ -144,7 +146,8 @@ protected:
nsIStyleContext* GetFirstLetterStyle(nsIPresContext* aPresContext); nsIStyleContext* GetFirstLetterStyle(nsIPresContext* aPresContext);
void SetFlags(PRUint32 aFlags) { void SetFlags(PRUint32 aFlags) {
mFlags = aFlags; mState &= ~NS_BLOCK_FLAGS_MASK;
mState |= aFlags;
} }
PRBool HaveOutsideBullet() const { PRBool HaveOutsideBullet() const {
@ -346,9 +349,6 @@ protected:
nsLineBox* mLines; nsLineBox* mLines;
// XXX subclass!
PRUint32 mFlags;
// Text run information // Text run information
nsTextRun* mTextRuns; nsTextRun* mTextRuns;

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

@ -1195,9 +1195,6 @@ nsBlockFrame::List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) con
if (0 != mState) { if (0 != mState) {
fprintf(out, " [state=%08x]", mState); fprintf(out, " [state=%08x]", mState);
} }
if (0 != mFlags) {
fprintf(out, " [flags=%x]", mFlags);
}
PRInt32 numInlineLines = 0; PRInt32 numInlineLines = 0;
PRInt32 numBlockLines = 0; PRInt32 numBlockLines = 0;
if (nsnull != mLines) { if (nsnull != mLines) {
@ -1393,7 +1390,7 @@ nsBlockFrame::Reflow(nsIPresContext& aPresContext,
// Should we create a space manager? // Should we create a space manager?
nsCOMPtr<nsISpaceManager> spaceManager; nsCOMPtr<nsISpaceManager> spaceManager;
if (mFlags & NS_BLOCK_SPACE_MGR) { if (NS_BLOCK_SPACE_MGR & mState) {
nsSpaceManager* rawPtr = new nsSpaceManager(this); nsSpaceManager* rawPtr = new nsSpaceManager(this);
if (!rawPtr) { if (!rawPtr) {
return NS_ERROR_OUT_OF_MEMORY; return NS_ERROR_OUT_OF_MEMORY;
@ -1407,7 +1404,7 @@ nsBlockFrame::Reflow(nsIPresContext& aPresContext,
} }
nsBlockReflowState state(aReflowState, &aPresContext, this, aMetrics); nsBlockReflowState state(aReflowState, &aPresContext, this, aMetrics);
if (NS_BLOCK_MARGIN_ROOT & mFlags) { if (NS_BLOCK_MARGIN_ROOT & mState) {
state.mIsTopMarginRoot = PR_TRUE; state.mIsTopMarginRoot = PR_TRUE;
state.mIsBottomMarginRoot = PR_TRUE; state.mIsBottomMarginRoot = PR_TRUE;
} }
@ -1505,7 +1502,7 @@ nsBlockFrame::Reflow(nsIPresContext& aPresContext,
// Compute our final size // Compute our final size
ComputeFinalSize(aReflowState, state, aMetrics); ComputeFinalSize(aReflowState, state, aMetrics);
if (mFlags & NS_BLOCK_WRAP_SIZE) { if (NS_BLOCK_WRAP_SIZE & mState) {
// When the area frame is supposed to wrap around all in-flow // When the area frame is supposed to wrap around all in-flow
// children, make sure its big enough to include those that stick // children, make sure its big enough to include those that stick
// outside the box. // outside the box.
@ -1767,7 +1764,7 @@ nsBlockFrame::ComputeFinalSize(const nsHTMLReflowState& aReflowState,
// There are two options here. We either shrink wrap around our // There are two options here. We either shrink wrap around our
// contents or we fluff out to the maximum block width. Note: // contents or we fluff out to the maximum block width. Note:
// We always shrink wrap when given an unconstrained width. // We always shrink wrap when given an unconstrained width.
if ((0 == (NS_BLOCK_SHRINK_WRAP & mFlags)) && if ((0 == (NS_BLOCK_SHRINK_WRAP & mState)) &&
!aState.mUnconstrainedWidth && !aState.mUnconstrainedWidth &&
!compact) { !compact) {
// Set our width to the max width if we aren't already that // Set our width to the max width if we aren't already that
@ -5804,10 +5801,10 @@ nsBlockFrame::Init(nsIPresContext& aPresContext,
nsIFrame* aPrevInFlow) nsIFrame* aPrevInFlow)
{ {
if (aPrevInFlow) { if (aPrevInFlow) {
// Copy over the block/area frame flags // Copy over the block/area frame type flags
nsBlockFrame* blockFrame = (nsBlockFrame*)aPrevInFlow; nsBlockFrame* blockFrame = (nsBlockFrame*)aPrevInFlow;
SetFlags(blockFrame->mFlags); SetFlags(blockFrame->mState & NS_BLOCK_FLAGS_MASK);
} }
nsresult rv = nsBlockFrameSuper::Init(aPresContext, aContent, aParent, nsresult rv = nsBlockFrameSuper::Init(aPresContext, aContent, aParent,

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

@ -1195,9 +1195,6 @@ nsBlockFrame::List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) con
if (0 != mState) { if (0 != mState) {
fprintf(out, " [state=%08x]", mState); fprintf(out, " [state=%08x]", mState);
} }
if (0 != mFlags) {
fprintf(out, " [flags=%x]", mFlags);
}
PRInt32 numInlineLines = 0; PRInt32 numInlineLines = 0;
PRInt32 numBlockLines = 0; PRInt32 numBlockLines = 0;
if (nsnull != mLines) { if (nsnull != mLines) {
@ -1393,7 +1390,7 @@ nsBlockFrame::Reflow(nsIPresContext& aPresContext,
// Should we create a space manager? // Should we create a space manager?
nsCOMPtr<nsISpaceManager> spaceManager; nsCOMPtr<nsISpaceManager> spaceManager;
if (mFlags & NS_BLOCK_SPACE_MGR) { if (NS_BLOCK_SPACE_MGR & mState) {
nsSpaceManager* rawPtr = new nsSpaceManager(this); nsSpaceManager* rawPtr = new nsSpaceManager(this);
if (!rawPtr) { if (!rawPtr) {
return NS_ERROR_OUT_OF_MEMORY; return NS_ERROR_OUT_OF_MEMORY;
@ -1407,7 +1404,7 @@ nsBlockFrame::Reflow(nsIPresContext& aPresContext,
} }
nsBlockReflowState state(aReflowState, &aPresContext, this, aMetrics); nsBlockReflowState state(aReflowState, &aPresContext, this, aMetrics);
if (NS_BLOCK_MARGIN_ROOT & mFlags) { if (NS_BLOCK_MARGIN_ROOT & mState) {
state.mIsTopMarginRoot = PR_TRUE; state.mIsTopMarginRoot = PR_TRUE;
state.mIsBottomMarginRoot = PR_TRUE; state.mIsBottomMarginRoot = PR_TRUE;
} }
@ -1505,7 +1502,7 @@ nsBlockFrame::Reflow(nsIPresContext& aPresContext,
// Compute our final size // Compute our final size
ComputeFinalSize(aReflowState, state, aMetrics); ComputeFinalSize(aReflowState, state, aMetrics);
if (mFlags & NS_BLOCK_WRAP_SIZE) { if (NS_BLOCK_WRAP_SIZE & mState) {
// When the area frame is supposed to wrap around all in-flow // When the area frame is supposed to wrap around all in-flow
// children, make sure its big enough to include those that stick // children, make sure its big enough to include those that stick
// outside the box. // outside the box.
@ -1767,7 +1764,7 @@ nsBlockFrame::ComputeFinalSize(const nsHTMLReflowState& aReflowState,
// There are two options here. We either shrink wrap around our // There are two options here. We either shrink wrap around our
// contents or we fluff out to the maximum block width. Note: // contents or we fluff out to the maximum block width. Note:
// We always shrink wrap when given an unconstrained width. // We always shrink wrap when given an unconstrained width.
if ((0 == (NS_BLOCK_SHRINK_WRAP & mFlags)) && if ((0 == (NS_BLOCK_SHRINK_WRAP & mState)) &&
!aState.mUnconstrainedWidth && !aState.mUnconstrainedWidth &&
!compact) { !compact) {
// Set our width to the max width if we aren't already that // Set our width to the max width if we aren't already that
@ -5804,10 +5801,10 @@ nsBlockFrame::Init(nsIPresContext& aPresContext,
nsIFrame* aPrevInFlow) nsIFrame* aPrevInFlow)
{ {
if (aPrevInFlow) { if (aPrevInFlow) {
// Copy over the block/area frame flags // Copy over the block/area frame type flags
nsBlockFrame* blockFrame = (nsBlockFrame*)aPrevInFlow; nsBlockFrame* blockFrame = (nsBlockFrame*)aPrevInFlow;
SetFlags(blockFrame->mFlags); SetFlags(blockFrame->mState & NS_BLOCK_FLAGS_MASK);
} }
nsresult rv = nsBlockFrameSuper::Init(aPresContext, aContent, aParent, nsresult rv = nsBlockFrameSuper::Init(aPresContext, aContent, aParent,

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

@ -241,12 +241,12 @@ NS_CreateHTMLElement(nsIHTMLContent** aResult,
// policies. // policies.
// Flags for block/area frames // Flags for block/area frames
#define NS_BLOCK_SHRINK_WRAP 0x1 #define NS_BLOCK_SHRINK_WRAP 0x00010000
#define NS_BLOCK_NO_AUTO_MARGINS 0x2 #define NS_BLOCK_NO_AUTO_MARGINS 0x00020000
#define NS_BLOCK_MARGIN_ROOT 0x4 #define NS_BLOCK_MARGIN_ROOT 0x00040000
#define NS_BLOCK_DOCUMENT_ROOT 0x8 #define NS_BLOCK_SPACE_MGR 0x00080000
#define NS_BLOCK_SPACE_MGR 0x10 #define NS_BLOCK_WRAP_SIZE 0x00100000
#define NS_BLOCK_WRAP_SIZE 0x20 #define NS_BLOCK_FLAGS_MASK 0x00ff0000
// Create a frame that supports "display: block" layout behavior // Create a frame that supports "display: block" layout behavior
extern nsresult NS_NewBlockFrame(nsIFrame** aNewFrame, extern nsresult NS_NewBlockFrame(nsIFrame** aNewFrame,
@ -261,7 +261,7 @@ NS_NewAttributeContent(nsIContent ** aResult);
// By default, area frames will extend // By default, area frames will extend
// their height to cover any children that "stick out". // their height to cover any children that "stick out".
extern nsresult NS_NewSelectsAreaFrame(nsIFrame** aNewFrame, extern nsresult NS_NewSelectsAreaFrame(nsIFrame** aNewFrame,
PRUint32 aFlags = NS_BLOCK_WRAP_SIZE); PRUint32 aFlags = NS_BLOCK_WRAP_SIZE);
// Create a basic area frame. By default, area frames will extend // Create a basic area frame. By default, area frames will extend
// their height to cover any children that "stick out". // their height to cover any children that "stick out".
@ -279,7 +279,7 @@ inline nsresult NS_NewTableCaptionFrame(nsIFrame** aNewFrame) {
// This type of AreaFrame is the document root, a margin root, and the // This type of AreaFrame is the document root, a margin root, and the
// initial containing block for absolutely positioned elements // initial containing block for absolutely positioned elements
inline nsresult NS_NewDocumentElementFrame(nsIFrame** aNewFrame) { inline nsresult NS_NewDocumentElementFrame(nsIFrame** aNewFrame) {
return NS_NewAreaFrame(aNewFrame, NS_BLOCK_SPACE_MGR|NS_BLOCK_DOCUMENT_ROOT|NS_BLOCK_MARGIN_ROOT); return NS_NewAreaFrame(aNewFrame, NS_BLOCK_SPACE_MGR|NS_BLOCK_MARGIN_ROOT);
} }
// This type of AreaFrame is a margin root, but does not shrink wrap // This type of AreaFrame is a margin root, but does not shrink wrap