| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2003 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 2003 Lars Knoll (knoll@kde.org) |
| 3 * Copyright (C) 2004, 2005, 2006, 2008, 2009, 2010 Apple Inc. All rights reserv
ed. | 3 * Copyright (C) 2004, 2005, 2006, 2008, 2009, 2010 Apple Inc. All rights reserv
ed. |
| 4 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> | 4 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> |
| 5 * Copyright (C) 2009 - 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserve
d. | 5 * Copyright (C) 2009 - 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserve
d. |
| 6 * | 6 * |
| 7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
| 8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
| 9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
| 10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 class CSSBorderImageSliceValue; | 52 class CSSBorderImageSliceValue; |
| 53 class CSSPrimitiveValue; | 53 class CSSPrimitiveValue; |
| 54 class CSSSelectorList; | 54 class CSSSelectorList; |
| 55 class CSSValue; | 55 class CSSValue; |
| 56 class CSSValueList; | 56 class CSSValueList; |
| 57 class Document; | 57 class Document; |
| 58 class Element; | 58 class Element; |
| 59 class ImmutableStylePropertySet; | 59 class ImmutableStylePropertySet; |
| 60 class MutableStylePropertySet; | 60 class MutableStylePropertySet; |
| 61 class StyleColor; | 61 class StyleColor; |
| 62 class StyleKeyframe; | |
| 63 class StylePropertyShorthand; | 62 class StylePropertyShorthand; |
| 64 class StyleRuleBase; | 63 class StyleRuleBase; |
| 65 class StyleRuleKeyframes; | |
| 66 class StyleSheetContents; | 64 class StyleSheetContents; |
| 67 | 65 |
| 68 // FIXME: This class is shared with CSSTokenizer so should we rename it to CSSSo
urceLocation? | 66 // FIXME: This class is shared with CSSTokenizer so should we rename it to CSSSo
urceLocation? |
| 69 struct CSSParserLocation { | 67 struct CSSParserLocation { |
| 70 unsigned offset; | 68 unsigned offset; |
| 71 unsigned lineNumber; | 69 unsigned lineNumber; |
| 72 CSSParserString token; | 70 CSSParserString token; |
| 73 }; | 71 }; |
| 74 | 72 |
| 75 class BisonCSSParser { | 73 class BisonCSSParser { |
| 76 STACK_ALLOCATED(); | 74 STACK_ALLOCATED(); |
| 77 friend inline int cssyylex(void*, BisonCSSParser*); | 75 friend inline int cssyylex(void*, BisonCSSParser*); |
| 78 public: | 76 public: |
| 79 explicit BisonCSSParser(const CSSParserContext&); | 77 explicit BisonCSSParser(const CSSParserContext&); |
| 80 ~BisonCSSParser(); | 78 ~BisonCSSParser(); |
| 81 | 79 |
| 82 void rollbackLastProperties(int num); | 80 void rollbackLastProperties(int num); |
| 83 void setCurrentProperty(CSSPropertyID); | 81 void setCurrentProperty(CSSPropertyID); |
| 84 | 82 |
| 85 void parseSheet(StyleSheetContents*, const String&); | 83 void parseSheet(StyleSheetContents*, const String&); |
| 86 PassRefPtr<StyleRuleBase> parseRule(StyleSheetContents*, const String&); | 84 PassRefPtr<StyleRuleBase> parseRule(StyleSheetContents*, const String&); |
| 87 PassRefPtr<StyleKeyframe> parseKeyframeRule(StyleSheetContents*, const Strin
g&); | |
| 88 bool parseSupportsCondition(const String&); | 85 bool parseSupportsCondition(const String&); |
| 89 static bool parseValue(MutableStylePropertySet*, CSSPropertyID, const String
&, CSSParserMode, StyleSheetContents*); | 86 static bool parseValue(MutableStylePropertySet*, CSSPropertyID, const String
&, CSSParserMode, StyleSheetContents*); |
| 90 static bool parseColor(RGBA32& color, const String&, bool strict = false); | 87 static bool parseColor(RGBA32& color, const String&, bool strict = false); |
| 91 static StyleColor colorFromRGBColorString(const String&); | 88 static StyleColor colorFromRGBColorString(const String&); |
| 92 static bool parseSystemColor(RGBA32& color, const String&); | 89 static bool parseSystemColor(RGBA32& color, const String&); |
| 93 static PassRefPtr<CSSValueList> parseFontFaceValue(const AtomicString&); | 90 static PassRefPtr<CSSValueList> parseFontFaceValue(const AtomicString&); |
| 94 static PassRefPtr<CSSValue> parseAnimationTimingFunctionValue(const String&)
; | 91 static PassRefPtr<CSSValue> parseAnimationTimingFunctionValue(const String&)
; |
| 95 bool parseDeclaration(MutableStylePropertySet*, const String&, CSSParserObse
rver*, StyleSheetContents* contextStyleSheet); | 92 bool parseDeclaration(MutableStylePropertySet*, const String&, CSSParserObse
rver*, StyleSheetContents* contextStyleSheet); |
| 96 static PassRefPtr<ImmutableStylePropertySet> parseInlineStyleDeclaration(con
st String&, Element*); | 93 static PassRefPtr<ImmutableStylePropertySet> parseInlineStyleDeclaration(con
st String&, Element*); |
| 97 PassOwnPtr<Vector<double> > parseKeyframeKeyList(const String&); | |
| 98 bool parseAttributeMatchType(CSSSelector::AttributeMatchType&, const String&
); | 94 bool parseAttributeMatchType(CSSSelector::AttributeMatchType&, const String&
); |
| 99 | 95 |
| 100 static bool parseValue(MutableStylePropertySet*, CSSPropertyID, const String
&, const Document&); | 96 static bool parseValue(MutableStylePropertySet*, CSSPropertyID, const String
&, const Document&); |
| 101 | 97 |
| 102 bool parseValue(CSSPropertyID); | 98 bool parseValue(CSSPropertyID); |
| 103 void parseSelector(const String&, CSSSelectorList&); | 99 void parseSelector(const String&, CSSSelectorList&); |
| 104 | 100 |
| 105 CSSParserSelector* createFloatingSelector(); | 101 CSSParserSelector* createFloatingSelector(); |
| 106 CSSParserSelector* createFloatingSelectorWithTagName(const QualifiedName&); | 102 CSSParserSelector* createFloatingSelectorWithTagName(const QualifiedName&); |
| 107 PassOwnPtr<CSSParserSelector> sinkFloatingSelector(CSSParserSelector*); | 103 PassOwnPtr<CSSParserSelector> sinkFloatingSelector(CSSParserSelector*); |
| 108 | 104 |
| 109 Vector<OwnPtr<CSSParserSelector> >* createFloatingSelectorVector(); | 105 Vector<OwnPtr<CSSParserSelector> >* createFloatingSelectorVector(); |
| 110 PassOwnPtr<Vector<OwnPtr<CSSParserSelector> > > sinkFloatingSelectorVector(V
ector<OwnPtr<CSSParserSelector> >*); | 106 PassOwnPtr<Vector<OwnPtr<CSSParserSelector> > > sinkFloatingSelectorVector(V
ector<OwnPtr<CSSParserSelector> >*); |
| 111 | 107 |
| 112 CSSParserValueList* createFloatingValueList(); | 108 CSSParserValueList* createFloatingValueList(); |
| 113 PassOwnPtr<CSSParserValueList> sinkFloatingValueList(CSSParserValueList*); | 109 PassOwnPtr<CSSParserValueList> sinkFloatingValueList(CSSParserValueList*); |
| 114 | 110 |
| 115 CSSParserFunction* createFloatingFunction(); | 111 CSSParserFunction* createFloatingFunction(); |
| 116 CSSParserFunction* createFloatingFunction(const CSSParserString& name, PassO
wnPtr<CSSParserValueList> args); | 112 CSSParserFunction* createFloatingFunction(const CSSParserString& name, PassO
wnPtr<CSSParserValueList> args); |
| 117 PassOwnPtr<CSSParserFunction> sinkFloatingFunction(CSSParserFunction*); | 113 PassOwnPtr<CSSParserFunction> sinkFloatingFunction(CSSParserFunction*); |
| 118 | 114 |
| 119 CSSParserValue& sinkFloatingValue(CSSParserValue&); | 115 CSSParserValue& sinkFloatingValue(CSSParserValue&); |
| 120 | 116 |
| 121 StyleKeyframe* createKeyframe(CSSParserValueList*); | |
| 122 StyleRuleKeyframes* createKeyframesRule(const String&, PassOwnPtr<Vector<Ref
Ptr<StyleKeyframe> > >, bool isPrefixed); | |
| 123 | |
| 124 typedef Vector<RefPtr<StyleRuleBase> > RuleList; | 117 typedef Vector<RefPtr<StyleRuleBase> > RuleList; |
| 125 RuleList* createRuleList(); | 118 RuleList* createRuleList(); |
| 126 RuleList* appendRule(RuleList*, StyleRuleBase*); | 119 RuleList* appendRule(RuleList*, StyleRuleBase*); |
| 127 StyleRuleBase* createStyleRule(Vector<OwnPtr<CSSParserSelector> >* selectors
); | 120 StyleRuleBase* createStyleRule(Vector<OwnPtr<CSSParserSelector> >* selectors
); |
| 128 StyleRuleBase* createFontFaceRule(); | 121 StyleRuleBase* createFontFaceRule(); |
| 129 StyleRuleBase* createSupportsRule(bool conditionIsSupported, RuleList*); | 122 StyleRuleBase* createSupportsRule(bool conditionIsSupported, RuleList*); |
| 130 void markSupportsRuleHeaderStart(); | 123 void markSupportsRuleHeaderStart(); |
| 131 void markSupportsRuleHeaderEnd(); | 124 void markSupportsRuleHeaderEnd(); |
| 132 PassRefPtr<CSSRuleSourceData> popSupportsRuleData(); | 125 PassRefPtr<CSSRuleSourceData> popSupportsRuleData(); |
| 133 StyleRuleBase* createHostRule(RuleList* rules); | 126 StyleRuleBase* createHostRule(RuleList* rules); |
| 134 | 127 |
| 135 void startDeclarationsForMarginBox(); | 128 void startDeclarationsForMarginBox(); |
| 136 void endDeclarationsForMarginBox(); | 129 void endDeclarationsForMarginBox(); |
| 137 | 130 |
| 138 Vector<RefPtr<StyleKeyframe> >* createFloatingKeyframeVector(); | |
| 139 PassOwnPtr<Vector<RefPtr<StyleKeyframe> > > sinkFloatingKeyframeVector(Vecto
r<RefPtr<StyleKeyframe> >*); | |
| 140 | |
| 141 CSSParserSelector* rewriteSpecifiersWithElementName(const AtomicString& name
spacePrefix, const AtomicString& elementName, CSSParserSelector*, bool isNamespa
cePlaceholder = false); | 131 CSSParserSelector* rewriteSpecifiersWithElementName(const AtomicString& name
spacePrefix, const AtomicString& elementName, CSSParserSelector*, bool isNamespa
cePlaceholder = false); |
| 142 CSSParserSelector* rewriteSpecifiersWithNamespaceIfNeeded(CSSParserSelector*
); | 132 CSSParserSelector* rewriteSpecifiersWithNamespaceIfNeeded(CSSParserSelector*
); |
| 143 CSSParserSelector* rewriteSpecifiers(CSSParserSelector*, CSSParserSelector*)
; | 133 CSSParserSelector* rewriteSpecifiers(CSSParserSelector*, CSSParserSelector*)
; |
| 144 CSSParserSelector* rewriteSpecifiersForShadowDistributed(CSSParserSelector*
specifiers, CSSParserSelector* distributedPseudoElementSelector); | 134 CSSParserSelector* rewriteSpecifiersForShadowDistributed(CSSParserSelector*
specifiers, CSSParserSelector* distributedPseudoElementSelector); |
| 145 | 135 |
| 146 void invalidBlockHit() { } | 136 void invalidBlockHit() { } |
| 147 | 137 |
| 148 Vector<OwnPtr<CSSParserSelector> >* reusableSelectorVector() { return &m_reu
sableSelectorVector; } | 138 Vector<OwnPtr<CSSParserSelector> >* reusableSelectorVector() { return &m_reu
sableSelectorVector; } |
| 149 | 139 |
| 150 void clearProperties(); | 140 void clearProperties(); |
| 151 | 141 |
| 152 PassRefPtr<ImmutableStylePropertySet> createStylePropertySet(); | 142 PassRefPtr<ImmutableStylePropertySet> createStylePropertySet(); |
| 153 | 143 |
| 154 CSSParserContext m_context; | 144 CSSParserContext m_context; |
| 155 | 145 |
| 156 CSSPropertyID m_id; | 146 CSSPropertyID m_id; |
| 157 RawPtr<StyleSheetContents> m_styleSheet; | 147 RawPtr<StyleSheetContents> m_styleSheet; |
| 158 RefPtr<StyleRuleBase> m_rule; | 148 RefPtr<StyleRuleBase> m_rule; |
| 159 RefPtr<StyleKeyframe> m_keyframe; | |
| 160 OwnPtr<CSSParserValueList> m_valueList; | 149 OwnPtr<CSSParserValueList> m_valueList; |
| 161 bool m_supportsCondition; | 150 bool m_supportsCondition; |
| 162 | 151 |
| 163 Vector<CSSProperty, 256> m_parsedProperties; | 152 Vector<CSSProperty, 256> m_parsedProperties; |
| 164 CSSSelectorList* m_selectorListForParseSelector; | 153 CSSSelectorList* m_selectorListForParseSelector; |
| 165 | 154 |
| 166 unsigned m_numParsedPropertiesBeforeMarginBox; | 155 unsigned m_numParsedPropertiesBeforeMarginBox; |
| 167 | 156 |
| 168 bool m_hadSyntacticallyValidCSSRule; | 157 bool m_hadSyntacticallyValidCSSRule; |
| 169 bool m_ignoreErrors; | 158 bool m_ignoreErrors; |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 bool m_ruleHasHeader; | 214 bool m_ruleHasHeader; |
| 226 | 215 |
| 227 bool m_allowImportRules; | 216 bool m_allowImportRules; |
| 228 bool m_allowNamespaceDeclarations; | 217 bool m_allowNamespaceDeclarations; |
| 229 | 218 |
| 230 bool m_inViewport; | 219 bool m_inViewport; |
| 231 | 220 |
| 232 CSSParserLocation m_locationLabel; | 221 CSSParserLocation m_locationLabel; |
| 233 | 222 |
| 234 Vector<RefPtr<StyleRuleBase> > m_parsedRules; | 223 Vector<RefPtr<StyleRuleBase> > m_parsedRules; |
| 235 Vector<RefPtr<StyleKeyframe> > m_parsedKeyframes; | |
| 236 Vector<OwnPtr<RuleList> > m_parsedRuleLists; | 224 Vector<OwnPtr<RuleList> > m_parsedRuleLists; |
| 237 Vector<CSSParserSelector*> m_floatingSelectors; | 225 Vector<CSSParserSelector*> m_floatingSelectors; |
| 238 Vector<Vector<OwnPtr<CSSParserSelector> >*> m_floatingSelectorVectors; | 226 Vector<Vector<OwnPtr<CSSParserSelector> >*> m_floatingSelectorVectors; |
| 239 Vector<CSSParserValueList*> m_floatingValueLists; | 227 Vector<CSSParserValueList*> m_floatingValueLists; |
| 240 Vector<CSSParserFunction*> m_floatingFunctions; | 228 Vector<CSSParserFunction*> m_floatingFunctions; |
| 241 | 229 |
| 242 OwnPtr<Vector<RefPtr<StyleKeyframe> > > m_floatingKeyframeVector; | |
| 243 | |
| 244 Vector<OwnPtr<CSSParserSelector> > m_reusableSelectorVector; | 230 Vector<OwnPtr<CSSParserSelector> > m_reusableSelectorVector; |
| 245 | 231 |
| 246 OwnPtr<RuleSourceDataList> m_supportsRuleDataStack; | 232 OwnPtr<RuleSourceDataList> m_supportsRuleDataStack; |
| 247 | 233 |
| 248 CSSTokenizer m_tokenizer; | 234 CSSTokenizer m_tokenizer; |
| 249 | 235 |
| 250 friend class TransformOperationInfo; | 236 friend class TransformOperationInfo; |
| 251 friend class FilterOperationInfo; | 237 friend class FilterOperationInfo; |
| 252 }; | 238 }; |
| 253 | 239 |
| 254 inline int cssyylex(void* yylval, BisonCSSParser* parser) | 240 inline int cssyylex(void* yylval, BisonCSSParser* parser) |
| 255 { | 241 { |
| 256 return parser->m_tokenizer.lex(yylval); | 242 return parser->m_tokenizer.lex(yylval); |
| 257 } | 243 } |
| 258 | 244 |
| 259 bool isValidNthToken(const CSSParserString&); | 245 bool isValidNthToken(const CSSParserString&); |
| 260 | 246 |
| 261 } // namespace blink | 247 } // namespace blink |
| 262 | 248 |
| 263 #endif // SKY_ENGINE_CORE_CSS_PARSER_BISONCSSPARSER_H_ | 249 #endif // SKY_ENGINE_CORE_CSS_PARSER_BISONCSSPARSER_H_ |
| OLD | NEW |