| 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 | 82 |
| 83 public: | 83 public: |
| 84 BisonCSSParser(const CSSParserContext&); | 84 BisonCSSParser(const CSSParserContext&); |
| 85 ~BisonCSSParser(); | 85 ~BisonCSSParser(); |
| 86 | 86 |
| 87 void rollbackLastProperties(int num); | 87 void rollbackLastProperties(int num); |
| 88 void setCurrentProperty(CSSPropertyID); | 88 void setCurrentProperty(CSSPropertyID); |
| 89 | 89 |
| 90 void parseSheet(StyleSheetContents*, const String&, const TextPosition& star
tPosition = TextPosition::minimumPosition(), CSSParserObserver* = 0, bool = fals
e); | 90 void parseSheet(StyleSheetContents*, const String&, const TextPosition& star
tPosition = TextPosition::minimumPosition(), CSSParserObserver* = 0, bool = fals
e); |
| 91 PassRefPtrWillBeRawPtr<StyleRuleBase> parseRule(StyleSheetContents*, const S
tring&); | 91 PassRefPtrWillBeRawPtr<StyleRuleBase> parseRule(StyleSheetContents*, const S
tring&); |
| 92 PassRefPtr<StyleKeyframe> parseKeyframeRule(StyleSheetContents*, const Strin
g&); | 92 PassRefPtrWillBeRawPtr<StyleKeyframe> parseKeyframeRule(StyleSheetContents*,
const String&); |
| 93 bool parseSupportsCondition(const String&); | 93 bool parseSupportsCondition(const String&); |
| 94 static bool parseValue(MutableStylePropertySet*, CSSPropertyID, const String
&, bool important, CSSParserMode, StyleSheetContents*); | 94 static bool parseValue(MutableStylePropertySet*, CSSPropertyID, const String
&, bool important, CSSParserMode, StyleSheetContents*); |
| 95 static bool parseColor(RGBA32& color, const String&, bool strict = false); | 95 static bool parseColor(RGBA32& color, const String&, bool strict = false); |
| 96 static bool parseSystemColor(RGBA32& color, const String&); | 96 static bool parseSystemColor(RGBA32& color, const String&); |
| 97 static PassRefPtrWillBeRawPtr<CSSValueList> parseFontFaceValue(const AtomicS
tring&); | 97 static PassRefPtrWillBeRawPtr<CSSValueList> parseFontFaceValue(const AtomicS
tring&); |
| 98 static PassRefPtrWillBeRawPtr<CSSValue> parseAnimationTimingFunctionValue(co
nst String&); | 98 static PassRefPtrWillBeRawPtr<CSSValue> parseAnimationTimingFunctionValue(co
nst String&); |
| 99 bool parseDeclaration(MutableStylePropertySet*, const String&, CSSParserObse
rver*, StyleSheetContents* contextStyleSheet); | 99 bool parseDeclaration(MutableStylePropertySet*, const String&, CSSParserObse
rver*, StyleSheetContents* contextStyleSheet); |
| 100 static PassRefPtr<ImmutableStylePropertySet> parseInlineStyleDeclaration(con
st String&, Element*); | 100 static PassRefPtr<ImmutableStylePropertySet> parseInlineStyleDeclaration(con
st String&, Element*); |
| 101 PassOwnPtr<Vector<double> > parseKeyframeKeyList(const String&); | 101 PassOwnPtr<Vector<double> > parseKeyframeKeyList(const String&); |
| 102 | 102 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 117 | 117 |
| 118 CSSParserFunction* createFloatingFunction(); | 118 CSSParserFunction* createFloatingFunction(); |
| 119 CSSParserFunction* createFloatingFunction(const CSSParserString& name, PassO
wnPtr<CSSParserValueList> args); | 119 CSSParserFunction* createFloatingFunction(const CSSParserString& name, PassO
wnPtr<CSSParserValueList> args); |
| 120 PassOwnPtr<CSSParserFunction> sinkFloatingFunction(CSSParserFunction*); | 120 PassOwnPtr<CSSParserFunction> sinkFloatingFunction(CSSParserFunction*); |
| 121 | 121 |
| 122 CSSParserValue& sinkFloatingValue(CSSParserValue&); | 122 CSSParserValue& sinkFloatingValue(CSSParserValue&); |
| 123 | 123 |
| 124 MediaQuerySet* createMediaQuerySet(); | 124 MediaQuerySet* createMediaQuerySet(); |
| 125 StyleRuleBase* createImportRule(const CSSParserString&, MediaQuerySet*); | 125 StyleRuleBase* createImportRule(const CSSParserString&, MediaQuerySet*); |
| 126 StyleKeyframe* createKeyframe(CSSParserValueList*); | 126 StyleKeyframe* createKeyframe(CSSParserValueList*); |
| 127 StyleRuleKeyframes* createKeyframesRule(const String&, PassOwnPtr<Vector<Ref
Ptr<StyleKeyframe> > >, bool isPrefixed); | 127 StyleRuleKeyframes* createKeyframesRule(const String&, PassOwnPtrWillBeRawPt
r<WillBeHeapVector<RefPtrWillBeMember<StyleKeyframe> > >, bool isPrefixed); |
| 128 | 128 |
| 129 typedef WillBeHeapVector<RefPtrWillBeMember<StyleRuleBase> > RuleList; | 129 typedef WillBeHeapVector<RefPtrWillBeMember<StyleRuleBase> > RuleList; |
| 130 StyleRuleBase* createMediaRule(MediaQuerySet*, RuleList*); | 130 StyleRuleBase* createMediaRule(MediaQuerySet*, RuleList*); |
| 131 RuleList* createRuleList(); | 131 RuleList* createRuleList(); |
| 132 RuleList* appendRule(RuleList*, StyleRuleBase*); | 132 RuleList* appendRule(RuleList*, StyleRuleBase*); |
| 133 StyleRuleBase* createStyleRule(Vector<OwnPtr<CSSParserSelector> >* selectors
); | 133 StyleRuleBase* createStyleRule(Vector<OwnPtr<CSSParserSelector> >* selectors
); |
| 134 StyleRuleBase* createFontFaceRule(); | 134 StyleRuleBase* createFontFaceRule(); |
| 135 StyleRuleBase* createPageRule(PassOwnPtr<CSSParserSelector> pageSelector); | 135 StyleRuleBase* createPageRule(PassOwnPtr<CSSParserSelector> pageSelector); |
| 136 StyleRuleBase* createMarginAtRule(CSSSelector::MarginBoxType); | 136 StyleRuleBase* createMarginAtRule(CSSSelector::MarginBoxType); |
| 137 StyleRuleBase* createSupportsRule(bool conditionIsSupported, RuleList*); | 137 StyleRuleBase* createSupportsRule(bool conditionIsSupported, RuleList*); |
| 138 void markSupportsRuleHeaderStart(); | 138 void markSupportsRuleHeaderStart(); |
| 139 void markSupportsRuleHeaderEnd(); | 139 void markSupportsRuleHeaderEnd(); |
| 140 PassRefPtr<CSSRuleSourceData> popSupportsRuleData(); | 140 PassRefPtr<CSSRuleSourceData> popSupportsRuleData(); |
| 141 StyleRuleBase* createHostRule(RuleList* rules); | 141 StyleRuleBase* createHostRule(RuleList* rules); |
| 142 | 142 |
| 143 void startDeclarationsForMarginBox(); | 143 void startDeclarationsForMarginBox(); |
| 144 void endDeclarationsForMarginBox(); | 144 void endDeclarationsForMarginBox(); |
| 145 | 145 |
| 146 MediaQueryExp* createFloatingMediaQueryExp(const AtomicString&, CSSParserVal
ueList*); | 146 MediaQueryExp* createFloatingMediaQueryExp(const AtomicString&, CSSParserVal
ueList*); |
| 147 PassOwnPtrWillBeRawPtr<MediaQueryExp> sinkFloatingMediaQueryExp(MediaQueryEx
p*); | 147 PassOwnPtrWillBeRawPtr<MediaQueryExp> sinkFloatingMediaQueryExp(MediaQueryEx
p*); |
| 148 WillBeHeapVector<OwnPtrWillBeMember<MediaQueryExp> >* createFloatingMediaQue
ryExpList(); | 148 WillBeHeapVector<OwnPtrWillBeMember<MediaQueryExp> >* createFloatingMediaQue
ryExpList(); |
| 149 PassOwnPtrWillBeRawPtr<WillBeHeapVector<OwnPtrWillBeMember<MediaQueryExp> >
> sinkFloatingMediaQueryExpList(WillBeHeapVector<OwnPtrWillBeMember<MediaQueryEx
p> >*); | 149 PassOwnPtrWillBeRawPtr<WillBeHeapVector<OwnPtrWillBeMember<MediaQueryExp> >
> sinkFloatingMediaQueryExpList(WillBeHeapVector<OwnPtrWillBeMember<MediaQueryEx
p> >*); |
| 150 MediaQuery* createFloatingMediaQuery(MediaQuery::Restrictor, const AtomicStr
ing&, PassOwnPtrWillBeRawPtr<WillBeHeapVector<OwnPtrWillBeMember<MediaQueryExp>
> >); | 150 MediaQuery* createFloatingMediaQuery(MediaQuery::Restrictor, const AtomicStr
ing&, PassOwnPtrWillBeRawPtr<WillBeHeapVector<OwnPtrWillBeMember<MediaQueryExp>
> >); |
| 151 MediaQuery* createFloatingMediaQuery(PassOwnPtrWillBeRawPtr<WillBeHeapVector
<OwnPtrWillBeMember<MediaQueryExp> > >); | 151 MediaQuery* createFloatingMediaQuery(PassOwnPtrWillBeRawPtr<WillBeHeapVector
<OwnPtrWillBeMember<MediaQueryExp> > >); |
| 152 MediaQuery* createFloatingNotAllQuery(); | 152 MediaQuery* createFloatingNotAllQuery(); |
| 153 PassOwnPtrWillBeRawPtr<MediaQuery> sinkFloatingMediaQuery(MediaQuery*); | 153 PassOwnPtrWillBeRawPtr<MediaQuery> sinkFloatingMediaQuery(MediaQuery*); |
| 154 | 154 |
| 155 Vector<RefPtr<StyleKeyframe> >* createFloatingKeyframeVector(); | 155 WillBeHeapVector<RefPtrWillBeMember<StyleKeyframe> >* createFloatingKeyframe
Vector(); |
| 156 PassOwnPtr<Vector<RefPtr<StyleKeyframe> > > sinkFloatingKeyframeVector(Vecto
r<RefPtr<StyleKeyframe> >*); | 156 PassOwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<StyleKeyframe> >
> sinkFloatingKeyframeVector(WillBeHeapVector<RefPtrWillBeMember<StyleKeyframe>
>*); |
| 157 | 157 |
| 158 void addNamespace(const AtomicString& prefix, const AtomicString& uri); | 158 void addNamespace(const AtomicString& prefix, const AtomicString& uri); |
| 159 QualifiedName determineNameInNamespace(const AtomicString& prefix, const Ato
micString& localName); | 159 QualifiedName determineNameInNamespace(const AtomicString& prefix, const Ato
micString& localName); |
| 160 | 160 |
| 161 CSSParserSelector* rewriteSpecifiersWithElementName(const AtomicString& name
spacePrefix, const AtomicString& elementName, CSSParserSelector*, bool isNamespa
cePlaceholder = false); | 161 CSSParserSelector* rewriteSpecifiersWithElementName(const AtomicString& name
spacePrefix, const AtomicString& elementName, CSSParserSelector*, bool isNamespa
cePlaceholder = false); |
| 162 CSSParserSelector* rewriteSpecifiersWithElementNameForCustomPseudoElement(co
nst QualifiedName& tag, const AtomicString& elementName, CSSParserSelector* spec
ifiers, bool tagIsForNamespaceRule); | 162 CSSParserSelector* rewriteSpecifiersWithElementNameForCustomPseudoElement(co
nst QualifiedName& tag, const AtomicString& elementName, CSSParserSelector* spec
ifiers, bool tagIsForNamespaceRule); |
| 163 CSSParserSelector* rewriteSpecifiersWithElementNameForContentPseudoElement(c
onst QualifiedName& tag, const AtomicString& elementName, CSSParserSelector* spe
cifiers, bool tagIsForNamespaceRule); | 163 CSSParserSelector* rewriteSpecifiersWithElementNameForContentPseudoElement(c
onst QualifiedName& tag, const AtomicString& elementName, CSSParserSelector* spe
cifiers, bool tagIsForNamespaceRule); |
| 164 CSSParserSelector* rewriteSpecifiersWithNamespaceIfNeeded(CSSParserSelector*
); | 164 CSSParserSelector* rewriteSpecifiersWithNamespaceIfNeeded(CSSParserSelector*
); |
| 165 CSSParserSelector* rewriteSpecifiers(CSSParserSelector*, CSSParserSelector*)
; | 165 CSSParserSelector* rewriteSpecifiers(CSSParserSelector*, CSSParserSelector*)
; |
| 166 CSSParserSelector* rewriteSpecifiersForShadowDistributed(CSSParserSelector*
specifiers, CSSParserSelector* distributedPseudoElementSelector); | 166 CSSParserSelector* rewriteSpecifiersForShadowDistributed(CSSParserSelector*
specifiers, CSSParserSelector* distributedPseudoElementSelector); |
| 167 | 167 |
| 168 void invalidBlockHit(); | 168 void invalidBlockHit(); |
| 169 | 169 |
| 170 Vector<OwnPtr<CSSParserSelector> >* reusableSelectorVector() { return &m_reu
sableSelectorVector; } | 170 Vector<OwnPtr<CSSParserSelector> >* reusableSelectorVector() { return &m_reu
sableSelectorVector; } |
| 171 | 171 |
| 172 void clearProperties(); | 172 void clearProperties(); |
| 173 | 173 |
| 174 PassRefPtr<ImmutableStylePropertySet> createStylePropertySet(); | 174 PassRefPtr<ImmutableStylePropertySet> createStylePropertySet(); |
| 175 | 175 |
| 176 CSSParserContext m_context; | 176 CSSParserContext m_context; |
| 177 | 177 |
| 178 bool m_important; | 178 bool m_important; |
| 179 CSSPropertyID m_id; | 179 CSSPropertyID m_id; |
| 180 StyleSheetContents* m_styleSheet; | 180 StyleSheetContents* m_styleSheet; |
| 181 RefPtrWillBePersistent<StyleRuleBase> m_rule; | 181 RefPtrWillBePersistent<StyleRuleBase> m_rule; |
| 182 RefPtr<StyleKeyframe> m_keyframe; | 182 RefPtrWillBePersistent<StyleKeyframe> m_keyframe; |
| 183 RefPtrWillBePersistent<MediaQuerySet> m_mediaList; | 183 RefPtrWillBePersistent<MediaQuerySet> m_mediaList; |
| 184 OwnPtr<CSSParserValueList> m_valueList; | 184 OwnPtr<CSSParserValueList> m_valueList; |
| 185 bool m_supportsCondition; | 185 bool m_supportsCondition; |
| 186 | 186 |
| 187 WillBePersistentHeapVector<CSSProperty, 256> m_parsedProperties; | 187 WillBePersistentHeapVector<CSSProperty, 256> m_parsedProperties; |
| 188 CSSSelectorList* m_selectorListForParseSelector; | 188 CSSSelectorList* m_selectorListForParseSelector; |
| 189 | 189 |
| 190 unsigned m_numParsedPropertiesBeforeMarginBox; | 190 unsigned m_numParsedPropertiesBeforeMarginBox; |
| 191 | 191 |
| 192 bool m_hasFontFaceOnlyValues; | 192 bool m_hasFontFaceOnlyValues; |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 bool m_ruleHasHeader; | 282 bool m_ruleHasHeader; |
| 283 | 283 |
| 284 bool m_allowImportRules; | 284 bool m_allowImportRules; |
| 285 bool m_allowNamespaceDeclarations; | 285 bool m_allowNamespaceDeclarations; |
| 286 | 286 |
| 287 bool m_inViewport; | 287 bool m_inViewport; |
| 288 | 288 |
| 289 CSSParserLocation m_locationLabel; | 289 CSSParserLocation m_locationLabel; |
| 290 | 290 |
| 291 WillBePersistentHeapVector<RefPtrWillBeMember<StyleRuleBase> > m_parsedRules
; | 291 WillBePersistentHeapVector<RefPtrWillBeMember<StyleRuleBase> > m_parsedRules
; |
| 292 Vector<RefPtr<StyleKeyframe> > m_parsedKeyframes; | 292 WillBePersistentHeapVector<RefPtrWillBeMember<StyleKeyframe> > m_parsedKeyfr
ames; |
| 293 WillBePersistentHeapVector<RefPtrWillBeMember<MediaQuerySet> > m_parsedMedia
QuerySets; | 293 WillBePersistentHeapVector<RefPtrWillBeMember<MediaQuerySet> > m_parsedMedia
QuerySets; |
| 294 WillBePersistentHeapVector<OwnPtrWillBeMember<RuleList> > m_parsedRuleLists; | 294 WillBePersistentHeapVector<OwnPtrWillBeMember<RuleList> > m_parsedRuleLists; |
| 295 Vector<CSSParserSelector*> m_floatingSelectors; | 295 Vector<CSSParserSelector*> m_floatingSelectors; |
| 296 Vector<Vector<OwnPtr<CSSParserSelector> >*> m_floatingSelectorVectors; | 296 Vector<Vector<OwnPtr<CSSParserSelector> >*> m_floatingSelectorVectors; |
| 297 Vector<CSSParserValueList*> m_floatingValueLists; | 297 Vector<CSSParserValueList*> m_floatingValueLists; |
| 298 Vector<CSSParserFunction*> m_floatingFunctions; | 298 Vector<CSSParserFunction*> m_floatingFunctions; |
| 299 | 299 |
| 300 OwnPtrWillBePersistent<MediaQuery> m_floatingMediaQuery; | 300 OwnPtrWillBePersistent<MediaQuery> m_floatingMediaQuery; |
| 301 OwnPtrWillBePersistent<MediaQueryExp> m_floatingMediaQueryExp; | 301 OwnPtrWillBePersistent<MediaQueryExp> m_floatingMediaQueryExp; |
| 302 OwnPtrWillBePersistent<WillBeHeapVector<OwnPtrWillBeMember<MediaQueryExp> >
> m_floatingMediaQueryExpList; | 302 OwnPtrWillBePersistent<WillBeHeapVector<OwnPtrWillBeMember<MediaQueryExp> >
> m_floatingMediaQueryExpList; |
| 303 | 303 |
| 304 OwnPtr<Vector<RefPtr<StyleKeyframe> > > m_floatingKeyframeVector; | 304 OwnPtrWillBePersistent<WillBeHeapVector<RefPtrWillBeMember<StyleKeyframe> >
> m_floatingKeyframeVector; |
| 305 | 305 |
| 306 Vector<OwnPtr<CSSParserSelector> > m_reusableSelectorVector; | 306 Vector<OwnPtr<CSSParserSelector> > m_reusableSelectorVector; |
| 307 | 307 |
| 308 OwnPtr<RuleSourceDataList> m_supportsRuleDataStack; | 308 OwnPtr<RuleSourceDataList> m_supportsRuleDataStack; |
| 309 | 309 |
| 310 bool isLoggingErrors(); | 310 bool isLoggingErrors(); |
| 311 void logError(const String& message, const CSSParserLocation&); | 311 void logError(const String& message, const CSSParserLocation&); |
| 312 | 312 |
| 313 CSSTokenizer m_tokenizer; | 313 CSSTokenizer m_tokenizer; |
| 314 | 314 |
| 315 friend class TransformOperationInfo; | 315 friend class TransformOperationInfo; |
| 316 friend class FilterOperationInfo; | 316 friend class FilterOperationInfo; |
| 317 }; | 317 }; |
| 318 | 318 |
| 319 inline int cssyylex(void* yylval, BisonCSSParser* parser) | 319 inline int cssyylex(void* yylval, BisonCSSParser* parser) |
| 320 { | 320 { |
| 321 return parser->m_tokenizer.lex(yylval); | 321 return parser->m_tokenizer.lex(yylval); |
| 322 } | 322 } |
| 323 | 323 |
| 324 bool isValidNthToken(const CSSParserString&); | 324 bool isValidNthToken(const CSSParserString&); |
| 325 | 325 |
| 326 } // namespace WebCore | 326 } // namespace WebCore |
| 327 | 327 |
| 328 #endif // BisonCSSParser_h | 328 #endif // BisonCSSParser_h |
| OLD | NEW |