Commit 76f7b76a authored by Aleks Totic's avatar Aleks Totic Committed by Chromium LUCI CQ

[TablesNG] Autosizing bug fix

Autosizer was being called twice, which made some tests fail.
1st call was inside ComputeTableInlineSize,
2nd call was in Layout.

Removed call in Layout, and now all autosizing tests look good.

I do not understand autosizing code very well.
My guess is that running autosizer twice in the same layout
leads to bad things, because it tries to size already sized
layout object, and ends up with a wrong multiplier.

Without this, fast/text-autosizing/tables/table-cell-inflation.html
fails.

Change-Id: I5deba326d6f3b1b178f994a7bb03bef67ccc2cd6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2616750Reviewed-by: default avatarIan Kilpatrick <ikilpatrick@chromium.org>
Commit-Queue: Aleks Totic <atotic@chromium.org>
Cr-Commit-Position: refs/heads/master@{#841392}
parent dbc4f65f
......@@ -117,6 +117,7 @@ LayoutUnit ComputeAssignableTableInlineSize(
/* containing_block_expects_minmax_without_percentages */ false,
/* skip_collapsed_columns */ false);
// Standard: "used width of the table".
LayoutUnit used_table_inline_size = ComputeUsedInlineSizeForTableFragment(
space, table, table_border_padding, grid_min_max);
......@@ -397,18 +398,8 @@ LayoutUnit NGTableLayoutAlgorithm::ComputeTableInlineSize(
scoped_refptr<const NGLayoutResult> NGTableLayoutAlgorithm::Layout() {
DCHECK(!BreakToken());
const bool is_fixed_layout = Style().IsFixedTableLayout();
// TODO(atotic) review autosizer usage in TablesNG.
// Legacy has:
// LayoutTable::UpdateLayout
// TextAutosizer::LayoutScope
// TableLayoutAlgorithmAuto::ComputeIntrinsicLogicalWidths
// TextAutosizer::TableLayoutScope
base::Optional<TextAutosizer::TableLayoutScope> text_autosizer;
if (!is_fixed_layout)
text_autosizer.emplace(To<LayoutNGTable>(Node().GetLayoutBox()));
const bool is_fixed_layout = Style().IsFixedTableLayout();
const LogicalSize border_spacing = Style().TableBorderSpacing();
NGTableGroupedChildren grouped_children(Node());
const scoped_refptr<const NGTableBorders> table_borders =
......@@ -628,8 +619,6 @@ void NGTableLayoutAlgorithm::ComputeTableSpecificFragmentData(
const PhysicalRect& table_grid_rect,
const LogicalSize& border_spacing,
const LayoutUnit table_grid_block_size) {
// TODO(atotic) SetHasNonCollapsedBorderDecoration should be a fragment
// property, not a flag on LayoutObject.
container_builder_.SetTableGridRect(table_grid_rect);
container_builder_.SetTableColumnCount(column_locations.size());
container_builder_.SetHasCollapsedBorders(table_borders.IsCollapsed());
......
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