Bug 116829 - [CSS] -webkit-var prefix is case-sensitive
Summary: [CSS] -webkit-var prefix is case-sensitive
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Claudio Saavedra
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-05-27 08:20 PDT by Claudio Saavedra
Modified: 2013-05-27 13:58 PDT (History)
8 users (show)

See Also:


Attachments
Patch (3.66 KB, patch)
2013-05-27 08:25 PDT, Claudio Saavedra
no flags Details | Formatted Diff | Diff
Patch (4.44 KB, patch)
2013-05-27 12:43 PDT, Claudio Saavedra
darin: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Claudio Saavedra 2013-05-27 08:20:39 PDT
[CSS] -webkit-var prefix is case-sensitive
Comment 1 Claudio Saavedra 2013-05-27 08:25:55 PDT
Created attachment 202987 [details]
Patch
Comment 2 Sergio Villar Senin 2013-05-27 09:28:18 PDT
Comment on attachment 202987 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=202987&action=review

The fix looks sane to me, just some minor comments.

> Source/WebCore/css/CSSParser.cpp:9866
> +    do {

The first assert of the case insensitive version still applies here, not sure if adding it pays off though as this is only used by the CSS custom properties stuff.

> Source/WebCore/css/CSSParser.cpp:9867
> +        if ((*string++) != (*constantString++))

I guess you can omit the parentheses here

> LayoutTests/fast/css/variables/case-sensitive.html:11
> +  -WEBKIT-VAR-padding: 200px;

What about adding something like "with no left padding" to the <p> in order to better explain test results?
Comment 3 Darin Adler 2013-05-27 12:32:56 PDT
Why is -webkit-var case sensitive when other things in CSS are not? Could you point to the specification that says it should be?
Comment 4 Claudio Saavedra 2013-05-27 12:43:34 PDT
Created attachment 203003 [details]
Patch
Comment 5 Claudio Saavedra 2013-05-27 12:45:18 PDT
(In reply to comment #3)
> Why is -webkit-var case sensitive when other things in CSS are not? Could you point to the specification that says it should be?

"Unlike other CSS properties, custom property names are case-sensitive. The "var-" prefix must be written in lower-case.

For example, VAR-FOO is invalid, because the prefix isn't "var-".
While both var-foo and var-FOO are valid, they are distinct properties - using var(foo) will refer to the first one, while using var(FOO) will refer to the second."

http://dev.w3.org/csswg/css-variables/#defining-variables
Comment 6 Darin Adler 2013-05-27 13:06:02 PDT
Comment on attachment 203003 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=203003&action=review

> Source/WebCore/css/CSSParser.cpp:9867
> +        ASSERT((*constantString >= 'a' && *constantString <= 'z') || *constantString == '-');

There is no reason to have this assertion. I know the previous reviewer suggested you add it. But the assertion above is there because it’s a precondition to calling toASCIILowerUnchecked. There’s no corresponding issue here and no need for the assertion.
Comment 7 Claudio Saavedra 2013-05-27 13:58:49 PDT
Committed r150776: <http://trac.webkit.org/changeset/150776>