Commit eafa16d5 authored by Christian Biesinger's avatar Christian Biesinger Committed by Commit Bot

[css-flexbox] Don't set height to 0 before ForceLayout

It's not necessary and causes problems in LayoutNG when we reuse the
cached fragment inside of ForceLayout (nothing will set the height
to the correct value)

In the specific testcase, we incorrectly think that the block has a
percentage-sized child due to the abspos item.

Bug: 967061
Change-Id: If6fabc93173f025966f359510e5b600914376e45
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1638192
Commit-Queue: Christian Biesinger <cbiesinger@chromium.org>
Reviewed-by: default avatarEmil A Eklund <eae@chromium.org>
Cr-Commit-Position: refs/heads/master@{#665233}
parent 02261a47
...@@ -1665,11 +1665,8 @@ void LayoutFlexibleBox::ApplyStretchAlignmentToChild(FlexItem& flex_item) { ...@@ -1665,11 +1665,8 @@ void LayoutFlexibleBox::ApplyStretchAlignmentToChild(FlexItem& flex_item) {
} }
if (child_needs_relayout || !child.HasOverrideLogicalHeight()) if (child_needs_relayout || !child.HasOverrideLogicalHeight())
child.SetOverrideLogicalHeight(flex_item.cross_axis_size); child.SetOverrideLogicalHeight(flex_item.cross_axis_size);
if (child_needs_relayout) { if (child_needs_relayout)
// TODO(cbiesinger): Why is this necessary?
child.SetLogicalHeight(LayoutUnit());
child.ForceLayout(); child.ForceLayout();
}
} else if (!flex_item.MainAxisIsInlineAxis() && } else if (!flex_item.MainAxisIsInlineAxis() &&
child.StyleRef().LogicalWidth().IsAuto()) { child.StyleRef().LogicalWidth().IsAuto()) {
if (flex_item.cross_axis_size != child.LogicalWidth()) { if (flex_item.cross_axis_size != child.LogicalWidth()) {
......
<!DOCTYPE html>
<link rel="author" title="Google LLC" href="http://www.google.com" />
<link rel="help" href="https://drafts.csswg.org/css-flexbox/#cross-sizing" />
<link rel="help" href="https://crbug.com/967061" />
<title>css-flexbox: Tests that we correctly size a flex item when we have a percentage-sized abspos element</title>
<link rel="match" href="../reference/ref-filled-green-100px-square.xht" />
<p>Test passes if there is a filled green square and <strong>no red</strong>.</p>
<div style="display: flex;">
<div style="overflow: hidden; position: relative;">
<div style="width: 100%; height: 100%; position: absolute; top: 0; left: 0;"></div>
<div style="width: 100px; height: 100px; background: green;"></div>
</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