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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 class ImmutableStylePropertySet; | 55 class ImmutableStylePropertySet; |
56 class StyleKeyframe; | 56 class StyleKeyframe; |
57 class StylePropertyShorthand; | 57 class StylePropertyShorthand; |
58 class StyleKeyframe; | 58 class StyleKeyframe; |
59 class UseCounter; | 59 class UseCounter; |
60 | 60 |
61 // Inputs: PropertyID, isImportant bool, CSSParserValueList. | 61 // Inputs: PropertyID, isImportant bool, CSSParserValueList. |
62 // Outputs: Vector of CSSProperties | 62 // Outputs: Vector of CSSProperties |
63 | 63 |
64 class CSSPropertyParser { | 64 class CSSPropertyParser { |
| 65 STACK_ALLOCATED(); |
65 public: | 66 public: |
66 typedef Vector<CSSProperty, 256> ParsedPropertyVector; | |
67 | |
68 CSSPropertyParser(OwnPtr<CSSParserValueList>&, | 67 CSSPropertyParser(OwnPtr<CSSParserValueList>&, |
69 const CSSParserContext&, bool inViewport, bool savedImportant, | 68 const CSSParserContext&, bool inViewport, bool savedImportant, |
70 ParsedPropertyVector&, bool& hasFontFaceOnlyValues); | 69 WillBeHeapVector<CSSProperty, 256>&, bool& hasFontFaceOnlyValues); |
71 ~CSSPropertyParser(); | 70 ~CSSPropertyParser(); |
72 | 71 |
73 // FIXME: Should this be on a separate ColorParser object? | 72 // FIXME: Should this be on a separate ColorParser object? |
74 template<typename StringType> | 73 template<typename StringType> |
75 static bool fastParseColor(RGBA32&, const StringType&, bool strict); | 74 static bool fastParseColor(RGBA32&, const StringType&, bool strict); |
76 | 75 |
77 bool parseValue(CSSPropertyID, bool important); | 76 bool parseValue(CSSPropertyID, bool important); |
78 | 77 |
79 static bool isSystemColor(int id); | 78 static bool isSystemColor(int id); |
80 | 79 |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 | 372 |
374 private: | 373 private: |
375 // Inputs: | 374 // Inputs: |
376 // FIXME: This should not be an OwnPtr&, many callers will need to be change
d. | 375 // FIXME: This should not be an OwnPtr&, many callers will need to be change
d. |
377 const OwnPtr<CSSParserValueList>& m_valueList; | 376 const OwnPtr<CSSParserValueList>& m_valueList; |
378 const CSSParserContext& m_context; | 377 const CSSParserContext& m_context; |
379 const bool m_inViewport; | 378 const bool m_inViewport; |
380 const bool m_important; // FIXME: This is only used by font-face-src and uni
code-range and undoubtably wrong! | 379 const bool m_important; // FIXME: This is only used by font-face-src and uni
code-range and undoubtably wrong! |
381 | 380 |
382 // Outputs: | 381 // Outputs: |
383 ParsedPropertyVector& m_parsedProperties; | 382 WillBeHeapVector<CSSProperty, 256>& m_parsedProperties; |
384 bool m_hasFontFaceOnlyValues; | 383 bool m_hasFontFaceOnlyValues; |
385 | 384 |
386 // Locals during parsing: | 385 // Locals during parsing: |
387 int m_inParseShorthand; | 386 int m_inParseShorthand; |
388 CSSPropertyID m_currentShorthand; | 387 CSSPropertyID m_currentShorthand; |
389 bool m_implicitShorthand; | 388 bool m_implicitShorthand; |
390 RefPtrWillBePersistent<CSSCalcValue> m_parsedCalculation; | 389 RefPtrWillBeRawPtr<CSSCalcValue> m_parsedCalculation; |
391 | 390 |
392 // FIXME: There is probably a small set of APIs we could expose for these | 391 // FIXME: There is probably a small set of APIs we could expose for these |
393 // classes w/o needing to make them friends. | 392 // classes w/o needing to make them friends. |
394 friend class ShadowParseContext; | 393 friend class ShadowParseContext; |
395 friend class BorderImageParseContext; | 394 friend class BorderImageParseContext; |
396 friend class BorderImageSliceParseContext; | 395 friend class BorderImageSliceParseContext; |
397 friend class BorderImageQuadParseContext; | 396 friend class BorderImageQuadParseContext; |
398 friend class TransformOperationInfo; | 397 friend class TransformOperationInfo; |
399 friend bool parseDeprecatedGradientColorStop(CSSPropertyParser*, CSSParserVa
lue*, CSSGradientColorStop&); | 398 friend bool parseDeprecatedGradientColorStop(CSSPropertyParser*, CSSParserVa
lue*, CSSGradientColorStop&); |
400 friend PassRefPtrWillBeRawPtr<CSSPrimitiveValue> parseGradientColorOrKeyword
(CSSPropertyParser*, CSSParserValue*); | 399 friend PassRefPtrWillBeRawPtr<CSSPrimitiveValue> parseGradientColorOrKeyword
(CSSPropertyParser*, CSSParserValue*); |
401 }; | 400 }; |
402 | 401 |
403 CSSPropertyID cssPropertyID(const CSSParserString&); | 402 CSSPropertyID cssPropertyID(const CSSParserString&); |
404 CSSPropertyID cssPropertyID(const String&); | 403 CSSPropertyID cssPropertyID(const String&); |
405 CSSValueID cssValueKeywordID(const CSSParserString&); | 404 CSSValueID cssValueKeywordID(const CSSParserString&); |
406 | 405 |
407 bool isKeywordPropertyID(CSSPropertyID); | 406 bool isKeywordPropertyID(CSSPropertyID); |
408 bool isValidKeywordPropertyAndValue(CSSPropertyID, int valueID, const CSSParserC
ontext&); | 407 bool isValidKeywordPropertyAndValue(CSSPropertyID, int valueID, const CSSParserC
ontext&); |
409 | 408 |
410 } // namespace WebCore | 409 } // namespace WebCore |
411 | 410 |
412 #endif // CSSPropertyParser_h | 411 #endif // CSSPropertyParser_h |
OLD | NEW |