зеркало из https://github.com/mozilla/pjs.git
Changed factory method to parameterize the shrink wrapping behavior
This commit is contained in:
Родитель
e55639d2fa
Коммит
dc4362fa13
|
@ -1047,7 +1047,7 @@ HTMLStyleSheetImpl::ConstructTableFrame(nsIPresContext* aPresContext,
|
|||
case NS_STYLE_DISPLAY_TABLE_CAPTION:
|
||||
// Have we already created a caption? If so, ignore this caption
|
||||
if (nsnull == captionFrame) {
|
||||
NS_NewBodyFrame(childContent, aNewFrame, captionFrame);
|
||||
NS_NewBodyFrame(childContent, aNewFrame, captionFrame, PR_FALSE);
|
||||
captionFrame->SetStyleContext(aPresContext, childStyleContext);
|
||||
// Process the caption's child content and initialize it
|
||||
nsIFrame* captionChildList;
|
||||
|
@ -1206,7 +1206,7 @@ HTMLStyleSheetImpl::ConstructFrameByTag(nsIPresContext* aPresContext,
|
|||
// processChildren = PR_TRUE;
|
||||
}
|
||||
else if (nsHTMLAtoms::body == aTag) {
|
||||
rv = NS_NewBodyFrame(aContent, aParentFrame, aNewFrame);
|
||||
rv = NS_NewBodyFrame(aContent, aParentFrame, aNewFrame, PR_TRUE);
|
||||
processChildren = PR_TRUE;
|
||||
}
|
||||
else if (nsHTMLAtoms::form == aTag) {
|
||||
|
@ -1260,7 +1260,7 @@ HTMLStyleSheetImpl::ConstructFrameByDisplayType(nsIPresContext* aPresContext,
|
|||
switch (styleDisplay->mDisplay) {
|
||||
case NS_STYLE_DISPLAY_BLOCK:
|
||||
case NS_STYLE_DISPLAY_LIST_ITEM:
|
||||
rv = NS_NewBlockFrame(aContent, aParentFrame, aNewFrame);
|
||||
rv = NS_NewBlockFrame(aContent, aParentFrame, aNewFrame, PR_FALSE);
|
||||
processChildren = PR_TRUE;
|
||||
break;
|
||||
|
||||
|
|
|
@ -280,6 +280,10 @@ public:
|
|||
virtual PRBool DeleteChildsNextInFlow(nsIPresContext& aPresContext,
|
||||
nsIFrame* aNextInFlow);
|
||||
|
||||
void SetShrinkWrap(PRBool aShrinkWrap) {
|
||||
mShrinkWrap = aShrinkWrap;
|
||||
}
|
||||
|
||||
PRBool DrainOverflowLines();
|
||||
|
||||
PRBool RemoveChild(LineData* aLines, nsIFrame* aChild);
|
||||
|
@ -378,6 +382,11 @@ public:
|
|||
|
||||
// For list-item frames, this is the bullet frame.
|
||||
BulletFrame* mBullet;
|
||||
|
||||
// If true then this frame doesn't act like css says, instead it
|
||||
// shrink wraps around its contents instead of filling out to its
|
||||
// parents size.
|
||||
PRBool mShrinkWrap;
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -1420,12 +1429,14 @@ nsBlockReflowState::GetAvailableSpace()
|
|||
|
||||
nsresult
|
||||
NS_NewBlockFrame(nsIContent* aContent, nsIFrame* aParentFrame,
|
||||
nsIFrame*& aNewFrame)
|
||||
nsIFrame*& aNewFrame, PRBool aShrinkWrap)
|
||||
{
|
||||
aNewFrame = new nsBlockFrame(aContent, aParentFrame);
|
||||
if (nsnull == aNewFrame) {
|
||||
nsBlockFrame* it = new nsBlockFrame(aContent, aParentFrame);
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
aNewFrame = it;
|
||||
it->SetShrinkWrap(aShrinkWrap);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -1855,9 +1866,10 @@ nsBlockFrame::ComputeFinalSize(nsBlockReflowState& aState,
|
|||
}
|
||||
else {
|
||||
// There are two options here. We either shrink wrap around our
|
||||
// contents or we fluff out to the maximum available width.
|
||||
// contents or we fluff out to the maximum available width. Note:
|
||||
// We always shrink wrap when given an unconstrained width.
|
||||
nscoord contentWidth = aState.mKidXMost + aState.mBorderPadding.right;
|
||||
if (!aState.mUnconstrainedWidth) {
|
||||
if (!mShrinkWrap && !aState.mUnconstrainedWidth) {
|
||||
// Fluff out to the max width if we aren't already that wide
|
||||
if (contentWidth < aState.maxSize.width) {
|
||||
contentWidth = aState.maxSize.width;
|
||||
|
|
|
@ -280,6 +280,10 @@ public:
|
|||
virtual PRBool DeleteChildsNextInFlow(nsIPresContext& aPresContext,
|
||||
nsIFrame* aNextInFlow);
|
||||
|
||||
void SetShrinkWrap(PRBool aShrinkWrap) {
|
||||
mShrinkWrap = aShrinkWrap;
|
||||
}
|
||||
|
||||
PRBool DrainOverflowLines();
|
||||
|
||||
PRBool RemoveChild(LineData* aLines, nsIFrame* aChild);
|
||||
|
@ -378,6 +382,11 @@ public:
|
|||
|
||||
// For list-item frames, this is the bullet frame.
|
||||
BulletFrame* mBullet;
|
||||
|
||||
// If true then this frame doesn't act like css says, instead it
|
||||
// shrink wraps around its contents instead of filling out to its
|
||||
// parents size.
|
||||
PRBool mShrinkWrap;
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -1420,12 +1429,14 @@ nsBlockReflowState::GetAvailableSpace()
|
|||
|
||||
nsresult
|
||||
NS_NewBlockFrame(nsIContent* aContent, nsIFrame* aParentFrame,
|
||||
nsIFrame*& aNewFrame)
|
||||
nsIFrame*& aNewFrame, PRBool aShrinkWrap)
|
||||
{
|
||||
aNewFrame = new nsBlockFrame(aContent, aParentFrame);
|
||||
if (nsnull == aNewFrame) {
|
||||
nsBlockFrame* it = new nsBlockFrame(aContent, aParentFrame);
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
aNewFrame = it;
|
||||
it->SetShrinkWrap(aShrinkWrap);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -1855,9 +1866,10 @@ nsBlockFrame::ComputeFinalSize(nsBlockReflowState& aState,
|
|||
}
|
||||
else {
|
||||
// There are two options here. We either shrink wrap around our
|
||||
// contents or we fluff out to the maximum available width.
|
||||
// contents or we fluff out to the maximum available width. Note:
|
||||
// We always shrink wrap when given an unconstrained width.
|
||||
nscoord contentWidth = aState.mKidXMost + aState.mBorderPadding.right;
|
||||
if (!aState.mUnconstrainedWidth) {
|
||||
if (!mShrinkWrap && !aState.mUnconstrainedWidth) {
|
||||
// Fluff out to the max width if we aren't already that wide
|
||||
if (contentWidth < aState.maxSize.width) {
|
||||
contentWidth = aState.maxSize.width;
|
||||
|
|
|
@ -280,6 +280,10 @@ public:
|
|||
virtual PRBool DeleteChildsNextInFlow(nsIPresContext& aPresContext,
|
||||
nsIFrame* aNextInFlow);
|
||||
|
||||
void SetShrinkWrap(PRBool aShrinkWrap) {
|
||||
mShrinkWrap = aShrinkWrap;
|
||||
}
|
||||
|
||||
PRBool DrainOverflowLines();
|
||||
|
||||
PRBool RemoveChild(LineData* aLines, nsIFrame* aChild);
|
||||
|
@ -378,6 +382,11 @@ public:
|
|||
|
||||
// For list-item frames, this is the bullet frame.
|
||||
BulletFrame* mBullet;
|
||||
|
||||
// If true then this frame doesn't act like css says, instead it
|
||||
// shrink wraps around its contents instead of filling out to its
|
||||
// parents size.
|
||||
PRBool mShrinkWrap;
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -1420,12 +1429,14 @@ nsBlockReflowState::GetAvailableSpace()
|
|||
|
||||
nsresult
|
||||
NS_NewBlockFrame(nsIContent* aContent, nsIFrame* aParentFrame,
|
||||
nsIFrame*& aNewFrame)
|
||||
nsIFrame*& aNewFrame, PRBool aShrinkWrap)
|
||||
{
|
||||
aNewFrame = new nsBlockFrame(aContent, aParentFrame);
|
||||
if (nsnull == aNewFrame) {
|
||||
nsBlockFrame* it = new nsBlockFrame(aContent, aParentFrame);
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
aNewFrame = it;
|
||||
it->SetShrinkWrap(aShrinkWrap);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -1855,9 +1866,10 @@ nsBlockFrame::ComputeFinalSize(nsBlockReflowState& aState,
|
|||
}
|
||||
else {
|
||||
// There are two options here. We either shrink wrap around our
|
||||
// contents or we fluff out to the maximum available width.
|
||||
// contents or we fluff out to the maximum available width. Note:
|
||||
// We always shrink wrap when given an unconstrained width.
|
||||
nscoord contentWidth = aState.mKidXMost + aState.mBorderPadding.right;
|
||||
if (!aState.mUnconstrainedWidth) {
|
||||
if (!mShrinkWrap && !aState.mUnconstrainedWidth) {
|
||||
// Fluff out to the max width if we aren't already that wide
|
||||
if (contentWidth < aState.maxSize.width) {
|
||||
contentWidth = aState.maxSize.width;
|
||||
|
|
|
@ -194,7 +194,7 @@ nsHTMLContainerFrame::CreateWrapperFrame(nsIPresContext& aPresContext,
|
|||
content->CanContainChildren(isContainer);
|
||||
if (isContainer) {
|
||||
// Wrap the floated element in a BODY frame.
|
||||
NS_NewBodyFrame(content, this, aWrapperFrame);
|
||||
NS_NewBodyFrame(content, this, aWrapperFrame, PR_FALSE);
|
||||
|
||||
// The body wrapper frame gets the original style context, and the floated
|
||||
// frame gets a pseudo style context
|
||||
|
@ -363,7 +363,7 @@ nsHTMLContainerFrame::WrapFrames(nsIPresContext& aPresContext,
|
|||
if (isContainer) {
|
||||
// Wrap the floated element in a BODY frame.
|
||||
nsIFrame* wrapperFrame;
|
||||
rv = NS_NewBodyFrame(content, this, wrapperFrame);
|
||||
rv = NS_NewBodyFrame(content, this, wrapperFrame, PR_FALSE);
|
||||
if (NS_OK != rv) {
|
||||
return rv;
|
||||
}
|
||||
|
|
|
@ -244,11 +244,11 @@ NS_NewBRFrame(nsIContent* aContent, nsIFrame* aParentFrame,
|
|||
|
||||
extern nsresult
|
||||
NS_NewBodyFrame(nsIContent* aContent, nsIFrame* aParentFrame,
|
||||
nsIFrame*& aNewFrame);
|
||||
nsIFrame*& aNewFrame, PRBool aIsTopLevel);
|
||||
|
||||
extern nsresult
|
||||
NS_NewBlockFrame(nsIContent* aContent, nsIFrame* aParentFrame,
|
||||
nsIFrame*& aNewFrame);
|
||||
nsIFrame*& aNewFrame, PRBool aShrinkWrap);
|
||||
|
||||
extern nsresult
|
||||
NS_NewCommentFrame(nsIContent* aContent, nsIFrame* aParentFrame,
|
||||
|
|
|
@ -280,6 +280,10 @@ public:
|
|||
virtual PRBool DeleteChildsNextInFlow(nsIPresContext& aPresContext,
|
||||
nsIFrame* aNextInFlow);
|
||||
|
||||
void SetShrinkWrap(PRBool aShrinkWrap) {
|
||||
mShrinkWrap = aShrinkWrap;
|
||||
}
|
||||
|
||||
PRBool DrainOverflowLines();
|
||||
|
||||
PRBool RemoveChild(LineData* aLines, nsIFrame* aChild);
|
||||
|
@ -378,6 +382,11 @@ public:
|
|||
|
||||
// For list-item frames, this is the bullet frame.
|
||||
BulletFrame* mBullet;
|
||||
|
||||
// If true then this frame doesn't act like css says, instead it
|
||||
// shrink wraps around its contents instead of filling out to its
|
||||
// parents size.
|
||||
PRBool mShrinkWrap;
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -1420,12 +1429,14 @@ nsBlockReflowState::GetAvailableSpace()
|
|||
|
||||
nsresult
|
||||
NS_NewBlockFrame(nsIContent* aContent, nsIFrame* aParentFrame,
|
||||
nsIFrame*& aNewFrame)
|
||||
nsIFrame*& aNewFrame, PRBool aShrinkWrap)
|
||||
{
|
||||
aNewFrame = new nsBlockFrame(aContent, aParentFrame);
|
||||
if (nsnull == aNewFrame) {
|
||||
nsBlockFrame* it = new nsBlockFrame(aContent, aParentFrame);
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
aNewFrame = it;
|
||||
it->SetShrinkWrap(aShrinkWrap);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -1855,9 +1866,10 @@ nsBlockFrame::ComputeFinalSize(nsBlockReflowState& aState,
|
|||
}
|
||||
else {
|
||||
// There are two options here. We either shrink wrap around our
|
||||
// contents or we fluff out to the maximum available width.
|
||||
// contents or we fluff out to the maximum available width. Note:
|
||||
// We always shrink wrap when given an unconstrained width.
|
||||
nscoord contentWidth = aState.mKidXMost + aState.mBorderPadding.right;
|
||||
if (!aState.mUnconstrainedWidth) {
|
||||
if (!mShrinkWrap && !aState.mUnconstrainedWidth) {
|
||||
// Fluff out to the max width if we aren't already that wide
|
||||
if (contentWidth < aState.maxSize.width) {
|
||||
contentWidth = aState.maxSize.width;
|
||||
|
|
|
@ -280,6 +280,10 @@ public:
|
|||
virtual PRBool DeleteChildsNextInFlow(nsIPresContext& aPresContext,
|
||||
nsIFrame* aNextInFlow);
|
||||
|
||||
void SetShrinkWrap(PRBool aShrinkWrap) {
|
||||
mShrinkWrap = aShrinkWrap;
|
||||
}
|
||||
|
||||
PRBool DrainOverflowLines();
|
||||
|
||||
PRBool RemoveChild(LineData* aLines, nsIFrame* aChild);
|
||||
|
@ -378,6 +382,11 @@ public:
|
|||
|
||||
// For list-item frames, this is the bullet frame.
|
||||
BulletFrame* mBullet;
|
||||
|
||||
// If true then this frame doesn't act like css says, instead it
|
||||
// shrink wraps around its contents instead of filling out to its
|
||||
// parents size.
|
||||
PRBool mShrinkWrap;
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -1420,12 +1429,14 @@ nsBlockReflowState::GetAvailableSpace()
|
|||
|
||||
nsresult
|
||||
NS_NewBlockFrame(nsIContent* aContent, nsIFrame* aParentFrame,
|
||||
nsIFrame*& aNewFrame)
|
||||
nsIFrame*& aNewFrame, PRBool aShrinkWrap)
|
||||
{
|
||||
aNewFrame = new nsBlockFrame(aContent, aParentFrame);
|
||||
if (nsnull == aNewFrame) {
|
||||
nsBlockFrame* it = new nsBlockFrame(aContent, aParentFrame);
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
aNewFrame = it;
|
||||
it->SetShrinkWrap(aShrinkWrap);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -1855,9 +1866,10 @@ nsBlockFrame::ComputeFinalSize(nsBlockReflowState& aState,
|
|||
}
|
||||
else {
|
||||
// There are two options here. We either shrink wrap around our
|
||||
// contents or we fluff out to the maximum available width.
|
||||
// contents or we fluff out to the maximum available width. Note:
|
||||
// We always shrink wrap when given an unconstrained width.
|
||||
nscoord contentWidth = aState.mKidXMost + aState.mBorderPadding.right;
|
||||
if (!aState.mUnconstrainedWidth) {
|
||||
if (!mShrinkWrap && !aState.mUnconstrainedWidth) {
|
||||
// Fluff out to the max width if we aren't already that wide
|
||||
if (contentWidth < aState.maxSize.width) {
|
||||
contentWidth = aState.maxSize.width;
|
||||
|
|
|
@ -280,6 +280,10 @@ public:
|
|||
virtual PRBool DeleteChildsNextInFlow(nsIPresContext& aPresContext,
|
||||
nsIFrame* aNextInFlow);
|
||||
|
||||
void SetShrinkWrap(PRBool aShrinkWrap) {
|
||||
mShrinkWrap = aShrinkWrap;
|
||||
}
|
||||
|
||||
PRBool DrainOverflowLines();
|
||||
|
||||
PRBool RemoveChild(LineData* aLines, nsIFrame* aChild);
|
||||
|
@ -378,6 +382,11 @@ public:
|
|||
|
||||
// For list-item frames, this is the bullet frame.
|
||||
BulletFrame* mBullet;
|
||||
|
||||
// If true then this frame doesn't act like css says, instead it
|
||||
// shrink wraps around its contents instead of filling out to its
|
||||
// parents size.
|
||||
PRBool mShrinkWrap;
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -1420,12 +1429,14 @@ nsBlockReflowState::GetAvailableSpace()
|
|||
|
||||
nsresult
|
||||
NS_NewBlockFrame(nsIContent* aContent, nsIFrame* aParentFrame,
|
||||
nsIFrame*& aNewFrame)
|
||||
nsIFrame*& aNewFrame, PRBool aShrinkWrap)
|
||||
{
|
||||
aNewFrame = new nsBlockFrame(aContent, aParentFrame);
|
||||
if (nsnull == aNewFrame) {
|
||||
nsBlockFrame* it = new nsBlockFrame(aContent, aParentFrame);
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
aNewFrame = it;
|
||||
it->SetShrinkWrap(aShrinkWrap);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -1855,9 +1866,10 @@ nsBlockFrame::ComputeFinalSize(nsBlockReflowState& aState,
|
|||
}
|
||||
else {
|
||||
// There are two options here. We either shrink wrap around our
|
||||
// contents or we fluff out to the maximum available width.
|
||||
// contents or we fluff out to the maximum available width. Note:
|
||||
// We always shrink wrap when given an unconstrained width.
|
||||
nscoord contentWidth = aState.mKidXMost + aState.mBorderPadding.right;
|
||||
if (!aState.mUnconstrainedWidth) {
|
||||
if (!mShrinkWrap && !aState.mUnconstrainedWidth) {
|
||||
// Fluff out to the max width if we aren't already that wide
|
||||
if (contentWidth < aState.maxSize.width) {
|
||||
contentWidth = aState.maxSize.width;
|
||||
|
|
|
@ -41,39 +41,21 @@
|
|||
static NS_DEFINE_IID(kIWebShellIID, NS_IWEB_SHELL_IID);
|
||||
|
||||
nsresult
|
||||
NS_NewBodyFrame(nsIContent* aContent, nsIFrame* aParent, nsIFrame*& aResult)
|
||||
NS_NewBodyFrame(nsIContent* aContent, nsIFrame* aParent, nsIFrame*& aResult,
|
||||
PRBool aIsTopLevel)
|
||||
{
|
||||
nsIFrame* it = new nsBodyFrame(aContent, aParent);
|
||||
nsBodyFrame* it = new nsBodyFrame(aContent, aParent);
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
it->SetIsTopLevel(aIsTopLevel);
|
||||
aResult = it;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// XXX FIX ME...
|
||||
// Returns true if this frame is being used a pseudo frame
|
||||
PRBool nsBodyFrame::IsPseudoFrame() const
|
||||
{
|
||||
PRBool result = PR_FALSE;
|
||||
|
||||
if (nsnull != mGeometricParent) {
|
||||
nsIContent* parentContent;
|
||||
|
||||
mGeometricParent->GetContent(parentContent);
|
||||
if (parentContent == mContent) {
|
||||
result = PR_TRUE;
|
||||
}
|
||||
NS_RELEASE(parentContent);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
nsBodyFrame::nsBodyFrame(nsIContent* aContent, nsIFrame* aParentFrame)
|
||||
: nsHTMLContainerFrame(aContent, aParentFrame)
|
||||
{
|
||||
mIsPseudoFrame = IsPseudoFrame();
|
||||
mSpaceManager = new nsSpaceManager(this);
|
||||
NS_ADDREF(mSpaceManager);
|
||||
}
|
||||
|
@ -111,7 +93,7 @@ NS_IMETHODIMP
|
|||
nsBodyFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList)
|
||||
{
|
||||
// Create a block frame and set its style context
|
||||
nsresult rv = NS_NewBlockFrame(mContent, this, mFirstChild);
|
||||
nsresult rv = NS_NewBlockFrame(mContent, this, mFirstChild, !mIsTopLevel);
|
||||
if (NS_OK != rv) {
|
||||
return rv;
|
||||
}
|
||||
|
@ -250,7 +232,7 @@ nsBodyFrame::Reflow(nsIPresContext& aPresContext,
|
|||
mySpacing->CalcBorderPaddingFor(this, borderPadding);
|
||||
|
||||
// Compute the child frame's max size
|
||||
nsSize kidMaxSize = GetColumnAvailSpace(&aPresContext, borderPadding,
|
||||
nsSize kidMaxSize = GetColumnAvailSpace(aPresContext, borderPadding,
|
||||
rsp->maxSize);
|
||||
mSpaceManager->Translate(borderPadding.left, borderPadding.top);
|
||||
|
||||
|
@ -350,7 +332,7 @@ nsBodyFrame::Reflow(nsIPresContext& aPresContext,
|
|||
}
|
||||
|
||||
// Now force a repaint of the damage area
|
||||
if (!mIsPseudoFrame && !damageArea.IsEmpty()) {
|
||||
if (mIsTopLevel && !damageArea.IsEmpty()) {
|
||||
Invalidate(damageArea);
|
||||
}
|
||||
|
||||
|
@ -403,7 +385,7 @@ AddToPadding(nsIPresContext* aPresContext,
|
|||
NS_METHOD
|
||||
nsBodyFrame::DidSetStyleContext(nsIPresContext* aPresContext)
|
||||
{
|
||||
if (mIsPseudoFrame) {
|
||||
if (!mIsTopLevel) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -486,15 +468,16 @@ nsBodyFrame::DidSetStyleContext(nsIPresContext* aPresContext)
|
|||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Helper functions
|
||||
|
||||
nsSize nsBodyFrame::GetColumnAvailSpace(nsIPresContext* aPresContext,
|
||||
const nsMargin& aBorderPadding,
|
||||
const nsSize& aMaxSize)
|
||||
nsSize
|
||||
nsBodyFrame::GetColumnAvailSpace(nsIPresContext& aPresContext,
|
||||
const nsMargin& aBorderPadding,
|
||||
const nsSize& aMaxSize)
|
||||
{
|
||||
nsSize result(aMaxSize);
|
||||
|
||||
// If we're not being used as a pseudo frame then make adjustments
|
||||
// If we are being used as a top-level frame then make adjustments
|
||||
// for border/padding and a vertical scrollbar
|
||||
if (!mIsPseudoFrame) {
|
||||
if (mIsTopLevel) {
|
||||
// If our width is constrained then subtract for the border/padding
|
||||
if (aMaxSize.width != NS_UNCONSTRAINEDSIZE) {
|
||||
result.width -= aBorderPadding.left +
|
||||
|
@ -549,7 +532,7 @@ nsBodyFrame::ComputeDesiredSize(nsIPresContext& aPresContext,
|
|||
width = styleSize.width + aBorderPadding.left + aBorderPadding.right;
|
||||
}
|
||||
else {
|
||||
if (!mIsPseudoFrame) {
|
||||
if (mIsTopLevel) {
|
||||
// Make sure we're at least as wide as our available width
|
||||
width = PR_MAX(aMetrics.width, aMaxSize.width);
|
||||
}
|
||||
|
@ -559,12 +542,12 @@ nsBodyFrame::ComputeDesiredSize(nsIPresContext& aPresContext,
|
|||
height = styleSize.width + aBorderPadding.top + aBorderPadding.bottom;
|
||||
}
|
||||
else {
|
||||
if (!mIsPseudoFrame) {
|
||||
if (mIsTopLevel) {
|
||||
height += aBorderPadding.top + aBorderPadding.bottom;
|
||||
}
|
||||
}
|
||||
|
||||
if (!mIsPseudoFrame) {
|
||||
if (mIsTopLevel) {
|
||||
// Make sure we're at least as wide as our available width
|
||||
width = PR_MAX(aMetrics.width, aMaxSize.width);
|
||||
height += aBorderPadding.top + aBorderPadding.bottom;
|
||||
|
|
|
@ -34,7 +34,7 @@ class nsBodyFrame : public nsHTMLContainerFrame,
|
|||
{
|
||||
public:
|
||||
friend nsresult NS_NewBodyFrame(nsIContent* aContent, nsIFrame* aParent,
|
||||
nsIFrame*& aResult);
|
||||
nsIFrame*& aResult, PRBool aIsTopLevel);
|
||||
|
||||
NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr);
|
||||
|
||||
|
@ -73,8 +73,12 @@ public:
|
|||
|
||||
NS_IMETHOD VerifyTree() const;
|
||||
|
||||
void SetIsTopLevel(PRBool aIsTopLevel) {
|
||||
mIsTopLevel = aIsTopLevel;
|
||||
}
|
||||
|
||||
protected:
|
||||
PRBool mIsPseudoFrame;
|
||||
PRBool mIsTopLevel;
|
||||
|
||||
nsBodyFrame(nsIContent* aContent, nsIFrame* aParentFrame);
|
||||
|
||||
|
@ -109,12 +113,9 @@ private:
|
|||
nsVoidArray mAbsoluteItems;
|
||||
PRInt32 mChildCount;
|
||||
|
||||
nsSize GetColumnAvailSpace(nsIPresContext* aPresContext,
|
||||
nsSize GetColumnAvailSpace(nsIPresContext& aPresContext,
|
||||
const nsMargin& aBorderPadding,
|
||||
const nsSize& aMaxSize);
|
||||
|
||||
// XXX FIX ME...
|
||||
PRBool IsPseudoFrame() const;
|
||||
};
|
||||
|
||||
#endif /* nsBodyFrame_h___ */
|
||||
|
|
|
@ -194,7 +194,7 @@ nsHTMLContainerFrame::CreateWrapperFrame(nsIPresContext& aPresContext,
|
|||
content->CanContainChildren(isContainer);
|
||||
if (isContainer) {
|
||||
// Wrap the floated element in a BODY frame.
|
||||
NS_NewBodyFrame(content, this, aWrapperFrame);
|
||||
NS_NewBodyFrame(content, this, aWrapperFrame, PR_FALSE);
|
||||
|
||||
// The body wrapper frame gets the original style context, and the floated
|
||||
// frame gets a pseudo style context
|
||||
|
@ -363,7 +363,7 @@ nsHTMLContainerFrame::WrapFrames(nsIPresContext& aPresContext,
|
|||
if (isContainer) {
|
||||
// Wrap the floated element in a BODY frame.
|
||||
nsIFrame* wrapperFrame;
|
||||
rv = NS_NewBodyFrame(content, this, wrapperFrame);
|
||||
rv = NS_NewBodyFrame(content, this, wrapperFrame, PR_FALSE);
|
||||
if (NS_OK != rv) {
|
||||
return rv;
|
||||
}
|
||||
|
|
|
@ -244,11 +244,11 @@ NS_NewBRFrame(nsIContent* aContent, nsIFrame* aParentFrame,
|
|||
|
||||
extern nsresult
|
||||
NS_NewBodyFrame(nsIContent* aContent, nsIFrame* aParentFrame,
|
||||
nsIFrame*& aNewFrame);
|
||||
nsIFrame*& aNewFrame, PRBool aIsTopLevel);
|
||||
|
||||
extern nsresult
|
||||
NS_NewBlockFrame(nsIContent* aContent, nsIFrame* aParentFrame,
|
||||
nsIFrame*& aNewFrame);
|
||||
nsIFrame*& aNewFrame, PRBool aShrinkWrap);
|
||||
|
||||
extern nsresult
|
||||
NS_NewCommentFrame(nsIContent* aContent, nsIFrame* aParentFrame,
|
||||
|
|
|
@ -1047,7 +1047,7 @@ HTMLStyleSheetImpl::ConstructTableFrame(nsIPresContext* aPresContext,
|
|||
case NS_STYLE_DISPLAY_TABLE_CAPTION:
|
||||
// Have we already created a caption? If so, ignore this caption
|
||||
if (nsnull == captionFrame) {
|
||||
NS_NewBodyFrame(childContent, aNewFrame, captionFrame);
|
||||
NS_NewBodyFrame(childContent, aNewFrame, captionFrame, PR_FALSE);
|
||||
captionFrame->SetStyleContext(aPresContext, childStyleContext);
|
||||
// Process the caption's child content and initialize it
|
||||
nsIFrame* captionChildList;
|
||||
|
@ -1206,7 +1206,7 @@ HTMLStyleSheetImpl::ConstructFrameByTag(nsIPresContext* aPresContext,
|
|||
// processChildren = PR_TRUE;
|
||||
}
|
||||
else if (nsHTMLAtoms::body == aTag) {
|
||||
rv = NS_NewBodyFrame(aContent, aParentFrame, aNewFrame);
|
||||
rv = NS_NewBodyFrame(aContent, aParentFrame, aNewFrame, PR_TRUE);
|
||||
processChildren = PR_TRUE;
|
||||
}
|
||||
else if (nsHTMLAtoms::form == aTag) {
|
||||
|
@ -1260,7 +1260,7 @@ HTMLStyleSheetImpl::ConstructFrameByDisplayType(nsIPresContext* aPresContext,
|
|||
switch (styleDisplay->mDisplay) {
|
||||
case NS_STYLE_DISPLAY_BLOCK:
|
||||
case NS_STYLE_DISPLAY_LIST_ITEM:
|
||||
rv = NS_NewBlockFrame(aContent, aParentFrame, aNewFrame);
|
||||
rv = NS_NewBlockFrame(aContent, aParentFrame, aNewFrame, PR_FALSE);
|
||||
processChildren = PR_TRUE;
|
||||
break;
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ NS_IMETHODIMP
|
|||
nsTableCellFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList)
|
||||
{
|
||||
// Create body pseudo frame
|
||||
NS_NewBodyFrame(mContent, this, mFirstChild);
|
||||
NS_NewBodyFrame(mContent, this, mFirstChild, PR_FALSE);
|
||||
|
||||
// Resolve style and set the style context
|
||||
nsIStyleContext* styleContext =
|
||||
|
@ -190,7 +190,7 @@ void nsTableCellFrame::CreatePsuedoFrame(nsIPresContext* aPresContext)
|
|||
// Do we have a prev-in-flow?
|
||||
if (nsnull == mPrevInFlow) {
|
||||
// No, create a body pseudo frame
|
||||
NS_NewBodyFrame(mContent, this, mFirstChild);
|
||||
NS_NewBodyFrame(mContent, this, mFirstChild, PR_FALSE);
|
||||
|
||||
// Resolve style and set the style context
|
||||
nsIStyleContext* styleContext =
|
||||
|
|
|
@ -1047,7 +1047,7 @@ HTMLStyleSheetImpl::ConstructTableFrame(nsIPresContext* aPresContext,
|
|||
case NS_STYLE_DISPLAY_TABLE_CAPTION:
|
||||
// Have we already created a caption? If so, ignore this caption
|
||||
if (nsnull == captionFrame) {
|
||||
NS_NewBodyFrame(childContent, aNewFrame, captionFrame);
|
||||
NS_NewBodyFrame(childContent, aNewFrame, captionFrame, PR_FALSE);
|
||||
captionFrame->SetStyleContext(aPresContext, childStyleContext);
|
||||
// Process the caption's child content and initialize it
|
||||
nsIFrame* captionChildList;
|
||||
|
@ -1206,7 +1206,7 @@ HTMLStyleSheetImpl::ConstructFrameByTag(nsIPresContext* aPresContext,
|
|||
// processChildren = PR_TRUE;
|
||||
}
|
||||
else if (nsHTMLAtoms::body == aTag) {
|
||||
rv = NS_NewBodyFrame(aContent, aParentFrame, aNewFrame);
|
||||
rv = NS_NewBodyFrame(aContent, aParentFrame, aNewFrame, PR_TRUE);
|
||||
processChildren = PR_TRUE;
|
||||
}
|
||||
else if (nsHTMLAtoms::form == aTag) {
|
||||
|
@ -1260,7 +1260,7 @@ HTMLStyleSheetImpl::ConstructFrameByDisplayType(nsIPresContext* aPresContext,
|
|||
switch (styleDisplay->mDisplay) {
|
||||
case NS_STYLE_DISPLAY_BLOCK:
|
||||
case NS_STYLE_DISPLAY_LIST_ITEM:
|
||||
rv = NS_NewBlockFrame(aContent, aParentFrame, aNewFrame);
|
||||
rv = NS_NewBlockFrame(aContent, aParentFrame, aNewFrame, PR_FALSE);
|
||||
processChildren = PR_TRUE;
|
||||
break;
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ NS_IMETHODIMP
|
|||
nsTableCellFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList)
|
||||
{
|
||||
// Create body pseudo frame
|
||||
NS_NewBodyFrame(mContent, this, mFirstChild);
|
||||
NS_NewBodyFrame(mContent, this, mFirstChild, PR_FALSE);
|
||||
|
||||
// Resolve style and set the style context
|
||||
nsIStyleContext* styleContext =
|
||||
|
@ -190,7 +190,7 @@ void nsTableCellFrame::CreatePsuedoFrame(nsIPresContext* aPresContext)
|
|||
// Do we have a prev-in-flow?
|
||||
if (nsnull == mPrevInFlow) {
|
||||
// No, create a body pseudo frame
|
||||
NS_NewBodyFrame(mContent, this, mFirstChild);
|
||||
NS_NewBodyFrame(mContent, this, mFirstChild, PR_FALSE);
|
||||
|
||||
// Resolve style and set the style context
|
||||
nsIStyleContext* styleContext =
|
||||
|
|
Загрузка…
Ссылка в новой задаче