Initial landing of CSS Parser Tokenization (and files to support that). Not used...
authorhyatt@apple.com <hyatt@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 28 Aug 2016 15:46:11 +0000 (15:46 +0000)
committerhyatt@apple.com <hyatt@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 28 Aug 2016 15:46:11 +0000 (15:46 +0000)
commitacced7ad1da94f2b44bc69d9f5a3dff2cb6168f3
tree5ae358b3682e452226d929ea981694c2787d8260
parent89758d905be87d90c63ece2593b3ca752fc524be
Initial landing of CSS Parser Tokenization (and files to support that). Not used yet.
https://bugs.webkit.org/show_bug.cgi?id=161174

This code is imported from Blink and is their CSS parser (modified to work in WebKit).
It is from commit e4bb90df7f2ed8a63975b5ed27a1b488cb9b146f, Mon Aug 22 2016.

Reviewed by Simon Fraser.

* CMakeLists.txt:
* WebCore.xcodeproj/project.pbxproj:
* css/CSSMarkup.cpp: Added.
(WebCore::isCSSTokenizerIdentifier):
(WebCore::serializeCharacter):
(WebCore::serializeCharacterAsCodePoint):
(WebCore::serializeIdentifier):
(WebCore::serializeString):
(WebCore::serializeURI):
(WebCore::serializeFontFamily):
* css/CSSMarkup.h: Added.
* css/CSSOMUtils.cpp: Removed.
* css/CSSOMUtils.h: Removed.
* css/CSSSelector.cpp:
* css/parser/CSSParserFastPaths.cpp: Added.
* css/parser/CSSParserFastPaths.h: Added.
* css/parser/CSSParserIdioms.h: Added.
(WebCore::isCSSSpace):
(WebCore::isNameStartCodePoint):
(WebCore::isNameCodePoint):
* css/parser/CSSParserObserver.h: Added.
(WebCore::CSSParserObserver::~CSSParserObserver):
* css/parser/CSSParserObserverWrapper.cpp: Added.
(WebCore::CSSParserObserverWrapper::startOffset):
(WebCore::CSSParserObserverWrapper::previousTokenStartOffset):
(WebCore::CSSParserObserverWrapper::endOffset):
(WebCore::CSSParserObserverWrapper::skipCommentsBefore):
(WebCore::CSSParserObserverWrapper::yieldCommentsBefore):
* css/parser/CSSParserObserverWrapper.h: Added.
(WebCore::CSSParserObserverWrapper::CSSParserObserverWrapper):
(WebCore::CSSParserObserverWrapper::observer):
(WebCore::CSSParserObserverWrapper::addComment):
(WebCore::CSSParserObserverWrapper::addToken):
(WebCore::CSSParserObserverWrapper::finalizeConstruction):
* css/parser/CSSParserToken.cpp: Added.
(WebCore::cssPrimitiveValueUnitFromTrie):
(WebCore::stringToUnitType):
(WebCore::CSSParserToken::CSSParserToken):
(WebCore::CSSParserToken::convertToDimensionWithUnit):
(WebCore::CSSParserToken::convertToPercentage):
(WebCore::CSSParserToken::delimiter):
(WebCore::CSSParserToken::numericSign):
(WebCore::CSSParserToken::numericValueType):
(WebCore::CSSParserToken::numericValue):
(WebCore::CSSParserToken::parseAsUnresolvedCSSPropertyID):
(WebCore::CSSParserToken::id):
(WebCore::CSSParserToken::functionId):
(WebCore::CSSParserToken::hasStringBacking):
(WebCore::CSSParserToken::copyWithUpdatedString):
(WebCore::CSSParserToken::valueDataCharRawEqual):
(WebCore::CSSParserToken::operator==):
(WebCore::CSSParserToken::serialize):
* css/parser/CSSParserToken.h: Added.
(WebCore::CSSParserToken::operator!=):
(WebCore::CSSParserToken::type):
(WebCore::CSSParserToken::value):
(WebCore::CSSParserToken::getHashTokenType):
(WebCore::CSSParserToken::getBlockType):
(WebCore::CSSParserToken::unitType):
(WebCore::CSSParserToken::unicodeRangeStart):
(WebCore::CSSParserToken::unicodeRangeEnd):
(WebCore::CSSParserToken::initValueFromStringView):
* css/parser/CSSParserTokenRange.cpp: Added.
(WebCore::CSSParserTokenRange::eofToken):
(WebCore::CSSParserTokenRange::makeSubRange):
(WebCore::CSSParserTokenRange::consumeBlock):
(WebCore::CSSParserTokenRange::consumeComponentValue):
(WebCore::CSSParserTokenRange::serialize):
* css/parser/CSSParserTokenRange.h: Added.
(WebCore::CSSParserTokenRange::CSSParserTokenRange):
(WebCore::CSSParserTokenRange::atEnd):
(WebCore::CSSParserTokenRange::end):
(WebCore::CSSParserTokenRange::peek):
(WebCore::CSSParserTokenRange::consume):
(WebCore::CSSParserTokenRange::consumeIncludingWhitespace):
(WebCore::CSSParserTokenRange::consumeWhitespace):
(WebCore::CSSParserTokenRange::begin):
* css/parser/CSSPropertyParser.cpp: Added.
(WebCore::hasPrefix):
(WebCore::cssPropertyID):
(WebCore::cssPropertyNameIOSAliasing):
(WebCore::isAppleLegacyCssValueKeyword):
(WebCore::cssValueKeywordID):
(WebCore::unresolvedCSSPropertyID):
* css/parser/CSSPropertyParser.h: Added.
(WebCore::CSSPropertyParser::inQuirksMode):
* css/parser/CSSPropertyParserHelpers.cpp: Added.
* css/parser/CSSPropertyParserHelpers.h: Added.
(WebCore::CSSPropertyParserHelpers::identMatches):
(WebCore::CSSPropertyParserHelpers::consumeIdent):
(WebCore::CSSPropertyParserHelpers::isCSSWideKeyword):
* css/parser/CSSTokenizer.cpp: Added.
(WebCore::CSSTokenizer::Scope::Scope):
(WebCore::CSSTokenizer::Scope::tokenRange):
(WebCore::CSSTokenizer::Scope::tokenCount):
(WebCore::isNewLine):
(WebCore::twoCharsAreValidEscape):
(WebCore::CSSTokenizer::CSSTokenizer):
(WebCore::CSSTokenizer::reconsume):
(WebCore::CSSTokenizer::consume):
(WebCore::CSSTokenizer::whiteSpace):
(WebCore::CSSTokenizer::blockStart):
(WebCore::CSSTokenizer::blockEnd):
(WebCore::CSSTokenizer::leftParenthesis):
(WebCore::CSSTokenizer::rightParenthesis):
(WebCore::CSSTokenizer::leftBracket):
(WebCore::CSSTokenizer::rightBracket):
(WebCore::CSSTokenizer::leftBrace):
(WebCore::CSSTokenizer::rightBrace):
(WebCore::CSSTokenizer::plusOrFullStop):
(WebCore::CSSTokenizer::asterisk):
(WebCore::CSSTokenizer::lessThan):
(WebCore::CSSTokenizer::comma):
(WebCore::CSSTokenizer::hyphenMinus):
(WebCore::CSSTokenizer::solidus):
(WebCore::CSSTokenizer::colon):
(WebCore::CSSTokenizer::semiColon):
(WebCore::CSSTokenizer::hash):
(WebCore::CSSTokenizer::circumflexAccent):
(WebCore::CSSTokenizer::dollarSign):
(WebCore::CSSTokenizer::verticalLine):
(WebCore::CSSTokenizer::tilde):
(WebCore::CSSTokenizer::commercialAt):
(WebCore::CSSTokenizer::reverseSolidus):
(WebCore::CSSTokenizer::asciiDigit):
(WebCore::CSSTokenizer::letterU):
(WebCore::CSSTokenizer::nameStart):
(WebCore::CSSTokenizer::stringStart):
(WebCore::CSSTokenizer::endOfFile):
(WebCore::CSSTokenizer::nextToken):
(WebCore::CSSTokenizer::consumeNumber):
(WebCore::CSSTokenizer::consumeNumericToken):
(WebCore::CSSTokenizer::consumeIdentLikeToken):
(WebCore::CSSTokenizer::consumeStringTokenUntil):
(WebCore::CSSTokenizer::consumeUnicodeRange):
(WebCore::isNonPrintableCodePoint):
(WebCore::CSSTokenizer::consumeUrlToken):
(WebCore::CSSTokenizer::consumeBadUrlRemnants):
(WebCore::CSSTokenizer::consumeSingleWhitespaceIfNext):
(WebCore::CSSTokenizer::consumeUntilCommentEndFound):
(WebCore::CSSTokenizer::consumeIfNext):
(WebCore::CSSTokenizer::consumeName):
(WebCore::CSSTokenizer::consumeEscape):
(WebCore::CSSTokenizer::nextTwoCharsAreValidEscape):
(WebCore::CSSTokenizer::nextCharsAreNumber):
(WebCore::CSSTokenizer::nextCharsAreIdentifier):
(WebCore::CSSTokenizer::registerString):
* css/parser/CSSTokenizer.h: Added.
(WebCore::CSSTokenizer::Scope::storeString):
* css/parser/CSSTokenizerInputStream.cpp: Added.
(WebCore::CSSTokenizerInputStream::CSSTokenizerInputStream):
(WebCore::CSSTokenizerInputStream::advanceUntilNonWhitespace):
(WebCore::CSSTokenizerInputStream::getDouble):
* css/parser/CSSTokenizerInputStream.h: Added.
(WebCore::CSSTokenizerInputStream::nextInputChar):
(WebCore::CSSTokenizerInputStream::peekWithoutReplacement):
(WebCore::CSSTokenizerInputStream::advance):
(WebCore::CSSTokenizerInputStream::pushBack):
(WebCore::CSSTokenizerInputStream::skipWhilePredicate):
(WebCore::CSSTokenizerInputStream::length):
(WebCore::CSSTokenizerInputStream::offset):
(WebCore::CSSTokenizerInputStream::rangeAt):
* platform/Length.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205103 268f45cc-cd09-0410-ab3c-d52691b4dbfc
29 files changed:
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/css/CSSAllInOne.cpp
Source/WebCore/css/CSSMarkup.cpp [new file with mode: 0644]
Source/WebCore/css/CSSMarkup.h [new file with mode: 0644]
Source/WebCore/css/CSSOMUtils.cpp [deleted file]
Source/WebCore/css/CSSSelector.cpp
Source/WebCore/css/DOMCSSNamespace.cpp
Source/WebCore/css/parser/CSSParser.cpp
Source/WebCore/css/parser/CSSParserFastPaths.cpp [new file with mode: 0644]
Source/WebCore/css/parser/CSSParserFastPaths.h [new file with mode: 0644]
Source/WebCore/css/parser/CSSParserIdioms.h [moved from Source/WebCore/css/CSSOMUtils.h with 66% similarity]
Source/WebCore/css/parser/CSSParserObserver.h [new file with mode: 0644]
Source/WebCore/css/parser/CSSParserObserverWrapper.cpp [new file with mode: 0644]
Source/WebCore/css/parser/CSSParserObserverWrapper.h [new file with mode: 0644]
Source/WebCore/css/parser/CSSParserToken.cpp [new file with mode: 0644]
Source/WebCore/css/parser/CSSParserToken.h [new file with mode: 0644]
Source/WebCore/css/parser/CSSParserTokenRange.cpp [new file with mode: 0644]
Source/WebCore/css/parser/CSSParserTokenRange.h [new file with mode: 0644]
Source/WebCore/css/parser/CSSPropertyParser.cpp [new file with mode: 0644]
Source/WebCore/css/parser/CSSPropertyParser.h [new file with mode: 0644]
Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp [new file with mode: 0644]
Source/WebCore/css/parser/CSSPropertyParserHelpers.h [new file with mode: 0644]
Source/WebCore/css/parser/CSSTokenizer.cpp [new file with mode: 0644]
Source/WebCore/css/parser/CSSTokenizer.h [new file with mode: 0644]
Source/WebCore/css/parser/CSSTokenizerInputStream.cpp [new file with mode: 0644]
Source/WebCore/css/parser/CSSTokenizerInputStream.h [new file with mode: 0644]
Source/WebCore/platform/Length.h