Bug 666041 patch 6.5: Add flag to nsHTMLReflowState & ComputeSize for measuring auto height. r=dbaron

This commit is contained in:
Daniel Holbert
2012-09-29 23:38:46 -07:00
parent 286a4a3cd0
commit 6a3a51a6de
4 changed files with 30 additions and 5 deletions

View File

@@ -174,6 +174,7 @@ nsHTMLReflowState::nsHTMLReflowState(nsPresContext* aPresContext,
mFlags.mAssumingHScrollbar = mFlags.mAssumingVScrollbar = false;
mFlags.mHasClearance = false;
mFlags.mIsColumnBalancing = false;
mFlags.mIsFlexContainerMeasuringHeight = false;
mFlags.mDummyParentReflowState = false;
mDiscoveredClearance = nullptr;
@@ -2009,6 +2010,12 @@ nsHTMLReflowState::InitConstraints(nsPresContext* aPresContext,
computeSizeFlags |= nsIFrame::eShrinkWrap;
}
// If we're inside of a flexbox that needs to measure our auto height,
// pass that information along to ComputeSize().
if (mFlags.mIsFlexContainerMeasuringHeight) {
computeSizeFlags |= nsIFrame::eUseAutoHeight;
}
nsSize size =
frame->ComputeSize(rendContext,
nsSize(aContainingBlockWidth,
@@ -2487,6 +2494,9 @@ nsHTMLReflowState::ComputeMinMaxValues(nscoord aContainingBlockWidth,
// depends on the content height. Treat them like 'auto'
// Likewise, check for calc() on internal table elements; calc() on
// such elements is unsupported.
// Likewise, if we're a child of a flex container who's measuring our
// intrinsic height, then we want to disregard our min-height.
// NOTE: We treat "min-height:auto" as "0" for the purpose of this code,
// since that's what it means in all cases except for on flex items -- and
// even there, we're supposed to ignore it (i.e. treat it as 0) until the
@@ -2496,7 +2506,8 @@ nsHTMLReflowState::ComputeMinMaxValues(nscoord aContainingBlockWidth,
(NS_AUTOHEIGHT == aContainingBlockHeight &&
minHeight.HasPercent()) ||
(mFrameType == NS_CSS_FRAME_TYPE_INTERNAL_TABLE &&
minHeight.IsCalcUnit())) {
minHeight.IsCalcUnit()) ||
mFlags.mIsFlexContainerMeasuringHeight) {
mComputedMinHeight = 0;
} else {
mComputedMinHeight = ComputeHeightValue(aContainingBlockHeight,
@@ -2510,13 +2521,16 @@ nsHTMLReflowState::ComputeMinMaxValues(nscoord aContainingBlockWidth,
mComputedMaxHeight = NS_UNCONSTRAINEDSIZE; // no limit
} else {
// Check for percentage based values and a containing block height that
// depends on the content height. Treat them like 'auto'
// depends on the content height. Treat them like 'none'
// Likewise, check for calc() on internal table elements; calc() on
// such elements is unsupported.
// Likewise, if we're a child of a flex container who's measuring our
// intrinsic height, then we want to disregard our max-height.
if ((NS_AUTOHEIGHT == aContainingBlockHeight &&
maxHeight.HasPercent()) ||
(mFrameType == NS_CSS_FRAME_TYPE_INTERNAL_TABLE &&
maxHeight.IsCalcUnit())) {
maxHeight.IsCalcUnit()) ||
mFlags.mIsFlexContainerMeasuringHeight) {
mComputedMaxHeight = NS_UNCONSTRAINEDSIZE;
} else {
mComputedMaxHeight = ComputeHeightValue(aContainingBlockHeight,