Bug 220814 - Top-side value erroneously serialized by getPropertyValue when shorthand is a custom property
Summary: Top-side value erroneously serialized by getPropertyValue when shorthand is a...
Status: RESOLVED INVALID
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-01-21 12:38 PST by Tyler Wilcock
Modified: 2021-01-21 16:12 PST (History)
6 users (show)

See Also:


Attachments
Patch (3.88 KB, patch)
2021-01-21 12:59 PST, Tyler Wilcock
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tyler Wilcock 2021-01-21 12:38:40 PST
Given `element.style.getPropertyValue(<shorthand property name>)`, if any of the associated longhands for this shorthand are pending substitution we should serialize an empty string, not the top-side value.

https://wpt.fyi/results/css/css-variables/variable-reference-shorthands.html?label=master&label=experimental&aligned&q=variable-reference-short

We fail the "target1 margin" test[1] (serializing "10px"):

```
<div id="target1" style="margin: var(--prop); margin-top: 10px"></div>
var testcases = [{ element: "target1", propertyName: "margin", expectedPropertyValue: "" }, ...]
```

because this:

https://github.com/WebKit/WebKit/blob/27018096404e5df088accf03481b693a8fd81eac/Source/WebCore/css/StyleProperties.cpp#L484#L485

unconditionally serializes the top shorthand value, which is normally fine except in this case where the shorthand is a custom property value.

Relevant spec: https://drafts.csswg.org/cssom/#dom-cssstyledeclaration-getpropertyvalue

[1]: https://github.com/WebKit/WebKit/blob/27018096404e5df088accf03481b693a8fd81eac/LayoutTests/imported/w3c/web-platform-tests/css/css-variables/variable-reference-shorthands.html#L25
Comment 1 Tyler Wilcock 2021-01-21 12:59:58 PST
Created attachment 418074 [details]
Patch
Comment 2 Tyler Wilcock 2021-01-21 16:11:59 PST
Nevermind, I think I want to go about this a different way.  I'm going to close this out.