Fixed boxes to only invalidate and redraw what has changed.

Made min and max sizes work
Made linux not suck!
This commit is contained in:
scc@netscape.com
1999-07-23 00:11:21 +00:00
parent 79b0c344d1
commit 01af8d6640
7 changed files with 633 additions and 812 deletions

View File

@@ -445,12 +445,13 @@ nsHTMLButtonControlFrame::Reflow(nsIPresContext& aPresContext,
// reflow the child
nsIFrame* firstKid = mFrames.FirstChild();
nsSize availSize(aReflowState.mComputedWidth, aReflowState.mComputedHeight);
nsSize availSize(aReflowState.mComputedWidth, NS_INTRINSICSIZE);
// indent the child inside us by the the focus border. We must do this separate from the
// regular border.
nsMargin focusPadding = mRenderer.GetAddedButtonBorderAndPadding();
if (NS_INTRINSICSIZE != availSize.width) {
availSize.width -= focusPadding.left + focusPadding.right;
availSize.width = PR_MAX(availSize.width,0);
@@ -459,8 +460,10 @@ nsHTMLButtonControlFrame::Reflow(nsIPresContext& aPresContext,
availSize.height -= focusPadding.top + focusPadding.bottom;
availSize.height = PR_MAX(availSize.height,0);
}
nsHTMLReflowState reflowState(aPresContext, aReflowState, firstKid, availSize);
//reflowState.computedWidth = availSize;
// XXX remove the following when the reflow state is fixed
//ButtonHack(reflowState, "html4 button's area");
@@ -471,7 +474,8 @@ nsHTMLButtonControlFrame::Reflow(nsIPresContext& aPresContext,
// See if it's targeted at us
aReflowState.reflowCommand->GetTarget(targetFrame);
if (this == targetFrame) {
// XXX Handle this...
Invalidate(nsRect(0,0,mRect.width,mRect.height), PR_FALSE);
reflowState.reason = eReflowReason_Resize;
} else {
nsIFrame* nextFrame;
@@ -487,9 +491,16 @@ nsHTMLButtonControlFrame::Reflow(nsIPresContext& aPresContext,
nsRect rect = nsRect(focusPadding.left + aReflowState.mComputedBorderPadding.left, focusPadding.top + aReflowState.mComputedBorderPadding.top, aDesiredSize.width, aDesiredSize.height);
firstKid->SetRect(rect);
// add in our border and padding to the size of the child
aDesiredSize.width += focusPadding.left + focusPadding.right;
aDesiredSize.height += focusPadding.top + focusPadding.bottom;
// if computed use the computed values.
if (aReflowState.mComputedWidth != NS_INTRINSICSIZE && (aDesiredSize.width < aReflowState.mComputedWidth))
aDesiredSize.width = aReflowState.mComputedWidth;
else
aDesiredSize.width += focusPadding.left + focusPadding.right;
if (aReflowState.mComputedHeight != NS_INTRINSICSIZE && (aDesiredSize.height < aReflowState.mComputedHeight))
aDesiredSize.height = aReflowState.mComputedHeight;
else
aDesiredSize.height += focusPadding.top + focusPadding.bottom;
aDesiredSize.width += aReflowState.mComputedBorderPadding.left + aReflowState.mComputedBorderPadding.right;
aDesiredSize.height += aReflowState.mComputedBorderPadding.top + aReflowState.mComputedBorderPadding.bottom;
@@ -502,6 +513,7 @@ nsHTMLButtonControlFrame::Reflow(nsIPresContext& aPresContext,
aDesiredSize.ascent = aDesiredSize.height;
aDesiredSize.descent = 0;
aStatus = NS_FRAME_COMPLETE;
return NS_OK;
}