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

Side by Side Diff: sky/engine/core/css/parser/BisonCSSParser.h

Issue 807703003: Remove @media rules. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years 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
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 13 matching lines...) Expand all
24 #define SKY_ENGINE_CORE_CSS_PARSER_BISONCSSPARSER_H_ 24 #define SKY_ENGINE_CORE_CSS_PARSER_BISONCSSPARSER_H_
25 25
26 #include "gen/sky/core/CSSPropertyNames.h" 26 #include "gen/sky/core/CSSPropertyNames.h"
27 #include "gen/sky/core/CSSValueKeywords.h" 27 #include "gen/sky/core/CSSValueKeywords.h"
28 #include "sky/engine/core/css/CSSCalculationValue.h" 28 #include "sky/engine/core/css/CSSCalculationValue.h"
29 #include "sky/engine/core/css/CSSFilterValue.h" 29 #include "sky/engine/core/css/CSSFilterValue.h"
30 #include "sky/engine/core/css/CSSGradientValue.h" 30 #include "sky/engine/core/css/CSSGradientValue.h"
31 #include "sky/engine/core/css/CSSProperty.h" 31 #include "sky/engine/core/css/CSSProperty.h"
32 #include "sky/engine/core/css/CSSPropertySourceData.h" 32 #include "sky/engine/core/css/CSSPropertySourceData.h"
33 #include "sky/engine/core/css/CSSSelector.h" 33 #include "sky/engine/core/css/CSSSelector.h"
34 #include "sky/engine/core/css/MediaQuery.h"
35 #include "sky/engine/core/css/StylePropertySet.h" 34 #include "sky/engine/core/css/StylePropertySet.h"
36 #include "sky/engine/core/css/parser/CSSParserMode.h" 35 #include "sky/engine/core/css/parser/CSSParserMode.h"
37 #include "sky/engine/core/css/parser/CSSParserObserver.h" 36 #include "sky/engine/core/css/parser/CSSParserObserver.h"
38 #include "sky/engine/core/css/parser/CSSParserValues.h" 37 #include "sky/engine/core/css/parser/CSSParserValues.h"
39 #include "sky/engine/core/css/parser/CSSPropertyParser.h" 38 #include "sky/engine/core/css/parser/CSSPropertyParser.h"
40 #include "sky/engine/core/css/parser/CSSTokenizer.h" 39 #include "sky/engine/core/css/parser/CSSTokenizer.h"
41 #include "sky/engine/platform/graphics/Color.h" 40 #include "sky/engine/platform/graphics/Color.h"
42 #include "sky/engine/wtf/HashSet.h" 41 #include "sky/engine/wtf/HashSet.h"
43 #include "sky/engine/wtf/OwnPtr.h" 42 #include "sky/engine/wtf/OwnPtr.h"
44 #include "sky/engine/wtf/Vector.h" 43 #include "sky/engine/wtf/Vector.h"
45 #include "sky/engine/wtf/text/AtomicString.h" 44 #include "sky/engine/wtf/text/AtomicString.h"
46 #include "sky/engine/wtf/text/TextPosition.h" 45 #include "sky/engine/wtf/text/TextPosition.h"
47 46
48 namespace blink { 47 namespace blink {
49 48
50 class AnimationParseContext; 49 class AnimationParseContext;
51 class CSSBasicShape; 50 class CSSBasicShape;
52 class CSSBasicShapeInset; 51 class CSSBasicShapeInset;
53 class CSSBorderImageSliceValue; 52 class CSSBorderImageSliceValue;
54 class CSSPrimitiveValue; 53 class CSSPrimitiveValue;
55 class CSSSelectorList; 54 class CSSSelectorList;
56 class CSSValue; 55 class CSSValue;
57 class CSSValueList; 56 class CSSValueList;
58 class Document; 57 class Document;
59 class Element; 58 class Element;
60 class ImmutableStylePropertySet; 59 class ImmutableStylePropertySet;
61 class MediaQueryExp;
62 class MediaQuerySet;
63 class MutableStylePropertySet; 60 class MutableStylePropertySet;
64 class StyleColor; 61 class StyleColor;
65 class StyleKeyframe; 62 class StyleKeyframe;
66 class StylePropertyShorthand; 63 class StylePropertyShorthand;
67 class StyleRuleBase; 64 class StyleRuleBase;
68 class StyleRuleKeyframes; 65 class StyleRuleKeyframes;
69 class StyleSheetContents; 66 class StyleSheetContents;
70 class UseCounter; 67 class UseCounter;
71 68
72 // FIXME: This class is shared with CSSTokenizer so should we rename it to CSSSo urceLocation? 69 // FIXME: This class is shared with CSSTokenizer so should we rename it to CSSSo urceLocation?
(...skipping 18 matching lines...) Expand all
91 PassRefPtr<StyleKeyframe> parseKeyframeRule(StyleSheetContents*, const Strin g&); 88 PassRefPtr<StyleKeyframe> parseKeyframeRule(StyleSheetContents*, const Strin g&);
92 bool parseSupportsCondition(const String&); 89 bool parseSupportsCondition(const String&);
93 static bool parseValue(MutableStylePropertySet*, CSSPropertyID, const String &, bool important, CSSParserMode, StyleSheetContents*); 90 static bool parseValue(MutableStylePropertySet*, CSSPropertyID, const String &, bool important, CSSParserMode, StyleSheetContents*);
94 static bool parseColor(RGBA32& color, const String&, bool strict = false); 91 static bool parseColor(RGBA32& color, const String&, bool strict = false);
95 static StyleColor colorFromRGBColorString(const String&); 92 static StyleColor colorFromRGBColorString(const String&);
96 static bool parseSystemColor(RGBA32& color, const String&); 93 static bool parseSystemColor(RGBA32& color, const String&);
97 static PassRefPtr<CSSValueList> parseFontFaceValue(const AtomicString&); 94 static PassRefPtr<CSSValueList> parseFontFaceValue(const AtomicString&);
98 static PassRefPtr<CSSValue> parseAnimationTimingFunctionValue(const String&) ; 95 static PassRefPtr<CSSValue> parseAnimationTimingFunctionValue(const String&) ;
99 bool parseDeclaration(MutableStylePropertySet*, const String&, CSSParserObse rver*, StyleSheetContents* contextStyleSheet); 96 bool parseDeclaration(MutableStylePropertySet*, const String&, CSSParserObse rver*, StyleSheetContents* contextStyleSheet);
100 static PassRefPtr<ImmutableStylePropertySet> parseInlineStyleDeclaration(con st String&, Element*); 97 static PassRefPtr<ImmutableStylePropertySet> parseInlineStyleDeclaration(con st String&, Element*);
101 PassRefPtr<MediaQuerySet> parseMediaQueryList(const String&);
102 PassOwnPtr<Vector<double> > parseKeyframeKeyList(const String&); 98 PassOwnPtr<Vector<double> > parseKeyframeKeyList(const String&);
103 bool parseAttributeMatchType(CSSSelector::AttributeMatchType&, const String& ); 99 bool parseAttributeMatchType(CSSSelector::AttributeMatchType&, const String& );
104 100
105 static bool parseValue(MutableStylePropertySet*, CSSPropertyID, const String &, bool important, const Document&); 101 static bool parseValue(MutableStylePropertySet*, CSSPropertyID, const String &, bool important, const Document&);
106 102
107 bool parseValue(CSSPropertyID, bool important); 103 bool parseValue(CSSPropertyID, bool important);
108 void parseSelector(const String&, CSSSelectorList&); 104 void parseSelector(const String&, CSSSelectorList&);
109 105
110 CSSParserSelector* createFloatingSelector(); 106 CSSParserSelector* createFloatingSelector();
111 CSSParserSelector* createFloatingSelectorWithTagName(const QualifiedName&); 107 CSSParserSelector* createFloatingSelectorWithTagName(const QualifiedName&);
112 PassOwnPtr<CSSParserSelector> sinkFloatingSelector(CSSParserSelector*); 108 PassOwnPtr<CSSParserSelector> sinkFloatingSelector(CSSParserSelector*);
113 109
114 Vector<OwnPtr<CSSParserSelector> >* createFloatingSelectorVector(); 110 Vector<OwnPtr<CSSParserSelector> >* createFloatingSelectorVector();
115 PassOwnPtr<Vector<OwnPtr<CSSParserSelector> > > sinkFloatingSelectorVector(V ector<OwnPtr<CSSParserSelector> >*); 111 PassOwnPtr<Vector<OwnPtr<CSSParserSelector> > > sinkFloatingSelectorVector(V ector<OwnPtr<CSSParserSelector> >*);
116 112
117 CSSParserValueList* createFloatingValueList(); 113 CSSParserValueList* createFloatingValueList();
118 PassOwnPtr<CSSParserValueList> sinkFloatingValueList(CSSParserValueList*); 114 PassOwnPtr<CSSParserValueList> sinkFloatingValueList(CSSParserValueList*);
119 115
120 CSSParserFunction* createFloatingFunction(); 116 CSSParserFunction* createFloatingFunction();
121 CSSParserFunction* createFloatingFunction(const CSSParserString& name, PassO wnPtr<CSSParserValueList> args); 117 CSSParserFunction* createFloatingFunction(const CSSParserString& name, PassO wnPtr<CSSParserValueList> args);
122 PassOwnPtr<CSSParserFunction> sinkFloatingFunction(CSSParserFunction*); 118 PassOwnPtr<CSSParserFunction> sinkFloatingFunction(CSSParserFunction*);
123 119
124 CSSParserValue& sinkFloatingValue(CSSParserValue&); 120 CSSParserValue& sinkFloatingValue(CSSParserValue&);
125 121
126 MediaQuerySet* createMediaQuerySet();
127 StyleKeyframe* createKeyframe(CSSParserValueList*); 122 StyleKeyframe* createKeyframe(CSSParserValueList*);
128 StyleRuleKeyframes* createKeyframesRule(const String&, PassOwnPtr<Vector<Ref Ptr<StyleKeyframe> > >, bool isPrefixed); 123 StyleRuleKeyframes* createKeyframesRule(const String&, PassOwnPtr<Vector<Ref Ptr<StyleKeyframe> > >, bool isPrefixed);
129 124
130 typedef Vector<RefPtr<StyleRuleBase> > RuleList; 125 typedef Vector<RefPtr<StyleRuleBase> > RuleList;
131 StyleRuleBase* createMediaRule(MediaQuerySet*, RuleList*);
132 RuleList* createRuleList(); 126 RuleList* createRuleList();
133 RuleList* appendRule(RuleList*, StyleRuleBase*); 127 RuleList* appendRule(RuleList*, StyleRuleBase*);
134 StyleRuleBase* createStyleRule(Vector<OwnPtr<CSSParserSelector> >* selectors ); 128 StyleRuleBase* createStyleRule(Vector<OwnPtr<CSSParserSelector> >* selectors );
135 StyleRuleBase* createFontFaceRule(); 129 StyleRuleBase* createFontFaceRule();
136 StyleRuleBase* createSupportsRule(bool conditionIsSupported, RuleList*); 130 StyleRuleBase* createSupportsRule(bool conditionIsSupported, RuleList*);
137 void markSupportsRuleHeaderStart(); 131 void markSupportsRuleHeaderStart();
138 void markSupportsRuleHeaderEnd(); 132 void markSupportsRuleHeaderEnd();
139 PassRefPtr<CSSRuleSourceData> popSupportsRuleData(); 133 PassRefPtr<CSSRuleSourceData> popSupportsRuleData();
140 StyleRuleBase* createHostRule(RuleList* rules); 134 StyleRuleBase* createHostRule(RuleList* rules);
141 135
142 void startDeclarationsForMarginBox(); 136 void startDeclarationsForMarginBox();
143 void endDeclarationsForMarginBox(); 137 void endDeclarationsForMarginBox();
144 138
145 MediaQueryExp* createFloatingMediaQueryExp(const AtomicString&, CSSParserVal ueList*);
146 PassOwnPtr<MediaQueryExp> sinkFloatingMediaQueryExp(MediaQueryExp*);
147 Vector<OwnPtr<MediaQueryExp> >* createFloatingMediaQueryExpList();
148 PassOwnPtr<Vector<OwnPtr<MediaQueryExp> > > sinkFloatingMediaQueryExpList(Ve ctor<OwnPtr<MediaQueryExp> >*);
149 MediaQuery* createFloatingMediaQuery(MediaQuery::Restrictor, const AtomicStr ing&, PassOwnPtr<Vector<OwnPtr<MediaQueryExp> > >);
150 MediaQuery* createFloatingMediaQuery(PassOwnPtr<Vector<OwnPtr<MediaQueryExp> > >);
151 MediaQuery* createFloatingNotAllQuery();
152 PassOwnPtr<MediaQuery> sinkFloatingMediaQuery(MediaQuery*);
153
154 Vector<RefPtr<StyleKeyframe> >* createFloatingKeyframeVector(); 139 Vector<RefPtr<StyleKeyframe> >* createFloatingKeyframeVector();
155 PassOwnPtr<Vector<RefPtr<StyleKeyframe> > > sinkFloatingKeyframeVector(Vecto r<RefPtr<StyleKeyframe> >*); 140 PassOwnPtr<Vector<RefPtr<StyleKeyframe> > > sinkFloatingKeyframeVector(Vecto r<RefPtr<StyleKeyframe> >*);
156 141
157 CSSParserSelector* rewriteSpecifiersWithElementName(const AtomicString& name spacePrefix, const AtomicString& elementName, CSSParserSelector*, bool isNamespa cePlaceholder = false); 142 CSSParserSelector* rewriteSpecifiersWithElementName(const AtomicString& name spacePrefix, const AtomicString& elementName, CSSParserSelector*, bool isNamespa cePlaceholder = false);
158 CSSParserSelector* rewriteSpecifiersWithNamespaceIfNeeded(CSSParserSelector* ); 143 CSSParserSelector* rewriteSpecifiersWithNamespaceIfNeeded(CSSParserSelector* );
159 CSSParserSelector* rewriteSpecifiers(CSSParserSelector*, CSSParserSelector*) ; 144 CSSParserSelector* rewriteSpecifiers(CSSParserSelector*, CSSParserSelector*) ;
160 CSSParserSelector* rewriteSpecifiersForShadowDistributed(CSSParserSelector* specifiers, CSSParserSelector* distributedPseudoElementSelector); 145 CSSParserSelector* rewriteSpecifiersForShadowDistributed(CSSParserSelector* specifiers, CSSParserSelector* distributedPseudoElementSelector);
161 146
162 void invalidBlockHit() { } 147 void invalidBlockHit() { }
163 148
164 Vector<OwnPtr<CSSParserSelector> >* reusableSelectorVector() { return &m_reu sableSelectorVector; } 149 Vector<OwnPtr<CSSParserSelector> >* reusableSelectorVector() { return &m_reu sableSelectorVector; }
165 150
166 void clearProperties(); 151 void clearProperties();
167 152
168 PassRefPtr<ImmutableStylePropertySet> createStylePropertySet(); 153 PassRefPtr<ImmutableStylePropertySet> createStylePropertySet();
169 154
170 CSSParserContext m_context; 155 CSSParserContext m_context;
171 156
172 bool m_important; 157 bool m_important;
173 CSSPropertyID m_id; 158 CSSPropertyID m_id;
174 RawPtr<StyleSheetContents> m_styleSheet; 159 RawPtr<StyleSheetContents> m_styleSheet;
175 RefPtr<StyleRuleBase> m_rule; 160 RefPtr<StyleRuleBase> m_rule;
176 RefPtr<StyleKeyframe> m_keyframe; 161 RefPtr<StyleKeyframe> m_keyframe;
177 RefPtr<MediaQuerySet> m_mediaList;
178 OwnPtr<CSSParserValueList> m_valueList; 162 OwnPtr<CSSParserValueList> m_valueList;
179 bool m_supportsCondition; 163 bool m_supportsCondition;
180 164
181 Vector<CSSProperty, 256> m_parsedProperties; 165 Vector<CSSProperty, 256> m_parsedProperties;
182 CSSSelectorList* m_selectorListForParseSelector; 166 CSSSelectorList* m_selectorListForParseSelector;
183 167
184 unsigned m_numParsedPropertiesBeforeMarginBox; 168 unsigned m_numParsedPropertiesBeforeMarginBox;
185 169
186 bool m_hadSyntacticallyValidCSSRule; 170 bool m_hadSyntacticallyValidCSSRule;
187 bool m_ignoreErrors; 171 bool m_ignoreErrors;
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 228
245 bool m_allowImportRules; 229 bool m_allowImportRules;
246 bool m_allowNamespaceDeclarations; 230 bool m_allowNamespaceDeclarations;
247 231
248 bool m_inViewport; 232 bool m_inViewport;
249 233
250 CSSParserLocation m_locationLabel; 234 CSSParserLocation m_locationLabel;
251 235
252 Vector<RefPtr<StyleRuleBase> > m_parsedRules; 236 Vector<RefPtr<StyleRuleBase> > m_parsedRules;
253 Vector<RefPtr<StyleKeyframe> > m_parsedKeyframes; 237 Vector<RefPtr<StyleKeyframe> > m_parsedKeyframes;
254 Vector<RefPtr<MediaQuerySet> > m_parsedMediaQuerySets;
255 Vector<OwnPtr<RuleList> > m_parsedRuleLists; 238 Vector<OwnPtr<RuleList> > m_parsedRuleLists;
256 Vector<CSSParserSelector*> m_floatingSelectors; 239 Vector<CSSParserSelector*> m_floatingSelectors;
257 Vector<Vector<OwnPtr<CSSParserSelector> >*> m_floatingSelectorVectors; 240 Vector<Vector<OwnPtr<CSSParserSelector> >*> m_floatingSelectorVectors;
258 Vector<CSSParserValueList*> m_floatingValueLists; 241 Vector<CSSParserValueList*> m_floatingValueLists;
259 Vector<CSSParserFunction*> m_floatingFunctions; 242 Vector<CSSParserFunction*> m_floatingFunctions;
260 243
261 OwnPtr<MediaQuery> m_floatingMediaQuery;
262 OwnPtr<MediaQueryExp> m_floatingMediaQueryExp;
263 OwnPtr<Vector<OwnPtr<MediaQueryExp> > > m_floatingMediaQueryExpList;
264
265 OwnPtr<Vector<RefPtr<StyleKeyframe> > > m_floatingKeyframeVector; 244 OwnPtr<Vector<RefPtr<StyleKeyframe> > > m_floatingKeyframeVector;
266 245
267 Vector<OwnPtr<CSSParserSelector> > m_reusableSelectorVector; 246 Vector<OwnPtr<CSSParserSelector> > m_reusableSelectorVector;
268 247
269 OwnPtr<RuleSourceDataList> m_supportsRuleDataStack; 248 OwnPtr<RuleSourceDataList> m_supportsRuleDataStack;
270 249
271 CSSTokenizer m_tokenizer; 250 CSSTokenizer m_tokenizer;
272 251
273 friend class TransformOperationInfo; 252 friend class TransformOperationInfo;
274 friend class FilterOperationInfo; 253 friend class FilterOperationInfo;
275 }; 254 };
276 255
277 inline int cssyylex(void* yylval, BisonCSSParser* parser) 256 inline int cssyylex(void* yylval, BisonCSSParser* parser)
278 { 257 {
279 return parser->m_tokenizer.lex(yylval); 258 return parser->m_tokenizer.lex(yylval);
280 } 259 }
281 260
282 bool isValidNthToken(const CSSParserString&); 261 bool isValidNthToken(const CSSParserString&);
283 262
284 } // namespace blink 263 } // namespace blink
285 264
286 #endif // SKY_ENGINE_CORE_CSS_PARSER_BISONCSSPARSER_H_ 265 #endif // SKY_ENGINE_CORE_CSS_PARSER_BISONCSSPARSER_H_
OLDNEW
« no previous file with comments | « sky/engine/core/css/StyleSheetContents.cpp ('k') | sky/engine/core/css/parser/BisonCSSParser-in.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698