From ac347fa7328e6a749219bb090f473eaa707ad51b Mon Sep 17 00:00:00 2001 From: "L. David Baron" Date: Fri, 7 Sep 2012 15:57:06 -0700 Subject: [PATCH] Distribute the width of column-spanning cells to columns with nothing in them, like we do for final table widths. (Bug 734569) r=dholbert --- .../colspan-distribute-to-empty-1-ref.html | 14 ++++++++++++++ .../colspan-distribute-to-empty-1a.html | 12 ++++++++++++ .../colspan-distribute-to-empty-1b.html | 12 ++++++++++++ layout/reftests/table-width/reftest.list | 2 ++ layout/tables/BasicTableLayoutStrategy.cpp | 17 +++++------------ 5 files changed, 45 insertions(+), 12 deletions(-) create mode 100644 layout/reftests/table-width/colspan-distribute-to-empty-1-ref.html create mode 100644 layout/reftests/table-width/colspan-distribute-to-empty-1a.html create mode 100644 layout/reftests/table-width/colspan-distribute-to-empty-1b.html diff --git a/layout/reftests/table-width/colspan-distribute-to-empty-1-ref.html b/layout/reftests/table-width/colspan-distribute-to-empty-1-ref.html new file mode 100644 index 00000000000..f3989ac4517 --- /dev/null +++ b/layout/reftests/table-width/colspan-distribute-to-empty-1-ref.html @@ -0,0 +1,14 @@ + +Distributing widths from spanning cells to empty columns + + + + + + + + + + + +
   
   
diff --git a/layout/reftests/table-width/colspan-distribute-to-empty-1a.html b/layout/reftests/table-width/colspan-distribute-to-empty-1a.html new file mode 100644 index 00000000000..2a94c7dd897 --- /dev/null +++ b/layout/reftests/table-width/colspan-distribute-to-empty-1a.html @@ -0,0 +1,12 @@ + +Distributing widths from spanning cells to empty columns + + + + + + + + + +
  
  
diff --git a/layout/reftests/table-width/colspan-distribute-to-empty-1b.html b/layout/reftests/table-width/colspan-distribute-to-empty-1b.html new file mode 100644 index 00000000000..f43ebd89dc2 --- /dev/null +++ b/layout/reftests/table-width/colspan-distribute-to-empty-1b.html @@ -0,0 +1,12 @@ + +Distributing widths from spanning cells to empty columns + + + + + + + + + +
  
  
diff --git a/layout/reftests/table-width/reftest.list b/layout/reftests/table-width/reftest.list index 919bcb1a4e3..bea4123d70f 100644 --- a/layout/reftests/table-width/reftest.list +++ b/layout/reftests/table-width/reftest.list @@ -60,3 +60,5 @@ fails == default-box-sizing-collapse-quirks.html default-box-sizing-collapse-qui == colgroup-vs-column-4.html colgroup-vs-column-4-ref.html == dynamic-fixed-layout-1.html dynamic-fixed-layout-1-ref.html == cell-pref-width-border-box.html cell-pref-width-border-box-ref.html +== colspan-distribute-to-empty-1a.html colspan-distribute-to-empty-1-ref.html +== colspan-distribute-to-empty-1b.html colspan-distribute-to-empty-1-ref.html diff --git a/layout/tables/BasicTableLayoutStrategy.cpp b/layout/tables/BasicTableLayoutStrategy.cpp index 2970f361091..33ef076d38f 100644 --- a/layout/tables/BasicTableLayoutStrategy.cpp +++ b/layout/tables/BasicTableLayoutStrategy.cpp @@ -700,10 +700,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, but with cells originating in them have zero pref width, - * equally between these [numNonSpecZeroWidthCols] + * b. 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] @@ -761,8 +761,7 @@ BasicTableLayoutStrategy::DistributeWidthToColumns(nscoord aWidth, total_fixed_pref = NSCoordSaturatingAdd(total_fixed_pref, pref_width); } else if (pref_width == 0) { - if (aWidthType == BTLS_FINAL_WIDTH && - cellMap->GetNumCellsOriginatingInCol(col) > 0) { + if (cellMap->GetNumCellsOriginatingInCol(col) > 0) { ++numNonSpecZeroWidthCols; } } else { @@ -823,9 +822,6 @@ BasicTableLayoutStrategy::DistributeWidthToColumns(nscoord aWidth, 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) { @@ -955,9 +951,6 @@ 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() && cellMap->GetNumCellsOriginatingInCol(col) > 0) {