diff --git a/mozilla/layout/reftests/bugs/413286-1-ref.html b/mozilla/layout/reftests/bugs/413286-1-ref.html
new file mode 100644
index 00000000000..f4a464e5e67
--- /dev/null
+++ b/mozilla/layout/reftests/bugs/413286-1-ref.html
@@ -0,0 +1,89 @@
+
+
+
+
+
+ With colspan:
+
+
+
+
+
+ Without colspan:
+
+
+
+
+
+
+
+
+
+
diff --git a/mozilla/layout/reftests/bugs/413286-1a.html b/mozilla/layout/reftests/bugs/413286-1a.html
new file mode 100644
index 00000000000..6743a039b61
--- /dev/null
+++ b/mozilla/layout/reftests/bugs/413286-1a.html
@@ -0,0 +1,108 @@
+
+
+
+
+
+ With colspan:
+
+
+
+
+
+ Without colspan:
+
+
+
+
+
+
+
+
+
+
+ | xxx |
+ xxx |
+ xxx |
+
+
+
+
diff --git a/mozilla/layout/reftests/bugs/413286-1b.html b/mozilla/layout/reftests/bugs/413286-1b.html
new file mode 100644
index 00000000000..31ac0b6aa10
--- /dev/null
+++ b/mozilla/layout/reftests/bugs/413286-1b.html
@@ -0,0 +1,108 @@
+
+
+
+
+
+ With colspan:
+
+
+
+
+
+ Without colspan:
+
+
+
+
+
+
+
+
+
+
+ | xxx |
+ xxx |
+ xxx |
+
+
+
+
diff --git a/mozilla/layout/reftests/bugs/413286-1c.html b/mozilla/layout/reftests/bugs/413286-1c.html
new file mode 100644
index 00000000000..34761884862
--- /dev/null
+++ b/mozilla/layout/reftests/bugs/413286-1c.html
@@ -0,0 +1,108 @@
+
+
+
+
+
+ With colspan:
+
+
+
+
+
+ Without colspan:
+
+
+
+
+
+
+
+
+
+
+ | xxx |
+ xxx |
+ xxx |
+
+
+
+
diff --git a/mozilla/layout/reftests/bugs/413286-2-ref.html b/mozilla/layout/reftests/bugs/413286-2-ref.html
new file mode 100644
index 00000000000..fda91a9e6ce
--- /dev/null
+++ b/mozilla/layout/reftests/bugs/413286-2-ref.html
@@ -0,0 +1,66 @@
+
+
+
+ Reference Case
+
+
+
+ No third column
+
+
+ Third column with low percent width
+
+
+ Third column with medium percent width
+
+
+ Third column with preferred width
+
+
+
diff --git a/mozilla/layout/reftests/bugs/413286-2a.html b/mozilla/layout/reftests/bugs/413286-2a.html
new file mode 100644
index 00000000000..8af608a05f2
--- /dev/null
+++ b/mozilla/layout/reftests/bugs/413286-2a.html
@@ -0,0 +1,67 @@
+
+
+
+ Spanning cell has no specified width
+
+
+
+ No third column
+
+
+ Third column with low percent width
+
+
+ Third column with medium percent width
+
+
+ Third column with preferred width
+
+
+
diff --git a/mozilla/layout/reftests/bugs/413286-2b.html b/mozilla/layout/reftests/bugs/413286-2b.html
new file mode 100644
index 00000000000..d4367a937e1
--- /dev/null
+++ b/mozilla/layout/reftests/bugs/413286-2b.html
@@ -0,0 +1,68 @@
+
+
+
+ Spanning cell has nonzero pref & min width
+
+
+
+ No third column
+
+
+ Third column with low percent width
+
+
+ Third column with medium percent width
+
+
+ Third column with preferred width
+
+
+
diff --git a/mozilla/layout/reftests/bugs/413286-2c.html b/mozilla/layout/reftests/bugs/413286-2c.html
new file mode 100644
index 00000000000..38ade8b385f
--- /dev/null
+++ b/mozilla/layout/reftests/bugs/413286-2c.html
@@ -0,0 +1,67 @@
+
+
+
+ Spanning cell has low percent width
+
+
+
+ No third column
+
+
+ Third column with low percent width
+
+
+ Third column with medium percent width
+
+
+ Third column with preferred width
+
+
+
diff --git a/mozilla/layout/reftests/bugs/413286-3-ref.html b/mozilla/layout/reftests/bugs/413286-3-ref.html
new file mode 100644
index 00000000000..be091cdab75
--- /dev/null
+++ b/mozilla/layout/reftests/bugs/413286-3-ref.html
@@ -0,0 +1,66 @@
+
+
+
+ Reference Case
+
+
+
+ No third column
+
+
+ Third column with low percent width
+
+
+ Third column with medium percent width
+
+
+ Third column with preferred width
+
+
+
diff --git a/mozilla/layout/reftests/bugs/413286-3.html b/mozilla/layout/reftests/bugs/413286-3.html
new file mode 100644
index 00000000000..a5bc1470298
--- /dev/null
+++ b/mozilla/layout/reftests/bugs/413286-3.html
@@ -0,0 +1,67 @@
+
+
+
+ Spanning cell has high percent width
+
+
+
+ No third column
+
+
+ Third column with low percent width
+
+
+ Third column with medium percent width
+
+
+ Third column with preferred width
+
+
+
diff --git a/mozilla/layout/reftests/bugs/413286-4-ref.html b/mozilla/layout/reftests/bugs/413286-4-ref.html
new file mode 100644
index 00000000000..f19e6c3cd89
--- /dev/null
+++ b/mozilla/layout/reftests/bugs/413286-4-ref.html
@@ -0,0 +1,66 @@
+
+
+
+ First two columns have no width
+
+
+
+ No third column
+
+
+ Third column with low percent width
+
+
+ Third column with medium percent width
+
+
+ Third column with preferred width
+
+
+
diff --git a/mozilla/layout/reftests/bugs/413286-4a.html b/mozilla/layout/reftests/bugs/413286-4a.html
new file mode 100644
index 00000000000..a2c53d88346
--- /dev/null
+++ b/mozilla/layout/reftests/bugs/413286-4a.html
@@ -0,0 +1,66 @@
+
+
+
+ Span & its columns have no width
+
+
+
+ No third column
+
+
+ Third column with low percent width
+
+
+ Third column with medium percent width
+
+
+ Third column with preferred width
+
+
+
diff --git a/mozilla/layout/reftests/bugs/413286-4b.html b/mozilla/layout/reftests/bugs/413286-4b.html
new file mode 100644
index 00000000000..1c2b43efe40
--- /dev/null
+++ b/mozilla/layout/reftests/bugs/413286-4b.html
@@ -0,0 +1,70 @@
+
+
+
+ First two columns have no width
+
+
+
+ No third column
+
+
+ Third column with low percent width
+
+
+ Third column with medium percent width
+
+
+ Third column with preferred width
+
+
+
diff --git a/mozilla/layout/reftests/bugs/413286-5-ref.html b/mozilla/layout/reftests/bugs/413286-5-ref.html
new file mode 100644
index 00000000000..70b3029542f
--- /dev/null
+++ b/mozilla/layout/reftests/bugs/413286-5-ref.html
@@ -0,0 +1,68 @@
+
+
+
+
+Other column fixed-width
+
+
+
+Other column percent-width
+
+
+
+Other column fixed-width; zero column spanned by colspan (crossing other column)
+
+
+
+Other column percent-width; zero column spanned by colspan (crossing other column)
+
+
+
+Other column fixed-width; two zero columns with colspan
+
+
+
+Other column percent-width; two zero columns with colspan
+
+
+
+
+
diff --git a/mozilla/layout/reftests/bugs/413286-5.html b/mozilla/layout/reftests/bugs/413286-5.html
new file mode 100644
index 00000000000..df72e6ede07
--- /dev/null
+++ b/mozilla/layout/reftests/bugs/413286-5.html
@@ -0,0 +1,68 @@
+
+
+
+
+Other column fixed-width
+
+
+
+Other column percent-width
+
+
+
+Other column fixed-width; zero column spanned by colspan (crossing other column)
+
+
+
+Other column percent-width; zero column spanned by colspan (crossing other column)
+
+
+
+Other column fixed-width; two zero columns with colspan
+
+
+
+Other column percent-width; two zero columns with colspan
+
+
+
+
+
diff --git a/mozilla/layout/reftests/bugs/413286-6-ref.html b/mozilla/layout/reftests/bugs/413286-6-ref.html
new file mode 100644
index 00000000000..65e3ae50fa8
--- /dev/null
+++ b/mozilla/layout/reftests/bugs/413286-6-ref.html
@@ -0,0 +1,48 @@
+
+
+
+
+Other column fixed-width; two zero columns with colspan; explicit 0 width on span
+
+
+
+Other column percent-width; two zero columns with colspan; explicit 0 width on span
+
+
+
+Other column fixed-width; zero-column explicitly zero-width; zero column spanned by colspan (crossing other column)
+
+
+
+Other column percent-width; zero-column explicitly zero-width; zero column spanned by colspan (crossing other column)
+
+
+
+
+
diff --git a/mozilla/layout/reftests/bugs/413286-6.html b/mozilla/layout/reftests/bugs/413286-6.html
new file mode 100644
index 00000000000..2b71da8ac23
--- /dev/null
+++ b/mozilla/layout/reftests/bugs/413286-6.html
@@ -0,0 +1,51 @@
+
+
+
+
+Other column fixed-width; two zero columns with colspan; explicit 0 width on span
+
+
+
+Other column percent-width; two zero columns with colspan; explicit 0 width on span
+
+
+
+Other column fixed-width; zero-column explicitly zero-width; zero column spanned by colspan (crossing other column)
+
+
+
+Other column percent-width; zero-column explicitly zero-width; zero column spanned by colspan (crossing other column)
+
+
+
+
+
diff --git a/mozilla/layout/reftests/bugs/reftest.list b/mozilla/layout/reftests/bugs/reftest.list
index b725ebda96c..2447225cba9 100644
--- a/mozilla/layout/reftests/bugs/reftest.list
+++ b/mozilla/layout/reftests/bugs/reftest.list
@@ -708,6 +708,17 @@ random == 403134-1.html 403134-1-ref.html # bug 405377
== 412607-1b.html 412607-1-ref.html
== 412679-1.html 412679-1-ref.html
== 412679-2.html 412679-2-ref.html
+== 413286-1a.html 413286-1-ref.html
+== 413286-1b.html 413286-1-ref.html
+== 413286-1c.html 413286-1-ref.html
+== 413286-2a.html 413286-2-ref.html
+== 413286-2b.html 413286-2-ref.html
+== 413286-2c.html 413286-2-ref.html
+== 413286-3.html 413286-3-ref.html
+== 413286-4a.html 413286-4-ref.html
+== 413286-4b.html 413286-4-ref.html
+== 413286-5.html 413286-5-ref.html
+== 413286-6.html 413286-6-ref.html
== 413292-1.html 413292-1-ref.html
== 413361-1.html 413361-1-ref.html
== 413840-background-unchanged.html 413840-background-unchanged-ref.html
diff --git a/mozilla/layout/reftests/table-width/balancing-2-ref.html b/mozilla/layout/reftests/table-width/balancing-2-ref.html
index 3b5c98b44f5..813710759b6 100644
--- a/mozilla/layout/reftests/table-width/balancing-2-ref.html
+++ b/mozilla/layout/reftests/table-width/balancing-2-ref.html
@@ -51,6 +51,20 @@ td { background: black; background: currentColor; }
|
+
+
+
+
| |
|
diff --git a/mozilla/layout/reftests/table-width/balancing-2.html b/mozilla/layout/reftests/table-width/balancing-2.html
index bb9d991248b..c43f4147674 100644
--- a/mozilla/layout/reftests/table-width/balancing-2.html
+++ b/mozilla/layout/reftests/table-width/balancing-2.html
@@ -57,10 +57,11 @@ span {
|
+
@@ -68,11 +69,25 @@ span {
+
+
+
+
|
|
diff --git a/mozilla/layout/tables/BasicTableLayoutStrategy.cpp b/mozilla/layout/tables/BasicTableLayoutStrategy.cpp
index 6e0a265c785..2740583c681 100644
--- a/mozilla/layout/tables/BasicTableLayoutStrategy.cpp
+++ b/mozilla/layout/tables/BasicTableLayoutStrategy.cpp
@@ -672,13 +672,17 @@ BasicTableLayoutStrategy::DistributeWidthToColumns(nscoord aWidth,
* percent width have nonzero pref width, in proportion to pref
* width [total_flex_pref]
*
- * b. otherwise, if any columns without percent width have nonzero
+ * b. (NOTE: this case is for BTLS_FINAL_WIDTH only) otherwise, if any
+ * columns without a specified coordinate width or percent width have
+ * zero pref width, equally between these [numNonSpecZeroWidthCols]
+ *
+ * c. otherwise, if any columns without percent width have nonzero
* pref width, in proportion to pref width [total_fixed_pref]
*
- * c. otherwise, if any columns have nonzero percentage widths, in
+ * d. otherwise, if any columns have nonzero percentage widths, in
* proportion to the percentage widths [total_pct]
*
- * d. otherwise, equally.
+ * e. otherwise, equally.
*/
// Loop #1 over the columns, to figure out the four values above so
@@ -692,6 +696,7 @@ BasicTableLayoutStrategy::DistributeWidthToColumns(nscoord aWidth,
total_fixed_pref = 0;
float total_pct = 0.0f; // 0.0f to 1.0f
PRInt32 numInfiniteWidthCols = 0;
+ PRInt32 numNonSpecZeroWidthCols = 0;
PRInt32 col;
for (col = aFirstCol; col < aFirstCol + aColCount; ++col) {
@@ -713,7 +718,7 @@ BasicTableLayoutStrategy::DistributeWidthToColumns(nscoord aWidth,
} else {
nscoord pref_width = colFrame->GetPrefCoord();
if (pref_width == nscoord_MAX) {
- numInfiniteWidthCols++;
+ ++numInfiniteWidthCols;
}
guess_pref = NSCoordSaturatingAdd(guess_pref, pref_width);
guess_min_pct += min_width;
@@ -725,6 +730,10 @@ BasicTableLayoutStrategy::DistributeWidthToColumns(nscoord aWidth,
guess_min_spec = NSCoordSaturatingAdd(guess_min_spec, delta);
total_fixed_pref = NSCoordSaturatingAdd(total_fixed_pref,
pref_width);
+ } else if (pref_width == 0) {
+ if (aWidthType == BTLS_FINAL_WIDTH) {
+ ++numNonSpecZeroWidthCols;
+ }
} else {
total_flex_pref = NSCoordSaturatingAdd(total_flex_pref,
pref_width);
@@ -739,9 +748,10 @@ BasicTableLayoutStrategy::DistributeWidthToColumns(nscoord aWidth,
FLEX_FIXED_SMALL, // between (2) and (3) above
FLEX_FLEX_SMALL, // between (3) and (4) above
FLEX_FLEX_LARGE, // greater than (4) above, case (a)
- FLEX_FIXED_LARGE, // greater than (4) above, case (b)
- FLEX_PCT_LARGE, // greater than (4) above, case (c)
- FLEX_ALL_LARGE // greater than (4) above, case (d)
+ FLEX_FLEX_LARGE_ZERO, // greater than (4) above, case (b)
+ FLEX_FIXED_LARGE, // greater than (4) above, case (c)
+ FLEX_PCT_LARGE, // greater than (4) above, case (d)
+ FLEX_ALL_LARGE // greater than (4) above, case (e)
};
Loop2Type l2t;
@@ -782,6 +792,12 @@ BasicTableLayoutStrategy::DistributeWidthToColumns(nscoord aWidth,
if (total_flex_pref > 0) {
l2t = FLEX_FLEX_LARGE;
basis.c = total_flex_pref;
+ } else if (numNonSpecZeroWidthCols > 0) {
+ NS_ASSERTION(aWidthType == BTLS_FINAL_WIDTH,
+ "numNonSpecZeroWidthCols should only "
+ "be set when we're setting final width.");
+ l2t = FLEX_FLEX_LARGE_ZERO;
+ basis.c = numNonSpecZeroWidthCols;
} else if (total_fixed_pref > 0) {
l2t = FLEX_FIXED_LARGE;
basis.c = total_fixed_pref;
@@ -878,7 +894,7 @@ BasicTableLayoutStrategy::DistributeWidthToColumns(nscoord aWidth,
if (numInfiniteWidthCols) {
if (colFrame->GetPrefCoord() == nscoord_MAX) {
c = c / float(numInfiniteWidthCols);
- numInfiniteWidthCols--;
+ --numInfiniteWidthCols;
} else {
c = 0.0f;
}
@@ -908,6 +924,23 @@ BasicTableLayoutStrategy::DistributeWidthToColumns(nscoord aWidth,
}
}
break;
+ case FLEX_FLEX_LARGE_ZERO:
+ NS_ASSERTION(aWidthType == BTLS_FINAL_WIDTH,
+ "FLEX_FLEX_LARGE_ZERO only should be hit "
+ "when we're setting final width.");
+ if (pct == 0.0f &&
+ !colFrame->GetHasSpecifiedCoord()) {
+
+ NS_ASSERTION(col_width == 0 &&
+ colFrame->GetPrefCoord() == 0,
+ "Since we're in FLEX_FLEX_LARGE_ZERO case, "
+ "all auto-width cols should have zero pref "
+ "width.");
+ float c = float(space) / float(basis.c);
+ col_width += NSToCoordRound(c);
+ --basis.c;
+ }
+ break;
case FLEX_FIXED_LARGE:
if (pct == 0.0f) {
NS_ASSERTION(col_width == colFrame->GetPrefCoord(),