Fixed it to so the root-frame isn't considered a containing block, and

changed SetRect() so it only resizes the child frame larger if its 'height'
is set to 'auto'
This commit is contained in:
troy%netscape.com 1999-02-03 01:31:09 +00:00
parent 22229b372a
commit c4b2263dbf
2 changed files with 22 additions and 10 deletions

View File

@ -67,7 +67,7 @@ public:
nsGUIEvent* aEvent,
nsEventStatus& aEventStatus);
NS_IMETHOD IsPercentageBase(PRBool& aBase) const {
aBase = PR_TRUE;
aBase = PR_FALSE;
return NS_OK;
}
@ -114,13 +114,19 @@ RootFrame::SetRect(const nsRect& aRect)
nsresult rv = nsHTMLContainerFrame::SetRect(aRect);
// Make sure our child's frame is adjusted as well
// Note: only do this if it's 'height' is 'auto'
nsIFrame* kidFrame = mFrames.FirstChild();
if (nsnull != kidFrame) {
nscoord yDelta = aRect.height - mNaturalHeight;
nsSize kidSize;
nsStylePosition* kidPosition;
kidFrame->GetStyleData(eStyleStruct_Position, (const nsStyleStruct*&)kidPosition);
kidFrame->GetSize(kidSize);
kidFrame->SizeTo(kidSize.width, kidSize.height + yDelta);
if (eStyleUnit_Auto == kidPosition->mHeight.GetUnit()) {
nscoord yDelta = aRect.height - mNaturalHeight;
nsSize kidSize;
kidFrame->GetSize(kidSize);
kidFrame->SizeTo(kidSize.width, kidSize.height + yDelta);
}
}
return rv;

View File

@ -67,7 +67,7 @@ public:
nsGUIEvent* aEvent,
nsEventStatus& aEventStatus);
NS_IMETHOD IsPercentageBase(PRBool& aBase) const {
aBase = PR_TRUE;
aBase = PR_FALSE;
return NS_OK;
}
@ -114,13 +114,19 @@ RootFrame::SetRect(const nsRect& aRect)
nsresult rv = nsHTMLContainerFrame::SetRect(aRect);
// Make sure our child's frame is adjusted as well
// Note: only do this if it's 'height' is 'auto'
nsIFrame* kidFrame = mFrames.FirstChild();
if (nsnull != kidFrame) {
nscoord yDelta = aRect.height - mNaturalHeight;
nsSize kidSize;
nsStylePosition* kidPosition;
kidFrame->GetStyleData(eStyleStruct_Position, (const nsStyleStruct*&)kidPosition);
kidFrame->GetSize(kidSize);
kidFrame->SizeTo(kidSize.width, kidSize.height + yDelta);
if (eStyleUnit_Auto == kidPosition->mHeight.GetUnit()) {
nscoord yDelta = aRect.height - mNaturalHeight;
nsSize kidSize;
kidFrame->GetSize(kidSize);
kidFrame->SizeTo(kidSize.width, kidSize.height + yDelta);
}
}
return rv;