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 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 | 373 |
375 private: | 374 private: |
376 // Inputs: | 375 // Inputs: |
377 // FIXME: This should not be an OwnPtr&, many callers will need to be change
d. | 376 // FIXME: This should not be an OwnPtr&, many callers will need to be change
d. |
378 const OwnPtr<CSSParserValueList>& m_valueList; | 377 const OwnPtr<CSSParserValueList>& m_valueList; |
379 const CSSParserContext& m_context; | 378 const CSSParserContext& m_context; |
380 const bool m_inViewport; | 379 const bool m_inViewport; |
381 const bool m_important; // FIXME: This is only used by font-face-src and uni
code-range and undoubtably wrong! | 380 const bool m_important; // FIXME: This is only used by font-face-src and uni
code-range and undoubtably wrong! |
382 | 381 |
383 // Outputs: | 382 // Outputs: |
384 ParsedPropertyVector& m_parsedProperties; | 383 WillBeHeapVector<CSSProperty, 256>& m_parsedProperties; |
385 bool m_hasFontFaceOnlyValues; | 384 bool m_hasFontFaceOnlyValues; |
386 | 385 |
387 // Locals during parsing: | 386 // Locals during parsing: |
388 int m_inParseShorthand; | 387 int m_inParseShorthand; |
389 CSSPropertyID m_currentShorthand; | 388 CSSPropertyID m_currentShorthand; |
390 bool m_implicitShorthand; | 389 bool m_implicitShorthand; |
391 RefPtrWillBePersistent<CSSCalcValue> m_parsedCalculation; | 390 RefPtrWillBeRawPtr<CSSCalcValue> m_parsedCalculation; |
392 | 391 |
393 // FIXME: There is probably a small set of APIs we could expose for these | 392 // FIXME: There is probably a small set of APIs we could expose for these |
394 // classes w/o needing to make them friends. | 393 // classes w/o needing to make them friends. |
395 friend class ShadowParseContext; | 394 friend class ShadowParseContext; |
396 friend class BorderImageParseContext; | 395 friend class BorderImageParseContext; |
397 friend class BorderImageSliceParseContext; | 396 friend class BorderImageSliceParseContext; |
398 friend class BorderImageQuadParseContext; | 397 friend class BorderImageQuadParseContext; |
399 friend class TransformOperationInfo; | 398 friend class TransformOperationInfo; |
400 friend bool parseDeprecatedGradientColorStop(CSSPropertyParser*, CSSParserVa
lue*, CSSGradientColorStop&); | 399 friend bool parseDeprecatedGradientColorStop(CSSPropertyParser*, CSSParserVa
lue*, CSSGradientColorStop&); |
401 friend PassRefPtrWillBeRawPtr<CSSPrimitiveValue> parseGradientColorOrKeyword
(CSSPropertyParser*, CSSParserValue*); | 400 friend PassRefPtrWillBeRawPtr<CSSPrimitiveValue> parseGradientColorOrKeyword
(CSSPropertyParser*, CSSParserValue*); |
402 }; | 401 }; |
403 | 402 |
404 CSSPropertyID cssPropertyID(const CSSParserString&); | 403 CSSPropertyID cssPropertyID(const CSSParserString&); |
405 CSSPropertyID cssPropertyID(const String&); | 404 CSSPropertyID cssPropertyID(const String&); |
406 CSSValueID cssValueKeywordID(const CSSParserString&); | 405 CSSValueID cssValueKeywordID(const CSSParserString&); |
407 | 406 |
408 bool isKeywordPropertyID(CSSPropertyID); | 407 bool isKeywordPropertyID(CSSPropertyID); |
409 bool isValidKeywordPropertyAndValue(CSSPropertyID, int valueID, const CSSParserC
ontext&); | 408 bool isValidKeywordPropertyAndValue(CSSPropertyID, int valueID, const CSSParserC
ontext&); |
410 | 409 |
411 } // namespace WebCore | 410 } // namespace WebCore |
412 | 411 |
413 #endif // CSSPropertyParser_h | 412 #endif // CSSPropertyParser_h |
OLD | NEW |