Commit c50358db authored by Javier Fernandez's avatar Javier Fernandez Committed by Commit Bot

[css-grid] Use AvailableSpace to detect grids with indefinite sizes

The spec considers flexible tracks as content-sized if the grid has an
indefinite size. We were using FreeSpace to determine this case as part
of the IsIntrinsicSizedGridArea, which is incorrect since that function
returns a different value before, during and after running the tracks
sizing algorithm.

We use the IsIntrinsicSizedGridArea function to detect cyclic sizing
dependencies in grid items, so that such items can participate in
baseline alignment. Hence, using the FreeSpace function lead to
inconsistent behavior in some cases, like the one described in the
bug this CL tries to fix.

Bug: 859374
Change-Id: Ifa90cdad6703c3b5e55a7230f85bc4ef63bf32d3
Reviewed-on: https://chromium-review.googlesource.com/1122217
Commit-Queue: Javier Fernandez <jfernandez@igalia.com>
Reviewed-by: default avatarSergio Villar <svillar@igalia.com>
Cr-Commit-Position: refs/heads/master@{#571885}
parent 1e06eb30
...@@ -8,6 +8,18 @@ ...@@ -8,6 +8,18 @@
<div id="grid" style="display: inline-grid; grid-template-columns: minmax(100px, 4fr);"> <div id="grid" style="display: inline-grid; grid-template-columns: minmax(100px, 4fr);">
<div id="item" style="justify-self: baseline;"></div> <div id="item" style="justify-self: baseline;"></div>
</div> </div>
<div id="grid" style="display: inline-grid; grid-template-columns: minmax(100px, 4fr);">
<div style="width: 100%; justify-self: baseline;"></div>
</div>
<div id="grid" style="display: inline-grid; grid-template-rows: 2fr;">
<div style="align-self: baseline;"></div>
</div>
<div id="grid" style="display: inline-grid; grid-template-rows: minmax(10px, 2fr);">
<div style="align-self: baseline;"></div>
</div>
<div id="grid" style="display: inline-grid; grid-template-rows: minmax(10px, 2fr);">
<div style="height: 100%; align-self: baseline;"></div>
</div>
<script> <script>
test(() => {}, "No crash or assertion failure."); test(() => {}, "No crash or assertion failure.");
</script> </script>
......
...@@ -251,7 +251,7 @@ bool GridTrackSizingAlgorithm::IsIntrinsicSizedGridArea(const LayoutBox& child, ...@@ -251,7 +251,7 @@ bool GridTrackSizingAlgorithm::IsIntrinsicSizedGridArea(const LayoutBox& child,
// TODO(jfernandez): https://github.com/w3c/csswg-drafts/issues/2611 // TODO(jfernandez): https://github.com/w3c/csswg-drafts/issues/2611
if (track_size.IsContentSized() || track_size.IsFitContent() || if (track_size.IsContentSized() || track_size.IsFitContent() ||
track_size.MinTrackBreadth().IsFlex() || track_size.MinTrackBreadth().IsFlex() ||
(track_size.MaxTrackBreadth().IsFlex() && !FreeSpace(direction))) (track_size.MaxTrackBreadth().IsFlex() && !AvailableSpace(direction)))
return true; return true;
} }
return false; return false;
......
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