Bug 776443 part 1. Support percent-less calc for internal table element heights. r=dbaron

This commit is contained in:
Boris Zbarsky
2012-11-21 11:19:30 -05:00
parent 53a154daa0
commit d2aeb32b7e
8 changed files with 52 additions and 19 deletions

View File

@@ -1996,8 +1996,9 @@ nsHTMLReflowState::InitConstraints(nsPresContext* aPresContext,
// 'height' property doesn't apply to table columns and column groups
heightUnit = eStyleUnit_Auto;
}
// calc() acts like 'auto' on internal table elements
if (eStyleUnit_Auto == heightUnit || height.IsCalcUnit()) {
// calc() with percentages acts like 'auto' on internal table elements
if (eStyleUnit_Auto == heightUnit ||
(height.IsCalcUnit() && height.CalcHasPercent())) {
mComputedHeight = NS_AUTOHEIGHT;
} else {
NS_ASSERTION(heightUnit == mStylePosition->mHeight.GetUnit(),
@@ -2541,8 +2542,8 @@ nsHTMLReflowState::ComputeMinMaxValues(nscoord aContainingBlockWidth,
// Check for percentage based values and a containing block height that
// depends on the content height. Treat them like 'auto'
// Likewise, check for calc() on internal table elements; calc() on
// such elements is unsupported.
// Likewise, check for calc() with percentages on internal table elements;
// that's treated as 'auto' too.
// Likewise, if we're a child of a flex container who's measuring our
// intrinsic height, then we want to disregard our min-height.
@@ -2555,7 +2556,7 @@ nsHTMLReflowState::ComputeMinMaxValues(nscoord aContainingBlockWidth,
(NS_AUTOHEIGHT == aContainingBlockHeight &&
minHeight.HasPercent()) ||
(mFrameType == NS_CSS_FRAME_TYPE_INTERNAL_TABLE &&
minHeight.IsCalcUnit()) ||
minHeight.IsCalcUnit() && minHeight.CalcHasPercent()) ||
mFlags.mIsFlexContainerMeasuringHeight) {
mComputedMinHeight = 0;
} else {
@@ -2571,14 +2572,14 @@ nsHTMLReflowState::ComputeMinMaxValues(nscoord aContainingBlockWidth,
} else {
// Check for percentage based values and a containing block height that
// depends on the content height. Treat them like 'none'
// Likewise, check for calc() on internal table elements; calc() on
// such elements is unsupported.
// Likewise, check for calc() with percentages on internal table elements;
// that's treated as 'auto' too.
// 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() && maxHeight.CalcHasPercent()) ||
mFlags.mIsFlexContainerMeasuringHeight) {
mComputedMaxHeight = NS_UNCONSTRAINEDSIZE;
} else {