Commit 6ec8a181 authored by David Grogan's avatar David Grogan Committed by Commit Bot

[css-tables] Ignore abspos tables when checking cell descendants

If a table is added dynamically as a child of a table cell, the cell
might call innerTable->HasSections() before the inner table has
calculated its sections. The cell was checking HasSections() because
cells change sizing behavior when they have a table with sections as an
immediate descendant.

This only happened in a very narrow scenario -- when an abspos table
with a %height that does not resolve as auto is dynamically added.

Bug: 977507
Change-Id: I7856291dc6508624a81e9b65af909fa8a0d8e749
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1696003Reviewed-by: default avatarChristian Biesinger <cbiesinger@chromium.org>
Commit-Queue: David Grogan <dgrogan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#676116}
parent 5cf4c049
...@@ -1920,7 +1920,8 @@ void LayoutTableSection::RelayoutCellIfFlexed(LayoutTableCell& cell, ...@@ -1920,7 +1920,8 @@ void LayoutTableSection::RelayoutCellIfFlexed(LayoutTableCell& cell,
if (!child->IsText() && if (!child->IsText() &&
child->StyleRef().LogicalHeight().IsPercentOrCalc() && child->StyleRef().LogicalHeight().IsPercentOrCalc() &&
(flex_all_children || ShouldFlexCellChild(cell, child)) && (flex_all_children || ShouldFlexCellChild(cell, child)) &&
(!child->IsTable() || ToLayoutTable(child)->HasSections())) { (!child->IsTable() || (!child->IsOutOfFlowPositioned() &&
ToLayoutTable(child)->HasSections()))) {
cell_children_flex = true; cell_children_flex = true;
break; break;
} }
......
<!doctype html>
<link rel="author" title="David Grogan" href="mailto:dgrogan@chromium.org">
<link rel="help" href="https://www.w3.org/TR/css-position-3/#def-cb">
<link rel="match" href="../reference/ref-filled-green-100px-square-only.html">
<link rel="bookmark" href="https://crbug.com/977507" />
<meta name="flags" content="" />
<meta name="assert" content="Abspos table works when it is dynamically added" />
<style>
table {
border-spacing: 0px;
}
td {
padding: 0px;
}
.outerTable {
height: 100px;
width: 100px;
position: relative;
}
.innerTable {
position: absolute;
top: 0px;
width: 100px;
height: 100%;
color: green;
background: green;
}
</style>
<p>Test passes if there is a filled green square.</p>
<table class=outerTable>
<td id=outerCell></td>
</table>
<script>
outerCell.innerHTML = "<table class=innerTable><td>some text</td></table>";
</script>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment