[CSS Parser] Add CSS Variable Parsing support
authorhyatt@apple.com <hyatt@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 13 Sep 2016 19:08:30 +0000 (19:08 +0000)
committerhyatt@apple.com <hyatt@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 13 Sep 2016 19:08:30 +0000 (19:08 +0000)
commit071ed043e30cfb20e8591fbc5d87c89267f61bf6
tree8f8271548883c3200fbbdfbb69f72628e2199c4e
parentca9f60c1de74a4ae7592ff5a00dca37213c24fa4
[CSS Parser] Add CSS Variable Parsing support
https://bugs.webkit.org/show_bug.cgi?id=161916

Reviewed by Dean Jackson.

This patch not only adds the parser for CSS variables (from Blink), but it also brings in
all of the data structures used to store variables and custom property declarations. We
will be abandoning our old data structures eventually in favor of these new ones. They
are not significantly different other than operating on the CSSParserTokenRanges rather
than the soon-to-be-removed parser value lists.

* CMakeLists.txt:
* WebCore.xcodeproj/project.pbxproj:
* css/CSSCustomIdentValue.cpp: Added.
(WebCore::CSSCustomIdentValue::CSSCustomIdentValue):
(WebCore::CSSCustomIdentValue::customCSSText):
* css/CSSCustomIdentValue.h: Added.
(WebCore::CSSCustomIdentValue::create):
(WebCore::CSSCustomIdentValue::value):
(WebCore::CSSCustomIdentValue::isKnownPropertyID):
(WebCore::CSSCustomIdentValue::valueAsPropertyID):
(WebCore::CSSCustomIdentValue::equals):
* css/CSSCustomPropertyDeclaration.cpp: Added.
(WebCore::CSSCustomPropertyDeclaration::customCSSText):
* css/CSSCustomPropertyDeclaration.h: Added.
(WebCore::CSSCustomPropertyDeclaration::create):
(WebCore::CSSCustomPropertyDeclaration::name):
(WebCore::CSSCustomPropertyDeclaration::value):
(WebCore::CSSCustomPropertyDeclaration::id):
(WebCore::CSSCustomPropertyDeclaration::equals):
(WebCore::CSSCustomPropertyDeclaration::CSSCustomPropertyDeclaration):
* css/CSSCustomPropertyValue.h:
* css/CSSValue.cpp:
(WebCore::CSSValue::cssText):
(WebCore::CSSValue::destroy):
* css/CSSValue.h:
(WebCore::CSSValue::isCustomPropertyDeclaration):
(WebCore::CSSValue::isCustomIdentValue):
(WebCore::CSSValue::isVariableReferenceValue):
* css/CSSValueKeywords.in:
* css/CSSVariableData.cpp: Added.
(WebCore::CSSVariableData::updateTokens):
(WebCore::CSSVariableData::operator==):
(WebCore::CSSVariableData::consumeAndUpdateTokens):
(WebCore::CSSVariableData::CSSVariableData):
* css/CSSVariableData.h: Added.
(WebCore::CSSVariableData::create):
(WebCore::CSSVariableData::createResolved):
(WebCore::CSSVariableData::tokenRange):
(WebCore::CSSVariableData::tokens):
(WebCore::CSSVariableData::needsVariableResolution):
(WebCore::CSSVariableData::CSSVariableData):
* css/CSSVariableDependentValue.h:
* css/CSSVariableReferenceValue.cpp: Added.
(WebCore::CSSVariableReferenceValue::customCSSText):
* css/CSSVariableReferenceValue.h: Added.
(WebCore::CSSVariableReferenceValue::create):
(WebCore::CSSVariableReferenceValue::variableDataValue):
(WebCore::CSSVariableReferenceValue::equals):
(WebCore::CSSVariableReferenceValue::CSSVariableReferenceValue):
* css/CSSVariableValue.h:
* css/parser/CSSParserImpl.cpp:
(WebCore::filterProperties):
(WebCore::CSSParserImpl::consumeDeclaration):
(WebCore::CSSParserImpl::consumeVariableValue):
* css/parser/CSSVariableParser.cpp: Added.
(WebCore::CSSVariableParser::isValidVariableName):
(WebCore::classifyBlock):
(WebCore::isValidVariableReference):
(WebCore::classifyVariableRange):
(WebCore::CSSVariableParser::containsValidVariableReferences):
(WebCore::CSSVariableParser::parseDeclarationValue):
* css/parser/CSSVariableParser.h: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205869 268f45cc-cd09-0410-ab3c-d52691b4dbfc
23 files changed:
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/css/CSSCustomIdentValue.cpp [new file with mode: 0644]
Source/WebCore/css/CSSCustomIdentValue.h [new file with mode: 0644]
Source/WebCore/css/CSSCustomPropertyDeclaration.cpp [new file with mode: 0644]
Source/WebCore/css/CSSCustomPropertyDeclaration.h [new file with mode: 0644]
Source/WebCore/css/CSSCustomPropertyValue.h
Source/WebCore/css/CSSValue.cpp
Source/WebCore/css/CSSValue.h
Source/WebCore/css/CSSValueKeywords.in
Source/WebCore/css/CSSVariableData.cpp [new file with mode: 0644]
Source/WebCore/css/CSSVariableData.h [new file with mode: 0644]
Source/WebCore/css/CSSVariableDependentValue.h
Source/WebCore/css/CSSVariableReferenceValue.cpp [new file with mode: 0644]
Source/WebCore/css/CSSVariableReferenceValue.h [new file with mode: 0644]
Source/WebCore/css/CSSVariableValue.h
Source/WebCore/css/parser/CSSAtRuleID.cpp
Source/WebCore/css/parser/CSSParserImpl.cpp
Source/WebCore/css/parser/CSSSelectorParser.cpp
Source/WebCore/css/parser/CSSSupportsParser.cpp
Source/WebCore/css/parser/CSSVariableParser.cpp [new file with mode: 0644]
Source/WebCore/css/parser/CSSVariableParser.h [new file with mode: 0644]