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

[css-flexbox] Re-read a flex item size after layout

...because tables ignore the override width, and if we don't re-check
the size we position the flex items incorrectly.

R=mstensho@chromium.org

Bug: 782948
Change-Id: I86ecf63fe2d9cd6b27813436a842e15cfed783c6
Reviewed-on: https://chromium-review.googlesource.com/780462Reviewed-by: default avatarDavid Grogan <dgrogan@chromium.org>
Commit-Queue: Christian Biesinger <cbiesinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#518135}
parent 953fcf3f
<!DOCTYPE html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../../resources/check-layout-th.js"></script>
<style>
.flexbox {
position: relative;
display: flex;
width: 150px;
}
table, tr, td {
padding: 0;
border-spacing: 0;
}
table {
flex: 1;
min-width: 0;
}
</style>
<body onload="checkLayout('.flexbox')">
<p>Note that this behavior is all incorrect, but we had a regression that was
even more incorrect, so this tests that we match our historical behavior.</p>
<p>You should not see overlapping text.</p>
<div class="flexbox">
<table data-expected-width="200" data-offset-x="0">
<tr><td><div style="width: 200px;">Some textual content</div></tr></td>
</table>
<table data-expected-width="200" data-offset-x="200">
<tr><td><div style="width: 200px;">Some textual content</div></tr></td>
</table>
</div>
......@@ -1445,6 +1445,12 @@ void LayoutFlexibleBox::LayoutLineItems(FlexLine* current_line,
relaid_out_children_.insert(child);
child->LayoutIfNeeded();
// This shouldn't be necessary, because we set the override size to be
// the flexed_content_size and so the result should in fact be that size.
// But it turns out that tables ignore the override size, and so we have
// to re-check the size so that we place the flex item correctly.
flex_item.flexed_content_size =
MainAxisExtentForChild(*child) - flex_item.main_axis_border_and_padding;
flex_item.cross_axis_size = CrossAxisExtentForChild(*child);
flex_item.cross_axis_intrinsic_size =
CrossAxisIntrinsicExtentForChild(*child);
......
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