Table cell frames and table caption frames now use block frames and not area
frames. This saves 24 bytes per frame instance
This commit is contained in:
troy%netscape.com 1999-10-08 04:32:46 +00:00
Родитель 935b028534
Коммит 72ee697f6c
12 изменённых файлов: 180 добавлений и 80 удалений

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

@ -368,32 +368,6 @@ nsAreaFrame::Reflow(nsIPresContext& aPresContext,
#endif
#endif
if (mFlags & NS_AREA_WRAP_SIZE) {
// When the area frame is supposed to wrap around all in-flow
// children, make sure its big enough to include those that stick
// outside the box.
if (NS_FRAME_OUTSIDE_CHILDREN & mState) {
nscoord xMost = aDesiredSize.mCombinedArea.XMost();
if (xMost > aDesiredSize.width) {
#ifdef NOISY_FINAL_SIZE
ListTag(stdout);
printf(": changing desired width from %d to %d\n",
aDesiredSize.width, xMost);
#endif
aDesiredSize.width = xMost;
}
nscoord yMost = aDesiredSize.mCombinedArea.YMost();
if (yMost > aDesiredSize.height) {
#ifdef NOISY_FINAL_SIZE
ListTag(stdout);
printf(": changing desired height from %d to %d\n",
aDesiredSize.height, yMost);
#endif
aDesiredSize.height = yMost;
}
}
}
// Let the absolutely positioned container reflow any absolutely positioned
// child frames that need to be reflowed, e.g., elements with a percentage
// based width/height

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

@ -940,7 +940,7 @@ nsBlockReflowState::RecoverStateFrom(nsLineBox* aLine,
const nsIID kBlockFrameCID = NS_BLOCK_FRAME_CID;
nsresult
NS_NewBlockFrame(nsIFrame** aNewFrame)
NS_NewBlockFrame(nsIFrame** aNewFrame, PRUint32 aFlags)
{
NS_PRECONDITION(aNewFrame, "null OUT ptr");
if (nsnull == aNewFrame) {
@ -950,6 +950,7 @@ NS_NewBlockFrame(nsIFrame** aNewFrame)
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}
it->SetFlags(aFlags);
*aNewFrame = it;
return NS_OK;
}
@ -1340,6 +1341,30 @@ nsBlockFrame::Reflow(nsIPresContext& aPresContext,
// Compute our final size
ComputeFinalSize(aReflowState, state, aMetrics);
if (mFlags & NS_BLOCK_WRAP_SIZE) {
// When the area frame is supposed to wrap around all in-flow
// children, make sure its big enough to include those that stick
// outside the box.
if (NS_FRAME_OUTSIDE_CHILDREN & mState) {
nscoord xMost = aMetrics.mCombinedArea.XMost();
if (xMost > aMetrics.width) {
#ifdef NOISY_FINAL_SIZE
ListTag(stdout);
printf(": changing desired width from %d to %d\n", aMetrics.width, xMost);
#endif
aMetrics.width = xMost;
}
nscoord yMost = aMetrics.mCombinedArea.YMost();
if (yMost > aMetrics.height) {
#ifdef NOISY_FINAL_SIZE
ListTag(stdout);
printf(": changing desired height from %d to %d\n", aMetrics.height, yMost);
#endif
aMetrics.height = yMost;
}
}
}
// If this is an incremental reflow and we changed size, then make sure our
// border is repainted if necessary
if (eReflowReason_Incremental == aReflowState.reason) {

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

@ -56,7 +56,7 @@ extern const nsIID kBlockFrameCID;
class nsBlockFrame : public nsBlockFrameSuper
{
public:
friend nsresult NS_NewBlockFrame(nsIFrame** aNewFrame);
friend nsresult NS_NewBlockFrame(nsIFrame** aNewFrame, PRUint32 aFlags);
// nsISupports
NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr);

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

@ -940,7 +940,7 @@ nsBlockReflowState::RecoverStateFrom(nsLineBox* aLine,
const nsIID kBlockFrameCID = NS_BLOCK_FRAME_CID;
nsresult
NS_NewBlockFrame(nsIFrame** aNewFrame)
NS_NewBlockFrame(nsIFrame** aNewFrame, PRUint32 aFlags)
{
NS_PRECONDITION(aNewFrame, "null OUT ptr");
if (nsnull == aNewFrame) {
@ -950,6 +950,7 @@ NS_NewBlockFrame(nsIFrame** aNewFrame)
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}
it->SetFlags(aFlags);
*aNewFrame = it;
return NS_OK;
}
@ -1340,6 +1341,30 @@ nsBlockFrame::Reflow(nsIPresContext& aPresContext,
// Compute our final size
ComputeFinalSize(aReflowState, state, aMetrics);
if (mFlags & NS_BLOCK_WRAP_SIZE) {
// When the area frame is supposed to wrap around all in-flow
// children, make sure its big enough to include those that stick
// outside the box.
if (NS_FRAME_OUTSIDE_CHILDREN & mState) {
nscoord xMost = aMetrics.mCombinedArea.XMost();
if (xMost > aMetrics.width) {
#ifdef NOISY_FINAL_SIZE
ListTag(stdout);
printf(": changing desired width from %d to %d\n", aMetrics.width, xMost);
#endif
aMetrics.width = xMost;
}
nscoord yMost = aMetrics.mCombinedArea.YMost();
if (yMost > aMetrics.height) {
#ifdef NOISY_FINAL_SIZE
ListTag(stdout);
printf(": changing desired height from %d to %d\n", aMetrics.height, yMost);
#endif
aMetrics.height = yMost;
}
}
}
// If this is an incremental reflow and we changed size, then make sure our
// border is repainted if necessary
if (eReflowReason_Incremental == aReflowState.reason) {

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

@ -940,7 +940,7 @@ nsBlockReflowState::RecoverStateFrom(nsLineBox* aLine,
const nsIID kBlockFrameCID = NS_BLOCK_FRAME_CID;
nsresult
NS_NewBlockFrame(nsIFrame** aNewFrame)
NS_NewBlockFrame(nsIFrame** aNewFrame, PRUint32 aFlags)
{
NS_PRECONDITION(aNewFrame, "null OUT ptr");
if (nsnull == aNewFrame) {
@ -950,6 +950,7 @@ NS_NewBlockFrame(nsIFrame** aNewFrame)
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}
it->SetFlags(aFlags);
*aNewFrame = it;
return NS_OK;
}
@ -1340,6 +1341,30 @@ nsBlockFrame::Reflow(nsIPresContext& aPresContext,
// Compute our final size
ComputeFinalSize(aReflowState, state, aMetrics);
if (mFlags & NS_BLOCK_WRAP_SIZE) {
// When the area frame is supposed to wrap around all in-flow
// children, make sure its big enough to include those that stick
// outside the box.
if (NS_FRAME_OUTSIDE_CHILDREN & mState) {
nscoord xMost = aMetrics.mCombinedArea.XMost();
if (xMost > aMetrics.width) {
#ifdef NOISY_FINAL_SIZE
ListTag(stdout);
printf(": changing desired width from %d to %d\n", aMetrics.width, xMost);
#endif
aMetrics.width = xMost;
}
nscoord yMost = aMetrics.mCombinedArea.YMost();
if (yMost > aMetrics.height) {
#ifdef NOISY_FINAL_SIZE
ListTag(stdout);
printf(": changing desired height from %d to %d\n", aMetrics.height, yMost);
#endif
aMetrics.height = yMost;
}
}
}
// If this is an incremental reflow and we changed size, then make sure our
// border is repainted if necessary
if (eReflowReason_Incremental == aReflowState.reason) {

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

@ -246,7 +246,11 @@ NS_CreateHTMLElement(nsIHTMLContent** aResult,
#define NS_BLOCK_MARGIN_ROOT 0x4
#define NS_BLOCK_DOCUMENT_ROOT 0x8
#define NS_BLOCK_SPACE_MGR 0x10
#define NS_AREA_WRAP_SIZE 0x20
#define NS_BLOCK_WRAP_SIZE 0x20
// Create a frame that supports "display: block" layout behavior
extern nsresult NS_NewBlockFrame(nsIFrame** aNewFrame,
PRUint32 aFlags = 0);
// Special Generated Content Frame
extern nsresult
@ -257,23 +261,23 @@ NS_NewAttributeContent(nsIContent ** aResult);
// By default, area frames will extend
// their height to cover any children that "stick out".
extern nsresult NS_NewSelectsAreaFrame(nsIFrame** aNewFrame,
PRUint32 aFlags = NS_AREA_WRAP_SIZE);
PRUint32 aFlags = NS_BLOCK_WRAP_SIZE);
// Create a basic area frame. By default, area frames will extend
// their height to cover any children that "stick out".
extern nsresult NS_NewAreaFrame(nsIFrame** aNewFrame,
PRUint32 aFlags = NS_AREA_WRAP_SIZE);
PRUint32 aFlags = NS_BLOCK_SPACE_MGR|NS_BLOCK_WRAP_SIZE);
// These AreaFrame's shrink wrap around their contents
inline nsresult NS_NewTableCellInnerFrame(nsIFrame** aNewFrame) {
return NS_NewAreaFrame(aNewFrame, NS_BLOCK_SPACE_MGR|NS_AREA_WRAP_SIZE);
return NS_NewBlockFrame(aNewFrame, NS_BLOCK_SPACE_MGR|NS_BLOCK_WRAP_SIZE);
}
inline nsresult NS_NewTableCaptionFrame(nsIFrame** aNewFrame) {
return NS_NewAreaFrame(aNewFrame, NS_BLOCK_SPACE_MGR|NS_AREA_WRAP_SIZE);
return NS_NewBlockFrame(aNewFrame, NS_BLOCK_SPACE_MGR|NS_BLOCK_WRAP_SIZE);
}
// This type of AreaFrame is the document root and is a margin root for
// margin collapsing.
// This type of AreaFrame is the document root, a margin root, and the
// initial containing block for absolutely positioned elements
inline nsresult NS_NewDocumentElementFrame(nsIFrame** aNewFrame) {
return NS_NewAreaFrame(aNewFrame, NS_BLOCK_SPACE_MGR|NS_BLOCK_DOCUMENT_ROOT|NS_BLOCK_MARGIN_ROOT);
}
@ -296,9 +300,6 @@ inline nsresult NS_NewRelativeItemWrapperFrame(nsIFrame** aNewFrame) {
extern nsresult NS_NewBRFrame(nsIFrame** aNewFrame);
// Create a frame that supports "display: block" layout behavior
extern nsresult NS_NewBlockFrame(nsIFrame** aNewFrame);
extern nsresult NS_NewCommentFrame(nsIFrame** aFrameResult);
extern nsresult NS_NewHRFrame(nsIFrame** aNewFrame);

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

@ -368,32 +368,6 @@ nsAreaFrame::Reflow(nsIPresContext& aPresContext,
#endif
#endif
if (mFlags & NS_AREA_WRAP_SIZE) {
// When the area frame is supposed to wrap around all in-flow
// children, make sure its big enough to include those that stick
// outside the box.
if (NS_FRAME_OUTSIDE_CHILDREN & mState) {
nscoord xMost = aDesiredSize.mCombinedArea.XMost();
if (xMost > aDesiredSize.width) {
#ifdef NOISY_FINAL_SIZE
ListTag(stdout);
printf(": changing desired width from %d to %d\n",
aDesiredSize.width, xMost);
#endif
aDesiredSize.width = xMost;
}
nscoord yMost = aDesiredSize.mCombinedArea.YMost();
if (yMost > aDesiredSize.height) {
#ifdef NOISY_FINAL_SIZE
ListTag(stdout);
printf(": changing desired height from %d to %d\n",
aDesiredSize.height, yMost);
#endif
aDesiredSize.height = yMost;
}
}
}
// Let the absolutely positioned container reflow any absolutely positioned
// child frames that need to be reflowed, e.g., elements with a percentage
// based width/height

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

@ -940,7 +940,7 @@ nsBlockReflowState::RecoverStateFrom(nsLineBox* aLine,
const nsIID kBlockFrameCID = NS_BLOCK_FRAME_CID;
nsresult
NS_NewBlockFrame(nsIFrame** aNewFrame)
NS_NewBlockFrame(nsIFrame** aNewFrame, PRUint32 aFlags)
{
NS_PRECONDITION(aNewFrame, "null OUT ptr");
if (nsnull == aNewFrame) {
@ -950,6 +950,7 @@ NS_NewBlockFrame(nsIFrame** aNewFrame)
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}
it->SetFlags(aFlags);
*aNewFrame = it;
return NS_OK;
}
@ -1340,6 +1341,30 @@ nsBlockFrame::Reflow(nsIPresContext& aPresContext,
// Compute our final size
ComputeFinalSize(aReflowState, state, aMetrics);
if (mFlags & NS_BLOCK_WRAP_SIZE) {
// When the area frame is supposed to wrap around all in-flow
// children, make sure its big enough to include those that stick
// outside the box.
if (NS_FRAME_OUTSIDE_CHILDREN & mState) {
nscoord xMost = aMetrics.mCombinedArea.XMost();
if (xMost > aMetrics.width) {
#ifdef NOISY_FINAL_SIZE
ListTag(stdout);
printf(": changing desired width from %d to %d\n", aMetrics.width, xMost);
#endif
aMetrics.width = xMost;
}
nscoord yMost = aMetrics.mCombinedArea.YMost();
if (yMost > aMetrics.height) {
#ifdef NOISY_FINAL_SIZE
ListTag(stdout);
printf(": changing desired height from %d to %d\n", aMetrics.height, yMost);
#endif
aMetrics.height = yMost;
}
}
}
// If this is an incremental reflow and we changed size, then make sure our
// border is repainted if necessary
if (eReflowReason_Incremental == aReflowState.reason) {

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

@ -56,7 +56,7 @@ extern const nsIID kBlockFrameCID;
class nsBlockFrame : public nsBlockFrameSuper
{
public:
friend nsresult NS_NewBlockFrame(nsIFrame** aNewFrame);
friend nsresult NS_NewBlockFrame(nsIFrame** aNewFrame, PRUint32 aFlags);
// nsISupports
NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr);

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

@ -940,7 +940,7 @@ nsBlockReflowState::RecoverStateFrom(nsLineBox* aLine,
const nsIID kBlockFrameCID = NS_BLOCK_FRAME_CID;
nsresult
NS_NewBlockFrame(nsIFrame** aNewFrame)
NS_NewBlockFrame(nsIFrame** aNewFrame, PRUint32 aFlags)
{
NS_PRECONDITION(aNewFrame, "null OUT ptr");
if (nsnull == aNewFrame) {
@ -950,6 +950,7 @@ NS_NewBlockFrame(nsIFrame** aNewFrame)
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}
it->SetFlags(aFlags);
*aNewFrame = it;
return NS_OK;
}
@ -1340,6 +1341,30 @@ nsBlockFrame::Reflow(nsIPresContext& aPresContext,
// Compute our final size
ComputeFinalSize(aReflowState, state, aMetrics);
if (mFlags & NS_BLOCK_WRAP_SIZE) {
// When the area frame is supposed to wrap around all in-flow
// children, make sure its big enough to include those that stick
// outside the box.
if (NS_FRAME_OUTSIDE_CHILDREN & mState) {
nscoord xMost = aMetrics.mCombinedArea.XMost();
if (xMost > aMetrics.width) {
#ifdef NOISY_FINAL_SIZE
ListTag(stdout);
printf(": changing desired width from %d to %d\n", aMetrics.width, xMost);
#endif
aMetrics.width = xMost;
}
nscoord yMost = aMetrics.mCombinedArea.YMost();
if (yMost > aMetrics.height) {
#ifdef NOISY_FINAL_SIZE
ListTag(stdout);
printf(": changing desired height from %d to %d\n", aMetrics.height, yMost);
#endif
aMetrics.height = yMost;
}
}
}
// If this is an incremental reflow and we changed size, then make sure our
// border is repainted if necessary
if (eReflowReason_Incremental == aReflowState.reason) {

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

@ -940,7 +940,7 @@ nsBlockReflowState::RecoverStateFrom(nsLineBox* aLine,
const nsIID kBlockFrameCID = NS_BLOCK_FRAME_CID;
nsresult
NS_NewBlockFrame(nsIFrame** aNewFrame)
NS_NewBlockFrame(nsIFrame** aNewFrame, PRUint32 aFlags)
{
NS_PRECONDITION(aNewFrame, "null OUT ptr");
if (nsnull == aNewFrame) {
@ -950,6 +950,7 @@ NS_NewBlockFrame(nsIFrame** aNewFrame)
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}
it->SetFlags(aFlags);
*aNewFrame = it;
return NS_OK;
}
@ -1340,6 +1341,30 @@ nsBlockFrame::Reflow(nsIPresContext& aPresContext,
// Compute our final size
ComputeFinalSize(aReflowState, state, aMetrics);
if (mFlags & NS_BLOCK_WRAP_SIZE) {
// When the area frame is supposed to wrap around all in-flow
// children, make sure its big enough to include those that stick
// outside the box.
if (NS_FRAME_OUTSIDE_CHILDREN & mState) {
nscoord xMost = aMetrics.mCombinedArea.XMost();
if (xMost > aMetrics.width) {
#ifdef NOISY_FINAL_SIZE
ListTag(stdout);
printf(": changing desired width from %d to %d\n", aMetrics.width, xMost);
#endif
aMetrics.width = xMost;
}
nscoord yMost = aMetrics.mCombinedArea.YMost();
if (yMost > aMetrics.height) {
#ifdef NOISY_FINAL_SIZE
ListTag(stdout);
printf(": changing desired height from %d to %d\n", aMetrics.height, yMost);
#endif
aMetrics.height = yMost;
}
}
}
// If this is an incremental reflow and we changed size, then make sure our
// border is repainted if necessary
if (eReflowReason_Incremental == aReflowState.reason) {

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

@ -246,7 +246,11 @@ NS_CreateHTMLElement(nsIHTMLContent** aResult,
#define NS_BLOCK_MARGIN_ROOT 0x4
#define NS_BLOCK_DOCUMENT_ROOT 0x8
#define NS_BLOCK_SPACE_MGR 0x10
#define NS_AREA_WRAP_SIZE 0x20
#define NS_BLOCK_WRAP_SIZE 0x20
// Create a frame that supports "display: block" layout behavior
extern nsresult NS_NewBlockFrame(nsIFrame** aNewFrame,
PRUint32 aFlags = 0);
// Special Generated Content Frame
extern nsresult
@ -257,23 +261,23 @@ NS_NewAttributeContent(nsIContent ** aResult);
// By default, area frames will extend
// their height to cover any children that "stick out".
extern nsresult NS_NewSelectsAreaFrame(nsIFrame** aNewFrame,
PRUint32 aFlags = NS_AREA_WRAP_SIZE);
PRUint32 aFlags = NS_BLOCK_WRAP_SIZE);
// Create a basic area frame. By default, area frames will extend
// their height to cover any children that "stick out".
extern nsresult NS_NewAreaFrame(nsIFrame** aNewFrame,
PRUint32 aFlags = NS_AREA_WRAP_SIZE);
PRUint32 aFlags = NS_BLOCK_SPACE_MGR|NS_BLOCK_WRAP_SIZE);
// These AreaFrame's shrink wrap around their contents
inline nsresult NS_NewTableCellInnerFrame(nsIFrame** aNewFrame) {
return NS_NewAreaFrame(aNewFrame, NS_BLOCK_SPACE_MGR|NS_AREA_WRAP_SIZE);
return NS_NewBlockFrame(aNewFrame, NS_BLOCK_SPACE_MGR|NS_BLOCK_WRAP_SIZE);
}
inline nsresult NS_NewTableCaptionFrame(nsIFrame** aNewFrame) {
return NS_NewAreaFrame(aNewFrame, NS_BLOCK_SPACE_MGR|NS_AREA_WRAP_SIZE);
return NS_NewBlockFrame(aNewFrame, NS_BLOCK_SPACE_MGR|NS_BLOCK_WRAP_SIZE);
}
// This type of AreaFrame is the document root and is a margin root for
// margin collapsing.
// This type of AreaFrame is the document root, a margin root, and the
// initial containing block for absolutely positioned elements
inline nsresult NS_NewDocumentElementFrame(nsIFrame** aNewFrame) {
return NS_NewAreaFrame(aNewFrame, NS_BLOCK_SPACE_MGR|NS_BLOCK_DOCUMENT_ROOT|NS_BLOCK_MARGIN_ROOT);
}
@ -296,9 +300,6 @@ inline nsresult NS_NewRelativeItemWrapperFrame(nsIFrame** aNewFrame) {
extern nsresult NS_NewBRFrame(nsIFrame** aNewFrame);
// Create a frame that supports "display: block" layout behavior
extern nsresult NS_NewBlockFrame(nsIFrame** aNewFrame);
extern nsresult NS_NewCommentFrame(nsIFrame** aFrameResult);
extern nsresult NS_NewHRFrame(nsIFrame** aNewFrame);