Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1840478 - Handle inherits flag and initial value for custom prope…
…rties. r=emilio,zrhoffman The CSS Properties and Values API allows to register CSS properties that can be either inherited or non-inherited, and which can also have initial values specified [1]. In [2], the representation of computed value for custom properties was changed to a pair of CustomPropertiesMaps: one map which is ref-counted (for properties unregistered or registered as inherited) and one which is not (for properties registered as non-inherited). The latter map is currently always None (i.e. all custom properties are handled as inherited) and several parts of the code assume this condition holds. This patch instead ensures that values for custom properties on a node are properly placed in the inherit or non_inherit map according to the inherits flag. Initial values for registered properties are taken into account and missing implementations of functions assuming non_inherited==None is completed. In order to minimize the size of the maps, absent values for non-inherited properties are interpreted as initial values during var substitution or retrieval of computed values (for non-inherited properties). This is used for `unset` and `initial` keywords while a copy of the parent's value is used for `inherit`. Last but not least, `CustomPropertiesBuilder` tries to perform lazy copy of the inherited style, postponing actual deep clone when necessary or falling back to a shallow copy when possible [3]. This is generalized a bit when the document contains custom properties registered as non-inherited and current optimizations are preserved as is for pages containing only non-registered custom properties. This could be further improved later [4]. [1] https://drafts.css-houdini.org/css-properties-values-api-1/ [2] https://hg.mozilla.org/mozilla-central/rev/8a7d9524a1b9 [3] https://bugzilla.mozilla.org/show_bug.cgi?id=1840478 [4] https://bugzilla.mozilla.org/show_bug.cgi?id=1855887 Differential Revision: https://phabricator.services.mozilla.com/D188812 UltraBlame original commit: 6453cd78e4f187bc198e83900dd9937c3cc6d0fc
- Loading branch information