diff --git a/mozilla/layout/reftests/bugs/425972-1-ref.html b/mozilla/layout/reftests/bugs/425972-1-ref.html
new file mode 100644
index 00000000000..279cadbb3f5
--- /dev/null
+++ b/mozilla/layout/reftests/bugs/425972-1-ref.html
@@ -0,0 +1,14 @@
+
+
+
+ there should not be a red bar over the whole page
+
+
+
+
+
diff --git a/mozilla/layout/reftests/bugs/425972-1.html b/mozilla/layout/reftests/bugs/425972-1.html
new file mode 100644
index 00000000000..a0851b1608e
--- /dev/null
+++ b/mozilla/layout/reftests/bugs/425972-1.html
@@ -0,0 +1,15 @@
+
+
+
+ there should be a red bar over the whole page
+
+
+
+
+
diff --git a/mozilla/layout/reftests/bugs/425972-2-ref.html b/mozilla/layout/reftests/bugs/425972-2-ref.html
new file mode 100644
index 00000000000..5ffc0f2921a
--- /dev/null
+++ b/mozilla/layout/reftests/bugs/425972-2-ref.html
@@ -0,0 +1,14 @@
+
+
+
+ there should not be a red bar over the whole page
+
+
+
+
+
diff --git a/mozilla/layout/reftests/bugs/425972-2.html b/mozilla/layout/reftests/bugs/425972-2.html
new file mode 100644
index 00000000000..1cf28b26fd5
--- /dev/null
+++ b/mozilla/layout/reftests/bugs/425972-2.html
@@ -0,0 +1,15 @@
+
+
+
+ there should not be a red bar over the whole page
+
+
+
+
+
diff --git a/mozilla/layout/reftests/bugs/reftest.list b/mozilla/layout/reftests/bugs/reftest.list
index 6fb46d2242b..5b70d119a7d 100644
--- a/mozilla/layout/reftests/bugs/reftest.list
+++ b/mozilla/layout/reftests/bugs/reftest.list
@@ -792,4 +792,6 @@ fails-if(MOZ_WIDGET_TOOLKIT=="gtk2") == 424074-1-ref2.xul 424074-1-ref3.xul
== 424434-1.html 424434-1-ref.html
== 424631-1.html 424631-1-ref.html
== 424710-1.html 424710-1-ref.html
-
+== 425972-1.html 425972-1-ref.html
+== 425972-2.html 425972-2-ref.html
+!= 425972-1.html 425972-2.html
diff --git a/mozilla/layout/tables/BasicTableLayoutStrategy.cpp b/mozilla/layout/tables/BasicTableLayoutStrategy.cpp
index 97e49d453b6..cfd0e78e930 100644
--- a/mozilla/layout/tables/BasicTableLayoutStrategy.cpp
+++ b/mozilla/layout/tables/BasicTableLayoutStrategy.cpp
@@ -680,9 +680,10 @@ BasicTableLayoutStrategy::DistributeWidthToColumns(nscoord aWidth,
* percent width have nonzero pref width, in proportion to pref
* width [total_flex_pref]
*
- * 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]
+ * b. (NOTE: this case is for BTLS_FINAL_WIDTH only) otherwise, if
+ * any columns without a specified coordinate width or percent
+ * width, but with cells originating in them 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]
@@ -739,7 +740,8 @@ BasicTableLayoutStrategy::DistributeWidthToColumns(nscoord aWidth,
total_fixed_pref = NSCoordSaturatingAdd(total_fixed_pref,
pref_width);
} else if (pref_width == 0) {
- if (aWidthType == BTLS_FINAL_WIDTH) {
+ if (aWidthType == BTLS_FINAL_WIDTH &&
+ mTableFrame->GetNumCellsOriginatingInCol(col)) {
++numNonSpecZeroWidthCols;
}
} else {
@@ -937,7 +939,8 @@ BasicTableLayoutStrategy::DistributeWidthToColumns(nscoord aWidth,
"FLEX_FLEX_LARGE_ZERO only should be hit "
"when we're setting final width.");
if (pct == 0.0f &&
- !colFrame->GetHasSpecifiedCoord()) {
+ !colFrame->GetHasSpecifiedCoord() &&
+ mTableFrame->GetNumCellsOriginatingInCol(col)) {
NS_ASSERTION(col_width == 0 &&
colFrame->GetPrefCoord() == 0,