Commit 179a1268 authored by David Grogan's avatar David Grogan Committed by Commit Bot

[FlexNG] Don't let min size go negative

We were subtracting border_padding when it wasn't present if the item
had min-size:auto but didn't qualify for the special flex min-size:auto
behavior because, for instance, it has overflow: hidden.

This fixes the telemetry_perf_unittests failure FlexNG was hitting on
the bots, which was caused by a recorded google docs page.

Change-Id: Ia6bde490651daf63e4ca77f9525870987bb9fe5c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2065626
Commit-Queue: David Grogan <dgrogan@chromium.org>
Reviewed-by: default avatarIan Kilpatrick <ikilpatrick@chromium.org>
Cr-Commit-Position: refs/heads/master@{#744017}
parent f425d06e
......@@ -433,8 +433,7 @@ void NGFlexLayoutAlgorithm::ConstructAndAppendFlexItems() {
return *min_max_size;
};
MinMaxSize min_max_sizes_in_main_axis_direction{LayoutUnit(),
MinMaxSize min_max_sizes_in_main_axis_direction{main_axis_border_padding,
LayoutUnit::Max()};
MinMaxSize min_max_sizes_in_cross_axis_direction{LayoutUnit(),
LayoutUnit::Max()};
......@@ -682,6 +681,8 @@ void NGFlexLayoutAlgorithm::ConstructAndAppendFlexItems() {
min, IntrinsicBlockSizeFunc, LengthResolvePhase::kLayout);
}
min_max_sizes_in_main_axis_direction -= main_axis_border_padding;
DCHECK_GE(min_max_sizes_in_main_axis_direction.min_size, 0);
DCHECK_GE(min_max_sizes_in_main_axis_direction.max_size, 0);
// TODO(dgrogan): Should min_max_sizes_in_cross_axis_direction include
// cross_axis_border_padding?
......
<!DOCTYPE html>
<link rel="author" title="David Grogan" href="mailto:dgrogan@chromium.org">
<link rel="help" href="https://www.w3.org/TR/css-flexbox-1/#layout-algorithm">
<link rel="match" href="../reference/ref-filled-green-100px-square-only.html">
<meta name="assert" content="Item's size includes padding even when there is overflow:hidden. Chrome crashed on this.">
<p>Test passes if there is a filled green square only.</p>
<div style="display: flex">
<div style="padding: 50px; background: green; overflow: hidden;"></div>
</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