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

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

Issue 860423004: Remove css !important (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 11 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
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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 explicit BisonCSSParser(const CSSParserContext&); 80 explicit BisonCSSParser(const CSSParserContext&);
81 ~BisonCSSParser(); 81 ~BisonCSSParser();
82 82
83 void rollbackLastProperties(int num); 83 void rollbackLastProperties(int num);
84 void setCurrentProperty(CSSPropertyID); 84 void setCurrentProperty(CSSPropertyID);
85 85
86 void parseSheet(StyleSheetContents*, const String&); 86 void parseSheet(StyleSheetContents*, const String&);
87 PassRefPtr<StyleRuleBase> parseRule(StyleSheetContents*, const String&); 87 PassRefPtr<StyleRuleBase> parseRule(StyleSheetContents*, const String&);
88 PassRefPtr<StyleKeyframe> parseKeyframeRule(StyleSheetContents*, const Strin g&); 88 PassRefPtr<StyleKeyframe> parseKeyframeRule(StyleSheetContents*, const Strin g&);
89 bool parseSupportsCondition(const String&); 89 bool parseSupportsCondition(const String&);
90 static bool parseValue(MutableStylePropertySet*, CSSPropertyID, const String &, bool important, CSSParserMode, StyleSheetContents*); 90 static bool parseValue(MutableStylePropertySet*, CSSPropertyID, const String &, CSSParserMode, StyleSheetContents*);
91 static bool parseColor(RGBA32& color, const String&, bool strict = false); 91 static bool parseColor(RGBA32& color, const String&, bool strict = false);
92 static StyleColor colorFromRGBColorString(const String&); 92 static StyleColor colorFromRGBColorString(const String&);
93 static bool parseSystemColor(RGBA32& color, const String&); 93 static bool parseSystemColor(RGBA32& color, const String&);
94 static PassRefPtr<CSSValueList> parseFontFaceValue(const AtomicString&); 94 static PassRefPtr<CSSValueList> parseFontFaceValue(const AtomicString&);
95 static PassRefPtr<CSSValue> parseAnimationTimingFunctionValue(const String&) ; 95 static PassRefPtr<CSSValue> parseAnimationTimingFunctionValue(const String&) ;
96 bool parseDeclaration(MutableStylePropertySet*, const String&, CSSParserObse rver*, StyleSheetContents* contextStyleSheet); 96 bool parseDeclaration(MutableStylePropertySet*, const String&, CSSParserObse rver*, StyleSheetContents* contextStyleSheet);
97 static PassRefPtr<ImmutableStylePropertySet> parseInlineStyleDeclaration(con st String&, Element*); 97 static PassRefPtr<ImmutableStylePropertySet> parseInlineStyleDeclaration(con st String&, Element*);
98 PassOwnPtr<Vector<double> > parseKeyframeKeyList(const String&); 98 PassOwnPtr<Vector<double> > parseKeyframeKeyList(const String&);
99 bool parseAttributeMatchType(CSSSelector::AttributeMatchType&, const String& ); 99 bool parseAttributeMatchType(CSSSelector::AttributeMatchType&, const String& );
100 100
101 static bool parseValue(MutableStylePropertySet*, CSSPropertyID, const String &, bool important, const Document&); 101 static bool parseValue(MutableStylePropertySet*, CSSPropertyID, const String &, const Document&);
102 102
103 bool parseValue(CSSPropertyID, bool important); 103 bool parseValue(CSSPropertyID);
104 void parseSelector(const String&, CSSSelectorList&); 104 void parseSelector(const String&, CSSSelectorList&);
105 105
106 CSSParserSelector* createFloatingSelector(); 106 CSSParserSelector* createFloatingSelector();
107 CSSParserSelector* createFloatingSelectorWithTagName(const QualifiedName&); 107 CSSParserSelector* createFloatingSelectorWithTagName(const QualifiedName&);
108 PassOwnPtr<CSSParserSelector> sinkFloatingSelector(CSSParserSelector*); 108 PassOwnPtr<CSSParserSelector> sinkFloatingSelector(CSSParserSelector*);
109 109
110 Vector<OwnPtr<CSSParserSelector> >* createFloatingSelectorVector(); 110 Vector<OwnPtr<CSSParserSelector> >* createFloatingSelectorVector();
111 PassOwnPtr<Vector<OwnPtr<CSSParserSelector> > > sinkFloatingSelectorVector(V ector<OwnPtr<CSSParserSelector> >*); 111 PassOwnPtr<Vector<OwnPtr<CSSParserSelector> > > sinkFloatingSelectorVector(V ector<OwnPtr<CSSParserSelector> >*);
112 112
113 CSSParserValueList* createFloatingValueList(); 113 CSSParserValueList* createFloatingValueList();
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 void invalidBlockHit() { } 147 void invalidBlockHit() { }
148 148
149 Vector<OwnPtr<CSSParserSelector> >* reusableSelectorVector() { return &m_reu sableSelectorVector; } 149 Vector<OwnPtr<CSSParserSelector> >* reusableSelectorVector() { return &m_reu sableSelectorVector; }
150 150
151 void clearProperties(); 151 void clearProperties();
152 152
153 PassRefPtr<ImmutableStylePropertySet> createStylePropertySet(); 153 PassRefPtr<ImmutableStylePropertySet> createStylePropertySet();
154 154
155 CSSParserContext m_context; 155 CSSParserContext m_context;
156 156
157 bool m_important;
158 CSSPropertyID m_id; 157 CSSPropertyID m_id;
159 RawPtr<StyleSheetContents> m_styleSheet; 158 RawPtr<StyleSheetContents> m_styleSheet;
160 RefPtr<StyleRuleBase> m_rule; 159 RefPtr<StyleRuleBase> m_rule;
161 RefPtr<StyleKeyframe> m_keyframe; 160 RefPtr<StyleKeyframe> m_keyframe;
162 OwnPtr<CSSParserValueList> m_valueList; 161 OwnPtr<CSSParserValueList> m_valueList;
163 bool m_supportsCondition; 162 bool m_supportsCondition;
164 163
165 Vector<CSSProperty, 256> m_parsedProperties; 164 Vector<CSSProperty, 256> m_parsedProperties;
166 CSSSelectorList* m_selectorListForParseSelector; 165 CSSSelectorList* m_selectorListForParseSelector;
167 166
168 unsigned m_numParsedPropertiesBeforeMarginBox; 167 unsigned m_numParsedPropertiesBeforeMarginBox;
169 168
170 bool m_hadSyntacticallyValidCSSRule; 169 bool m_hadSyntacticallyValidCSSRule;
171 bool m_ignoreErrors; 170 bool m_ignoreErrors;
172 171
173 AtomicString m_defaultNamespace; 172 AtomicString m_defaultNamespace;
174 173
175 // tokenizer methods and data 174 // tokenizer methods and data
176 CSSParserObserver* m_observer; 175 CSSParserObserver* m_observer;
177 176
178 // Local functions which just call into CSSParserObserver if non-null. 177 // Local functions which just call into CSSParserObserver if non-null.
179 void startRule(); 178 void startRule();
180 void endRule(bool valid); 179 void endRule(bool valid);
181 void startRuleHeader(CSSRuleSourceData::Type); 180 void startRuleHeader(CSSRuleSourceData::Type);
182 void endRuleHeader(); 181 void endRuleHeader();
183 void startSelector(); 182 void startSelector();
184 void endSelector(); 183 void endSelector();
185 void startRuleBody(); 184 void startRuleBody();
186 void startProperty(); 185 void startProperty();
187 void endProperty(bool isImportantFound, bool isPropertyParsed, CSSParserErro r = NoCSSError); 186 void endProperty(bool isPropertyParsed, CSSParserError = NoCSSError);
188 void startEndUnknownRule(); 187 void startEndUnknownRule();
189 188
190 void endInvalidRuleHeader(); 189 void endInvalidRuleHeader();
191 void reportError(const CSSParserLocation&, CSSParserError = GeneralCSSError) { } 190 void reportError(const CSSParserLocation&, CSSParserError = GeneralCSSError) { }
192 void setLocationLabel(const CSSParserLocation& location) { m_locationLabel = location; } 191 void setLocationLabel(const CSSParserLocation& location) { m_locationLabel = location; }
193 const CSSParserLocation& lastLocationLabel() const { return m_locationLabel; } 192 const CSSParserLocation& lastLocationLabel() const { return m_locationLabel; }
194 193
195 void tokenToLowerCase(CSSParserString& token); 194 void tokenToLowerCase(CSSParserString& token);
196 195
197 CSSParserLocation currentLocation() { return m_tokenizer.currentLocation(); } 196 CSSParserLocation currentLocation() { return m_tokenizer.currentLocation(); }
198 197
199 private: 198 private:
200 inline void ensureLineEndings(); 199 inline void ensureLineEndings();
201 200
202 void setStyleSheet(StyleSheetContents* styleSheet) { m_styleSheet = styleShe et; } 201 void setStyleSheet(StyleSheetContents* styleSheet) { m_styleSheet = styleShe et; }
203 202
204 bool inViewport() const { return m_inViewport; } 203 bool inViewport() const { return m_inViewport; }
205 204
206 void recheckAtKeyword(const UChar* str, int len); 205 void recheckAtKeyword(const UChar* str, int len);
207 206
208 template<unsigned prefixLength, unsigned suffixLength> 207 template<unsigned prefixLength, unsigned suffixLength>
209 inline void setupParser(const char (&prefix)[prefixLength], const String& st ring, const char (&suffix)[suffixLength]) 208 inline void setupParser(const char (&prefix)[prefixLength], const String& st ring, const char (&suffix)[suffixLength])
210 { 209 {
211 setupParser(prefix, prefixLength - 1, string, suffix, suffixLength - 1); 210 setupParser(prefix, prefixLength - 1, string, suffix, suffixLength - 1);
212 } 211 }
213 void setupParser(const char* prefix, unsigned prefixLength, const String&, c onst char* suffix, unsigned suffixLength); 212 void setupParser(const char* prefix, unsigned prefixLength, const String&, c onst char* suffix, unsigned suffixLength);
214 213
215 bool parseValue(MutableStylePropertySet*, CSSPropertyID, const String&, bool important, StyleSheetContents* contextStyleSheet); 214 bool parseValue(MutableStylePropertySet*, CSSPropertyID, const String&, Styl eSheetContents* contextStyleSheet);
216 PassRefPtr<ImmutableStylePropertySet> parseDeclaration(const String&, StyleS heetContents* contextStyleSheet); 215 PassRefPtr<ImmutableStylePropertySet> parseDeclaration(const String&, StyleS heetContents* contextStyleSheet);
217 216
218 bool parseColor(const String&); 217 bool parseColor(const String&);
219 218
220 const String* m_source; 219 const String* m_source;
221 TextPosition m_startPosition; 220 TextPosition m_startPosition;
222 CSSRuleSourceData::Type m_ruleHeaderType; 221 CSSRuleSourceData::Type m_ruleHeaderType;
223 unsigned m_ruleHeaderStartOffset; 222 unsigned m_ruleHeaderStartOffset;
224 int m_ruleHeaderStartLineNumber; 223 int m_ruleHeaderStartLineNumber;
225 OwnPtr<Vector<unsigned> > m_lineEndings; 224 OwnPtr<Vector<unsigned> > m_lineEndings;
(...skipping 30 matching lines...) Expand all
256 inline int cssyylex(void* yylval, BisonCSSParser* parser) 255 inline int cssyylex(void* yylval, BisonCSSParser* parser)
257 { 256 {
258 return parser->m_tokenizer.lex(yylval); 257 return parser->m_tokenizer.lex(yylval);
259 } 258 }
260 259
261 bool isValidNthToken(const CSSParserString&); 260 bool isValidNthToken(const CSSParserString&);
262 261
263 } // namespace blink 262 } // namespace blink
264 263
265 #endif // SKY_ENGINE_CORE_CSS_PARSER_BISONCSSPARSER_H_ 264 #endif // SKY_ENGINE_CORE_CSS_PARSER_BISONCSSPARSER_H_
OLDNEW
« no previous file with comments | « sky/engine/core/css/StylePropertySet.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