[CSS Parser] Get CSSParserFastPaths.cpp compiling
authorhyatt@apple.com <hyatt@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 16 Sep 2016 00:33:45 +0000 (00:33 +0000)
committerhyatt@apple.com <hyatt@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 16 Sep 2016 00:33:45 +0000 (00:33 +0000)
commita6e55adfc158f1bcb8b60222db67fb2f13ec0286
treea8f16869b05b5377f061b0dbcd6a14ea7d8a3be1
parent869e4c6342c7cd8eb3c8af86363ee76dc2480ffa
[CSS Parser] Get CSSParserFastPaths.cpp compiling
https://bugs.webkit.org/show_bug.cgi?id=162033

Reviewed by Dean Jackson.

* CMakeLists.txt:
* WebCore.xcodeproj/project.pbxproj:
Add new StyleColor.h/.cpp files to the projecty

* css/CSSFunctionValue.cpp:
(WebCore::CSSFunctionValue::CSSFunctionValue):
(WebCore::CSSFunctionValue::customCSSText):
(WebCore::CSSFunctionValue::append):
(WebCore::CSSFunctionValue::buildParserValueSubstitutingVariables):
* css/CSSFunctionValue.h:
Tweak CSSFunctionValue so that the name can be represented as a keyword ID instead of a String. Eventually we also
want to make CSSFunctionValue subclass CSSValueList rather than referencing a separate CSSValueList as a member. For now
I left that alone though in order to not change too much in the old parser.

* css/CSSProperty.cpp:
(WebCore::CSSProperty::isDescriptorOnly):
Whether or not a property is only a descriptor, e.g., used in viewport and font face stuff.

* css/CSSProperty.h:
* css/CSSValueKeywords.in:
Added new keywords for functions that can be used as values. The new parser uses keywords to represent function names.

* css/StyleColor.cpp: Added.
(WebCore::StyleColor::colorFromKeyword):
(WebCore::StyleColor::isColorKeyword):
(WebCore::StyleColor::isSystemColor):
* css/StyleColor.h: Added.
(WebCore::StyleColor::StyleColor):
(WebCore::StyleColor::currentColor):
(WebCore::StyleColor::isCurrentColor):
(WebCore::StyleColor::getColor):
(WebCore::StyleColor::resolve):
(WebCore::operator==):
(WebCore::operator!=):
New color helper that contains code for checking and looking up colors. This code is similar to some code we already
had in the old CSSParser.cpp file, but this way it can be used outside the parser and/or in different files.

* css/parser/CSSParserFastPaths.cpp:
(WebCore::parseSimpleLengthValue):
(WebCore::isColorPropertyID):
(WebCore::parseColorIntOrPercentage):
(WebCore::fastParseColorInternal):
(WebCore::CSSParserFastPaths::parseColor):
(WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
(WebCore::isUniversalKeyword):
(WebCore::parseKeywordValue):
(WebCore::parseTransformTranslateArguments):
(WebCore::parseTransformNumberArguments):
(WebCore::parseSimpleTransformValue):
(WebCore::transformCanLikelyUseFastPath):
(WebCore::parseSimpleTransformList):
(WebCore::parseSimpleTransform):
(WebCore::CSSParserFastPaths::maybeParseValue):
* css/parser/CSSParserFastPaths.h:
Get everything compiling in this file. Key changes included reverting to our old unit names, making CSSFunctionValue compatible,
adding support for StyleColor, adding support for mode checking of keywords, and fixing up the memory management model so that
RefPtrs are used on returns from parsing functions.

* css/parser/CSSParserIdioms.cpp:
(WebCore::isValueAllowedInMode):
* css/parser/CSSParserIdioms.h:
New helper function for restricting keywords to certain modes only. The -webkit-text color quirk has been moved to this function.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206007 268f45cc-cd09-0410-ab3c-d52691b4dbfc
14 files changed:
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/css/CSSFunctionValue.cpp
Source/WebCore/css/CSSFunctionValue.h
Source/WebCore/css/CSSProperty.cpp
Source/WebCore/css/CSSProperty.h
Source/WebCore/css/CSSValueKeywords.in
Source/WebCore/css/StyleColor.cpp [new file with mode: 0644]
Source/WebCore/css/StyleColor.h [new file with mode: 0644]
Source/WebCore/css/parser/CSSParserFastPaths.cpp
Source/WebCore/css/parser/CSSParserFastPaths.h
Source/WebCore/css/parser/CSSParserIdioms.cpp
Source/WebCore/css/parser/CSSParserIdioms.h