diff options
| author | Simon Hausmann <simon.hausmann@nokia.com> | 2012-09-10 19:10:20 +0200 |
|---|---|---|
| committer | Simon Hausmann <simon.hausmann@nokia.com> | 2012-09-10 19:10:20 +0200 |
| commit | 284837daa07b29d6a63a748544a90b1f5842ac5c (patch) | |
| tree | ecd258180bde91fe741e0cfd2638beb3c6da7e8e /Source/WebCore/css/CSSParser.h | |
| parent | 2e2ba8ff45915f40ed3e014101269c175f2a89a0 (diff) | |
| download | qtwebkit-284837daa07b29d6a63a748544a90b1f5842ac5c.tar.gz | |
Imported WebKit commit 68645295d2e3e09af2c942f092556f06aa5f8b0d (http://svn.webkit.org/repository/webkit/trunk@128073)
New snapshot
Diffstat (limited to 'Source/WebCore/css/CSSParser.h')
| -rw-r--r-- | Source/WebCore/css/CSSParser.h | 128 |
1 files changed, 112 insertions, 16 deletions
diff --git a/Source/WebCore/css/CSSParser.h b/Source/WebCore/css/CSSParser.h index 16e5bd70c..e33090f83 100644 --- a/Source/WebCore/css/CSSParser.h +++ b/Source/WebCore/css/CSSParser.h @@ -51,7 +51,7 @@ class CSSProperty; class CSSSelectorList; class CSSValue; class CSSValueList; -class CSSWrapShape; +class CSSBasicShape; class Document; class Element; class MediaQueryExp; @@ -66,10 +66,13 @@ class StyleSheetContents; class StyledElement; #if ENABLE(CSS_SHADERS) +class WebKitCSSArrayFunctionValue; class WebKitCSSMixFunctionValue; #endif class CSSParser { + friend inline int cssyylex(void*, CSSParser*); + public: CSSParser(const CSSParserContext&); @@ -148,11 +151,11 @@ public: bool parseClipShape(CSSPropertyID, bool important); - bool parseExclusionShape(bool shapeInside, bool important); - PassRefPtr<CSSWrapShape> parseExclusionShapeRectangle(CSSParserValueList* args); - PassRefPtr<CSSWrapShape> parseExclusionShapeCircle(CSSParserValueList* args); - PassRefPtr<CSSWrapShape> parseExclusionShapeEllipse(CSSParserValueList* args); - PassRefPtr<CSSWrapShape> parseExclusionShapePolygon(CSSParserValueList* args); + bool parseBasicShape(CSSPropertyID, bool important); + PassRefPtr<CSSBasicShape> parseBasicShapeRectangle(CSSParserValueList* args); + PassRefPtr<CSSBasicShape> parseBasicShapeCircle(CSSParserValueList* args); + PassRefPtr<CSSBasicShape> parseBasicShapeEllipse(CSSParserValueList* args); + PassRefPtr<CSSBasicShape> parseBasicShapePolygon(CSSParserValueList* args); bool parseFont(bool important); PassRefPtr<CSSValueList> parseFontFamily(); @@ -219,6 +222,7 @@ public: PassRefPtr<CSSValueList> parseFilter(); PassRefPtr<WebKitCSSFilterValue> parseBuiltinFilterArguments(CSSParserValueList*, WebKitCSSFilterValue::FilterOperationType); #if ENABLE(CSS_SHADERS) + PassRefPtr<WebKitCSSArrayFunctionValue> parseCustomFilterArrayFunction(CSSParserValue*); PassRefPtr<WebKitCSSMixFunctionValue> parseMixFunction(CSSParserValue*); PassRefPtr<WebKitCSSFilterValue> parseCustomFilter(CSSParserValue*); PassRefPtr<CSSValueList> parseCustomFilterTransform(CSSParserValueList*); @@ -354,7 +358,9 @@ public: PassRefPtr<CSSRuleSourceData> popRuleData(); void resetPropertyRange() { m_propertyRange.start = m_propertyRange.end = UINT_MAX; } bool isExtractingSourceData() const { return !!m_currentRuleDataStack; } - int lex(void* yylval); + + inline int lex(void* yylval) { return (this->*m_lexFunc)(yylval); } + int token() { return m_token; } PassRefPtr<CSSPrimitiveValue> createPrimitiveNumericValue(CSSParserValue*); @@ -363,23 +369,72 @@ public: static KURL completeURL(const CSSParserContext&, const String& url); private: + bool is8BitSource() { return m_is8BitSource; } + + template <typename SourceCharacterType> + int realLex(void* yylval); + + UChar*& currentCharacter16(); + + template <typename CharacterType> + inline CharacterType*& currentCharacter(); + + template <typename CharacterType> + inline CharacterType* tokenStart(); + + template <typename CharacterType> + inline void setTokenStart(CharacterType*); + + inline unsigned tokenStartOffset(); + inline UChar tokenStartChar(); + + template <typename CharacterType> inline bool isIdentifierStart(); - static inline UChar* checkAndSkipString(UChar*, UChar); + template <typename CharacterType> + static inline CharacterType* checkAndSkipString(CharacterType*, int); - void parseEscape(UChar*&); - inline void parseIdentifier(UChar*&, bool&); - inline void parseString(UChar*&, UChar); - inline void parseURI(UChar*&, UChar*&); + template <typename CharacterType> + unsigned parseEscape(CharacterType*&); + template <typename DestCharacterType> + inline void UnicodeToChars(DestCharacterType*&, unsigned); + template <typename SrcCharacterType, typename DestCharacterType> + inline bool parseIdentifierInternal(SrcCharacterType*&, DestCharacterType*&, bool&); + + template <typename CharacterType> + inline void parseIdentifier(CharacterType*&, CSSParserString&, bool&); + + template <typename SrcCharacterType, typename DestCharacterType> + inline bool parseStringInternal(SrcCharacterType*&, DestCharacterType*&, UChar); + + template <typename CharacterType> + inline void parseString(CharacterType*&, CSSParserString& resultString, UChar); + + template <typename CharacterType> + inline bool parseURIInternal(CharacterType*&, CharacterType*&); + + template <typename CharacterType> + inline void parseURI(CSSParserString&); + template <typename CharacterType> inline bool parseUnicodeRange(); + template <typename CharacterType> bool parseNthChild(); + template <typename CharacterType> bool parseNthChildExtra(); + template <typename CharacterType> inline void detectFunctionTypeToken(int); + template <typename CharacterType> inline void detectMediaQueryToken(int); - inline void detectNumberToken(UChar*, int); + template <typename CharacterType> + inline void detectNumberToken(CharacterType*, int); + template <typename CharacterType> inline void detectDashToken(int); + template <typename CharacterType> inline void detectAtToken(int, bool); + template <typename CharacterType> + inline void setRuleHeaderEnd(const CharacterType*); + void setStyleSheet(StyleSheetContents*); inline bool inStrictMode() const { return m_context.mode == CSSStrictMode || m_context.mode == SVGAttributeMode; } @@ -430,9 +485,16 @@ private: }; ParsingMode m_parsingMode; - OwnArrayPtr<UChar> m_dataStart; - UChar* m_currentCharacter; - UChar* m_tokenStart; + bool m_is8BitSource; + OwnArrayPtr<LChar> m_dataStart8; + OwnArrayPtr<UChar> m_dataStart16; + LChar* m_currentCharacter8; + UChar* m_currentCharacter16; + union { + LChar* ptr8; + UChar* ptr16; + } m_tokenStart; + unsigned m_length; int m_token; int m_lineNumber; int m_lastSelectorLineNumber; @@ -440,6 +502,8 @@ private: bool m_allowImportRules; bool m_allowNamespaceDeclarations; + int (CSSParser::*m_lexFunc)(void*); + Vector<RefPtr<StyleRuleBase> > m_parsedRules; Vector<RefPtr<StyleKeyframe> > m_parsedKeyframes; Vector<RefPtr<MediaQuerySet> > m_parsedMediaQuerySets; @@ -535,6 +599,38 @@ String quoteCSSStringIfNeeded(const String&); String quoteCSSURLIfNeeded(const String&); bool isValidNthToken(const CSSParserString&); + +template <> +inline void CSSParser::setTokenStart<LChar>(LChar* tokenStart) +{ + m_tokenStart.ptr8 = tokenStart; +} + +template <> +inline void CSSParser::setTokenStart<UChar>(UChar* tokenStart) +{ + m_tokenStart.ptr16 = tokenStart; +} + +inline unsigned CSSParser::tokenStartOffset() +{ + if (is8BitSource()) + return m_tokenStart.ptr8 - m_dataStart8.get(); + return m_tokenStart.ptr16 - m_dataStart16.get(); +} + +inline UChar CSSParser::tokenStartChar() +{ + if (is8BitSource()) + return *m_tokenStart.ptr8; + return *m_tokenStart.ptr16; +} + +inline int cssyylex(void* yylval, CSSParser* parser) +{ + return parser->lex(yylval); +} + } // namespace WebCore #endif // CSSParser_h |
