Bug 164075

Summary: [CSS Parser] Implement CSS variables
Product: WebKit Reporter: Dave Hyatt <hyatt>
Component: CSSAssignee: Dave Hyatt <hyatt>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue
Priority: P2    
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch
dino: review+
Patch
dino: review+
Patch dino: review+

Description Dave Hyatt 2016-10-27 13:40:56 PDT
[CSS Parser] Implement CSS variables
Comment 1 Dave Hyatt 2016-10-27 13:54:32 PDT
Created attachment 293052 [details]
Patch
Comment 2 WebKit Commit Bot 2016-10-27 13:55:48 PDT
Attachment 293052 [details] did not pass style-queue:


ERROR: Source/WebCore/css/CSSVariableData.h:63:  Weird number of spaces at line-start.  Are you using a 4-space indent?  [whitespace/indent] [3]
Total errors found: 1 in 24 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Dave Hyatt 2016-10-27 13:57:08 PDT
Created attachment 293053 [details]
Patch
Comment 4 Dean Jackson 2016-10-27 14:08:47 PDT
Comment on attachment 293053 [details]
Patch

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

> Source/WebCore/WebCore.xcodeproj/project.pbxproj:3425
> -		9444CBE81D8861C20073A074 /* CSSVariableData.h in Headers */ = {isa = PBXBuildFile; fileRef = 9444CBDD1D8861580073A074 /* CSSVariableData.h */; };
> +		9444CBE81D8861C20073A074 /* CSSVariableData.h in Headers */ = {isa = PBXBuildFile; fileRef = 9444CBDD1D8861580073A074 /* CSSVariableData.h */; settings = {ATTRIBUTES = (Private, ); }; };

Was this intentional?

> Source/WebCore/css/CSSVariableData.cpp:109
> +            AtomicString variableName =
> +            block.consumeIncludingWhitespace().value().toAtomicString();

Typo. Accidental newline.

> Source/WebCore/css/parser/CSSParser.cpp:1809
> +        const CSSVariableDependentValue& dependentValue = downcast<CSSVariableDependentValue>(value);

You could probably auto this.

> Source/WebCore/css/parser/CSSParser.cpp:1814
> +        CSSPropertyID dependentValuePropertyID = dependentValue.propertyID();

And this. etc.

> Source/WebCore/css/parser/CSSParser.cpp:1858
> +        const CSSVariableReferenceValue& valueWithReferences = downcast<CSSVariableReferenceValue>(value);
> +        const CSSVariableData* variableData = valueWithReferences.variableDataValue();

More autos.

> Source/WebCore/css/parser/CSSParserImpl.cpp:95
> -            CSSCustomPropertyValue* customValue = downcast<CSSCustomPropertyValue>(property.value());
> -            const AtomicString& name = customValue->name();
> -            if (seenCustomProperties.contains(name))
> +            auto& name = downcast<CSSCustomPropertyValue>(*property.value()).name();
> +            if (!seenCustomProperties.add(name).isNewEntry)
>                  continue;
> -            seenCustomProperties.add(name);
> +            output[--unusedEntries] = property;
>              continue;
>          }

I don't understand this change.
Comment 5 Dave Hyatt 2016-10-27 14:12:07 PDT
Created attachment 293054 [details]
Patch
Comment 6 Dean Jackson 2016-10-27 14:31:39 PDT
Comment on attachment 293054 [details]
Patch

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

> Source/WebCore/css/CSSVariableData.cpp:108
> +            AtomicString variableName =

This still needs fixing.
Comment 7 Dave Hyatt 2016-10-27 14:46:03 PDT
Created attachment 293062 [details]
Patch
Comment 8 Dave Hyatt 2016-10-27 15:08:11 PDT
Landed in r208006.