Bug 785754. Fix handling of max-height for frame classes that still seem to think that the mComputedMinHeight/mComputedMaxHeight of a reflow state are border-box heights, not content-box heights. r=mats

This commit is contained in:
Boris Zbarsky 2012-08-27 15:46:23 -04:00
Родитель 06caecb924
Коммит bbba2e04b8
13 изменённых файлов: 103 добавлений и 24 удалений

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

@ -226,23 +226,24 @@ nsHTMLButtonControlFrame::Reflow(nsPresContext* aPresContext,
aDesiredSize.width = aReflowState.ComputedWidth();
// If computed use the computed value.
if (aReflowState.ComputedHeight() != NS_INTRINSICSIZE)
if (aReflowState.ComputedHeight() != NS_INTRINSICSIZE) {
aDesiredSize.height = aReflowState.ComputedHeight();
else
} 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();
// Make sure we obey min/max-height. Note that we do this after adjusting
// for borderpadding, since buttons have border-box sizing...
// XXXbz unless someone overrides that, of course! We should really consider
// exposing nsHTMLReflowState::AdjustComputed* or something.
aDesiredSize.height = NS_CSS_MINMAX(aDesiredSize.height,
aReflowState.mComputedMinHeight,
aReflowState.mComputedMaxHeight);
aDesiredSize.ascent +=
aReflowState.mComputedBorderPadding.top + focusPadding.top;

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

@ -121,9 +121,6 @@ NS_IMETHODIMP nsMeterFrame::Reflow(nsPresContext* aPresContext,
aReflowState.mComputedBorderPadding.LeftRight();
aDesiredSize.height = aReflowState.ComputedHeight() +
aReflowState.mComputedBorderPadding.TopBottom();
aDesiredSize.height = NS_CSS_MINMAX(aDesiredSize.height,
aReflowState.mComputedMinHeight,
aReflowState.mComputedMaxHeight);
aDesiredSize.SetOverflowAreasToDesiredBounds();
ConsiderChildOverflow(aDesiredSize.mOverflowAreas, barFrame);

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

@ -129,9 +129,6 @@ NS_IMETHODIMP nsProgressFrame::Reflow(nsPresContext* aPresContext,
aReflowState.mComputedBorderPadding.LeftRight();
aDesiredSize.height = aReflowState.ComputedHeight() +
aReflowState.mComputedBorderPadding.TopBottom();
aDesiredSize.height = NS_CSS_MINMAX(aDesiredSize.height,
aReflowState.mComputedMinHeight,
aReflowState.mComputedMaxHeight);
aDesiredSize.SetOverflowAreasToDesiredBounds();
ConsiderChildOverflow(aDesiredSize.mOverflowAreas, barFrame);

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

@ -0,0 +1,12 @@
<!DOCTYPE html>
<style>
button {
height: 50px;
padding: 23px;
border: 1px solid black;
box-sizing: border-box;
-moz-box-sizing: border-box;
overflow: hidden;
}
</style>
<button>Some text</button>

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

@ -0,0 +1,12 @@
<!DOCTYPE html>
<style>
button {
max-height: 50px;
padding: 23px;
border: 1px solid black;
box-sizing: border-box;
-moz-box-sizing: border-box;
overflow: hidden;
}
</style>
<button>Some text</button>

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

@ -0,0 +1,12 @@
<!DOCTYPE html>
<style>
meter {
height: 50px;
padding: 23px;
border: 1px solid black;
box-sizing: border-box;
-moz-box-sizing: border-box;
overflow: hidden;
}
</style>
<meter>Some text</meter>

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

@ -0,0 +1,12 @@
<!DOCTYPE html>
<style>
meter {
max-height: 50px;
padding: 23px;
border: 1px solid black;
box-sizing: border-box;
-moz-box-sizing: border-box;
overflow: hidden;
}
</style>
<meter>Some text</meter>

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

@ -24,3 +24,4 @@ include default-style/reftest.list
# Tests for bugs:
== block-invalidate.html block-invalidate-ref.html
== in-cells.html in-cells-ref.html
== max-height.html max-height-ref.html

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

@ -0,0 +1,12 @@
<!DOCTYPE html>
<style>
progress {
height: 50px;
padding: 23px;
border: 1px solid black;
box-sizing: border-box;
-moz-box-sizing: border-box;
overflow: hidden;
}
</style>
<progress>Some text</progress>

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

@ -0,0 +1,12 @@
<!DOCTYPE html>
<style>
progress {
max-height: 50px;
padding: 23px;
border: 1px solid black;
box-sizing: border-box;
-moz-box-sizing: border-box;
overflow: hidden;
}
</style>
<progress>Some text</progress>

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

@ -23,3 +23,4 @@
# Tests for bugs:
== block-invalidate.html block-invalidate-ref.html
== in-cells.html in-cells-ref.html
== max-height.html max-height-ref.html

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

@ -63,6 +63,7 @@ fails-if(Android) != textarea-rtl.html textarea-no-resize.html
asserts(2) == button-first-letter-1.html button-first-letter-1-ref.html
asserts(1) != button-first-letter-1.html button-first-letter-1-noref.html
== button-max-height.html button-max-height-ref.html
== legend.html legend-ref.html
@ -72,6 +73,9 @@ include placeholder/reftest.list
# input
include input/reftest.list
# meter element
include meter/reftest.list
# output element
include output/reftest.list

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

@ -269,18 +269,24 @@ nsLeafBoxFrame::Reflow(nsPresContext* aPresContext,
}
// handle reflow state min and max sizes
// XXXbz the width handling here seems to be wrong, since
// mComputedMin/MaxWidth is a content-box size, whole
// computedSize.width is a border-box size...
if (computedSize.width > aReflowState.mComputedMaxWidth)
computedSize.width = aReflowState.mComputedMaxWidth;
if (computedSize.height > aReflowState.mComputedMaxHeight)
computedSize.height = aReflowState.mComputedMaxHeight;
if (computedSize.width < aReflowState.mComputedMinWidth)
computedSize.width = aReflowState.mComputedMinWidth;
if (computedSize.height < aReflowState.mComputedMinHeight)
computedSize.height = aReflowState.mComputedMinHeight;
// Now adjust computedSize.height for our min and max computed
// height. The only problem is that those are content-box sizes,
// while computedSize.height is a border-box size. So subtract off
// m.TopBottom() before adjusting, then readd it.
computedSize.height = NS_MAX(0, computedSize.height - m.TopBottom());
computedSize.height = NS_CSS_MINMAX(computedSize.height,
aReflowState.mComputedMinHeight,
aReflowState.mComputedMaxHeight);
computedSize.height += m.TopBottom();
nsRect r(mRect.x, mRect.y, computedSize.width, computedSize.height);