RESOLVED FIXED 239670
[cssom] Some longhands indexed in computed style are not serialized
https://bugs.webkit.org/show_bug.cgi?id=239670
Summary [cssom] Some longhands indexed in computed style are not serialized
Oriol Brufau
Reported 2022-04-22 12:51:29 PDT
A computed style only indexes declarations for longhand properties: var cs = getComputedStyle(document.body); var longhands = new Set(cs); longhands.has("perspective-origin-x"); // true longhands.has("perspective-origin-y"); // true longhands.has("perspective-origin"); // false However, then it fails to serialize some longhands: cs.getPropertyValue("perspective-origin-x"); // "" cs.getPropertyValue("perspective-origin-y"); // "" cs.getPropertyValue("perspective-origin"); // "960px 123.9375px" If only the shorthand can be serialized, either index the shorthand instead of the longhands (perspective-origin-x/y are actually not standard, it may be OK to pretend they don't exist), or let the longhands serialize properly.
Attachments
Patch (12.34 KB, patch)
2022-05-02 08:55 PDT, Oriol Brufau
no flags
Patch (16.80 KB, patch)
2022-05-02 12:38 PDT, Oriol Brufau
no flags
Patch (30.81 KB, patch)
2022-05-02 16:25 PDT, Oriol Brufau
no flags
Radar WebKit Bug Importer
Comment 1 2022-04-29 12:52:14 PDT
Oriol Brufau
Comment 2 2022-05-02 08:55:38 PDT
EWS Watchlist
Comment 3 2022-05-02 08:58:08 PDT
This patch modifies the imported WPT tests. Please ensure that any changes on the tests (not coming from a WPT import) are exported to WPT. Please see https://trac.webkit.org/wiki/WPTExportProcess
Oriol Brufau
Comment 4 2022-05-02 12:38:48 PDT
Oriol Brufau
Comment 5 2022-05-02 12:40:12 PDT
Is this good, or should I instead exclude these longhands from being indexed in the computed style?
Tim Nguyen (:ntim)
Comment 6 2022-05-02 13:54:42 PDT
Comment on attachment 458700 [details] Patch My issue with this is that perspective-origin-x/y and transform-origin-x/y/z aren't standard. Can we try to unship those (at least the unprefixed versions)?
Oriol Brufau
Comment 7 2022-05-02 13:58:40 PDT
I'm afraid of compat risks of completely unshipping them. But the option of not indexing them in computed styles would be closer to that.
Tim Nguyen (:ntim)
Comment 8 2022-05-02 15:47:02 PDT
(In reply to Oriol Brufau from comment #7) > I'm afraid of compat risks of completely unshipping them. > But the option of not indexing them in computed styles would be closer to > that. Chrome ships the prefixed versions, but not the unprefixed ones. Seems like we could do a similar thing? For this bug specifically, perspective-origin should be indexed, but not the other 2 longhands.
Oriol Brufau
Comment 9 2022-05-02 16:25:06 PDT
Oriol Brufau
Comment 10 2022-05-02 16:34:55 PDT
(In reply to Tim Nguyen (:ntim) from comment #8) > (In reply to Oriol Brufau from comment #7) > > I'm afraid of compat risks of completely unshipping them. > > But the option of not indexing them in computed styles would be closer to > > that. > > Chrome ships the prefixed versions, but not the unprefixed ones. Seems like > we could do a similar thing? Chrome treats both perspective-origin and -webkit-perspective-origin-{x,y} as longhands that share a computed value. But that's so broken for revert-layer: https://bugs.chromium.org/p/chromium/issues/detail?id=1319414 So I prefer not to do that. > For this bug specifically, perspective-origin should be indexed, but not the > other 2 longhands. I have attached a new patch that does that, without unshipping the non-standard longhands.
Darin Adler
Comment 11 2022-05-04 11:54:19 PDT
I don’t mean to override Tim’s judgement here. May want to hear from him before landing.
Oriol Brufau
Comment 12 2022-05-04 12:15:50 PDT
To summarize the problem with unshipping perspective-origin-x/y while keeping -webkit-perspective-origin-x/y: a) If perspective-origin becomes a longhand, we have a problem with revert-layer (same as Blink). b) If perspective-origin becomes a shorthand of -webkit-perspective-origin-x/y, then we have the same problem as now: i) If -webkit-perspective-origin-x/y are indexed in computed styles instead of perspective-origin, then they should serialize. ii) Otherwise -webkit-perspective-origin-x/y should be skipped, and index perspective-origin instead. Option a) seems undesirable. And option b) seems orthogonal: whatever needs to be done with -webkit-perspective-origin-x/y when unshipping perspective-origin-x/y is the same that needs to be done to perspective-origin-x/y when not unshipping them. So I would land the patch as-is. Option b) can be considered in another bug.
Tim Nguyen (:ntim)
Comment 13 2022-05-09 22:53:54 PDT
(In reply to Darin Adler from comment #11) > I don’t mean to override Tim’s judgement here. May want to hear from him > before landing. The current patch is fine as it is. I'll file a new bug to unship the unprefixed non-standard longhands.
EWS
Comment 14 2022-05-09 23:53:28 PDT
Committed r294002 (250438@main): <https://commits.webkit.org/250438@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 458713 [details].
Note You need to log in before you can comment on or make changes to this bug.