Commit 0c934f62 authored by Ian Kilpatrick's avatar Ian Kilpatrick Committed by Commit Bot

[tables] Tables should respect the min content-size.

Previously when we had a specified main-size, and we were a table, we
considered this to be the min-size instead.

This was incorrect. Instead we should have been applying the min
content-size as the floor for tables, and leaving the main size alone.

Bug: 1128941
Change-Id: I7310b5d31990ff77a028837f742b3a0eba697318
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2438775
Commit-Queue: Ian Kilpatrick <ikilpatrick@chromium.org>
Reviewed-by: default avatarAleks Totic <atotic@chromium.org>
Cr-Commit-Position: refs/heads/master@{#812447}
parent a11c45f1
...@@ -458,18 +458,16 @@ void ComputeOutOfFlowInlineDimensions( ...@@ -458,18 +458,16 @@ void ComputeOutOfFlowInlineDimensions(
max_inline_size = std::min(sizes.max_size, max_inline_size); max_inline_size = std::min(sizes.max_size, max_inline_size);
} }
bool is_table = style.IsDisplayTableBox(); // Tables are never allowed to go below their min-content size.
const bool is_table = style.IsDisplayTableBox();
if (is_table)
min_inline_size = std::max(min_inline_size, minmax_content_sizes->min_size);
base::Optional<LayoutUnit> inline_size; base::Optional<LayoutUnit> inline_size;
if (!style.LogicalWidth().IsAuto()) { if (!style.LogicalWidth().IsAuto()) {
LayoutUnit resolved_inline_size = inline_size =
ResolveMainInlineLength(space, style, border_padding, ResolveMainInlineLength(space, style, border_padding,
minmax_content_sizes, style.LogicalWidth()); minmax_content_sizes, style.LogicalWidth());
// Tables use the inline-size as a minimum.
if (is_table)
min_inline_size = std::max(min_inline_size, resolved_inline_size);
else
inline_size = resolved_inline_size;
} else if (replaced_size.has_value()) { } else if (replaced_size.has_value()) {
inline_size = replaced_size->inline_size; inline_size = replaced_size->inline_size;
} else if (IsInlineSizeComputableFromBlockSize(style)) { } else if (IsInlineSizeComputableFromBlockSize(style)) {
...@@ -529,18 +527,16 @@ void ComputeOutOfFlowBlockDimensions( ...@@ -529,18 +527,16 @@ void ComputeOutOfFlowBlockDimensions(
space, style, border_padding, style.LogicalMaxHeight(), space, style, border_padding, style.LogicalMaxHeight(),
LengthResolvePhase::kLayout); LengthResolvePhase::kLayout);
bool is_table = style.IsDisplayTableBox(); // Tables are never allowed to go below their "auto" block-size.
const bool is_table = style.IsDisplayTableBox();
if (is_table)
min_block_size = std::max(min_block_size, min_max_sizes->min_size);
base::Optional<LayoutUnit> block_size; base::Optional<LayoutUnit> block_size;
if (!style.LogicalHeight().IsAuto()) { if (!style.LogicalHeight().IsAuto()) {
LayoutUnit resolved_block_size = ResolveMainBlockLength( block_size = ResolveMainBlockLength(
space, style, border_padding, style.LogicalHeight(), space, style, border_padding, style.LogicalHeight(),
child_block_size_or_indefinite, LengthResolvePhase::kLayout); child_block_size_or_indefinite, LengthResolvePhase::kLayout);
// Tables use the block-size as a minimum.
if (is_table)
min_block_size = std::max(min_block_size, resolved_block_size);
else
block_size = resolved_block_size;
} else if (replaced_size.has_value()) { } else if (replaced_size.has_value()) {
block_size = replaced_size->block_size; block_size = replaced_size->block_size;
} }
......
...@@ -423,6 +423,7 @@ virtual/web-components-v0-disabled/* [ Skip ] ...@@ -423,6 +423,7 @@ virtual/web-components-v0-disabled/* [ Skip ]
crbug.com/591099 external/wpt/css/css-tables/absolute-tables-002.html [ Failure ] crbug.com/591099 external/wpt/css/css-tables/absolute-tables-002.html [ Failure ]
crbug.com/591099 external/wpt/css/css-tables/absolute-tables-007.html [ Failure ] crbug.com/591099 external/wpt/css/css-tables/absolute-tables-007.html [ Failure ]
crbug.com/591099 external/wpt/css/css-tables/absolute-tables-011.tentative.html [ Failure ] crbug.com/591099 external/wpt/css/css-tables/absolute-tables-011.tentative.html [ Failure ]
crbug.com/591099 external/wpt/css/css-tables/absolute-tables-015.html [ Failure ]
crbug.com/591099 virtual/scalefactor200/external/wpt/element-timing/observe-text.html [ Failure ] crbug.com/591099 virtual/scalefactor200/external/wpt/element-timing/observe-text.html [ Failure ]
crbug.com/591099 virtual/scalefactor200withoutzoom/external/wpt/element-timing/css-generated-text.html [ Failure ] crbug.com/591099 virtual/scalefactor200withoutzoom/external/wpt/element-timing/css-generated-text.html [ Failure ]
......
<!DOCTYPE html>
<link rel="help" href="https://crbug.com/1128941">
<link rel="match" href="../reference/ref-filled-green-100px-square.xht">
<meta name="assert" content="A positioned absolute table should respect its main-size, and never go below its min-content size.">
<style>
table {
position: absolute;
width: 50%;
border-spacing: 0;
}
td {
width: 100%;
line-height: 0;
padding: 0;
background: red;
}
span {
display: inline-block;
width: 100px;
height: 50px;
background: green;
}
</style>
<p>Test passes if there is a filled green square and <strong>no red</strong>.</p>
<div style="width: 200px; height: 200px; position: relative;">
<table>
<td>
<span></span>
<span></span>
</td>
</table>
</div>
<!DOCTYPE html>
<link rel="help" href="https://crbug.com/1128941">
<link rel="match" href="../reference/ref-filled-green-100px-square.xht">
<meta name="assert" content="A positioned absolute table should respect its main-size, and never go below its min-content size.">
<style>
table {
position: absolute;
width: 10%;
border-spacing: 0;
}
td {
width: 100%;
line-height: 0;
padding: 0;
background: red;
}
span {
display: inline-block;
width: 100px;
height: 50px;
background: green;
}
</style>
<p>Test passes if there is a filled green square and <strong>no red</strong>.</p>
<div style="width: 200px; height: 200px; position: relative;">
<table>
<td>
<span></span>
<span></span>
</td>
</table>
</div>
<!DOCTYPE html>
<link rel="help" href="https://crbug.com/1128941">
<link rel="match" href="../reference/ref-filled-green-100px-square.xht">
<meta name="assert" content="A positioned absolute table should respect its main-size, and never go below its min-content size.">
<style>
table {
position: absolute;
width: 0px;
border-spacing: 0;
}
td {
width: 100%;
line-height: 0;
padding: 0;
background: red;
}
span {
display: inline-block;
width: 100px;
height: 50px;
background: green;
}
</style>
<p>Test passes if there is a filled green square and <strong>no red</strong>.</p>
<div style="width: 200px; height: 200px; position: relative;">
<table>
<td>
<span></span>
<span></span>
</td>
</table>
</div>
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