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: Source/core/css/parser/CSSPropertyParser.h

Issue 1319343004: Add property parser code path based on CSSParserTokenRange (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Patch for landing Created 5 years, 3 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.
11 * 11 *
12 * This library is distributed in the hope that it will be useful, 12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Library General Public License for more details. 15 * Library General Public License for more details.
16 * 16 *
17 * You should have received a copy of the GNU Library General Public License 17 * You should have received a copy of the GNU Library General Public License
18 * along with this library; see the file COPYING.LIB. If not, write to 18 * along with this library; see the file COPYING.LIB. If not, write to
19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 * Boston, MA 02110-1301, USA. 20 * Boston, MA 02110-1301, USA.
21 */ 21 */
22 22
23 #ifndef CSSPropertyParser_h 23 #ifndef CSSPropertyParser_h
24 #define CSSPropertyParser_h 24 #define CSSPropertyParser_h
25 25
26 #include "core/css/CSSGradientValue.h" 26 #include "core/css/CSSGradientValue.h"
27 #include "core/css/CSSGridTemplateAreasValue.h" 27 #include "core/css/CSSGridTemplateAreasValue.h"
28 #include "core/css/CSSPropertySourceData.h" 28 #include "core/css/CSSPropertySourceData.h"
29 #include "core/css/parser/CSSParserTokenRange.h"
29 #include "platform/Length.h" 30 #include "platform/Length.h"
30 31
31 namespace blink { 32 namespace blink {
32 33
33 class BorderImageParseContext; 34 class BorderImageParseContext;
34 class CSSBorderImageSliceValue; 35 class CSSBorderImageSliceValue;
35 class CSSBasicShape; 36 class CSSBasicShape;
36 class CSSBasicShapeInset; 37 class CSSBasicShapeInset;
37 class CSSFunctionValue; 38 class CSSFunctionValue;
38 class CSSGradientValue; 39 class CSSGradientValue;
(...skipping 26 matching lines...) Expand all
65 FTime = 0x0020, 66 FTime = 0x0020,
66 FFrequency = 0x0040, 67 FFrequency = 0x0040,
67 FPositiveInteger = 0x0080, 68 FPositiveInteger = 0x0080,
68 FRelative = 0x0100, 69 FRelative = 0x0100,
69 FResolution = 0x0200, 70 FResolution = 0x0200,
70 FNonNeg = 0x0400, 71 FNonNeg = 0x0400,
71 FUnitlessQuirk = 0x0800 72 FUnitlessQuirk = 0x0800
72 }; 73 };
73 74
74 static bool parseValue(CSSPropertyID, bool important, 75 static bool parseValue(CSSPropertyID, bool important,
75 CSSParserValueList*, const CSSParserContext&, 76 const CSSParserTokenRange&, const CSSParserContext&,
76 WillBeHeapVector<CSSProperty, 256>&, StyleRule::Type); 77 WillBeHeapVector<CSSProperty, 256>&, StyleRule::Type);
77 78
78 static bool isSystemColor(CSSValueID); 79 static bool isSystemColor(CSSValueID);
79 static bool isColorKeyword(CSSValueID); 80 static bool isColorKeyword(CSSValueID);
80 81
81 private: 82 private:
82 CSSPropertyParser(CSSParserValueList*, const CSSParserContext&, 83 CSSPropertyParser(CSSParserValueList*, const CSSParserTokenRange&, const CSS ParserContext&,
83 WillBeHeapVector<CSSProperty, 256>&, StyleRule::Type); 84 WillBeHeapVector<CSSProperty, 256>&, StyleRule::Type);
84 85
85 bool parseValue(CSSPropertyID, bool important); 86 bool parseValue(CSSPropertyID, bool important);
87 PassRefPtrWillBeRawPtr<CSSValue> parseSingleValue(CSSPropertyID);
86 88
87 bool inShorthand() const { return m_inParseShorthand; } 89 bool inShorthand() const { return m_inParseShorthand; }
88 bool inQuirksMode() const { return isQuirksModeBehavior(m_context.mode()); } 90 bool inQuirksMode() const { return isQuirksModeBehavior(m_context.mode()); }
89 91
90 bool parseViewportProperty(CSSPropertyID propId, bool important); 92 bool parseViewportProperty(CSSPropertyID propId, bool important);
91 bool parseViewportShorthand(CSSPropertyID propId, CSSPropertyID first, CSSPr opertyID second, bool important); 93 bool parseViewportShorthand(CSSPropertyID propId, CSSPropertyID first, CSSPr opertyID second, bool important);
92 bool parseFontFaceDescriptor(CSSPropertyID); 94 bool parseFontFaceDescriptor(CSSPropertyID);
93 95
94 KURL completeURL(const String& url) const; 96 KURL completeURL(const String& url) const;
95 97
96 void addProperty(CSSPropertyID, PassRefPtrWillBeRawPtr<CSSValue>, bool impor tant, bool implicit = false); 98 void addProperty(CSSPropertyID, PassRefPtrWillBeRawPtr<CSSValue>, bool impor tant, bool implicit = false);
97 void rollbackLastProperties(int num); 99 void rollbackLastProperties(int num);
98 void addExpandedPropertyForValue(CSSPropertyID propId, PassRefPtrWillBeRawPt r<CSSValue>, bool); 100 void addExpandedPropertyForValue(CSSPropertyID propId, PassRefPtrWillBeRawPt r<CSSValue>, bool);
99 101
100 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> parseValidPrimitive(CSSValueID ide nt, CSSParserValue*); 102 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> parseValidPrimitive(CSSValueID ide nt, CSSParserValue*);
101 103
102 bool parseShorthand(CSSPropertyID, const StylePropertyShorthand&, bool impor tant); 104 bool parseShorthand(CSSPropertyID, const StylePropertyShorthand&, bool impor tant);
105 bool parseShorthand(CSSPropertyID, bool important);
103 bool parse4Values(CSSPropertyID, const CSSPropertyID* properties, bool impor tant); 106 bool parse4Values(CSSPropertyID, const CSSPropertyID* properties, bool impor tant);
104 PassRefPtrWillBeRawPtr<CSSValueList> parseContent(); 107 PassRefPtrWillBeRawPtr<CSSValueList> parseContent();
105 PassRefPtrWillBeRawPtr<CSSValue> parseQuotes();
106 108
107 PassRefPtrWillBeRawPtr<CSSValue> parseAttr(CSSParserValueList* args); 109 PassRefPtrWillBeRawPtr<CSSValue> parseAttr(CSSParserValueList* args);
108 110
109 bool parseFillImage(CSSParserValueList*, RefPtrWillBeRawPtr<CSSValue>&); 111 bool parseFillImage(CSSParserValueList*, RefPtrWillBeRawPtr<CSSValue>&);
110 112
111 enum FillPositionFlag { InvalidFillPosition = 0, AmbiguousFillPosition = 1, XFillPosition = 2, YFillPosition = 4 }; 113 enum FillPositionFlag { InvalidFillPosition = 0, AmbiguousFillPosition = 1, XFillPosition = 2, YFillPosition = 4 };
112 enum FillPositionParsingMode { ResolveValuesAsPercent = 0, ResolveValuesAsKe yword = 1 }; 114 enum FillPositionParsingMode { ResolveValuesAsPercent = 0, ResolveValuesAsKe yword = 1 };
113 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> parseFillPositionComponent(CSSPars erValueList*, unsigned& cumulativeFlags, FillPositionFlag& individualFlag, FillP ositionParsingMode = ResolveValuesAsPercent, Units = FUnknown); 115 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> parseFillPositionComponent(CSSPars erValueList*, unsigned& cumulativeFlags, FillPositionFlag& individualFlag, FillP ositionParsingMode = ResolveValuesAsPercent, Units = FUnknown);
114 PassRefPtrWillBeRawPtr<CSSValue> parseFillPositionX(CSSParserValueList*); 116 PassRefPtrWillBeRawPtr<CSSValue> parseFillPositionX(CSSParserValueList*);
115 PassRefPtrWillBeRawPtr<CSSValue> parseFillPositionY(CSSParserValueList*); 117 PassRefPtrWillBeRawPtr<CSSValue> parseFillPositionY(CSSParserValueList*);
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 bool parseDeprecatedLinearGradient(CSSParserValueList*, RefPtrWillBeRawPtr<C SSValue>&, CSSGradientRepeat repeating); 235 bool parseDeprecatedLinearGradient(CSSParserValueList*, RefPtrWillBeRawPtr<C SSValue>&, CSSGradientRepeat repeating);
234 bool parseDeprecatedRadialGradient(CSSParserValueList*, RefPtrWillBeRawPtr<C SSValue>&, CSSGradientRepeat repeating); 236 bool parseDeprecatedRadialGradient(CSSParserValueList*, RefPtrWillBeRawPtr<C SSValue>&, CSSGradientRepeat repeating);
235 bool parseLinearGradient(CSSParserValueList*, RefPtrWillBeRawPtr<CSSValue>&, CSSGradientRepeat repeating); 237 bool parseLinearGradient(CSSParserValueList*, RefPtrWillBeRawPtr<CSSValue>&, CSSGradientRepeat repeating);
236 bool parseRadialGradient(CSSParserValueList*, RefPtrWillBeRawPtr<CSSValue>&, CSSGradientRepeat repeating); 238 bool parseRadialGradient(CSSParserValueList*, RefPtrWillBeRawPtr<CSSValue>&, CSSGradientRepeat repeating);
237 bool parseGradientColorStops(CSSParserValueList*, CSSGradientValue*, bool ex pectComma); 239 bool parseGradientColorStops(CSSParserValueList*, CSSGradientValue*, bool ex pectComma);
238 240
239 bool parseCrossfade(CSSParserValueList*, RefPtrWillBeRawPtr<CSSValue>&); 241 bool parseCrossfade(CSSParserValueList*, RefPtrWillBeRawPtr<CSSValue>&);
240 242
241 PassRefPtrWillBeRawPtr<CSSValue> parseImageSet(CSSParserValueList*); 243 PassRefPtrWillBeRawPtr<CSSValue> parseImageSet(CSSParserValueList*);
242 244
243 PassRefPtrWillBeRawPtr<CSSValue> parseWillChange();
244
245 PassRefPtrWillBeRawPtr<CSSValueList> parseFilter(); 245 PassRefPtrWillBeRawPtr<CSSValueList> parseFilter();
246 PassRefPtrWillBeRawPtr<CSSFunctionValue> parseBuiltinFilterArguments(CSSPars erValueList*, CSSValueID); 246 PassRefPtrWillBeRawPtr<CSSFunctionValue> parseBuiltinFilterArguments(CSSPars erValueList*, CSSValueID);
247 247
248 PassRefPtrWillBeRawPtr<CSSValueList> parseTransformOrigin(); 248 PassRefPtrWillBeRawPtr<CSSValueList> parseTransformOrigin();
249 PassRefPtrWillBeRawPtr<CSSValueList> parseTransform(bool useLegacyParsing); 249 PassRefPtrWillBeRawPtr<CSSValueList> parseTransform(bool useLegacyParsing);
250 PassRefPtrWillBeRawPtr<CSSValue> parseTransformValue(bool useLegacyParsing, CSSParserValue*); 250 PassRefPtrWillBeRawPtr<CSSValue> parseTransformValue(bool useLegacyParsing, CSSParserValue*);
251 251
252 PassRefPtrWillBeRawPtr<CSSValue> parseMotionPath(); 252 PassRefPtrWillBeRawPtr<CSSValue> parseMotionPath();
253 PassRefPtrWillBeRawPtr<CSSValue> parseMotionRotation(); 253 PassRefPtrWillBeRawPtr<CSSValue> parseMotionRotation();
254 254
(...skipping 23 matching lines...) Expand all
278 PassRefPtrWillBeRawPtr<CSSBasicShape> parseInsetRoundedCorners(PassRefPtrWil lBeRawPtr<CSSBasicShapeInset>, CSSParserValueList*); 278 PassRefPtrWillBeRawPtr<CSSBasicShape> parseInsetRoundedCorners(PassRefPtrWil lBeRawPtr<CSSBasicShapeInset>, CSSParserValueList*);
279 279
280 enum SizeParameterType { 280 enum SizeParameterType {
281 None, 281 None,
282 Auto, 282 Auto,
283 Length, 283 Length,
284 PageSize, 284 PageSize,
285 Orientation, 285 Orientation,
286 }; 286 };
287 287
288 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> parsePage();
289 PassRefPtrWillBeRawPtr<CSSValueList> parseSize(); 288 PassRefPtrWillBeRawPtr<CSSValueList> parseSize();
290 SizeParameterType parseSizeParameter(CSSValueList* parsedValues, CSSParserVa lue*, SizeParameterType prevParamType); 289 SizeParameterType parseSizeParameter(CSSValueList* parsedValues, CSSParserVa lue*, SizeParameterType prevParamType);
291 290
292 bool parseFontFaceSrcURI(CSSValueList*); 291 bool parseFontFaceSrcURI(CSSValueList*);
293 bool parseFontFaceSrcLocal(CSSValueList*); 292 bool parseFontFaceSrcLocal(CSSValueList*);
294 293
295 class ImplicitScope { 294 class ImplicitScope {
296 STACK_ALLOCATED(); 295 STACK_ALLOCATED();
297 WTF_MAKE_NONCOPYABLE(ImplicitScope); 296 WTF_MAKE_NONCOPYABLE(ImplicitScope);
298 public: 297 public:
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 void commitBorderImageProperty(CSSPropertyID, PassRefPtrWillBeRawPtr<CSSValu e>, bool important); 358 void commitBorderImageProperty(CSSPropertyID, PassRefPtrWillBeRawPtr<CSSValu e>, bool important);
360 359
361 PassRefPtrWillBeRawPtr<CSSValue> parseScrollSnapPoints(); 360 PassRefPtrWillBeRawPtr<CSSValue> parseScrollSnapPoints();
362 PassRefPtrWillBeRawPtr<CSSValue> parseScrollSnapDestination(); 361 PassRefPtrWillBeRawPtr<CSSValue> parseScrollSnapDestination();
363 PassRefPtrWillBeRawPtr<CSSValue> parseScrollSnapCoordinate(); 362 PassRefPtrWillBeRawPtr<CSSValue> parseScrollSnapCoordinate();
364 PassRefPtrWillBeRawPtr<CSSValue> parseScrollSnapPosition(); 363 PassRefPtrWillBeRawPtr<CSSValue> parseScrollSnapPosition();
365 364
366 private: 365 private:
367 // Inputs: 366 // Inputs:
368 CSSParserValueList* m_valueList; 367 CSSParserValueList* m_valueList;
368 CSSParserTokenRange m_range;
369 const CSSParserContext& m_context; 369 const CSSParserContext& m_context;
370 370
371 // Outputs: 371 // Outputs:
372 WillBeHeapVector<CSSProperty, 256>& m_parsedProperties; 372 WillBeHeapVector<CSSProperty, 256>& m_parsedProperties;
373 StyleRule::Type m_ruleType; 373 StyleRule::Type m_ruleType;
374 374
375 // Locals during parsing: 375 // Locals during parsing:
376 int m_inParseShorthand; 376 int m_inParseShorthand;
377 CSSPropertyID m_currentShorthand; 377 CSSPropertyID m_currentShorthand;
378 bool m_implicitShorthand; 378 bool m_implicitShorthand;
379 RefPtrWillBeMember<CSSCalcValue> m_parsedCalculation; 379 RefPtrWillBeMember<CSSCalcValue> m_parsedCalculation;
380 }; 380 };
381 381
382 CSSPropertyID unresolvedCSSPropertyID(const CSSParserString&); 382 CSSPropertyID unresolvedCSSPropertyID(const CSSParserString&);
383 CSSValueID cssValueKeywordID(const CSSParserString&); 383 CSSValueID cssValueKeywordID(const CSSParserString&);
384 384
385 } // namespace blink 385 } // namespace blink
386 386
387 #endif // CSSPropertyParser_h 387 #endif // CSSPropertyParser_h
OLDNEW
« no previous file with comments | « Source/core/css/parser/CSSParserValues.cpp ('k') | Source/core/css/parser/CSSPropertyParser.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698