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

This commit is contained in:
Boris Zbarsky
2012-11-21 11:19:37 -05:00
parent d2aeb32b7e
commit e7fc953610
9 changed files with 39 additions and 22 deletions

View File

@@ -66,7 +66,7 @@ FixedTableLayoutStrategy::GetMinWidth(nsRenderingContext* aRenderingContext)
}
const nsStyleCoord *styleWidth =
&colFrame->GetStylePosition()->mWidth;
if (styleWidth->GetUnit() == eStyleUnit_Coord) {
if (styleWidth->ConvertsToLength()) {
result += nsLayoutUtils::ComputeWidthValue(aRenderingContext,
colFrame, 0, 0, 0, *styleWidth);
} else if (styleWidth->GetUnit() == eStyleUnit_Percent) {
@@ -74,7 +74,7 @@ FixedTableLayoutStrategy::GetMinWidth(nsRenderingContext* aRenderingContext)
} else {
NS_ASSERTION(styleWidth->GetUnit() == eStyleUnit_Auto ||
styleWidth->GetUnit() == eStyleUnit_Enumerated ||
styleWidth->IsCalcUnit(),
(styleWidth->IsCalcUnit() && styleWidth->CalcHasPercent()),
"bad width");
// The 'table-layout: fixed' algorithm considers only cells
@@ -85,7 +85,7 @@ FixedTableLayoutStrategy::GetMinWidth(nsRenderingContext* aRenderingContext)
cellMap->GetCellInfoAt(0, col, &originates, &colSpan);
if (cellFrame) {
styleWidth = &cellFrame->GetStylePosition()->mWidth;
if (styleWidth->GetUnit() == eStyleUnit_Coord ||
if (styleWidth->ConvertsToLength() ||
(styleWidth->GetUnit() == eStyleUnit_Enumerated &&
(styleWidth->GetIntValue() == NS_STYLE_WIDTH_MAX_CONTENT ||
styleWidth->GetIntValue() == NS_STYLE_WIDTH_MIN_CONTENT))) {
@@ -107,7 +107,7 @@ FixedTableLayoutStrategy::GetMinWidth(nsRenderingContext* aRenderingContext)
}
}
// else, for 'auto', '-moz-available', '-moz-fit-content',
// and 'calc()', do nothing
// and 'calc()' with percentages, do nothing
}
}
}
@@ -208,7 +208,7 @@ FixedTableLayoutStrategy::ComputeColumnWidths(const nsHTMLReflowState& aReflowSt
const nsStyleCoord *styleWidth =
&colFrame->GetStylePosition()->mWidth;
nscoord colWidth;
if (styleWidth->GetUnit() == eStyleUnit_Coord) {
if (styleWidth->ConvertsToLength()) {
colWidth = nsLayoutUtils::ComputeWidthValue(
aReflowState.rendContext,
colFrame, 0, 0, 0, *styleWidth);
@@ -221,7 +221,7 @@ FixedTableLayoutStrategy::ComputeColumnWidths(const nsHTMLReflowState& aReflowSt
} else {
NS_ASSERTION(styleWidth->GetUnit() == eStyleUnit_Auto ||
styleWidth->GetUnit() == eStyleUnit_Enumerated ||
styleWidth->IsCalcUnit(),
(styleWidth->IsCalcUnit() && styleWidth->CalcHasPercent()),
"bad width");
// The 'table-layout: fixed' algorithm considers only cells
@@ -232,7 +232,7 @@ FixedTableLayoutStrategy::ComputeColumnWidths(const nsHTMLReflowState& aReflowSt
cellMap->GetCellInfoAt(0, col, &originates, &colSpan);
if (cellFrame) {
styleWidth = &cellFrame->GetStylePosition()->mWidth;
if (styleWidth->GetUnit() == eStyleUnit_Coord ||
if (styleWidth->ConvertsToLength() ||
(styleWidth->GetUnit() == eStyleUnit_Enumerated &&
(styleWidth->GetIntValue() == NS_STYLE_WIDTH_MAX_CONTENT ||
styleWidth->GetIntValue() == NS_STYLE_WIDTH_MIN_CONTENT))) {
@@ -257,7 +257,7 @@ FixedTableLayoutStrategy::ComputeColumnWidths(const nsHTMLReflowState& aReflowSt
pctTotal += pct;
} else {
// 'auto', '-moz-available', '-moz-fit-content', and
// 'calc()'
// 'calc()' with percentages
colWidth = unassignedMarker;
}
if (colWidth != unassignedMarker) {