[meta] Get rid of CSS property implicit flag
https://bugs.webkit.org/show_bug.cgi?id=248383
Summary [meta] Get rid of CSS property implicit flag
Tim Nguyen (:ntim)
Reported 2022-11-28 00:22:14 PST
The implicit flag is supposed to represent whether a longhand was implicitly set to its default value from a shorthand or not, in order to omit it from the shorthand serialization. It is set at parse-time, see `CSSPropertyParser::addPropertyWithImplicitDefault` or `CSSPropertyParser::addProperty(..., true)`, and read when serializing, see usages of `PropertyReference::isImplicit()`. It has a couple issues however: - it has become a hack that's used to omit keywords for serialization purposes without necessarily representing the meaning of implicit (see how it's used for the list-style longhands) - serialization has to omit default values regardless of whether the property was set implicitly or not, so checks for `isImplicit` in StyleProperties.cpp really mean, `== <default-value>` I think it would be beneficial to stop using this flag, and to check for equality with the default values in StyleProperties.cpp.
Attachments
Darin Adler
Comment 2 2022-11-28 05:50:10 PST
When I started researching this, the remaining uses outside the style serialization machinery were in the inspector tools.
Radar WebKit Bug Importer
Comment 3 2022-12-05 00:23:17 PST
Darin Adler
Comment 4 2023-02-10 08:17:16 PST
We will need to keep the “implicit initial” concept even when we get rid of the implicit flag, because it turns out that using that CSSValue rather than actually creating the initial value CSSValue was an accidental but important performance optimization. However, we could rename it something different like “initial value placeholder”. Another alternative would be to change it to be represented by a null pointer rather than an actual CSSValue, which I’m sure would achieve a similar performance optimization.
Note You need to log in before you can comment on or make changes to this bug.