Commit bf802aa6 authored by Manuel Rego Casasnovas's avatar Manuel Rego Casasnovas Committed by Commit Bot

[css-tables] Scrollbar should be removed from OverrideLogicalHeight()

When computing the percentage height of table cell replaced children,
if the table cell has horizontal scrollbar we have to subtract
its height from the OverrideLogicalHeight().

The patch is just following a suggestion from a TODO in
LayoutBox::AvailableLogicalHeightUsing().

BUG=838144
TEST=external/wpt/css/css-tables/height-distribution/percentage-sizing-of-table-cell-replaced-children-001.html

Change-Id: I21f33b82978ffaeb7a6f04eb49ef2e1a52c1e8c0
Reviewed-on: https://chromium-review.googlesource.com/1035125Reviewed-by: default avatarMorten Stenshorne <mstensho@chromium.org>
Commit-Queue: Manuel Rego Casasnovas <rego@igalia.com>
Cr-Commit-Position: refs/heads/master@{#554853}
parent 7b2345f4
<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS Reftest Reference: Percentage sizing of table cell children with margin, border, padding and scrollbar</title>
<link rel="author" title="Manuel Rego Casasnovas" href="mailto:rego@igalia.com">
<style>
.table {
display: block;
border: solid 5px black;
width: 150px;
height: 100px;
}
.td {
background: cyan;
overflow: scroll;
padding: 5px 15px 10px 20px;
border: solid magenta;
border-width: 12px 9px 6px 3px;
height: 100px;
box-sizing: border-box;
}
img {
display: block;
background: yellow;
width: 100%;
height: 100%;
}
</style>
<p>The test passes if you see scrollbars but there's no overflow, so you cannot actually scroll.</p>
<div class="table">
<div class="td">
<img />
</div>
</div>
<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS Table Test: Percentage sizing of table cell replaced children with margin, border, padding and scrollbar</title>
<link rel="author" title="Manuel Rego Casasnovas" href="mailto:rego@igalia.com">
<link rel="help" href="https://drafts.csswg.org/css-tables-3/#content-measure">
<link rel="match" href="percentage-sizing-of-table-cell-replaced-children-001-ref.html">
<meta name="assert" content="Checks that table cell replaced children resolve properly their percentage sizes, even when the table cell has margin, border, padding and scrollbar.">
<style>
.table {
display: table;
border: solid 5px black;
width: 150px;
height: 100px;
}
.td {
display: table-cell;
background: cyan;
overflow: scroll;
margin: 1px 2px 3px 4px;
padding: 5px 15px 10px 20px;
border: solid magenta;
border-width: 12px 9px 6px 3px;
}
img {
display: block;
background: yellow;
width: 100%;
height: 100%;
}
</style>
<p>The test passes if you see scrollbars but there's no overflow, so you cannot actually scroll.</p>
<div class="table">
<div class="td">
<img />
</div>
</div>
...@@ -3732,9 +3732,9 @@ LayoutUnit LayoutBox::AvailableLogicalHeightUsing( ...@@ -3732,9 +3732,9 @@ LayoutUnit LayoutBox::AvailableLogicalHeightUsing(
// below. // below.
if (IsTableCell() && (h.IsAuto() || h.IsPercentOrCalc())) { if (IsTableCell() && (h.IsAuto() || h.IsPercentOrCalc())) {
if (HasOverrideLogicalHeight()) { if (HasOverrideLogicalHeight()) {
// TODO(rego): Shouldn't we subtract the scrollbar height too?
return OverrideLogicalHeight() - return OverrideLogicalHeight() -
CollapsedBorderAndCSSPaddingLogicalHeight(); CollapsedBorderAndCSSPaddingLogicalHeight() -
ScrollbarLogicalHeight();
} }
return LogicalHeight() - BorderAndPaddingLogicalHeight(); return LogicalHeight() - BorderAndPaddingLogicalHeight();
} }
......
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