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

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

Issue 1219463003: Dissect and clean up instances of color parsing in CSSPropertyParser (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Update handling of 'grey' in fast-path color parser. Created 5 years, 5 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 FRelative = 0x0100, 67 FRelative = 0x0100,
68 FResolution = 0x0200, 68 FResolution = 0x0200,
69 FNonNeg = 0x0400, 69 FNonNeg = 0x0400,
70 FUnitlessQuirk = 0x0800 70 FUnitlessQuirk = 0x0800
71 }; 71 };
72 72
73 static bool parseValue(CSSPropertyID, bool important, 73 static bool parseValue(CSSPropertyID, bool important,
74 CSSParserValueList*, const CSSParserContext&, 74 CSSParserValueList*, const CSSParserContext&,
75 WillBeHeapVector<CSSProperty, 256>&, StyleRule::Type); 75 WillBeHeapVector<CSSProperty, 256>&, StyleRule::Type);
76 76
77 static bool isSystemColor(int id); 77 static bool isSystemColor(CSSValueID);
78 static bool isColorKeyword(CSSValueID);
78 79
79 private: 80 private:
80 CSSPropertyParser(CSSParserValueList*, const CSSParserContext&, 81 CSSPropertyParser(CSSParserValueList*, const CSSParserContext&,
81 WillBeHeapVector<CSSProperty, 256>&, StyleRule::Type); 82 WillBeHeapVector<CSSProperty, 256>&, StyleRule::Type);
82 83
83 bool parseValue(CSSPropertyID, bool important); 84 bool parseValue(CSSPropertyID, bool important);
84 85
85 bool inShorthand() const { return m_inParseShorthand; } 86 bool inShorthand() const { return m_inParseShorthand; }
86 bool inQuirksMode() const { return isQuirksModeBehavior(m_context.mode()); } 87 bool inQuirksMode() const { return isQuirksModeBehavior(m_context.mode()); }
87 88
88 bool parseViewportProperty(CSSPropertyID propId, bool important); 89 bool parseViewportProperty(CSSPropertyID propId, bool important);
89 bool parseViewportShorthand(CSSPropertyID propId, CSSPropertyID first, CSSPr opertyID second, bool important); 90 bool parseViewportShorthand(CSSPropertyID propId, CSSPropertyID first, CSSPr opertyID second, bool important);
90 bool parseFontFaceDescriptor(CSSPropertyID); 91 bool parseFontFaceDescriptor(CSSPropertyID);
91 92
92 KURL completeURL(const String& url) const; 93 KURL completeURL(const String& url) const;
93 94
94 void addProperty(CSSPropertyID, PassRefPtrWillBeRawPtr<CSSValue>, bool impor tant, bool implicit = false); 95 void addProperty(CSSPropertyID, PassRefPtrWillBeRawPtr<CSSValue>, bool impor tant, bool implicit = false);
95 void rollbackLastProperties(int num); 96 void rollbackLastProperties(int num);
96 void addExpandedPropertyForValue(CSSPropertyID propId, PassRefPtrWillBeRawPt r<CSSValue>, bool); 97 void addExpandedPropertyForValue(CSSPropertyID propId, PassRefPtrWillBeRawPt r<CSSValue>, bool);
97 98
98 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> parseValidPrimitive(CSSValueID ide nt, CSSParserValue*); 99 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> parseValidPrimitive(CSSValueID ide nt, CSSParserValue*);
99 100
100 bool parseShorthand(CSSPropertyID, const StylePropertyShorthand&, bool impor tant); 101 bool parseShorthand(CSSPropertyID, const StylePropertyShorthand&, bool impor tant);
101 bool parse4Values(CSSPropertyID, const CSSPropertyID* properties, bool impor tant); 102 bool parse4Values(CSSPropertyID, const CSSPropertyID* properties, bool impor tant);
102 PassRefPtrWillBeRawPtr<CSSValueList> parseContent(); 103 PassRefPtrWillBeRawPtr<CSSValueList> parseContent();
103 PassRefPtrWillBeRawPtr<CSSValue> parseQuotes(); 104 PassRefPtrWillBeRawPtr<CSSValue> parseQuotes();
104 105
105 PassRefPtrWillBeRawPtr<CSSValue> parseAttr(CSSParserValueList* args); 106 PassRefPtrWillBeRawPtr<CSSValue> parseAttr(CSSParserValueList* args);
106 107
107 PassRefPtrWillBeRawPtr<CSSValue> parseBackgroundColor();
108
109 bool parseFillImage(CSSParserValueList*, RefPtrWillBeRawPtr<CSSValue>&); 108 bool parseFillImage(CSSParserValueList*, RefPtrWillBeRawPtr<CSSValue>&);
110 109
111 enum FillPositionFlag { InvalidFillPosition = 0, AmbiguousFillPosition = 1, XFillPosition = 2, YFillPosition = 4 }; 110 enum FillPositionFlag { InvalidFillPosition = 0, AmbiguousFillPosition = 1, XFillPosition = 2, YFillPosition = 4 };
112 enum FillPositionParsingMode { ResolveValuesAsPercent = 0, ResolveValuesAsKe yword = 1 }; 111 enum FillPositionParsingMode { ResolveValuesAsPercent = 0, ResolveValuesAsKe yword = 1 };
113 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> parseFillPositionComponent(CSSPars erValueList*, unsigned& cumulativeFlags, FillPositionFlag& individualFlag, FillP ositionParsingMode = ResolveValuesAsPercent, Units = FUnknown); 112 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> parseFillPositionComponent(CSSPars erValueList*, unsigned& cumulativeFlags, FillPositionFlag& individualFlag, FillP ositionParsingMode = ResolveValuesAsPercent, Units = FUnknown);
114 PassRefPtrWillBeRawPtr<CSSValue> parseFillPositionX(CSSParserValueList*); 113 PassRefPtrWillBeRawPtr<CSSValue> parseFillPositionX(CSSParserValueList*);
115 PassRefPtrWillBeRawPtr<CSSValue> parseFillPositionY(CSSParserValueList*); 114 PassRefPtrWillBeRawPtr<CSSValue> parseFillPositionY(CSSParserValueList*);
116 void parse2ValuesFillPosition(CSSParserValueList*, RefPtrWillBeRawPtr<CSSVal ue>&, RefPtrWillBeRawPtr<CSSValue>&, Units = FUnknown); 115 void parse2ValuesFillPosition(CSSParserValueList*, RefPtrWillBeRawPtr<CSSVal ue>&, RefPtrWillBeRawPtr<CSSValue>&, Units = FUnknown);
117 bool isPotentialPositionValue(CSSParserValue*); 116 bool isPotentialPositionValue(CSSParserValue*);
118 void parseFillPosition(CSSParserValueList*, RefPtrWillBeRawPtr<CSSValue>&, R efPtrWillBeRawPtr<CSSValue>&, Units = FUnknown); 117 void parseFillPosition(CSSParserValueList*, RefPtrWillBeRawPtr<CSSValue>&, R efPtrWillBeRawPtr<CSSValue>&, Units = FUnknown);
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 PassRefPtrWillBeRawPtr<CSSBasicShape> parseBasicShapePolygon(CSSParserValueL ist* args); 181 PassRefPtrWillBeRawPtr<CSSBasicShape> parseBasicShapePolygon(CSSParserValueL ist* args);
183 PassRefPtrWillBeRawPtr<CSSBasicShape> parseBasicShapeInset(CSSParserValueLis t* args); 182 PassRefPtrWillBeRawPtr<CSSBasicShape> parseBasicShapeInset(CSSParserValueLis t* args);
184 183
185 bool parseFont(bool important); 184 bool parseFont(bool important);
186 void parseSystemFont(bool important); 185 void parseSystemFont(bool important);
187 PassRefPtrWillBeRawPtr<CSSValueList> parseFontFamily(); 186 PassRefPtrWillBeRawPtr<CSSValueList> parseFontFamily();
188 187
189 PassRefPtrWillBeRawPtr<CSSValue> parseCounter(int defaultValue); 188 PassRefPtrWillBeRawPtr<CSSValue> parseCounter(int defaultValue);
190 PassRefPtrWillBeRawPtr<CSSValue> parseCounterContent(CSSParserValueList* arg s, bool counters); 189 PassRefPtrWillBeRawPtr<CSSValue> parseCounterContent(CSSParserValueList* arg s, bool counters);
191 190
192 bool parseColorParameters(CSSParserValue*, int* colorValues, bool parseAlpha ); 191 bool parseColorParameters(const CSSParserValue*, int* colorValues, bool pars eAlpha);
193 bool parseHSLParameters(CSSParserValue*, double* colorValues, bool parseAlph a); 192 bool parseHSLParameters(const CSSParserValue*, double* colorValues, bool par seAlpha);
194 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> parseColor(CSSParserValue* = 0, bo ol acceptQuirkyColors = false); 193 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> parseColor(const CSSParserValue*, bool acceptQuirkyColors = false);
195 bool parseColorFromValue(CSSParserValue*, RGBA32&, bool acceptQuirkyColors = false); 194 bool parseColorFromValue(const CSSParserValue*, RGBA32&, bool acceptQuirkyCo lors = false);
195
196 bool acceptQuirkyColors(CSSPropertyID) const;
197 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> parseBackgroundColor(const CSSPars erValue*);
198 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> parseTapHighlightColor(const CSSPa rserValue*);
199 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> parseGradientStopColor(const CSSPa rserValue*);
200 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> parseDeprecatedGradientStopColor(c onst CSSParserValue*);
201 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> parseSVGColor(const CSSParserValue *);
196 202
197 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> parseLineHeight(); 203 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> parseLineHeight();
198 bool parseFontSize(bool important); 204 bool parseFontSize(bool important);
199 bool parseFontVariant(bool important); 205 bool parseFontVariant(bool important);
200 bool parseFontWeight(bool important); 206 bool parseFontWeight(bool important);
201 PassRefPtrWillBeRawPtr<CSSValueList> parseFontFaceSrc(); 207 PassRefPtrWillBeRawPtr<CSSValueList> parseFontFaceSrc();
202 PassRefPtrWillBeRawPtr<CSSValueList> parseFontFaceUnicodeRange(); 208 PassRefPtrWillBeRawPtr<CSSValueList> parseFontFaceUnicodeRange();
203 209
204 bool parseSVGValue(CSSPropertyID propId, bool important); 210 bool parseSVGValue(CSSPropertyID propId, bool important);
205 PassRefPtrWillBeRawPtr<CSSValue> parseSVGStrokeDasharray(); 211 PassRefPtrWillBeRawPtr<CSSValue> parseSVGStrokeDasharray();
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 bool m_implicitShorthand; 384 bool m_implicitShorthand;
379 RefPtrWillBeMember<CSSCalcValue> m_parsedCalculation; 385 RefPtrWillBeMember<CSSCalcValue> m_parsedCalculation;
380 }; 386 };
381 387
382 CSSPropertyID unresolvedCSSPropertyID(const CSSParserString&); 388 CSSPropertyID unresolvedCSSPropertyID(const CSSParserString&);
383 CSSValueID cssValueKeywordID(const CSSParserString&); 389 CSSValueID cssValueKeywordID(const CSSParserString&);
384 390
385 } // namespace blink 391 } // namespace blink
386 392
387 #endif // CSSPropertyParser_h 393 #endif // CSSPropertyParser_h
OLDNEW
« no previous file with comments | « Source/core/css/parser/CSSParserFastPaths.cpp ('k') | Source/core/css/parser/CSSPropertyParser.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698