Closed Bug 1493748 Opened 6 years ago Closed 6 years ago

[wpt-sync] Sync PR 13193 - [css-properties-values-api] Substitution behavior.

Categories

(Core :: CSS Parsing and Computation, enhancement, P4)

enhancement

Tracking

()

RESOLVED FIXED
mozilla64
Tracking Status
firefox64 --- fixed

People

(Reporter: mozilla.org, Unassigned)

References

()

Details

(Whiteboard: [wptsync downstream])

Sync web-platform-tests PR 13193 into mozilla-central (this bug is closed when the sync is complete).

PR: https://github.com/web-platform-tests/wpt/pull/13193
Details from upstream follow.

Anders Hartvoll Ruud <andruud@chromium.org> wrote:
>  [css-properties-values-api] Substitution behavior.
>  
>  Currently, registered properties substitute into other values exactly
>  like specified (like unregistered properties). This means that, for
>  a \<length>-registered property with a specified value "10em" (for
>  instance), when that property is substituted via var()-reference,
>  the tokens "10em" are inserted. This is not correct, and produces the
>  wrong result with e.g. inherited values.
>  
>  This CL changes that, by implementing "absolutization" of registered
>  custom properties: a process which calculates the computed value of
>  the property, and then produces a token stream usable for substitution
>  which is equivalent to the computed value.
>  
>   * Currently we resolve var()-references on all custom properties
>     before applying high-priority properties. This is no longer
>     possible, because the true value of a custom property (also
>     unregistered) can not be known until the font has been updated.
>     Consider: --reg-len: 1em; --unreg:var(--reg-len). Here, the
>     computed value of --unreg should be "16px" (assuming a font-size
>     of 16px), and not "1em". If we destructively resolve --unreg
>     before the font size is known, we end up with the wrong tokens.
>  
>     Hence the resolution process has been moved to after the font
>     has been updated.
>  
>   * Custom properties must also be usable from high-priority properties.
>     Since they are no longer resolved beforehand, they are resolved
>     "on the fly", non-destructively. "Non-destructively" means that
>     resolved token streams are not stored on ComputedStyle, such that
>     any var()-references are kept for the _real_ resolution pass after
>     the font has been updated.
>  
>     This works, because the high-priority properties do not require
>     proper "absolute substitution" to produce the correct value.
>  
>     Note that font-size is special, in that font-relative units may
>     not be used if they arrive via a registered custom property.
>  
>   * There is a special resolving pass for registered custom properties
>     (ComputeRegisteredVariables). This pass produces non-absolute CSSValues
>     for calculation of animation.
>  
>   * Parsing of registered properties now happens entirely in
>     CSSVariableResolver, and no longer in variable.cc. Having this in
>     multiple places is just confusing.
>  
>  R=futhark@chromium.org
>  
>  Bug: 641877
>  Change-Id: Ic705d0808ffcea0ae5db02fb20870767175bb706
>  Reviewed-on: https://chromium-review.googlesource.com/1240274
>  WPT-Export-Revision: f80e282384e09a9e3c5238207e57bc50d390ffd7
PR 13193 applied with additional changes from upstream: d5d003b4993520826bd7dfb274e355cbba6cb6e8, 689968f390a8c5c897ab5c9fa0f6fe27a40b5cc3
Component: web-platform-tests → CSS Parsing and Computation
Product: Testing → Core
Ran 3 tests and 15 subtests
OK     : 3
FAIL   : 15

New tests that have failures or other problems:
/css/css-properties-values-api/registered-properties-inheritance.html
    Calc expressions are resolved before inheritance: FAIL
    Explicitly inheriting from a parent with an invalid value results in initial value.: FAIL
    Explicitly inheriting from a parent with no value results in initial value.: FAIL
    Font-relative units are absolutized before before inheritance: FAIL
    Reference to syntax-incompatible variable results in inherited value: FAIL
    Reference to undefined variable results in inherited value: FAIL
/css/css-properties-values-api/var-reference-registered-properties.html
    Calc expressions are resolved when substituting: FAIL
    Font-relative units are absolutized when substituting: FAIL
    Lists with relative units are absolutized when substituting: FAIL
Pushed by wptsync@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/eecc27b7ef23
[wpt PR 13193] - [css-properties-values-api] Substitution behavior., a=testonly
https://hg.mozilla.org/mozilla-central/rev/eecc27b7ef23
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla64
You need to log in before you can comment on or make changes to this bug.