OLD | NEW |
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 Loading... |
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(); | 108 PassRefPtrWillBeRawPtr<CSSValue> parseQuotes(); |
106 | 109 |
107 PassRefPtrWillBeRawPtr<CSSValue> parseAttr(CSSParserValueList* args); | 110 PassRefPtrWillBeRawPtr<CSSValue> parseAttr(CSSParserValueList* args); |
108 | 111 |
109 bool parseFillImage(CSSParserValueList*, RefPtrWillBeRawPtr<CSSValue>&); | 112 bool parseFillImage(CSSParserValueList*, RefPtrWillBeRawPtr<CSSValue>&); |
110 | 113 |
111 enum FillPositionFlag { InvalidFillPosition = 0, AmbiguousFillPosition = 1,
XFillPosition = 2, YFillPosition = 4 }; | 114 enum FillPositionFlag { InvalidFillPosition = 0, AmbiguousFillPosition = 1,
XFillPosition = 2, YFillPosition = 4 }; |
112 enum FillPositionParsingMode { ResolveValuesAsPercent = 0, ResolveValuesAsKe
yword = 1 }; | 115 enum FillPositionParsingMode { ResolveValuesAsPercent = 0, ResolveValuesAsKe
yword = 1 }; |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 void commitBorderImageProperty(CSSPropertyID, PassRefPtrWillBeRawPtr<CSSValu
e>, bool important); | 362 void commitBorderImageProperty(CSSPropertyID, PassRefPtrWillBeRawPtr<CSSValu
e>, bool important); |
360 | 363 |
361 PassRefPtrWillBeRawPtr<CSSValue> parseScrollSnapPoints(); | 364 PassRefPtrWillBeRawPtr<CSSValue> parseScrollSnapPoints(); |
362 PassRefPtrWillBeRawPtr<CSSValue> parseScrollSnapDestination(); | 365 PassRefPtrWillBeRawPtr<CSSValue> parseScrollSnapDestination(); |
363 PassRefPtrWillBeRawPtr<CSSValue> parseScrollSnapCoordinate(); | 366 PassRefPtrWillBeRawPtr<CSSValue> parseScrollSnapCoordinate(); |
364 PassRefPtrWillBeRawPtr<CSSValue> parseScrollSnapPosition(); | 367 PassRefPtrWillBeRawPtr<CSSValue> parseScrollSnapPosition(); |
365 | 368 |
366 private: | 369 private: |
367 // Inputs: | 370 // Inputs: |
368 CSSParserValueList* m_valueList; | 371 CSSParserValueList* m_valueList; |
| 372 CSSParserTokenRange m_range; |
369 const CSSParserContext& m_context; | 373 const CSSParserContext& m_context; |
370 | 374 |
371 // Outputs: | 375 // Outputs: |
372 WillBeHeapVector<CSSProperty, 256>& m_parsedProperties; | 376 WillBeHeapVector<CSSProperty, 256>& m_parsedProperties; |
373 StyleRule::Type m_ruleType; | 377 StyleRule::Type m_ruleType; |
374 | 378 |
375 // Locals during parsing: | 379 // Locals during parsing: |
376 int m_inParseShorthand; | 380 int m_inParseShorthand; |
377 CSSPropertyID m_currentShorthand; | 381 CSSPropertyID m_currentShorthand; |
378 bool m_implicitShorthand; | 382 bool m_implicitShorthand; |
379 RefPtrWillBeMember<CSSCalcValue> m_parsedCalculation; | 383 RefPtrWillBeMember<CSSCalcValue> m_parsedCalculation; |
380 }; | 384 }; |
381 | 385 |
382 CSSPropertyID unresolvedCSSPropertyID(const CSSParserString&); | 386 CSSPropertyID unresolvedCSSPropertyID(const CSSParserString&); |
383 CSSValueID cssValueKeywordID(const CSSParserString&); | 387 CSSValueID cssValueKeywordID(const CSSParserString&); |
384 | 388 |
385 } // namespace blink | 389 } // namespace blink |
386 | 390 |
387 #endif // CSSPropertyParser_h | 391 #endif // CSSPropertyParser_h |
OLD | NEW |