Bug 192922 - CSS variables don't work for colors in "border" property
Summary: CSS variables don't work for colors in "border" property
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P2 Normal
Assignee: Justin Michaud
Keywords: HasReduction, InRadar
Depends on:
Reported: 2018-12-20 00:49 PST by Nikita Vasilyev
Modified: 2018-12-21 13:33 PST (History)
7 users (show)

See Also:

[HTML] Reduction (423 bytes, text/html)
2018-12-20 00:49 PST, Nikita Vasilyev
no flags Details
Patch (3.43 KB, patch)
2018-12-21 11:56 PST, Justin Michaud
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Nikita Vasilyev 2018-12-20 00:49:14 PST
Created attachment 357798 [details]
[HTML] Reduction

See the reduction. In Chrome both rectangles have a green border. In STP 72, only the first one.
Comment 1 Radar WebKit Bug Importer 2018-12-20 11:43:29 PST
Comment 2 Joseph Pecoraro 2018-12-20 11:58:17 PST
Actually this appears to just be the order of properties in the `border` shorthand:

Note that this works:

    border: hsl(100, 100%, var(--foreground-lightness)) 4px solid;

But not this:

    border: 4px solid hsl(100, 100%, var(--foreground-lightness));
Comment 3 Justin Michaud 2018-12-21 10:46:31 PST
This works:
.fail {
    --foreground: 100;
    border: 4px rgb(100, 0, var(--foreground)) dashed;
This does not:
.fail {
    --foreground: 100;
    border: 4px dashed rgb(100, 0, var(--foreground));

The reason is that in the first case, in CSSPropertyParser::consumeBorder, we do not consume the entire value and so consuming the border fails. In the second case, consuming the border does not fail. In CSSPropertyParser::parseValueStart, we expect the parsing to fail in order to fall through to the variable reference parser.
Comment 4 Justin Michaud 2018-12-21 11:56:05 PST
Created attachment 357962 [details]
Comment 5 WebKit Commit Bot 2018-12-21 13:33:12 PST
Comment on attachment 357962 [details]

Clearing flags on attachment: 357962

Committed r239516: <https://trac.webkit.org/changeset/239516>
Comment 6 WebKit Commit Bot 2018-12-21 13:33:13 PST
All reviewed patches have been landed.  Closing bug.