Bug 242775 - shorthand serialization for background and mask should not include "initial" in the middle of the value
Summary: shorthand serialization for background and mask should not include "initial" ...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Darin Adler
URL:
Keywords: BrowserCompat, InRadar
Depends on:
Blocks: 185953 247769
  Show dependency treegraph
 
Reported: 2022-07-14 16:25 PDT by Cameron McCormack (:heycam)
Modified: 2022-12-21 07:30 PST (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Cameron McCormack (:heycam) 2022-07-14 16:25:24 PDT
For example:

<!DOCTYPE html>
<style>
div { background: none; background-position: initial; }
</style>
<pre id=log></pre>
<script>
log.textContent = "background: " + document.styleSheets[0].cssRules[0].style.getPropertyValue("background");
</script>

This outputs "background: none initial initial", which is not valid.
Comment 1 Radar WebKit Bug Importer 2022-07-21 16:26:16 PDT
<rdar://problem/97405629>
Comment 2 Darin Adler 2022-11-14 12:11:18 PST
There is a straightforward way to make sure we don’t serialize any shorthands when one of the longhands has a keyword like "initial". I wrote the code for it and it’s super-simple.

But a prerequisite for doing that is that we have to stop setting longhands to "initial" as a side effect of *using* a shorthand. Otherwise, we’ll be getting the empty string way too often. That means we probably need to fix bug 244657 *before* fixing this one.
Comment 3 Tim Nguyen (:ntim) 2022-11-14 13:32:12 PST
Does removing `case CSSPropertyBackground:` from the `canUseShorthandForLonghand` blocklist in StyleProperties help?
Comment 4 Darin Adler 2022-11-21 10:35:13 PST
It does not fix this problem, no, but it should be done for other reasons.
Comment 5 Darin Adler 2022-12-01 07:51:54 PST
Pull request: https://github.com/WebKit/WebKit/pull/7025
Comment 6 EWS 2022-12-06 12:55:13 PST
Committed 257429@main (a0488d1bf07c): <https://commits.webkit.org/257429@main>

Reviewed commits have been landed. Closing PR #7025 and removing active labels.