commit | 10b193d11ac7733b30e6c7cdade84c0093fba682 | [log] [tgz] |
---|---|---|
author | Anders Hartvoll Ruud <andruud@chromium.org> | Tue Sep 25 12:54:26 2018 |
committer | Commit Bot <commit-bot@chromium.org> | Tue Sep 25 12:54:26 2018 |
tree | 8b77d29a8a05c9deeed780a1b3747a49f8ea5c4b | |
parent | 33e252a73b7c952fe21098c79250ea4d9fcd807a [diff] |
[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 Reviewed-by: Rune Lillesveen <futhark@chromium.org> Commit-Queue: Anders Ruud <andruud@chromium.org> Cr-Commit-Position: refs/heads/master@{#593902}
Chromium is an open-source browser project that aims to build a safer, faster, and more stable way for all users to experience the web.
The project's web site is https://www.chromium.org.
Documentation in the source is rooted in docs/README.md.
Learn how to Get Around the Chromium Source Code Directory Structure .