зеркало из https://github.com/mozilla/gecko-dev.git
Bug 776443 part 1. Support percent-less calc for internal table element heights. r=dbaron
This commit is contained in:
Родитель
99668e7fe2
Коммит
c882c3bf6c
|
@ -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 {
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
<!DOCTYPE html>
|
||||
<style>
|
||||
table { background: yellow; }
|
||||
td { height: 50px; }
|
||||
</style>
|
||||
<table><tr><td>Should be 50px tall</td></tr></table>
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
<!DOCTYPE html>
|
||||
<style>
|
||||
table { background: yellow; }
|
||||
td { height: calc(25px + 25px); }
|
||||
</style>
|
||||
<table><tr><td>Should be 50px tall</td></tr></table>
|
|
@ -1714,6 +1714,7 @@ needs-focus == 731726-1.html 731726-1-ref.html
|
|||
== 758561-1.html 758561-1-ref.html
|
||||
fuzzy-if(true,1,19) == 759036-1.html 759036-1-ref.html
|
||||
fuzzy-if(true,17,5859) == 759036-2.html 759036-2-ref.html
|
||||
== 776443-1.html 776443-1-ref.html
|
||||
== 776265-1a.html 776265-1-ref.html
|
||||
== 776265-1b.html 776265-1-ref.html
|
||||
== 776265-1c.html 776265-1-ref.html
|
||||
|
|
|
@ -1,5 +1,12 @@
|
|||
<!DOCTYPE HTML>
|
||||
<title>Test that height:calc() has no effect on inner table elements</title>
|
||||
<title>Test that height:calc() with no percentages has an effect on inner table elements</title>
|
||||
<style>
|
||||
tbody, tr, td {
|
||||
height: 500px;
|
||||
min-height: 700px;
|
||||
max-height: 2px;
|
||||
}
|
||||
</style>
|
||||
<table border>
|
||||
<tbody>
|
||||
<tr>
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
<!DOCTYPE HTML>
|
||||
<title>Test that height:calc() has no effect on inner table elements</title>
|
||||
<title>Test that height:calc() with no percentages has an effect on inner table elements</title>
|
||||
<style>
|
||||
tbody, tr, td {
|
||||
height: -moz-calc(500px);
|
||||
min-height: -moz-calc(1000px);
|
||||
min-height: -moz-calc(700px);
|
||||
max-height: -moz-calc(2px);
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -1543,8 +1543,9 @@ nsTableFrame::AncestorsHaveStyleHeight(const nsHTMLReflowState& aParentReflowSta
|
|||
(nsGkAtoms::tableRowFrame == frameType) ||
|
||||
(nsGkAtoms::tableRowGroupFrame == frameType)) {
|
||||
const nsStyleCoord &height = rs->mStylePosition->mHeight;
|
||||
// calc() treated like 'auto' on internal table elements
|
||||
if (height.GetUnit() != eStyleUnit_Auto && !height.IsCalcUnit()) {
|
||||
// calc() with percentages treated like 'auto' on internal table elements
|
||||
if (height.GetUnit() != eStyleUnit_Auto &&
|
||||
(!height.IsCalcUnit() || !height.HasPercent())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -488,13 +488,13 @@ nsTableRowFrame::CalcHeight(const nsHTMLReflowState& aReflowState)
|
|||
ResetHeight(computedHeight);
|
||||
|
||||
const nsStylePosition* position = GetStylePosition();
|
||||
if (eStyleUnit_Coord == position->mHeight.GetUnit()) {
|
||||
SetFixedHeight(position->mHeight.GetCoordValue());
|
||||
if (position->mHeight.ConvertsToLength()) {
|
||||
SetFixedHeight(nsRuleNode::ComputeCoordPercentCalc(position->mHeight, 0));
|
||||
}
|
||||
else if (eStyleUnit_Percent == position->mHeight.GetUnit()) {
|
||||
SetPctHeight(position->mHeight.GetPercentValue());
|
||||
}
|
||||
// calc() is treated like 'auto' on table rows.
|
||||
// calc() with percentages is treated like 'auto' on table rows.
|
||||
|
||||
for (nsIFrame* kidFrame = mFrames.FirstChild(); kidFrame;
|
||||
kidFrame = kidFrame->GetNextSibling()) {
|
||||
|
@ -606,6 +606,13 @@ nsTableRowFrame::CalculateCellActualHeight(nsTableCellFrame* aCellFrame,
|
|||
int32_t rowSpan = tableFrame->GetEffectiveRowSpan(*aCellFrame);
|
||||
|
||||
switch (position->mHeight.GetUnit()) {
|
||||
case eStyleUnit_Calc: {
|
||||
if (position->mHeight.CalcHasPercent()) {
|
||||
// Treat this like "auto"
|
||||
break;
|
||||
}
|
||||
// Fall through to the coord case
|
||||
}
|
||||
case eStyleUnit_Coord: {
|
||||
nscoord outsideBoxSizing = 0;
|
||||
// In quirks mode, table cell width should be content-box, but height
|
||||
|
@ -627,7 +634,9 @@ nsTableRowFrame::CalculateCellActualHeight(nsTableCellFrame* aCellFrame,
|
|||
}
|
||||
}
|
||||
|
||||
specifiedHeight = position->mHeight.GetCoordValue() + outsideBoxSizing;
|
||||
specifiedHeight =
|
||||
nsRuleNode::ComputeCoordPercentCalc(position->mHeight, 0) +
|
||||
outsideBoxSizing;
|
||||
|
||||
if (1 == rowSpan)
|
||||
SetFixedHeight(specifiedHeight);
|
||||
|
@ -640,7 +649,7 @@ nsTableRowFrame::CalculateCellActualHeight(nsTableCellFrame* aCellFrame,
|
|||
break;
|
||||
}
|
||||
case eStyleUnit_Auto:
|
||||
default: // includes calc(), which we treat like 'auto'
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1370,7 +1379,8 @@ void nsTableRowFrame::InitHasCellWithStyleHeight(nsTableFrame* aTableFrame)
|
|||
const nsStyleCoord &cellHeight = cellFrame->GetStylePosition()->mHeight;
|
||||
if (aTableFrame->GetEffectiveRowSpan(*cellFrame) == 1 &&
|
||||
cellHeight.GetUnit() != eStyleUnit_Auto &&
|
||||
!cellHeight.IsCalcUnit() /* calc() treated like 'auto' */) {
|
||||
/* calc() with percentages treated like 'auto' */
|
||||
(!cellHeight.IsCalcUnit() || !cellHeight.HasPercent())) {
|
||||
AddStateBits(NS_ROW_HAS_CELL_WITH_STYLE_HEIGHT);
|
||||
return;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче