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. |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 }; | 85 }; |
86 | 86 |
87 static bool parseValue(CSSPropertyID, bool important, | 87 static bool parseValue(CSSPropertyID, bool important, |
88 const CSSParserTokenRange&, const CSSParserContext&, | 88 const CSSParserTokenRange&, const CSSParserContext&, |
89 WillBeHeapVector<CSSProperty, 256>&, StyleRule::Type); | 89 WillBeHeapVector<CSSProperty, 256>&, StyleRule::Type); |
90 | 90 |
91 static bool isSystemColor(CSSValueID); | 91 static bool isSystemColor(CSSValueID); |
92 static bool isColorKeyword(CSSValueID); | 92 static bool isColorKeyword(CSSValueID); |
93 static bool isValidNumericValue(double); | 93 static bool isValidNumericValue(double); |
94 | 94 |
| 95 // TODO(rwlbuis): move to CSSPropertyParser.cpp once CSSParserToken conversi
on is done. |
| 96 static PassRefPtrWillBeRawPtr<CSSValue> createCSSImageValueWithReferrer(cons
t AtomicString& rawValue, const CSSParserContext& context) |
| 97 { |
| 98 RefPtrWillBeRawPtr<CSSValue> imageValue = CSSImageValue::create(rawValue
, context.completeURL(rawValue)); |
| 99 toCSSImageValue(imageValue.get())->setReferrer(context.referrer()); |
| 100 return imageValue; |
| 101 } |
| 102 |
95 private: | 103 private: |
96 CSSPropertyParser(const CSSParserTokenRange&, const CSSParserContext&, | 104 CSSPropertyParser(const CSSParserTokenRange&, const CSSParserContext&, |
97 WillBeHeapVector<CSSProperty, 256>&); | 105 WillBeHeapVector<CSSProperty, 256>&); |
98 | 106 |
99 // TODO(timloh): Rename once the CSSParserValue-based parseValue is removed | 107 // TODO(timloh): Rename once the CSSParserValue-based parseValue is removed |
100 bool parseValueStart(CSSPropertyID unresolvedProperty, bool important); | 108 bool parseValueStart(CSSPropertyID unresolvedProperty, bool important); |
101 bool consumeCSSWideKeyword(CSSPropertyID unresolvedProperty, bool important)
; | 109 bool consumeCSSWideKeyword(CSSPropertyID unresolvedProperty, bool important)
; |
102 PassRefPtrWillBeRawPtr<CSSValue> parseSingleValue(CSSPropertyID); | 110 PassRefPtrWillBeRawPtr<CSSValue> parseSingleValue(CSSPropertyID); |
103 | 111 |
104 bool parseValue(CSSPropertyID, bool important); | 112 bool parseValue(CSSPropertyID, bool important); |
105 | 113 |
106 bool inShorthand() const { return m_inParseShorthand; } | 114 bool inShorthand() const { return m_inParseShorthand; } |
107 bool inQuirksMode() const { return isQuirksModeBehavior(m_context.mode()); } | 115 bool inQuirksMode() const { return isQuirksModeBehavior(m_context.mode()); } |
108 | 116 |
109 bool parseViewportDescriptor(CSSPropertyID propId, bool important); | 117 bool parseViewportDescriptor(CSSPropertyID propId, bool important); |
110 bool parseFontFaceDescriptor(CSSPropertyID); | 118 bool parseFontFaceDescriptor(CSSPropertyID); |
111 | 119 |
112 KURL completeURL(const String& url) const; | |
113 | |
114 void addProperty(CSSPropertyID, PassRefPtrWillBeRawPtr<CSSValue>, bool impor
tant, bool implicit = false); | 120 void addProperty(CSSPropertyID, PassRefPtrWillBeRawPtr<CSSValue>, bool impor
tant, bool implicit = false); |
115 void rollbackLastProperties(int num); | 121 void rollbackLastProperties(int num); |
116 void addExpandedPropertyForValue(CSSPropertyID propId, PassRefPtrWillBeRawPt
r<CSSValue>, bool); | 122 void addExpandedPropertyForValue(CSSPropertyID propId, PassRefPtrWillBeRawPt
r<CSSValue>, bool); |
117 | 123 |
118 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> parseValidPrimitive(CSSValueID ide
nt, CSSParserValue*); | 124 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> parseValidPrimitive(CSSValueID ide
nt, CSSParserValue*); |
119 | 125 |
120 bool parseShorthand(CSSPropertyID, const StylePropertyShorthand&, bool impor
tant); | 126 bool parseShorthand(CSSPropertyID, const StylePropertyShorthand&, bool impor
tant); |
121 bool parseShorthand(CSSPropertyID, bool important); | 127 bool parseShorthand(CSSPropertyID, bool important); |
122 bool consumeShorthandGreedily(const StylePropertyShorthand&, bool important)
; | 128 bool consumeShorthandGreedily(const StylePropertyShorthand&, bool important)
; |
123 bool consume4Values(const StylePropertyShorthand&, bool important); | 129 bool consume4Values(const StylePropertyShorthand&, bool important); |
(...skipping 24 matching lines...) Expand all Loading... |
148 | 154 |
149 void addFillValue(RefPtrWillBeRawPtr<CSSValue>& lval, PassRefPtrWillBeRawPtr
<CSSValue> rval); | 155 void addFillValue(RefPtrWillBeRawPtr<CSSValue>& lval, PassRefPtrWillBeRawPtr
<CSSValue> rval); |
150 | 156 |
151 bool parseCubicBezierTimingFunctionValue(CSSParserValueList*& args, double&
result); | 157 bool parseCubicBezierTimingFunctionValue(CSSParserValueList*& args, double&
result); |
152 | 158 |
153 // Legacy parsing allows <string>s for animation-name | 159 // Legacy parsing allows <string>s for animation-name |
154 bool consumeAnimationShorthand(const StylePropertyShorthand&, bool useLegacy
Parsing, bool important); | 160 bool consumeAnimationShorthand(const StylePropertyShorthand&, bool useLegacy
Parsing, bool important); |
155 | 161 |
156 bool consumeColumns(bool important); | 162 bool consumeColumns(bool important); |
157 | 163 |
158 PassRefPtrWillBeRawPtr<CSSValue> consumeCursor(CSSParserTokenRange&); | |
159 | |
160 PassRefPtrWillBeRawPtr<CSSValue> parseGridPosition(); | 164 PassRefPtrWillBeRawPtr<CSSValue> parseGridPosition(); |
161 bool parseIntegerOrCustomIdentFromGridPosition(RefPtrWillBeRawPtr<CSSPrimiti
veValue>& numericValue, RefPtrWillBeRawPtr<CSSCustomIdentValue>& gridLineName); | 165 bool parseIntegerOrCustomIdentFromGridPosition(RefPtrWillBeRawPtr<CSSPrimiti
veValue>& numericValue, RefPtrWillBeRawPtr<CSSCustomIdentValue>& gridLineName); |
162 bool parseGridItemPositionShorthand(CSSPropertyID, bool important); | 166 bool parseGridItemPositionShorthand(CSSPropertyID, bool important); |
163 bool parseGridTemplateRowsAndAreas(PassRefPtrWillBeRawPtr<CSSValue>, bool im
portant); | 167 bool parseGridTemplateRowsAndAreas(PassRefPtrWillBeRawPtr<CSSValue>, bool im
portant); |
164 bool parseGridTemplateShorthand(bool important); | 168 bool parseGridTemplateShorthand(bool important); |
165 bool parseGridShorthand(bool important); | 169 bool parseGridShorthand(bool important); |
166 bool parseGridAreaShorthand(bool important); | 170 bool parseGridAreaShorthand(bool important); |
167 bool parseGridGapShorthand(bool important); | 171 bool parseGridGapShorthand(bool important); |
168 bool parseSingleGridAreaLonghand(RefPtrWillBeRawPtr<CSSValue>&); | 172 bool parseSingleGridAreaLonghand(RefPtrWillBeRawPtr<CSSValue>&); |
169 PassRefPtrWillBeRawPtr<CSSValue> parseGridTrackList(); | 173 PassRefPtrWillBeRawPtr<CSSValue> parseGridTrackList(); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 bool parseDeprecatedGradient(CSSParserValueList*, RefPtrWillBeRawPtr<CSSValu
e>&); | 227 bool parseDeprecatedGradient(CSSParserValueList*, RefPtrWillBeRawPtr<CSSValu
e>&); |
224 bool parseDeprecatedLinearGradient(CSSParserValueList*, RefPtrWillBeRawPtr<C
SSValue>&, CSSGradientRepeat repeating); | 228 bool parseDeprecatedLinearGradient(CSSParserValueList*, RefPtrWillBeRawPtr<C
SSValue>&, CSSGradientRepeat repeating); |
225 bool parseDeprecatedRadialGradient(CSSParserValueList*, RefPtrWillBeRawPtr<C
SSValue>&, CSSGradientRepeat repeating); | 229 bool parseDeprecatedRadialGradient(CSSParserValueList*, RefPtrWillBeRawPtr<C
SSValue>&, CSSGradientRepeat repeating); |
226 bool parseLinearGradient(CSSParserValueList*, RefPtrWillBeRawPtr<CSSValue>&,
CSSGradientRepeat repeating); | 230 bool parseLinearGradient(CSSParserValueList*, RefPtrWillBeRawPtr<CSSValue>&,
CSSGradientRepeat repeating); |
227 bool parseRadialGradient(CSSParserValueList*, RefPtrWillBeRawPtr<CSSValue>&,
CSSGradientRepeat repeating); | 231 bool parseRadialGradient(CSSParserValueList*, RefPtrWillBeRawPtr<CSSValue>&,
CSSGradientRepeat repeating); |
228 bool parseGradientColorStops(CSSParserValueList*, CSSGradientValue*, bool ex
pectComma); | 232 bool parseGradientColorStops(CSSParserValueList*, CSSGradientValue*, bool ex
pectComma); |
229 | 233 |
230 bool parseCrossfade(CSSParserValueList*, RefPtrWillBeRawPtr<CSSValue>&); | 234 bool parseCrossfade(CSSParserValueList*, RefPtrWillBeRawPtr<CSSValue>&); |
231 | 235 |
232 PassRefPtrWillBeRawPtr<CSSValue> parseImageSet(CSSParserValueList*); | 236 PassRefPtrWillBeRawPtr<CSSValue> parseImageSet(CSSParserValueList*); |
233 PassRefPtrWillBeRawPtr<CSSValue> consumeImageSet(CSSParserTokenRange&); | |
234 | 237 |
235 PassRefPtrWillBeRawPtr<CSSValueList> parseFilter(); | 238 PassRefPtrWillBeRawPtr<CSSValueList> parseFilter(); |
236 PassRefPtrWillBeRawPtr<CSSFunctionValue> parseBuiltinFilterArguments(CSSPars
erValueList*, CSSValueID); | 239 PassRefPtrWillBeRawPtr<CSSFunctionValue> parseBuiltinFilterArguments(CSSPars
erValueList*, CSSValueID); |
237 | 240 |
238 bool parseCalculation(CSSParserValue*, ValueRange); | 241 bool parseCalculation(CSSParserValue*, ValueRange); |
239 | 242 |
240 bool parseGeneratedImage(CSSParserValueList*, RefPtrWillBeRawPtr<CSSValue>&)
; | 243 bool parseGeneratedImage(CSSParserValueList*, RefPtrWillBeRawPtr<CSSValue>&)
; |
241 | 244 |
242 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createPrimitiveNumericValue(CSSPar
serValue*); | 245 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createPrimitiveNumericValue(CSSPar
serValue*); |
243 PassRefPtrWillBeRawPtr<CSSStringValue> createPrimitiveStringValue(CSSParserV
alue*); | 246 PassRefPtrWillBeRawPtr<CSSStringValue> createPrimitiveStringValue(CSSParserV
alue*); |
244 PassRefPtrWillBeRawPtr<CSSCustomIdentValue> createPrimitiveCustomIdentValue(
CSSParserValue*); | 247 PassRefPtrWillBeRawPtr<CSSCustomIdentValue> createPrimitiveCustomIdentValue(
CSSParserValue*); |
245 | 248 |
246 // TODO(rwlbuis): move to CSSPropertyParser.cpp once CSSParserToken conversi
on is done. | |
247 inline PassRefPtrWillBeRawPtr<CSSValue> createCSSImageValueWithReferrer(cons
t AtomicString& rawValue, const KURL& url) | |
248 { | |
249 RefPtrWillBeRawPtr<CSSValue> imageValue = CSSImageValue::create(rawValue
, url); | |
250 toCSSImageValue(imageValue.get())->setReferrer(m_context.referrer()); | |
251 return imageValue; | |
252 } | |
253 | |
254 PassRefPtrWillBeRawPtr<CSSBasicShapeInsetValue> parseInsetRoundedCorners(Pas
sRefPtrWillBeRawPtr<CSSBasicShapeInsetValue>, CSSParserValueList*); | 249 PassRefPtrWillBeRawPtr<CSSBasicShapeInsetValue> parseInsetRoundedCorners(Pas
sRefPtrWillBeRawPtr<CSSBasicShapeInsetValue>, CSSParserValueList*); |
255 | 250 |
256 PassRefPtrWillBeRawPtr<CSSValue> consumeFontFaceSrcURI(); | 251 PassRefPtrWillBeRawPtr<CSSValue> consumeFontFaceSrcURI(); |
257 PassRefPtrWillBeRawPtr<CSSValue> consumeFontFaceSrcLocal(); | 252 PassRefPtrWillBeRawPtr<CSSValue> consumeFontFaceSrcLocal(); |
258 | 253 |
259 class ImplicitScope { | 254 class ImplicitScope { |
260 STACK_ALLOCATED(); | 255 STACK_ALLOCATED(); |
261 WTF_MAKE_NONCOPYABLE(ImplicitScope); | 256 WTF_MAKE_NONCOPYABLE(ImplicitScope); |
262 public: | 257 public: |
263 ImplicitScope(CSSPropertyParser* parser) | 258 ImplicitScope(CSSPropertyParser* parser) |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 bool m_implicitShorthand; | 335 bool m_implicitShorthand; |
341 RefPtrWillBeMember<CSSCalcValue> m_parsedCalculation; | 336 RefPtrWillBeMember<CSSCalcValue> m_parsedCalculation; |
342 }; | 337 }; |
343 | 338 |
344 CSSPropertyID unresolvedCSSPropertyID(const CSSParserString&); | 339 CSSPropertyID unresolvedCSSPropertyID(const CSSParserString&); |
345 CSSValueID cssValueKeywordID(const CSSParserString&); | 340 CSSValueID cssValueKeywordID(const CSSParserString&); |
346 | 341 |
347 } // namespace blink | 342 } // namespace blink |
348 | 343 |
349 #endif // CSSPropertyParser_h | 344 #endif // CSSPropertyParser_h |
OLD | NEW |