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 49a6f5e64c
commit 537fbfa9d6
7 changed files with 37 additions and 20 deletions

View File

@@ -137,10 +137,11 @@ GetWidthInfo(nsRenderingContext *aRenderingContext,
const nsStyleCoord &width = stylePos->mWidth;
nsStyleUnit unit = width.GetUnit();
// NOTE: We're ignoring calc() units here, for lack of a sensible
// idea for what to do with them. This means calc() is basically
// handled like 'auto' for table cells and columns.
if (unit == eStyleUnit_Coord) {
// NOTE: We're ignoring calc() units with percentages here, for lack of a
// sensible idea for what to do with them. This means calc() with
// percentages is basically handled like 'auto' for table cells and
// columns.
if (width.ConvertsToLength()) {
hasSpecifiedWidth = true;
// Note: since ComputeWidthValue was designed to return content-box
// width, it will (in some cases) subtract the box-sizing edges.
@@ -192,7 +193,7 @@ GetWidthInfo(nsRenderingContext *aRenderingContext,
unit = maxWidth.GetUnit();
// XXX To really implement 'max-width' well, we'd need to store
// it separately on the columns.
if (unit == eStyleUnit_Coord || unit == eStyleUnit_Enumerated) {
if (maxWidth.ConvertsToLength() || unit == eStyleUnit_Enumerated) {
nscoord w =
nsLayoutUtils::ComputeWidthValue(aRenderingContext, aFrame,
0, 0, 0, maxWidth);
@@ -205,7 +206,7 @@ GetWidthInfo(nsRenderingContext *aRenderingContext,
if (p < prefPercent)
prefPercent = p;
}
// treat calc() on max-width just like 'none'.
// treat calc() with percentages on max-width just like 'none'.
nsStyleCoord minWidth(stylePos->mMinWidth);
if (minWidth.GetUnit() == eStyleUnit_Enumerated) {
@@ -218,7 +219,7 @@ GetWidthInfo(nsRenderingContext *aRenderingContext,
eStyleUnit_Enumerated);
}
unit = minWidth.GetUnit();
if (unit == eStyleUnit_Coord || unit == eStyleUnit_Enumerated) {
if (minWidth.ConvertsToLength() || unit == eStyleUnit_Enumerated) {
nscoord w =
nsLayoutUtils::ComputeWidthValue(aRenderingContext, aFrame,
0, 0, 0, minWidth);
@@ -231,7 +232,7 @@ GetWidthInfo(nsRenderingContext *aRenderingContext,
if (p > prefPercent)
prefPercent = p;
}
// treat calc() on min-width just like '0'.
// treat calc() with percentages on min-width just like '0'.
// XXX Should col frame have border/padding considered?
if (aIsCell) {