diff --git a/layout/forms/nsHTMLButtonControlFrame.cpp b/layout/forms/nsHTMLButtonControlFrame.cpp index c5519e7ca2ca..16213ea512c5 100644 --- a/layout/forms/nsHTMLButtonControlFrame.cpp +++ b/layout/forms/nsHTMLButtonControlFrame.cpp @@ -209,22 +209,6 @@ nsHTMLButtonControlFrame::Reflow(nsPresContext* aPresContext, aDesiredSize.width = aReflowState.ComputedWidth(); - // If computed use the computed value. - if (aReflowState.ComputedHeight() != NS_INTRINSICSIZE) { - aDesiredSize.height = aReflowState.ComputedHeight(); - } else { - aDesiredSize.height += focusPadding.TopBottom(); - - // Make sure we obey min/max-height in the case when we're doing intrinsic - // sizing (we get it for free when we have a non-intrinsic - // aReflowState.ComputedHeight()). Note that we do this before adjusting - // for borderpadding, since mComputedMaxHeight and mComputedMinHeight are - // content heights. - aDesiredSize.height = NS_CSS_MINMAX(aDesiredSize.height, - aReflowState.mComputedMinHeight, - aReflowState.mComputedMaxHeight); - } - aDesiredSize.width += aReflowState.mComputedBorderPadding.LeftRight(); aDesiredSize.height += aReflowState.mComputedBorderPadding.TopBottom(); @@ -289,6 +273,22 @@ nsHTMLButtonControlFrame::ReflowButtonContents(nsPresContext* aPresContext, aReflowState.mComputedBorderPadding.TopBottom(); minInternalHeight = std::max(minInternalHeight, 0); + // Compute our desired height before vertically centering our children + if (aReflowState.ComputedHeight() != NS_INTRINSICSIZE) { + aDesiredSize.height = aReflowState.ComputedHeight(); + } else { + aDesiredSize.height += aFocusPadding.TopBottom(); + + // Make sure we obey min/max-height in the case when we're doing intrinsic + // sizing (we get it for free when we have a non-intrinsic + // aReflowState.ComputedHeight()). Note that we do this before adjusting + // for borderpadding, since mComputedMaxHeight and mComputedMinHeight are + // content heights. + aDesiredSize.height = NS_CSS_MINMAX(aDesiredSize.height, + aReflowState.mComputedMinHeight, + aReflowState.mComputedMaxHeight); + } + // center child vertically nscoord yoff = 0; if (aReflowState.ComputedHeight() != NS_INTRINSICSIZE) { diff --git a/layout/reftests/forms/button/min-height-ref.html b/layout/reftests/forms/button/min-height-ref.html new file mode 100644 index 000000000000..5f0f2d654e63 --- /dev/null +++ b/layout/reftests/forms/button/min-height-ref.html @@ -0,0 +1,17 @@ + + + + + + + + + + + diff --git a/layout/reftests/forms/button/min-height.html b/layout/reftests/forms/button/min-height.html new file mode 100644 index 000000000000..cadffa78d541 --- /dev/null +++ b/layout/reftests/forms/button/min-height.html @@ -0,0 +1,22 @@ + + + + + + + + + + + diff --git a/layout/reftests/forms/button/reftest.list b/layout/reftests/forms/button/reftest.list index 540cc9a67117..8b0c1e30ea1d 100644 --- a/layout/reftests/forms/button/reftest.list +++ b/layout/reftests/forms/button/reftest.list @@ -1,3 +1,4 @@ asserts(2) == first-letter-1.html first-letter-1-ref.html asserts(1) != first-letter-1.html first-letter-1-noref.html == max-height.html max-height-ref.html +== min-height.html min-height-ref.html