Open Bug 1201941 Opened 9 years ago Updated 1 year ago

[css-grid] Consider rewriting some parts of the "Stretch Flexible Tracks" algorithm to avoid rounding errors

Categories

(Core :: Layout: Grid, defect)

defect

Tracking

()

People

(Reporter: MatsPalmgren_bugz, Unassigned)

References

(Blocks 3 open bugs)

Details

Follow-up from bug 1176621 comment 14.

Our current implementation follows the spec language pretty much exactly.
Unfortunately that leads to noticeable rounding errors in some rare cases.
(bug 1176621 has a test)

dholbert suggests that we use a "chip-away-remaining-space" strategy instead
like we usually do when distributing space between items, which I agree
would fix this bug.  The problem is that the algo in the spec appears to
not lend itself to doing that easily.  So we need to develop our own algo
for this, which is a bit risky since we need to be confident that it
corresponds to the spec's algo and the spec might evolve too.

Note that there's now a WPT test that directly tests this, which we fail per
https://searchfox.org/mozilla-central/rev/267682a8f45221bf0bfe999d4a0239706a43bc56/testing/web-platform/meta/css/css-grid/layout-algorithm/flex-tracks-with-fractional-size.html.ini

More info on that in bug 1737353 (which is essentially a dupe of this bug).

I've posted a testcase with a few examples in https://bugzilla.mozilla.org/attachment.cgi?id=9250069 . It shows how a single grid-item that we ask to span the whole grid can actually over- or under-shoot (and fail to precisely cover up the grid container), due to this bug.

Severity: minor → S4
Component: Layout → Layout: Grid
Severity: S4 → S3
You need to log in before you can comment on or make changes to this bug.