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