Figure out what to do with flex="" attributes when emulating -moz-box with flexbox.
Categories
(Core :: Layout, task)
Tracking
()
Tracking | Status | |
---|---|---|
firefox105 | --- | fixed |
People
(Reporter: emilio, Assigned: emilio)
References
Details
Attachments
(3 files)
That's the big thing of the layout emulation that doesn't quite work.
When we were doing it via pref, we had:
But that's neither perfect nor behavior-preserving. In XUL, the attribute overrides any CSS, which is not true for this.
We have a lot of usage of the flex="" attribute, but it is mostly flex="1":
$ rg 'flex="' | rg -v 'flex="1"' | cut -d : -f 1 | rg -v '/reftest|/crashtest|/tests' | uniq | wc -l
11
So I think a concrete proposal could look like:
- Make flex="1" work via an attribute selector.
- Make flex="<other-stuff>" not work, both when emulating and when using XUL layout (that is, remove support for looking up the flex attribute from XUL layout, so that we have the same behavior everywhere).
That should be relatively straight-forward / easy to audit... Does that sound reasonable?
Assignee | ||
Comment 1•2 years ago
|
||
Assignee | ||
Comment 2•2 years ago
|
||
Comment on attachment 9289458 [details]
Bug 1784265 - Drop support for flex attribute values other than 0 and 1. r=dholbert!,mconley!
Gijs / Brian, wdyt of something like this? This should make legacy layout and flexbox emulation behave the same wrt the flex attribute.
This gives me a working browser UI but I need to fix a couple other places (not many, see comment 0 + a couple JS places that do setAttribute("flex")
). If this seems reasonable, I can finish it up and I can give a heads-up / help fix thunderbird / pinebuild as needed. The relevant asserts should ensure that if they're not hit we're not changing behavior.
Updated•2 years ago
|
Assignee | ||
Updated•2 years ago
|
Updated•2 years ago
|
Assignee | ||
Comment 3•2 years ago
|
||
It's basically an alias of setAttribute("flex", value), and it has no
remaining usage in the tree.
Since it's less useful now, let's remove the WebIDL API in favor of CSS.
Do this as a separate patch so that thunderbird / pine / etc can revert
this patch for diagnostics / to find UI with behavior changes.
Depends on D154394
Assignee | ||
Comment 4•2 years ago
|
||
Do this separately so that Thunderbird / pine can revert this patch and
find affected elements.
Depends on D154498
Assignee | ||
Comment 5•2 years ago
|
||
Magnus, you might want to run a debug build of Thunderbird through try with the first patch in this bug, to find broken layouts that grepping the tree with rg 'flex="' | rg -v 'flex="1"'
doesn't find. In general for one-off usages it might be worth just replacing flex="N"
with style="-moz-box-flex: N"
. For more complex usage it is probably worth moving it to CSS proper.
Assignee | ||
Comment 6•2 years ago
|
||
For posterity, I considered to make this work more similarly to how html attributes behave (mapping the flex
attribute to -moz-box-flex
in style).
But the resulting priority is different (XUL was making the attribute override CSS, while attribute mapping would work the other way around). Let me know if you'd find that preferable tho, it's possible to figure out when it differs from the mapped attribute as well...
Comment 7•2 years ago
|
||
Comment on attachment 9289458 [details]
Bug 1784265 - Drop support for flex attribute values other than 0 and 1. r=dholbert!,mconley!
(In reply to Emilio Cobos Álvarez (:emilio) from comment #2)
Comment on attachment 9289458 [details]
Bug 1784265 - Drop support for flex attribute values other than 0 and 1. r=dholbert!,mconley!Gijs / Brian, wdyt of something like this? This should make legacy layout and flexbox emulation behave the same wrt the flex attribute.
This gives me a working browser UI but I need to fix a couple other places (not many, see comment 0 + a couple JS places that do
setAttribute("flex")
). If this seems reasonable, I can finish it up and I can give a heads-up / help fix thunderbird / pinebuild as needed. The relevant asserts should ensure that if they're not hit we're not changing behavior.
This seems reasonable enough to me.
Comment 9•2 years ago
|
||
Backed out 3 changesets (Bug 1784265) for causing reftest failures on flex-emulation-1.xhtml.
Backout link
Push with failures <--> R1
Failure Log
Assignee | ||
Updated•2 years ago
|
Comment 10•2 years ago
|
||
Comment 11•2 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/79ce2b08a99e
https://hg.mozilla.org/mozilla-central/rev/c67009279787
https://hg.mozilla.org/mozilla-central/rev/644d39c51480
Comment 12•2 years ago
|
||
(In reply to Emilio Cobos Álvarez (:emilio) from comment #5)
Magnus, you might want to run a debug build of Thunderbird through try with the first patch in this bug, to find broken layouts.
Thanks, it found one case.
Description
•