Distribute the width of column-spanning cells to columns with nothing in them, like we do for final table widths. (Bug 734569) r=dholbert

This commit is contained in:
L. David Baron 2012-09-07 15:57:06 -07:00
parent c68c3ea901
commit ac347fa732
5 changed files with 45 additions and 12 deletions

View File

@ -0,0 +1,14 @@
<!DOCTYPE HTML>
<title>Distributing widths from spanning cells to empty columns</title>
<table cellpadding="0" cellspacing="0" width="75">
<tr>
<td width="25" bgcolor="yellow" >&nbsp;</td>
<td width="25" bgcolor="aqua" >&nbsp;</td>
<td width="25" bgcolor="aqua" >&nbsp;</td>
</tr>
<tr>
<td width="25" bgcolor="fuchsia">&nbsp;</td>
<td width="25" bgcolor="fuchsia">&nbsp;</td>
<td width="25" bgcolor="yellow" >&nbsp;</td>
</tr>
</table>

View File

@ -0,0 +1,12 @@
<!DOCTYPE HTML>
<title>Distributing widths from spanning cells to empty columns</title>
<table cellpadding="0" cellspacing="0">
<tr>
<td width="25" bgcolor="yellow" >&nbsp;</td>
<td width="50" colspan="2" bgcolor="aqua" >&nbsp;</td>
</tr>
<tr>
<td width="50" colspan="2" bgcolor="fuchsia">&nbsp;</td>
<td width="25" bgcolor="yellow" >&nbsp;</td>
</tr>
</table>

View File

@ -0,0 +1,12 @@
<!DOCTYPE HTML>
<title>Distributing widths from spanning cells to empty columns</title>
<table cellpadding="0" cellspacing="0" width="75">
<tr>
<td width="25" bgcolor="yellow" >&nbsp;</td>
<td width="50" colspan="2" bgcolor="aqua" >&nbsp;</td>
</tr>
<tr>
<td width="50" colspan="2" bgcolor="fuchsia">&nbsp;</td>
<td width="25" bgcolor="yellow" >&nbsp;</td>
</tr>
</table>

View File

@ -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

View File

@ -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) {