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

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: Address review comments 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 25 matching lines...) Expand all
64 FTime = 0x0020, 65 FTime = 0x0020,
65 FFrequency = 0x0040, 66 FFrequency = 0x0040,
66 FPositiveInteger = 0x0080, 67 FPositiveInteger = 0x0080,
67 FRelative = 0x0100, 68 FRelative = 0x0100,
68 FResolution = 0x0200, 69 FResolution = 0x0200,
69 FNonNeg = 0x0400, 70 FNonNeg = 0x0400,
70 FUnitlessQuirk = 0x0800 71 FUnitlessQuirk = 0x0800
71 }; 72 };
72 73
73 static bool parseValue(CSSPropertyID, bool important, 74 static bool parseValue(CSSPropertyID, bool important,
74 CSSParserValueList*, const CSSParserContext&, 75 const CSSParserTokenRange&, const CSSParserContext&,
75 WillBeHeapVector<CSSProperty, 256>&, StyleRule::Type); 76 WillBeHeapVector<CSSProperty, 256>&, StyleRule::Type);
76 77
77 static bool isSystemColor(CSSValueID); 78 static bool isSystemColor(CSSValueID);
78 static bool isColorKeyword(CSSValueID); 79 static bool isColorKeyword(CSSValueID);
79 80
80 private: 81 private:
81 CSSPropertyParser(CSSParserValueList*, const CSSParserContext&, 82 CSSPropertyParser(CSSParserValueList*, const CSSParserTokenRange&, const CSS ParserContext&,
82 WillBeHeapVector<CSSProperty, 256>&, StyleRule::Type); 83 WillBeHeapVector<CSSProperty, 256>&, StyleRule::Type);
83 84
84 bool parseValue(CSSPropertyID, bool important); 85 bool parseValue(CSSPropertyID, bool important);
86 PassRefPtrWillBeRawPtr<CSSValue> parseSingleValue(CSSPropertyID);
85 87
86 bool inShorthand() const { return m_inParseShorthand; } 88 bool inShorthand() const { return m_inParseShorthand; }
87 bool inQuirksMode() const { return isQuirksModeBehavior(m_context.mode()); } 89 bool inQuirksMode() const { return isQuirksModeBehavior(m_context.mode()); }
88 90
89 bool parseViewportProperty(CSSPropertyID propId, bool important); 91 bool parseViewportProperty(CSSPropertyID propId, bool important);
90 bool parseViewportShorthand(CSSPropertyID propId, CSSPropertyID first, CSSPr opertyID second, bool important); 92 bool parseViewportShorthand(CSSPropertyID propId, CSSPropertyID first, CSSPr opertyID second, bool important);
91 bool parseFontFaceDescriptor(CSSPropertyID); 93 bool parseFontFaceDescriptor(CSSPropertyID);
92 94
93 KURL completeURL(const String& url) const; 95 KURL completeURL(const String& url) const;
94 96
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 void commitBorderImageProperty(CSSPropertyID, PassRefPtrWillBeRawPtr<CSSValu e>, bool important); 359 void commitBorderImageProperty(CSSPropertyID, PassRefPtrWillBeRawPtr<CSSValu e>, bool important);
358 360
359 PassRefPtrWillBeRawPtr<CSSValue> parseScrollSnapPoints(); 361 PassRefPtrWillBeRawPtr<CSSValue> parseScrollSnapPoints();
360 PassRefPtrWillBeRawPtr<CSSValue> parseScrollSnapDestination(); 362 PassRefPtrWillBeRawPtr<CSSValue> parseScrollSnapDestination();
361 PassRefPtrWillBeRawPtr<CSSValue> parseScrollSnapCoordinate(); 363 PassRefPtrWillBeRawPtr<CSSValue> parseScrollSnapCoordinate();
362 PassRefPtrWillBeRawPtr<CSSValue> parseScrollSnapPosition(); 364 PassRefPtrWillBeRawPtr<CSSValue> parseScrollSnapPosition();
363 365
364 private: 366 private:
365 // Inputs: 367 // Inputs:
366 CSSParserValueList* m_valueList; 368 CSSParserValueList* m_valueList;
369 CSSParserTokenRange m_range;
367 const CSSParserContext& m_context; 370 const CSSParserContext& m_context;
368 371
369 // Outputs: 372 // Outputs:
370 WillBeHeapVector<CSSProperty, 256>& m_parsedProperties; 373 WillBeHeapVector<CSSProperty, 256>& m_parsedProperties;
371 StyleRule::Type m_ruleType; 374 StyleRule::Type m_ruleType;
372 375
373 // Locals during parsing: 376 // Locals during parsing:
374 int m_inParseShorthand; 377 int m_inParseShorthand;
375 CSSPropertyID m_currentShorthand; 378 CSSPropertyID m_currentShorthand;
376 bool m_implicitShorthand; 379 bool m_implicitShorthand;
377 RefPtrWillBeMember<CSSCalcValue> m_parsedCalculation; 380 RefPtrWillBeMember<CSSCalcValue> m_parsedCalculation;
378 }; 381 };
379 382
380 CSSPropertyID unresolvedCSSPropertyID(const CSSParserString&); 383 CSSPropertyID unresolvedCSSPropertyID(const CSSParserString&);
381 CSSValueID cssValueKeywordID(const CSSParserString&); 384 CSSValueID cssValueKeywordID(const CSSParserString&);
382 385
383 } // namespace blink 386 } // namespace blink
384 387
385 #endif // CSSPropertyParser_h 388 #endif // CSSPropertyParser_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698