Open Bug 1872755 Opened 2 years ago Updated 8 days ago

Consider supporting `-webkit-fill-available` as an alias for `-moz-available` (extended to work in the height axis)

Categories

(Core :: CSS Parsing and Computation, defect)

defect

Tracking

()

ASSIGNED
Webcompat Priority P2

People

(Reporter: dholbert, Assigned: dholbert)

References

(Blocks 2 open bugs)

Details

(Keywords: webcompat:platform-bug)

Attachments

(2 files, 1 obsolete file)

We've apparently got some sites that rely on width:-webkit-fill-available for proper layout, and are broken in Firefox as a result.

Example: https://github.com/webcompat/web-bugs/issues/115962#issuecomment-1871236155

This is roughly equivalent to -moz-available. Perhaps we should just implement it as an alias for -moz-available?

Here's a testcase:

data:text/html,<div style="width:20px; overflow:clip; width: -webkit-fill-available;">CanYouSeeMe

Firefox just renders 20px of the text and clips the rest (dutifully honoring the CSS that it understands).

(If you manually swap in -moz-available into that data URI, then we show all of the text.)

Blocks: 1170789
See Also: → 1872785
Severity: -- → S3

[Transferring WebCompat Priority: P2 from bug 1495868 to this bug here, since the aliasing that's proposed in this bug here seems to be the remaining webcompat-relevant work that's covered in bug 1495868.]

Webcompat Priority: --- → P2
Blocks: 1495868
Blocks: 1891380

Bad news: in bug 1891380 at least, it seems our -moz-available isn't enough like -webkit-available where aliasing would help. In that bug, height:-moz-available collapses to 0 height, whereas height:-webkit-available (in Chrome) expands to fill the viewport.

It looks like, in Chrome/WebKit, height:-webkit-available specifically works on elements that are position:absolute or fixed. But it behaves like height:auto on in-flow content, I think.

Attachment #9396567 - Attachment description: testcase 1, testing `-moz-available` and `-webkit-fill-available` for both `width` and `height` → testcase 1, testing `-moz-available` and `-webkit-fill-available` for both `width` and `height` on abspos element

er, I guess the relevant condition is just whether or not the containing block has a definite height, i.e. whether a percent height would have resolved. Here's an example where this works in Chrome, with in-flow content. (Notably, this results in overflow here, because the height value resolves to the height that would fill the container's available space; though in this case there's other siblings preceeding this element, which pushes it downwards.)

Chrome's behavior seems probably-correct for the definition of stretch in the spec, here:
https://drafts.csswg.org/css-sizing-4/#stretch-fit-sizing
...so it probably makes sense to modify -moz-available to match Chrome's behavior on these heights, in the interests of eventually supporting the stretch keyword for height/width and having -moz-available be an alias for that, per bug 1495868.

No longer blocks: 1891380

I guess the compat issue discussed in comment 3 - comment 6 is tracked in bug 527285.

Blocks: 527285

This is still an issue based on: https://github.com/webcompat/web-bugs/issues/115962

Environment:
OS: Windows 10
Browsers tested: Firefox Nightly 128.0a1 (2024-05-30) / Firefox Release 126 / Chrome 125.0.6422.113

No longer blocks: 1896571

Here's my tentative plan here, at the moment -- I'm imagining three distinct phases, landing in the order described below, to address the existing webcompat breakage while being cautious about possible follow-on regressions:

(1) bug 1872755 [this bug]: add support for -webkit-fill-available as a new keyword, sharing some code with -moz-available, but extended to work in the height axis (where -moz-available would still do nothing per bug 527285).
(2) bug 1789477: Add support for the stretch keyword as the official name for the -webkit-fill-available behavior from (1), with -webkit-fill-available changing to be an alias (which I think is what Chrome is also planning on doing).
(3) bug 527285: Adjust -moz-available to also be an alias for stretch so that all three keywords do the same thing.

Part (1) should directly address the various -webkit-fill-available bugs, with as-small-as-possible chance for site-breakage/regressions.

Part (2) adds the standards-based keyword for that behavior; and part (3) will help us modernize -moz-available and remove special-case/legacy codepaths. It's possible that parts (2) or (3) might trigger regressions in cases where sites happen to accidentally have fragile dependencies on these keywords not-working (behaving as auto or being ignored) in certain contexts; if we run into that sort of breakage, we could always backout or slow-rollout these parts as-needed while we address breakage, without needing to slow our deployment of Part (1).

Summary: Consider supporting `-webkit-fill-available` as an alias for `-moz-available` → Consider supporting `-webkit-fill-available` as an alias for `-moz-available` (extended to work in the height axis)

(And I'll use this bug here to cover "Part (1)" from that plan. Parts (2) and (3) happen in separate bugs [now linked above] and don't have any need to land in the same timeframe as Part (1) or as each other.)

Assignee: nobody → dholbert
Status: NEW → ASSIGNED
Depends on: 1909773

This fixes the LinkedIn bug and also the gracobaby.ca bug, if you enable the
layout.css.webkit-fill-available.enabled about:config pref (added in an earlier
patch in this series).

Depends on: 1920633
Depends on: 1933408

Comment on attachment 9414790 [details]
WIP: Bug 1872755: Handle 'stretch' and '-webkit-fill-available' as block-sizes, in nsIFrame::ComputeSize.

Revision D217688 was moved to bug 1933408. Setting attachment 9414790 [details] to obsolete.

Attachment #9414790 - Attachment is obsolete: true
Depends on: 1937278
No longer blocks: 1495868

[adding platform-scheduled:2025-03-31 to mark this as scheduled-to-be-completed-during-Q1, though most likely it'll be completed on Nightly pretty soon. I've got a patch in my local repo with some necessary fixes that I need to finish off and land, and then I think we can enable this pref on Nightly and let it ride the trains. I've just been focused on interop-2025-related stuff and other catchup tasks since coming back from holiday break.]

User Story: (updated)
Blocks: 1911579
Blocks: 1944727
Blocks: 1954955

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

[adding platform-scheduled:2025-03-31 to mark this as scheduled-to-be-completed-during-Q1

[pushing date out a bit; didn't finish this off yet, but still planning to do so soon]

User Story: (updated)
User Story: (updated)
Blocks: 1966389
Blocks: 1969245

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

[pushing date out a bit; didn't finish this off yet, but still planning to do so soon]

[Sorry for churn -- I ended up taking bug 1935269 and associated work first, so pushing this date out a bit again.]

User Story: (updated)
User Story: (updated)
User Story: (updated)
Depends on: 1988301

Updated plan here:
A) bug 1988301: Add an additional pref to prevent us from accepting -webkit-fill-available in properties beyond width and height (that's where we see it the most, and where I think we've got robust support)
B) bug 1988938: Land a pref-flip to enable layout.css.webkit-fill-available.enabled to enable support (in width and height)
[these^ address most of the webcompat pain here]
C) bug [to be filed]: Finish making the keyword robust in other properties.
D) bug 1989071: Enable the pref that we added in (A) to fully-support the keyword, addressing remaining webcompat pain.
E) bug 1989073: Clean up the now-unnecessary shim code added in (A)

User Story: (updated)

(planning on finishing (A) and (B) within the next day or so; the rest is hopefully doable next week; but in any case (A) and (B) will get us to a much better place)

Depends on: 1988938
No longer depends on: 1937278
No longer blocks: 1944727
No longer blocks: 1918019
No longer blocks: 1911579
No longer blocks: 1896571
No longer blocks: 1886566
No longer blocks: 1978907
No longer blocks: 1949113
No longer blocks: 1971690

Per bug 1988938 comment 7, I'm moving some dependencies from this bug to that bug, specifically the dependencies that are fixed by the pref-flip that I just landed there (which as noted in comment 17 is most of the webcompat pain here)

And I'm going to move most other bugs to hang off of bug 1989071 (which is where we'll enable the secondary pref to support this keyword in other properties like {min,max}-{height,width}).

No longer blocks: 1916903
No longer blocks: 1886561
No longer blocks: 1948047
No longer blocks: 1956209
No longer blocks: 1954955
No longer blocks: 1966389
No longer blocks: 1969245

(removing https://webcompat.com/issues/115962 from see-also since it's tracked by bug 1872785 and it stopped reproducing after a site redesign)

User Story: (updated)

Blink successfully aliased -webkit-fill-available to stretch.

See Also: → 1886561
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: