Bug 835873 - Include minHeight calculation before vertically centering a button's children. r=bz

This commit is contained in:
Bear Travis 2013-07-10 10:02:47 -04:00
Родитель d806e1e244
Коммит 9a1e760e9a
4 изменённых файлов: 56 добавлений и 16 удалений

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

@ -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) {

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

@ -0,0 +1,17 @@
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<style>
.btn1, .btn2 {
border: 5px solid green;
background-color: blue;
height: 50px;
}
</style>
</head>
<body>
<input type='submit' class='btn1' value='' />
<input type='submit' class='btn2' value='' />
</body>
</html>

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

@ -0,0 +1,22 @@
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<style>
.btn1, .btn2 {
border: 5px solid green;
background-color: blue;
}
.btn1 {
min-height: 50px;
}
.btn2 {
height: 50px;
}
</style>
</head>
<body>
<input type='submit' class='btn1' value='' />
<input type='submit' class='btn2' value='' />
</body>
</html>

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

@ -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