Commit d22a0616 authored by Robert Hogan's avatar Robert Hogan Committed by Commit Bot

Distribute all extra height to rows

Bug: 690087
Change-Id: I9628c03accaf66fffae40d96bb1de2174e5fd3e2
Reviewed-on: https://chromium-review.googlesource.com/732110
Commit-Queue: Robert Hogan <robhogan@gmail.com>
Reviewed-by: default avatarEmil A Eklund <eae@chromium.org>
Cr-Commit-Position: refs/heads/master@{#513102}
parent ee720928
...@@ -28,10 +28,8 @@ ...@@ -28,10 +28,8 @@
</div> </div>
</div> </div>
<!-- crbug.com/690087: We use 99px instead of 100px because we end up discarding 1px when trying <div class="table container" style="display: block; float: left; height: 100px;">
to allocate the spare pixels to the table. --> <div class="td" style="height: 92px;" style="display: block;">
<div class="table container" style="display: block; float: left; height: 99px;">
<div class="td" style="height: 91px;" style="display: block;">
<div class="item"></div> <div class="item"></div>
</div> </div>
</div> </div>
...@@ -6,41 +6,18 @@ ...@@ -6,41 +6,18 @@
"contentsOpaque": true, "contentsOpaque": true,
"backgroundColor": "#FFFFFF", "backgroundColor": "#FFFFFF",
"paintInvalidations": [ "paintInvalidations": [
{
"object": "LayoutTable TABLE",
"rect": [8, 106, 106, 1],
"reason": "incremental"
},
{
"object": "LayoutTableCell TD",
"rect": [10, 104, 102, 1],
"reason": "incremental"
},
{
"object": "LayoutBlockFlow DIV id='target'",
"rect": [11, 45, 100, 25],
"reason": "geometry"
},
{ {
"object": "LayoutBlockFlow DIV id='target'", "object": "LayoutBlockFlow DIV id='target'",
"rect": [11, 44, 50, 25], "rect": [61, 45, 50, 25],
"reason": "geometry" "reason": "incremental"
} }
] ]
} }
], ],
"objectPaintInvalidations": [ "objectPaintInvalidations": [
{
"object": "LayoutTable TABLE",
"reason": "incremental"
},
{
"object": "LayoutTableCell TD",
"reason": "incremental"
},
{ {
"object": "LayoutBlockFlow DIV id='target'", "object": "LayoutBlockFlow DIV id='target'",
"reason": "geometry" "reason": "incremental"
} }
] ]
} }
......
...@@ -536,11 +536,7 @@ void LayoutTable::DistributeExtraLogicalHeight(int extra_logical_height) { ...@@ -536,11 +536,7 @@ void LayoutTable::DistributeExtraLogicalHeight(int extra_logical_height) {
extra_logical_height -= extra_logical_height -=
section->DistributeExtraLogicalHeightToRows(extra_logical_height); section->DistributeExtraLogicalHeightToRows(extra_logical_height);
// crbug.com/690087: We really would like to enable this ASSERT to ensure that DCHECK(!FirstBody() || !extra_logical_height);
// all the extra space has been distributed.
// However our current distribution algorithm does not round properly and thus
// we can have some remaining height.
// DCHECK(!topSection() || !extraLogicalHeight);
} }
void LayoutTable::SimplifiedNormalFlowLayout() { void LayoutTable::SimplifiedNormalFlowLayout() {
......
...@@ -1092,15 +1092,17 @@ void LayoutTableSection::DistributeRemainingExtraLogicalHeight( ...@@ -1092,15 +1092,17 @@ void LayoutTableSection::DistributeRemainingExtraLogicalHeight(
if (extra_logical_height <= 0 || !row_pos_[total_rows]) if (extra_logical_height <= 0 || !row_pos_[total_rows])
return; return;
// FIXME: row_pos_[total_rows] - row_pos_[0] is the total rows' size.
int total_row_size = row_pos_[total_rows];
int total_logical_height_added = 0; int total_logical_height_added = 0;
int previous_row_position = row_pos_[0]; int previous_row_position = row_pos_[0];
float total_row_size = row_pos_[total_rows] - previous_row_position;
for (unsigned r = 0; r < total_rows; r++) { for (unsigned r = 0; r < total_rows; r++) {
// weight with the original height // weight with the original height
total_logical_height_added += extra_logical_height * float height_to_add = extra_logical_height *
(row_pos_[r + 1] - previous_row_position) / (row_pos_[r + 1] - previous_row_position) /
total_row_size; total_row_size;
total_logical_height_added =
std::min<int>(total_logical_height_added + std::ceil(height_to_add),
extra_logical_height);
previous_row_position = row_pos_[r + 1]; previous_row_position = row_pos_[r + 1];
row_pos_[r + 1] += total_logical_height_added; row_pos_[r + 1] += total_logical_height_added;
} }
......
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