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 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 | 373 |
373 private: | 374 private: |
374 // Inputs: | 375 // Inputs: |
375 // 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. |
376 const OwnPtr<CSSParserValueList>& m_valueList; | 377 const OwnPtr<CSSParserValueList>& m_valueList; |
377 const CSSParserContext& m_context; | 378 const CSSParserContext& m_context; |
378 const bool m_inViewport; | 379 const bool m_inViewport; |
379 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! |
380 | 381 |
381 // Outputs: | 382 // Outputs: |
382 WillBeHeapVector<CSSProperty, 256>& m_parsedProperties; | 383 ParsedPropertyVector& m_parsedProperties; |
383 bool m_hasFontFaceOnlyValues; | 384 bool m_hasFontFaceOnlyValues; |
384 | 385 |
385 // Locals during parsing: | 386 // Locals during parsing: |
386 int m_inParseShorthand; | 387 int m_inParseShorthand; |
387 CSSPropertyID m_currentShorthand; | 388 CSSPropertyID m_currentShorthand; |
388 bool m_implicitShorthand; | 389 bool m_implicitShorthand; |
389 RefPtrWillBeRawPtr<CSSCalcValue> m_parsedCalculation; | 390 RefPtrWillBePersistent<CSSCalcValue> m_parsedCalculation; |
390 | 391 |
391 // 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 |
392 // classes w/o needing to make them friends. | 393 // classes w/o needing to make them friends. |
393 friend class ShadowParseContext; | 394 friend class ShadowParseContext; |
394 friend class BorderImageParseContext; | 395 friend class BorderImageParseContext; |
395 friend class BorderImageSliceParseContext; | 396 friend class BorderImageSliceParseContext; |
396 friend class BorderImageQuadParseContext; | 397 friend class BorderImageQuadParseContext; |
397 friend class TransformOperationInfo; | 398 friend class TransformOperationInfo; |
398 friend bool parseDeprecatedGradientColorStop(CSSPropertyParser*, CSSParserVa
lue*, CSSGradientColorStop&); | 399 friend bool parseDeprecatedGradientColorStop(CSSPropertyParser*, CSSParserVa
lue*, CSSGradientColorStop&); |
399 friend PassRefPtrWillBeRawPtr<CSSPrimitiveValue> parseGradientColorOrKeyword
(CSSPropertyParser*, CSSParserValue*); | 400 friend PassRefPtrWillBeRawPtr<CSSPrimitiveValue> parseGradientColorOrKeyword
(CSSPropertyParser*, CSSParserValue*); |
400 }; | 401 }; |
401 | 402 |
402 CSSPropertyID cssPropertyID(const CSSParserString&); | 403 CSSPropertyID cssPropertyID(const CSSParserString&); |
403 CSSPropertyID cssPropertyID(const String&); | 404 CSSPropertyID cssPropertyID(const String&); |
404 CSSValueID cssValueKeywordID(const CSSParserString&); | 405 CSSValueID cssValueKeywordID(const CSSParserString&); |
405 | 406 |
406 bool isKeywordPropertyID(CSSPropertyID); | 407 bool isKeywordPropertyID(CSSPropertyID); |
407 bool isValidKeywordPropertyAndValue(CSSPropertyID, int valueID, const CSSParserC
ontext&); | 408 bool isValidKeywordPropertyAndValue(CSSPropertyID, int valueID, const CSSParserC
ontext&); |
408 | 409 |
409 } // namespace WebCore | 410 } // namespace WebCore |
410 | 411 |
411 #endif // CSSPropertyParser_h | 412 #endif // CSSPropertyParser_h |
OLD | NEW |