Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(185)

Side by Side Diff: Source/core/css/parser/BisonCSSParser.h

Issue 170283019: Change various helper classes to transition types to get CSSValue entirely onto the gc heap. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 PassRefPtr<StyleRuleBase> parseRule(StyleSheetContents*, const String&); 91 PassRefPtr<StyleRuleBase> parseRule(StyleSheetContents*, const String&);
92 PassRefPtr<StyleKeyframe> parseKeyframeRule(StyleSheetContents*, const Strin g&); 92 PassRefPtr<StyleKeyframe> parseKeyframeRule(StyleSheetContents*, const Strin g&);
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&, Document*); 96 static bool parseSystemColor(RGBA32& color, const String&, Document*);
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 PassRefPtr<MediaQuerySet> parseMediaQueryList(const String&); 101 PassRefPtrWillBeRawPtr<MediaQuerySet> parseMediaQueryList(const String&);
102 PassOwnPtr<Vector<double> > parseKeyframeKeyList(const String&); 102 PassOwnPtr<Vector<double> > parseKeyframeKeyList(const String&);
103 103
104 static bool parseValue(MutableStylePropertySet*, CSSPropertyID, const String &, bool important, const Document&); 104 static bool parseValue(MutableStylePropertySet*, CSSPropertyID, const String &, bool important, const Document&);
105 105
106 bool parseValue(CSSPropertyID, bool important); 106 bool parseValue(CSSPropertyID, bool important);
107 void parseSelector(const String&, CSSSelectorList&); 107 void parseSelector(const String&, CSSSelectorList&);
108 108
109 CSSParserSelector* createFloatingSelector(); 109 CSSParserSelector* createFloatingSelector();
110 CSSParserSelector* createFloatingSelectorWithTagName(const QualifiedName&); 110 CSSParserSelector* createFloatingSelectorWithTagName(const QualifiedName&);
111 PassOwnPtr<CSSParserSelector> sinkFloatingSelector(CSSParserSelector*); 111 PassOwnPtr<CSSParserSelector> sinkFloatingSelector(CSSParserSelector*);
(...skipping 26 matching lines...) Expand all
138 StyleRuleBase* createSupportsRule(bool conditionIsSupported, RuleList*); 138 StyleRuleBase* createSupportsRule(bool conditionIsSupported, RuleList*);
139 void markSupportsRuleHeaderStart(); 139 void markSupportsRuleHeaderStart();
140 void markSupportsRuleHeaderEnd(); 140 void markSupportsRuleHeaderEnd();
141 PassRefPtr<CSSRuleSourceData> popSupportsRuleData(); 141 PassRefPtr<CSSRuleSourceData> popSupportsRuleData();
142 StyleRuleBase* createHostRule(RuleList* rules); 142 StyleRuleBase* createHostRule(RuleList* rules);
143 143
144 void startDeclarationsForMarginBox(); 144 void startDeclarationsForMarginBox();
145 void endDeclarationsForMarginBox(); 145 void endDeclarationsForMarginBox();
146 146
147 MediaQueryExp* createFloatingMediaQueryExp(const AtomicString&, CSSParserVal ueList*); 147 MediaQueryExp* createFloatingMediaQueryExp(const AtomicString&, CSSParserVal ueList*);
148 PassOwnPtr<MediaQueryExp> sinkFloatingMediaQueryExp(MediaQueryExp*); 148 PassOwnPtrWillBeRawPtr<MediaQueryExp> sinkFloatingMediaQueryExp(MediaQueryEx p*);
149 Vector<OwnPtr<MediaQueryExp> >* createFloatingMediaQueryExpList(); 149 WillBeHeapVector<OwnPtrWillBeMember<MediaQueryExp> >* createFloatingMediaQue ryExpList();
150 PassOwnPtr<Vector<OwnPtr<MediaQueryExp> > > sinkFloatingMediaQueryExpList(Ve ctor<OwnPtr<MediaQueryExp> >*); 150 PassOwnPtrWillBeRawPtr<WillBeHeapVector<OwnPtrWillBeMember<MediaQueryExp> > > sinkFloatingMediaQueryExpList(WillBeHeapVector<OwnPtrWillBeMember<MediaQueryEx p> >*);
151 MediaQuery* createFloatingMediaQuery(MediaQuery::Restrictor, const AtomicStr ing&, PassOwnPtr<Vector<OwnPtr<MediaQueryExp> > >); 151 MediaQuery* createFloatingMediaQuery(MediaQuery::Restrictor, const AtomicStr ing&, PassOwnPtrWillBeRawPtr<WillBeHeapVector<OwnPtrWillBeMember<MediaQueryExp> > >);
152 MediaQuery* createFloatingMediaQuery(PassOwnPtr<Vector<OwnPtr<MediaQueryExp> > >); 152 MediaQuery* createFloatingMediaQuery(PassOwnPtrWillBeRawPtr<WillBeHeapVector <OwnPtrWillBeMember<MediaQueryExp> > >);
153 MediaQuery* createFloatingNotAllQuery(); 153 MediaQuery* createFloatingNotAllQuery();
154 PassOwnPtr<MediaQuery> sinkFloatingMediaQuery(MediaQuery*); 154 PassOwnPtrWillBeRawPtr<MediaQuery> sinkFloatingMediaQuery(MediaQuery*);
155 155
156 Vector<RefPtr<StyleKeyframe> >* createFloatingKeyframeVector(); 156 Vector<RefPtr<StyleKeyframe> >* createFloatingKeyframeVector();
157 PassOwnPtr<Vector<RefPtr<StyleKeyframe> > > sinkFloatingKeyframeVector(Vecto r<RefPtr<StyleKeyframe> >*); 157 PassOwnPtr<Vector<RefPtr<StyleKeyframe> > > sinkFloatingKeyframeVector(Vecto r<RefPtr<StyleKeyframe> >*);
158 158
159 void addNamespace(const AtomicString& prefix, const AtomicString& uri); 159 void addNamespace(const AtomicString& prefix, const AtomicString& uri);
160 QualifiedName determineNameInNamespace(const AtomicString& prefix, const Ato micString& localName); 160 QualifiedName determineNameInNamespace(const AtomicString& prefix, const Ato micString& localName);
161 161
162 CSSParserSelector* rewriteSpecifiersWithElementName(const AtomicString& name spacePrefix, const AtomicString& elementName, CSSParserSelector*, bool isNamespa cePlaceholder = false); 162 CSSParserSelector* rewriteSpecifiersWithElementName(const AtomicString& name spacePrefix, const AtomicString& elementName, CSSParserSelector*, bool isNamespa cePlaceholder = false);
163 CSSParserSelector* rewriteSpecifiersWithElementNameForCustomPseudoElement(co nst QualifiedName& tag, const AtomicString& elementName, CSSParserSelector* spec ifiers, bool tagIsForNamespaceRule); 163 CSSParserSelector* rewriteSpecifiersWithElementNameForCustomPseudoElement(co nst QualifiedName& tag, const AtomicString& elementName, CSSParserSelector* spec ifiers, bool tagIsForNamespaceRule);
164 CSSParserSelector* rewriteSpecifiersWithElementNameForContentPseudoElement(c onst QualifiedName& tag, const AtomicString& elementName, CSSParserSelector* spe cifiers, bool tagIsForNamespaceRule); 164 CSSParserSelector* rewriteSpecifiersWithElementNameForContentPseudoElement(c onst QualifiedName& tag, const AtomicString& elementName, CSSParserSelector* spe cifiers, bool tagIsForNamespaceRule);
165 CSSParserSelector* rewriteSpecifiersWithNamespaceIfNeeded(CSSParserSelector* ); 165 CSSParserSelector* rewriteSpecifiersWithNamespaceIfNeeded(CSSParserSelector* );
166 CSSParserSelector* rewriteSpecifiers(CSSParserSelector*, CSSParserSelector*) ; 166 CSSParserSelector* rewriteSpecifiers(CSSParserSelector*, CSSParserSelector*) ;
167 CSSParserSelector* rewriteSpecifiersForShadowDistributed(CSSParserSelector* specifiers, CSSParserSelector* distributedPseudoElementSelector); 167 CSSParserSelector* rewriteSpecifiersForShadowDistributed(CSSParserSelector* specifiers, CSSParserSelector* distributedPseudoElementSelector);
168 168
169 void invalidBlockHit(); 169 void invalidBlockHit();
170 170
171 Vector<OwnPtr<CSSParserSelector> >* reusableSelectorVector() { return &m_reu sableSelectorVector; } 171 Vector<OwnPtr<CSSParserSelector> >* reusableSelectorVector() { return &m_reu sableSelectorVector; }
172 172
173 void clearProperties(); 173 void clearProperties();
174 174
175 PassRefPtr<ImmutableStylePropertySet> createStylePropertySet(); 175 PassRefPtr<ImmutableStylePropertySet> createStylePropertySet();
176 176
177 CSSParserContext m_context; 177 CSSParserContext m_context;
178 178
179 bool m_important; 179 bool m_important;
180 CSSPropertyID m_id; 180 CSSPropertyID m_id;
181 StyleSheetContents* m_styleSheet; 181 StyleSheetContents* m_styleSheet;
182 RefPtr<StyleRuleBase> m_rule; 182 RefPtr<StyleRuleBase> m_rule;
183 RefPtr<StyleKeyframe> m_keyframe; 183 RefPtr<StyleKeyframe> m_keyframe;
184 RefPtr<MediaQuerySet> m_mediaList; 184 RefPtrWillBePersistent<MediaQuerySet> m_mediaList;
185 OwnPtr<CSSParserValueList> m_valueList; 185 OwnPtr<CSSParserValueList> m_valueList;
186 bool m_supportsCondition; 186 bool m_supportsCondition;
187 187
188 CSSPropertyParser::ParsedPropertyVector m_parsedProperties; 188 CSSPropertyParser::ParsedPropertyVector m_parsedProperties;
189 CSSSelectorList* m_selectorListForParseSelector; 189 CSSSelectorList* m_selectorListForParseSelector;
190 190
191 unsigned m_numParsedPropertiesBeforeMarginBox; 191 unsigned m_numParsedPropertiesBeforeMarginBox;
192 192
193 bool m_hasFontFaceOnlyValues; 193 bool m_hasFontFaceOnlyValues;
194 bool m_hadSyntacticallyValidCSSRule; 194 bool m_hadSyntacticallyValidCSSRule;
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 284
285 bool m_allowImportRules; 285 bool m_allowImportRules;
286 bool m_allowNamespaceDeclarations; 286 bool m_allowNamespaceDeclarations;
287 287
288 bool m_inViewport; 288 bool m_inViewport;
289 289
290 CSSParserLocation m_locationLabel; 290 CSSParserLocation m_locationLabel;
291 291
292 Vector<RefPtr<StyleRuleBase> > m_parsedRules; 292 Vector<RefPtr<StyleRuleBase> > m_parsedRules;
293 Vector<RefPtr<StyleKeyframe> > m_parsedKeyframes; 293 Vector<RefPtr<StyleKeyframe> > m_parsedKeyframes;
294 Vector<RefPtr<MediaQuerySet> > m_parsedMediaQuerySets; 294 WillBePersistentHeapVector<RefPtrWillBeMember<MediaQuerySet> > m_parsedMedia QuerySets;
295 Vector<OwnPtr<RuleList> > m_parsedRuleLists; 295 Vector<OwnPtr<RuleList> > m_parsedRuleLists;
296 Vector<CSSParserSelector*> m_floatingSelectors; 296 Vector<CSSParserSelector*> m_floatingSelectors;
297 Vector<Vector<OwnPtr<CSSParserSelector> >*> m_floatingSelectorVectors; 297 Vector<Vector<OwnPtr<CSSParserSelector> >*> m_floatingSelectorVectors;
298 Vector<CSSParserValueList*> m_floatingValueLists; 298 Vector<CSSParserValueList*> m_floatingValueLists;
299 Vector<CSSParserFunction*> m_floatingFunctions; 299 Vector<CSSParserFunction*> m_floatingFunctions;
300 300
301 OwnPtr<MediaQuery> m_floatingMediaQuery; 301 OwnPtrWillBePersistent<MediaQuery> m_floatingMediaQuery;
302 OwnPtr<MediaQueryExp> m_floatingMediaQueryExp; 302 OwnPtrWillBePersistent<MediaQueryExp> m_floatingMediaQueryExp;
303 OwnPtr<Vector<OwnPtr<MediaQueryExp> > > m_floatingMediaQueryExpList; 303 OwnPtrWillBePersistent<WillBeHeapVector<OwnPtrWillBeMember<MediaQueryExp> > > m_floatingMediaQueryExpList;
haraken 2014/02/21 01:02:36 Can you use WillBePersistentHeapVector<OwnPtrWillB
wibling-chromium 2014/02/21 08:43:08 Yes, thanks for catching this.
304 304
305 OwnPtr<Vector<RefPtr<StyleKeyframe> > > m_floatingKeyframeVector; 305 OwnPtr<Vector<RefPtr<StyleKeyframe> > > m_floatingKeyframeVector;
306 306
307 Vector<OwnPtr<CSSParserSelector> > m_reusableSelectorVector; 307 Vector<OwnPtr<CSSParserSelector> > m_reusableSelectorVector;
308 308
309 OwnPtr<RuleSourceDataList> m_supportsRuleDataStack; 309 OwnPtr<RuleSourceDataList> m_supportsRuleDataStack;
310 310
311 bool isLoggingErrors(); 311 bool isLoggingErrors();
312 void logError(const String& message, const CSSParserLocation&); 312 void logError(const String& message, const CSSParserLocation&);
313 313
314 CSSTokenizer m_tokenizer; 314 CSSTokenizer m_tokenizer;
315 315
316 friend class TransformOperationInfo; 316 friend class TransformOperationInfo;
317 friend class FilterOperationInfo; 317 friend class FilterOperationInfo;
318 }; 318 };
319 319
320 inline int cssyylex(void* yylval, BisonCSSParser* parser) 320 inline int cssyylex(void* yylval, BisonCSSParser* parser)
321 { 321 {
322 return parser->m_tokenizer.lex(yylval); 322 return parser->m_tokenizer.lex(yylval);
323 } 323 }
324 324
325 } // namespace WebCore 325 } // namespace WebCore
326 326
327 #endif // BisonCSSParser_h 327 #endif // BisonCSSParser_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698