Remove some no longer needed code. Bug 368273, r+sr=dbaron

This commit is contained in:
bzbarsky%mit.edu 2007-01-30 05:52:27 +00:00
Родитель fcd7e069de
Коммит 4fcbe6d913
4 изменённых файлов: 11 добавлений и 45 удалений

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

@ -572,18 +572,11 @@ static void printSize(char * aDesc, nscoord aSize)
nscoord nscoord
nsComboboxControlFrame::GetMinWidth(nsIRenderingContext *aRenderingContext) nsComboboxControlFrame::GetMinWidth(nsIRenderingContext *aRenderingContext)
{ {
// Note: to fix the combobox equivalent of bug 40596 while still working // We want to size to our pref width
// correctly in general, we want to return our preferred width as our min
// width if our style width is auto. Otherwise, we're ok with shrinking as
// small as needed.
nscoord result; nscoord result;
DISPLAY_MIN_WIDTH(this, result); DISPLAY_MIN_WIDTH(this, result);
if (GetStylePosition()->mWidth.GetUnit() == eStyleUnit_Auto) { result = GetPrefWidth(aRenderingContext);
result = GetPrefWidth(aRenderingContext);
} else {
result = 0;
}
return result; return result;
} }

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

@ -244,32 +244,16 @@ nsHTMLButtonControlFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
nscoord nscoord
nsHTMLButtonControlFrame::GetMinWidth(nsIRenderingContext* aRenderingContext) nsHTMLButtonControlFrame::GetMinWidth(nsIRenderingContext* aRenderingContext)
{
return DoGetMinWidth(aRenderingContext, PR_TRUE);
}
nscoord
nsHTMLButtonControlFrame::DoGetMinWidth(nsIRenderingContext* aRenderingContext,
PRBool aZeroIfWidthSpecified)
{ {
nscoord result; nscoord result;
DISPLAY_MIN_WIDTH(this, result); DISPLAY_MIN_WIDTH(this, result);
// Note: to fix the button equivalent of bug 40596 while still working nsIFrame* kid = mFrames.FirstChild();
// correctly in general, we want to return our actual min width as our min result = nsLayoutUtils::IntrinsicForContainer(aRenderingContext,
// width if our style width is auto. Otherwise, we're ok with shrinking as kid,
// small as needed. nsLayoutUtils::MIN_WIDTH);
if (!aZeroIfWidthSpecified ||
GetStylePosition()->mWidth.GetUnit() == eStyleUnit_Auto) {
nsIFrame* kid = mFrames.FirstChild();
result = nsLayoutUtils::IntrinsicForContainer(aRenderingContext,
kid,
nsLayoutUtils::MIN_WIDTH);
result += mRenderer.GetAddedButtonBorderAndPadding().LeftRight(); result += mRenderer.GetAddedButtonBorderAndPadding().LeftRight();
} else {
result = 0;
}
return result; return result;
} }
@ -373,7 +357,7 @@ nsHTMLButtonControlFrame::ReflowButtonContents(nsPresContext* aPresContext,
// better look in such cases we adjust the available width and our left // better look in such cases we adjust the available width and our left
// offset to allow the kid to spill left into our padding. // offset to allow the kid to spill left into our padding.
nscoord xoffset = aFocusPadding.left + aReflowState.mComputedBorderPadding.left; nscoord xoffset = aFocusPadding.left + aReflowState.mComputedBorderPadding.left;
nscoord extrawidth = DoGetMinWidth(aReflowState.rendContext, PR_FALSE) - nscoord extrawidth = GetMinWidth(aReflowState.rendContext) -
aReflowState.ComputedWidth(); aReflowState.ComputedWidth();
if (extrawidth > 0) { if (extrawidth > 0) {
nscoord extraleft = extrawidth / 2; nscoord extraleft = extrawidth / 2;

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

@ -75,11 +75,6 @@ public:
virtual nscoord GetPrefWidth(nsIRenderingContext *aRenderingContext); virtual nscoord GetPrefWidth(nsIRenderingContext *aRenderingContext);
// Differs from GetMinWidth in that it allows one to specify whether
// to fall back on 0 for the min width if we have a specified width.
nscoord DoGetMinWidth(nsIRenderingContext *aRenderingContext,
PRBool aZeroIfWidthSpecified);
NS_IMETHOD Reflow(nsPresContext* aPresContext, NS_IMETHOD Reflow(nsPresContext* aPresContext,
nsHTMLReflowMetrics& aDesiredSize, nsHTMLReflowMetrics& aDesiredSize,
const nsHTMLReflowState& aReflowState, const nsHTMLReflowState& aReflowState,

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

@ -1744,17 +1744,11 @@ nsTextControlFrame::CreateAnonymousContent(nsPresContext* aPresContext,
nscoord nscoord
nsTextControlFrame::GetMinWidth(nsIRenderingContext* aRenderingContext) nsTextControlFrame::GetMinWidth(nsIRenderingContext* aRenderingContext)
{ {
// Note: to fix bug 40596 while still working correctly in general, we want // Our min width is just our preferred width if we have auto width.
// to return our preferred width as our min width if our style width is auto.
// Otherwise, we're ok with shrinking as small as needed.
nscoord result; nscoord result;
DISPLAY_MIN_WIDTH(this, result); DISPLAY_MIN_WIDTH(this, result);
if (GetStylePosition()->mWidth.GetUnit() == eStyleUnit_Auto) { result = GetPrefWidth(aRenderingContext);
result = GetPrefWidth(aRenderingContext);
} else {
result = 0;
}
return result; return result;
} }