You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add initial support for computed/used/resolved property values
This commit adds a first pass of the implementation of the processings to get a
resolved value from a CSSStyleDeclaration returned by getComputedStyle():
- collect and filter values declared for the property and element
- sort declared values to output a cascaded value
- default the cascaded value to output a specified value
- resolve the specified value into a computed value by absolutizing component
values when there is enough data, following the requirements of the
"computed value" line in the property definition table
- resolve the computed value into a used value for some properties
It lacks support for several features:
- collecting transition and animation declarations
- collecting declarations from a higher (encapsulation/tree) context
- sort declarations based on their context (and importance)
- calculate the specificity of pseudos defined with an evaluation context
- resolve the computed value of an arbitrary substitution containing value
- resolve the computed value of a <whole-value>
- resolve the computed/used value of other relative value types than <color>
- resolve the computed/used value of other properties than color-like ones,
whose "computed value" line is not "as specified"
- resolve the computed/used value of a shorthand
Less importantly, <system-color> and <deprecated-color> are resolved without
considering the user preferred color scheme, its overriding preference, or the
UA default color scheme.
Several problems also need to be fixed:
- at least one selector of the style rule must match the element in order to
collect a declaration for the property, while calculating the specificity
requires matching all selectors: a caching system would avoid matching the
same selector against the same element (and context) multiple times
- selector matching algorithms must not enter in a shadow tree unless it is
explicitly specified for a selector, which should be defined in the specs
but is not
- top-level shadow tree elements must inherit values from the shadow host
- "text-decoration-line" and "page" inheritance rules must be considered
- evaluating @container's condition only considers <container-name>
- component values are not resolved when nested in a function or simple block
Most of these features and problems require a more in-depth reflection on the
model, more particularly on:
- how to collect and sort declared values
- how to represent the context, associate it to a declaration, and pass it to
the selector matching algorithms
- how to resolve a computed and used value
Adding more tests will help to identify all requirements.
0 commit comments