LibWeb: Distribute colspan cell width equally when baseline is zero
This matches the behavior of other engines.
This commit is contained in:
parent
1e8ae879c5
commit
0b346d1952
6 changed files with 100 additions and 10 deletions
|
|
@ -407,6 +407,10 @@ void TableFormattingContext::compute_table_measures()
|
|||
if (baseline_max_content_size != 0) {
|
||||
cell_min_contribution += CSSPixels::nearest_value_for(rows_or_columns[rc_index].max_size / static_cast<double>(baseline_max_content_size))
|
||||
* max(CSSPixels(0), cell_min_size<RowOrColumn>(cell) - baseline_max_content_size - baseline_border_spacing);
|
||||
} else {
|
||||
// AD-HOC: The spec does not define behavior when baseline is zero. We distribute equally.
|
||||
// This matches how undefined ratios are handled elsewhere.
|
||||
cell_min_contribution += max(CSSPixels(0), cell_min_size<RowOrColumn>(cell) - baseline_border_spacing) / cell_span_value;
|
||||
}
|
||||
|
||||
// The contribution of the cell is the sum of:
|
||||
|
|
@ -418,6 +422,10 @@ void TableFormattingContext::compute_table_measures()
|
|||
if (baseline_max_content_size != 0) {
|
||||
cell_max_contribution += CSSPixels::nearest_value_for(rows_or_columns[rc_index].max_size / static_cast<double>(baseline_max_content_size))
|
||||
* max(CSSPixels(0), cell_max_size<RowOrColumn>(cell) - baseline_max_content_size - baseline_border_spacing);
|
||||
} else {
|
||||
// AD-HOC: The spec does not define behavior when baseline is zero. We distribute equally,
|
||||
// This matches how undefined ratios are handled elsewhere.
|
||||
cell_max_contribution += max(CSSPixels(0), cell_max_size<RowOrColumn>(cell) - baseline_border_spacing) / cell_span_value;
|
||||
}
|
||||
cell_min_contributions_by_rc_index[rc_index].append(cell_min_contribution);
|
||||
cell_max_contributions_by_rc_index[rc_index].append(cell_max_contribution);
|
||||
|
|
|
|||
|
|
@ -1,17 +1,17 @@
|
|||
Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children: not-inline
|
||||
BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 40 0+0+0] [BFC] children: not-inline
|
||||
BlockContainer <body> at [8,8] [8+0+0 784 0+0+8] [8+0+0 24 0+0+8] children: not-inline
|
||||
TableWrapper <(anonymous)> at [8,8] [0+0+0 6 0+0+778] [0+0+0 24 0+0+0] [BFC] children: not-inline
|
||||
Box <table> at [8,8] table-box [0+0+0 6 0+0+0] [0+0+0 24 0+0+0] [TFC] children: not-inline
|
||||
TableWrapper <(anonymous)> at [8,8] [0+0+0 20.25 0+0+763.75] [0+0+0 24 0+0+0] [BFC] children: not-inline
|
||||
Box <table> at [8,8] table-box [0+0+0 20.25 0+0+0] [0+0+0 24 0+0+0] [TFC] children: not-inline
|
||||
BlockContainer <(anonymous)> (not painted) children: inline
|
||||
TextNode <#text> (not painted)
|
||||
Box <tbody> at [10,10] table-row-group [0+0+0 2 0+0+0] [0+0+0 20 0+0+0] children: not-inline
|
||||
Box <tbody> at [10,10] table-row-group [0+0+0 16.25 0+0+0] [0+0+0 20 0+0+0] children: not-inline
|
||||
BlockContainer <(anonymous)> (not painted) children: inline
|
||||
TextNode <#text> (not painted)
|
||||
Box <tr> at [10,10] table-row [0+0+0 2 0+0+0] [0+0+0 20 0+0+0] children: not-inline
|
||||
Box <tr> at [10,10] table-row [0+0+0 16.25 0+0+0] [0+0+0 20 0+0+0] children: not-inline
|
||||
BlockContainer <(anonymous)> (not painted) children: inline
|
||||
TextNode <#text> (not painted)
|
||||
BlockContainer <td> at [11,11] table-cell [0+0+1 0 1+0+0] [0+0+1 18 1+0+0] [BFC] children: inline
|
||||
BlockContainer <td> at [11,11] table-cell [0+0+1 14.25 1+0+0] [0+0+1 18 1+0+0] [BFC] children: inline
|
||||
frag 0 from TextNode start: 0, length: 1, rect: [11,11 14.265625x18] baseline: 13.796875
|
||||
"A"
|
||||
TextNode <#text> (not painted)
|
||||
|
|
@ -25,11 +25,11 @@ Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children
|
|||
ViewportPaintable (Viewport<#document>) [0,0 800x600]
|
||||
PaintableWithLines (BlockContainer<HTML>) [0,0 800x40]
|
||||
PaintableWithLines (BlockContainer<BODY>) [8,8 784x24]
|
||||
PaintableWithLines (TableWrapper(anonymous)) [8,8 6x24]
|
||||
PaintableBox (Box<TABLE>) [8,8 6x24]
|
||||
PaintableBox (Box<TBODY>) [10,10 2x20]
|
||||
PaintableBox (Box<TR>) [10,10 2x20]
|
||||
PaintableWithLines (BlockContainer<TD>) [10,10 2x20]
|
||||
PaintableWithLines (TableWrapper(anonymous)) [8,8 20.25x24]
|
||||
PaintableBox (Box<TABLE>) [8,8 20.25x24]
|
||||
PaintableBox (Box<TBODY>) [10,10 16.25x20]
|
||||
PaintableBox (Box<TR>) [10,10 16.25x20]
|
||||
PaintableWithLines (BlockContainer<TD>) [10,10 16.25x20]
|
||||
TextPaintable (TextNode<#text>)
|
||||
|
||||
SC for Viewport<#document> [0,0 800x600] [children: 1] (z-index: auto)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,10 @@
|
|||
Harness status: OK
|
||||
|
||||
Found 5 tests
|
||||
|
||||
5 Pass
|
||||
Pass td 1
|
||||
Pass td 2
|
||||
Pass td 3
|
||||
Pass td 4
|
||||
Pass td 5
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
Harness status: OK
|
||||
|
||||
Found 5 tests
|
||||
|
||||
5 Pass
|
||||
Pass td 1
|
||||
Pass td 2
|
||||
Pass td 3
|
||||
Pass td 4
|
||||
Pass td 5
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
<!DOCTYPE html>
|
||||
<link rel="author" title="Morten Stenshorne" href="mailto:mstensho@chromium.org">
|
||||
<link rel="help" href="https://bugs.chromium.org/p/chromium/issues/detail?id=1430449">
|
||||
<p>There should be five squares.</p>
|
||||
<table cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td colspan="2" style="background:blue;" data-expected-width="75" data-expected-height="75">
|
||||
<div style="width:50px; height:75px;"></div>
|
||||
</td>
|
||||
<td colspan="2" style="background:green;" data-expected-width="75" data-expected-height="75">
|
||||
<div style="width:50px; height:75px;"></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="background:black;" data-expected-width="50" data-expected-height="50">
|
||||
<div style="width:50px; height:50px;"></div>
|
||||
</td>
|
||||
<td colspan="2" style="background:lime;" data-expected-width="50" data-expected-height="50">
|
||||
<div style="width:50px; height:50px;"></div>
|
||||
</td>
|
||||
<td style="background:hotpink;" data-expected-width="50" data-expected-height="50">
|
||||
<div style="width:50px; height:50px;"></div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<script src="../../resources/testharness.js"></script>
|
||||
<script src="../../resources/testharnessreport.js"></script>
|
||||
<script src="../../resources/check-layout-th.js"></script>
|
||||
<script>
|
||||
checkLayout('td')
|
||||
</script>
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
<!DOCTYPE html>
|
||||
<link rel="author" title="Morten Stenshorne" href="mailto:mstensho@chromium.org">
|
||||
<link rel="help" href="https://bugs.chromium.org/p/chromium/issues/detail?id=1430449">
|
||||
<p>There should be five squares.</p>
|
||||
<table cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td colspan="3" style="background:blue;" data-expected-width="75" data-expected-height="75">
|
||||
<div style="width:50px; height:75px;"></div>
|
||||
</td>
|
||||
<td colspan="3" style="background:green;" data-expected-width="75" data-expected-height="75">
|
||||
<div style="width:50px; height:75px;"></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="background:black;" data-expected-width="50" data-expected-height="50">
|
||||
<div style="width:50px; height:50px;"></div>
|
||||
</td>
|
||||
<td colspan="4" style="background:lime;" data-expected-width="50" data-expected-height="50">
|
||||
<div style="width:50px; height:50px;"></div>
|
||||
</td>
|
||||
<td style="background:hotpink;" data-expected-width="50" data-expected-height="50">
|
||||
<div style="width:50px; height:50px;"></div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<script src="../../resources/testharness.js"></script>
|
||||
<script src="../../resources/testharnessreport.js"></script>
|
||||
<script src="../../resources/check-layout-th.js"></script>
|
||||
<script>
|
||||
checkLayout('td')
|
||||
</script>
|
||||
Loading…
Reference in a new issue