getComputedStyle for registered custom CSS properties is not very consistent |
||||||
Issue description
1) Registered properties don't have the initial value go through computation for getComputedStyle.
CSS.registerProperty({name: '--foo', syntax: '<length>', initialValue: 'calc(10px)'});
getComputedStyle(e).getPropertyValue('--foo') will return calc(10px) when --foo is not set, but will return 10px when it is set to calc(10px) or to initial.
2) Computation only does things for <length> types. For regular properties, we always compute colors like pink into rgb values, but a custom property registered as <color> will be returned by getComputedStyle as pink.
,
Dec 7 2016
This bug is for registered custom properties. Unregistered custom properties will always just return the value you specify if there are no var() references.
,
Jan 16 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/8a637421ef6b1bbfe05708f814a914e57c17a8b6 commit 8a637421ef6b1bbfe05708f814a914e57c17a8b6 Author: timloh <timloh@chromium.org> Date: Mon Jan 16 05:14:07 2017 Compute initial values for registered custom properties. This patch makes initial values for registered custom properties go through computation, so initial values like calc(10px) end up as 10px when accessed through getComputedStyle. As per css-cascade logic they would normally go through regular computation anyway, but since we skip this for registered properties for efficiency we need to handle this case specially. BUG= 671490 Review-Url: https://codereview.chromium.org/2622403006 Cr-Commit-Position: refs/heads/master@{#443847} [modify] https://crrev.com/8a637421ef6b1bbfe05708f814a914e57c17a8b6/third_party/WebKit/LayoutTests/custom-properties/registered-property-initial.html [modify] https://crrev.com/8a637421ef6b1bbfe05708f814a914e57c17a8b6/third_party/WebKit/Source/core/css/CSSToLengthConversionData.cpp [modify] https://crrev.com/8a637421ef6b1bbfe05708f814a914e57c17a8b6/third_party/WebKit/Source/core/css/CSSToLengthConversionData.h [modify] https://crrev.com/8a637421ef6b1bbfe05708f814a914e57c17a8b6/third_party/WebKit/Source/core/css/PropertyRegistration.cpp [modify] https://crrev.com/8a637421ef6b1bbfe05708f814a914e57c17a8b6/third_party/WebKit/Source/core/css/resolver/StyleBuilderConverter.cpp [modify] https://crrev.com/8a637421ef6b1bbfe05708f814a914e57c17a8b6/third_party/WebKit/Source/core/css/resolver/StyleBuilderConverter.h
,
Jan 17 2017
The first part is fixed by the patch in comment 3, the remaining bit is mostly just a consistency thing and probably not too important. It's unclear whether the specs are supposed to make it work but if so I think it'll be implied by the cssom specs.
,
Feb 13 2017
,
Mar 8 2017
,
Jun 29 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/53b56ec80be3c1b18df487c03963416a1313d6c5 commit 53b56ec80be3c1b18df487c03963416a1313d6c5 Author: hs1217.lee <hs1217.lee@samsung.com> Date: Thu Jun 29 06:49:47 2017 CSS Properties & Values API: Compute initial values for transfrom-list type. For <transform-function> values contained in <transform-list> values, the computed value is as specified but with all lengths resolved to their computed values. https://drafts.css-houdini.org/css-properties-values-api-1/#calculation-of-computed-values BUG= 671490 Review-Url: https://codereview.chromium.org/2937043002 Cr-Commit-Position: refs/heads/master@{#483312} [modify] https://crrev.com/53b56ec80be3c1b18df487c03963416a1313d6c5/third_party/WebKit/LayoutTests/custom-properties/registered-property-initial.html [modify] https://crrev.com/53b56ec80be3c1b18df487c03963416a1313d6c5/third_party/WebKit/Source/core/css/PropertyRegistration.cpp [modify] https://crrev.com/53b56ec80be3c1b18df487c03963416a1313d6c5/third_party/WebKit/Source/core/css/resolver/StyleBuilderConverter.cpp
,
Oct 30 2017
,
Oct 31 2017
,
Nov 29 2017
|
||||||
►
Sign in to add a comment |
||||||
Comment 1 by joshcarpenter@chromium.org
, Dec 7 2016