Open Bug 1936942 Opened 10 months ago Updated 10 months ago

Flex item with 'width: -moz-available' (or 'stretch') and wide content ends up too wide (failing to consider specified-size suggestion)

Categories

(Core :: Layout: Flexbox, defect)

defect

Tracking

()

People

(Reporter: dholbert, Unassigned)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

Attached file testcase 1

STR:

  1. Load attached testcase.

EXPECTED RESULTS:
Cyan area should exactly fill the width of the black-bordered box.

ACTUAL RESULTS:
Cyan area overshoots and is as wide as the text.

This is a bug in this code in nsFlexContainerFrame::PartiallyResolveAutoMinSize:
https://searchfox.org/mozilla-central/rev/a5e04104f9c6cfd69f9c855f0b0f665afd444c74/layout/generic/nsFlexContainerFrame.cpp#1570-1577

if (aAxisTracker.IsRowOriented()) {
  if (mainStyleSize.IsLengthPercentage()) {
    // NOTE: We ignore extremum inline-size. This is OK because the caller is
    // responsible for computing the min-content inline-size and min()'ing it
    // with the value we return.
    specifiedSizeSuggestion = aFlexItem.Frame()->ComputeISizeValue(
        cbWM, PercentageBasisForItem(), boxSizingAdjust,
        mainStyleSize.AsLengthPercentage());

In this case where we use -moz-available, it's not enough to trust the caller to resolve our min-content size, because that's not what our -moz-available size actually computes to. It's essentially 100% and should be handled similarly to the IsLengthPercentage case.

This is relevant for stretch (the standardized keyword for this behavior) but it's already reproducible with -moz-available.

Chrome gives EXPECTED RESULTS (they use -webkit-fill-available and/or stretch which mean the same thing as -moz-available in the inline axis).

Blocks: 1789477
Summary: Flex item with 'width: -moz-available' and wide content ends up too wide (failing to consider specified-size suggestion) → Flex item with 'width: -moz-available' (or 'stretch') and wide content ends up too wide (failing to consider specified-size suggestion)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: