Bug 248383 - [meta] Get rid of CSS property implicit flag
Summary: [meta] Get rid of CSS property implicit flag
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on: 248386
Blocks:
  Show dependency treegraph
 
Reported: 2022-11-28 00:22 PST by Tim Nguyen (:ntim)
Modified: 2023-02-10 08:17 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 Tim Nguyen (:ntim) 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.
Comment 2 Darin Adler 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.
Comment 3 Radar WebKit Bug Importer 2022-12-05 00:23:17 PST
<rdar://problem/102971327>
Comment 4 Darin Adler 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.