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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 static bool isColorKeyword(CSSValueID); | 51 static bool isColorKeyword(CSSValueID); |
52 static bool isValidNumericValue(double); | 52 static bool isValidNumericValue(double); |
53 | 53 |
54 private: | 54 private: |
55 CSSPropertyParser(const CSSParserTokenRange&, const CSSParserContext&, | 55 CSSPropertyParser(const CSSParserTokenRange&, const CSSParserContext&, |
56 HeapVector<CSSProperty, 256>*); | 56 HeapVector<CSSProperty, 256>*); |
57 | 57 |
58 // TODO(timloh): Rename once the CSSParserValue-based parseValue is removed | 58 // TODO(timloh): Rename once the CSSParserValue-based parseValue is removed |
59 bool parseValueStart(CSSPropertyID unresolvedProperty, bool important); | 59 bool parseValueStart(CSSPropertyID unresolvedProperty, bool important); |
60 bool consumeCSSWideKeyword(CSSPropertyID unresolvedProperty, bool important)
; | 60 bool consumeCSSWideKeyword(CSSPropertyID unresolvedProperty, bool important)
; |
61 CSSValue* parseSingleValue(CSSPropertyID); | 61 CSSValue* parseSingleValue(CSSPropertyID, CSSPropertyID = CSSPropertyInvalid
); |
62 | 62 |
63 bool inQuirksMode() const { return isQuirksModeBehavior(m_context.mode()); } | 63 bool inQuirksMode() const { return isQuirksModeBehavior(m_context.mode()); } |
64 | 64 |
65 bool parseViewportDescriptor(CSSPropertyID propId, bool important); | 65 bool parseViewportDescriptor(CSSPropertyID propId, bool important); |
66 bool parseFontFaceDescriptor(CSSPropertyID); | 66 bool parseFontFaceDescriptor(CSSPropertyID); |
67 | 67 |
68 void addProperty(CSSPropertyID, CSSValue*, bool important, bool implicit = f
alse); | 68 void addProperty(CSSPropertyID, CSSPropertyID, CSSValue*, bool important, bo
ol implicit = false); |
69 void addExpandedPropertyForValue(CSSPropertyID propId, CSSValue*, bool); | 69 void addExpandedPropertyForValue(CSSPropertyID propId, CSSValue*, bool); |
70 | 70 |
71 bool consumeBorder(bool important); | 71 bool consumeBorder(bool important); |
72 | 72 |
73 bool parseShorthand(CSSPropertyID, bool important); | 73 bool parseShorthand(CSSPropertyID, bool important); |
74 bool consumeShorthandGreedily(const StylePropertyShorthand&, bool important)
; | 74 bool consumeShorthandGreedily(const StylePropertyShorthand&, bool important)
; |
75 bool consume4Values(const StylePropertyShorthand&, bool important); | 75 bool consume4Values(const StylePropertyShorthand&, bool important); |
76 | 76 |
77 // Legacy parsing allows <string>s for animation-name | 77 // Legacy parsing allows <string>s for animation-name |
78 bool consumeAnimationShorthand(const StylePropertyShorthand&, bool useLegacy
Parsing, bool important); | 78 bool consumeAnimationShorthand(const StylePropertyShorthand&, bool useLegacy
Parsing, bool important); |
79 bool consumeBackgroundShorthand(const StylePropertyShorthand&, bool importan
t); | 79 bool consumeBackgroundShorthand(const StylePropertyShorthand&, bool importan
t); |
80 | 80 |
81 bool consumeColumns(bool important); | 81 bool consumeColumns(bool important); |
82 | 82 |
83 bool consumeGridItemPositionShorthand(CSSPropertyID, bool important); | 83 bool consumeGridItemPositionShorthand(CSSPropertyID, bool important); |
84 bool consumeGridTemplateRowsAndAreasAndColumns(bool important); | 84 bool consumeGridTemplateRowsAndAreasAndColumns(CSSPropertyID, bool important
); |
85 bool consumeGridTemplateShorthand(bool important); | 85 bool consumeGridTemplateShorthand(CSSPropertyID, bool important); |
86 bool consumeGridShorthand(bool important); | 86 bool consumeGridShorthand(bool important); |
87 bool consumeGridAreaShorthand(bool important); | 87 bool consumeGridAreaShorthand(bool important); |
88 | 88 |
89 bool consumeFont(bool important); | 89 bool consumeFont(bool important); |
90 bool consumeSystemFont(bool important); | 90 bool consumeSystemFont(bool important); |
91 | 91 |
92 bool consumeBorderSpacing(bool important); | 92 bool consumeBorderSpacing(bool important); |
93 | 93 |
94 // CSS3 Parsing Routines (for properties specific to CSS3) | 94 // CSS3 Parsing Routines (for properties specific to CSS3) |
95 bool consumeBorderImage(CSSPropertyID, bool important); | 95 bool consumeBorderImage(CSSPropertyID, bool important); |
96 | 96 |
97 bool consumeFlex(bool important); | 97 bool consumeFlex(bool important); |
98 | 98 |
99 bool consumeLegacyBreakProperty(CSSPropertyID, bool important); | 99 bool consumeLegacyBreakProperty(CSSPropertyID, bool important); |
100 | 100 |
101 class ShorthandScope { | |
102 STACK_ALLOCATED(); | |
103 public: | |
104 ShorthandScope(CSSPropertyParser* parser, CSSPropertyID propId) : m_pars
er(parser) | |
105 { | |
106 if (!(m_parser->m_inParseShorthand++)) | |
107 m_parser->m_currentShorthand = propId; | |
108 } | |
109 ~ShorthandScope() | |
110 { | |
111 if (!(--m_parser->m_inParseShorthand)) | |
112 m_parser->m_currentShorthand = CSSPropertyInvalid; | |
113 } | |
114 | |
115 private: | |
116 CSSPropertyParser* m_parser; | |
117 }; | |
118 | |
119 private: | 101 private: |
120 // Inputs: | 102 // Inputs: |
121 CSSParserTokenRange m_range; | 103 CSSParserTokenRange m_range; |
122 const CSSParserContext& m_context; | 104 const CSSParserContext& m_context; |
123 | |
124 // Outputs: | 105 // Outputs: |
125 HeapVector<CSSProperty, 256>* m_parsedProperties; | 106 HeapVector<CSSProperty, 256>* m_parsedProperties; |
126 | |
127 // Locals during parsing: | |
128 int m_inParseShorthand; | |
129 CSSPropertyID m_currentShorthand; | |
130 }; | 107 }; |
131 | 108 |
132 CSSPropertyID unresolvedCSSPropertyID(const CSSParserString&); | 109 CSSPropertyID unresolvedCSSPropertyID(const CSSParserString&); |
133 CSSValueID cssValueKeywordID(const CSSParserString&); | 110 CSSValueID cssValueKeywordID(const CSSParserString&); |
134 | 111 |
135 } // namespace blink | 112 } // namespace blink |
136 | 113 |
137 #endif // CSSPropertyParser_h | 114 #endif // CSSPropertyParser_h |
OLD | NEW |