Closed Bug 1909773 Opened 4 months ago Closed 4 months ago

Add off-by-default support for 'stretch' and '-webkit-fill-available' as aliases for existing -moz-available behavior

Categories

(Core :: Layout, enhancement)

enhancement

Tracking

()

RESOLVED FIXED
130 Branch
Tracking Status
firefox130 --- fixed

People

(Reporter: dholbert, Assigned: dholbert)

References

(Blocks 3 open bugs)

Details

Attachments

(4 files)

As a step towards real '-webkit-fill-available' / 'stretch' support, I've got a patch stack to implement those CSS keywords (off-by-default for now) simply as aliases for our existing -moz-available behavior.

That's all I'm doing with this bug here; then, in bug 1872755, I'll iterate on top of this to add block-axis handling for these newly-added keywords (so that they expand to fill the containing block when used as 'height', for example). (Later on, we can tentatively expand that block-axis behavior to also happen for -moz-available in bug 527285, being cautious to watch for webcompat fallout from that change to our legacy prefixed keyword.)

Depends on: 1909797

This patch doesn't change behavior.

This change might look like a very-marginal deduplication, but it will help
reduce repeated code in later patches in this series (there are two more shared
"BehavesLike{...}" functions that will be added to this macro).

This patch doesn't change behavior.

The '-moz-available' keyword is our closest equivalent to the CSS 'stretch'
keyword, specifically for the inline axis (since we currently nerf
'-moz-available' to behave like the initial value in the block axis). Hence, it
makes sense to say that the '-moz-available' keyword "Behaves Like Stretch On
Inline Axis".

By abstracting the existing behavior behind this helper-function, we can
start implementing the actual 'stretch' value in terms of this existing
behavior, in later patches.

This patch is intended to be mechanical, just adding the new keyword as an
alias for the existing behavior, basically.

In a later bug, 'stretch' will gain additional capabilities before we enable
the pref. After that, I intend to ultimately make '-moz-available' an alias of
'stretch', assuming that doing so is web-compatible.

Both '-webkit-fill-available' and 'stretch' are equivalent to '-moz-available'
at this point in the patch series, and both are off-by-default, because
actually supporting them would require that we add special logic to handle them
as block-axis sizes (which I'll do in a separate bug).

Pushed by dholbert@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/15995deb04ce part 1: Use a macro to implement the BehavesLikeInitialValueOnBlockAxis method for StyleSize and StyleMaxSize. r=emilio https://hg.mozilla.org/integration/autoland/rev/e67adc2224e9 part 2: Create BehavesLikeStretchOnInlineAxis() utility-function as an abstraction for the '-moz-available' sizing behavior. r=emilio https://hg.mozilla.org/integration/autoland/rev/7496f354f4f2 part 3: Add off-by-default support for the CSS 'stretch' sizing keyword, just matching the behavior of '-moz-available' for now. r=emilio https://hg.mozilla.org/integration/autoland/rev/385ced980d83 part 4: Add support for '-webkit-fill-available' as an alias for the CSS 'stretch' behavior (off-by-default for now). r=emilio

(In reply to Daniel Holbert [:dholbert] from comment #5)

Try: https://treeherder.mozilla.org/jobs?repo=try&revision=15115b569abdd009b9c1f4e5c564c538b31de1d9

(Note, this^ Try run had a mochitest failure in layout/style/test/test_value_computation.html from me forgetting to add the -webkit prefixed keyword to an array of -moz-available aliases in that test file; I addressed that in https://phabricator.services.mozilla.com/D217687?vs=894602&id=894897#toc before landing.)

I did another mochitests-only Try run with that fix here:
https://treeherder.mozilla.org/jobs?repo=try&revision=8130291a9f06475160cf704365118245eb41db55
where the orange is all intermittent, I think (aside from the ES orange which is a nit that I later addressed before actually landing)

Just before landing I kicked off a mach try auto try run, which is still going and is here, though I don't anticipate any test failures given the above:
https://treeherder.mozilla.org/jobs?repo=try&revision=dd8e4233a54d5ebeac1101d5e3f5120ba8d97439

Blocks: 1920633
Blocks: 1933408
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: