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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 FResolution = 0x0200, | 67 FResolution = 0x0200, |
68 FNonNeg = 0x0400, | 68 FNonNeg = 0x0400, |
69 FUnitlessQuirk = 0x0800 | 69 FUnitlessQuirk = 0x0800 |
70 }; | 70 }; |
71 | 71 |
72 static bool parseValue(CSSPropertyID, bool important, | 72 static bool parseValue(CSSPropertyID, bool important, |
73 const CSSParserTokenRange&, const CSSParserContext&, | 73 const CSSParserTokenRange&, const CSSParserContext&, |
74 HeapVector<CSSProperty, 256>&, StyleRule::RuleType); | 74 HeapVector<CSSProperty, 256>&, StyleRule::RuleType); |
75 | 75 |
76 // Parses a non-shorthand CSS property | 76 // Parses a non-shorthand CSS property |
77 static RawPtr<CSSValue> parseSingleValue(CSSPropertyID, const CSSParserToken
Range&, const CSSParserContext&); | 77 static CSSValue* parseSingleValue(CSSPropertyID, const CSSParserTokenRange&,
const CSSParserContext&); |
78 | 78 |
79 // TODO(timloh): This doesn't seem like the right place for these | 79 // TODO(timloh): This doesn't seem like the right place for these |
80 static bool isSystemColor(CSSValueID); | 80 static bool isSystemColor(CSSValueID); |
81 static bool isColorKeyword(CSSValueID); | 81 static bool isColorKeyword(CSSValueID); |
82 static bool isValidNumericValue(double); | 82 static bool isValidNumericValue(double); |
83 | 83 |
84 private: | 84 private: |
85 CSSPropertyParser(const CSSParserTokenRange&, const CSSParserContext&, | 85 CSSPropertyParser(const CSSParserTokenRange&, const CSSParserContext&, |
86 HeapVector<CSSProperty, 256>*); | 86 HeapVector<CSSProperty, 256>*); |
87 | 87 |
88 // TODO(timloh): Rename once the CSSParserValue-based parseValue is removed | 88 // TODO(timloh): Rename once the CSSParserValue-based parseValue is removed |
89 bool parseValueStart(CSSPropertyID unresolvedProperty, bool important); | 89 bool parseValueStart(CSSPropertyID unresolvedProperty, bool important); |
90 bool consumeCSSWideKeyword(CSSPropertyID unresolvedProperty, bool important)
; | 90 bool consumeCSSWideKeyword(CSSPropertyID unresolvedProperty, bool important)
; |
91 RawPtr<CSSValue> parseSingleValue(CSSPropertyID); | 91 CSSValue* parseSingleValue(CSSPropertyID); |
92 | 92 |
93 RawPtr<CSSValue> legacyParseValue(CSSPropertyID); | 93 CSSValue* legacyParseValue(CSSPropertyID); |
94 bool legacyParseAndApplyValue(CSSPropertyID, bool important); | 94 bool legacyParseAndApplyValue(CSSPropertyID, bool important); |
95 bool legacyParseShorthand(CSSPropertyID, bool important); | 95 bool legacyParseShorthand(CSSPropertyID, bool important); |
96 | 96 |
97 bool inShorthand() const { return m_inParseShorthand; } | 97 bool inShorthand() const { return m_inParseShorthand; } |
98 bool inQuirksMode() const { return isQuirksModeBehavior(m_context.mode()); } | 98 bool inQuirksMode() const { return isQuirksModeBehavior(m_context.mode()); } |
99 | 99 |
100 bool parseViewportDescriptor(CSSPropertyID propId, bool important); | 100 bool parseViewportDescriptor(CSSPropertyID propId, bool important); |
101 bool parseFontFaceDescriptor(CSSPropertyID); | 101 bool parseFontFaceDescriptor(CSSPropertyID); |
102 | 102 |
103 void addProperty(CSSPropertyID, RawPtr<CSSValue>, bool important, bool impli
cit = false); | 103 void addProperty(CSSPropertyID, CSSValue*, bool important, bool implicit = f
alse); |
104 void addExpandedPropertyForValue(CSSPropertyID propId, RawPtr<CSSValue>, boo
l); | 104 void addExpandedPropertyForValue(CSSPropertyID propId, CSSValue*, bool); |
105 | 105 |
106 bool consumeBorder(bool important); | 106 bool consumeBorder(bool important); |
107 | 107 |
108 bool parseShorthand(CSSPropertyID, bool important); | 108 bool parseShorthand(CSSPropertyID, bool important); |
109 bool consumeShorthandGreedily(const StylePropertyShorthand&, bool important)
; | 109 bool consumeShorthandGreedily(const StylePropertyShorthand&, bool important)
; |
110 bool consume4Values(const StylePropertyShorthand&, bool important); | 110 bool consume4Values(const StylePropertyShorthand&, bool important); |
111 | 111 |
112 // Legacy parsing allows <string>s for animation-name | 112 // Legacy parsing allows <string>s for animation-name |
113 bool consumeAnimationShorthand(const StylePropertyShorthand&, bool useLegacy
Parsing, bool important); | 113 bool consumeAnimationShorthand(const StylePropertyShorthand&, bool useLegacy
Parsing, bool important); |
114 bool consumeBackgroundShorthand(const StylePropertyShorthand&, bool importan
t); | 114 bool consumeBackgroundShorthand(const StylePropertyShorthand&, bool importan
t); |
115 | 115 |
116 bool consumeColumns(bool important); | 116 bool consumeColumns(bool important); |
117 | 117 |
118 bool consumeGridItemPositionShorthand(CSSPropertyID, bool important); | 118 bool consumeGridItemPositionShorthand(CSSPropertyID, bool important); |
119 RawPtr<CSSValue> parseGridTemplateColumns(bool important); | 119 CSSValue* parseGridTemplateColumns(bool important); |
120 bool parseGridTemplateRowsAndAreasAndColumns(bool important); | 120 bool parseGridTemplateRowsAndAreasAndColumns(bool important); |
121 bool parseGridTemplateShorthand(bool important); | 121 bool parseGridTemplateShorthand(bool important); |
122 bool parseGridShorthand(bool important); | 122 bool parseGridShorthand(bool important); |
123 bool consumeGridAreaShorthand(bool important); | 123 bool consumeGridAreaShorthand(bool important); |
124 RawPtr<CSSValue> parseGridTrackList(); | 124 CSSValue* parseGridTrackList(); |
125 bool parseGridTrackRepeatFunction(CSSValueList&, bool& isAutoRepeat); | 125 bool parseGridTrackRepeatFunction(CSSValueList&, bool& isAutoRepeat); |
126 RawPtr<CSSValue> parseGridTrackSize(CSSParserValueList& inputList, TrackSize
Restriction = AllowAll); | 126 CSSValue* parseGridTrackSize(CSSParserValueList& inputList, TrackSizeRestric
tion = AllowAll); |
127 RawPtr<CSSPrimitiveValue> parseGridBreadth(CSSParserValue*, TrackSizeRestric
tion = AllowAll); | 127 CSSPrimitiveValue* parseGridBreadth(CSSParserValue*, TrackSizeRestriction =
AllowAll); |
128 bool parseGridLineNames(CSSParserValueList&, CSSValueList&, CSSGridLineNames
Value* = nullptr); | 128 bool parseGridLineNames(CSSParserValueList&, CSSValueList&, CSSGridLineNames
Value* = nullptr); |
129 RawPtr<CSSValue> parseGridAutoFlow(CSSParserValueList&); | 129 CSSValue* parseGridAutoFlow(CSSParserValueList&); |
130 | 130 |
131 bool consumeFont(bool important); | 131 bool consumeFont(bool important); |
132 bool consumeSystemFont(bool important); | 132 bool consumeSystemFont(bool important); |
133 | 133 |
134 bool consumeBorderSpacing(bool important); | 134 bool consumeBorderSpacing(bool important); |
135 | 135 |
136 // CSS3 Parsing Routines (for properties specific to CSS3) | 136 // CSS3 Parsing Routines (for properties specific to CSS3) |
137 bool consumeBorderImage(CSSPropertyID, bool important); | 137 bool consumeBorderImage(CSSPropertyID, bool important); |
138 | 138 |
139 bool consumeFlex(bool important); | 139 bool consumeFlex(bool important); |
140 | 140 |
141 bool consumeLegacyBreakProperty(CSSPropertyID, bool important); | 141 bool consumeLegacyBreakProperty(CSSPropertyID, bool important); |
142 | 142 |
143 bool parseCalculation(CSSParserValue*, ValueRange); | 143 bool parseCalculation(CSSParserValue*, ValueRange); |
144 | 144 |
145 RawPtr<CSSPrimitiveValue> createPrimitiveNumericValue(CSSParserValue*); | 145 CSSPrimitiveValue* createPrimitiveNumericValue(CSSParserValue*); |
146 RawPtr<CSSCustomIdentValue> createPrimitiveCustomIdentValue(CSSParserValue*)
; | 146 CSSCustomIdentValue* createPrimitiveCustomIdentValue(CSSParserValue*); |
147 | 147 |
148 class ShorthandScope { | 148 class ShorthandScope { |
149 STACK_ALLOCATED(); | 149 STACK_ALLOCATED(); |
150 public: | 150 public: |
151 ShorthandScope(CSSPropertyParser* parser, CSSPropertyID propId) : m_pars
er(parser) | 151 ShorthandScope(CSSPropertyParser* parser, CSSPropertyID propId) : m_pars
er(parser) |
152 { | 152 { |
153 if (!(m_parser->m_inParseShorthand++)) | 153 if (!(m_parser->m_inParseShorthand++)) |
154 m_parser->m_currentShorthand = propId; | 154 m_parser->m_currentShorthand = propId; |
155 } | 155 } |
156 ~ShorthandScope() | 156 ~ShorthandScope() |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 // TODO(rob.buis): should move to CSSPropertyParser after conversion. | 198 // TODO(rob.buis): should move to CSSPropertyParser after conversion. |
199 bool allTracksAreFixedSized(CSSValueList&); | 199 bool allTracksAreFixedSized(CSSValueList&); |
200 bool parseGridTemplateAreasRow(const String&, NamedGridAreaMap&, const size_t, s
ize_t&); | 200 bool parseGridTemplateAreasRow(const String&, NamedGridAreaMap&, const size_t, s
ize_t&); |
201 | 201 |
202 CSSPropertyID unresolvedCSSPropertyID(const CSSParserString&); | 202 CSSPropertyID unresolvedCSSPropertyID(const CSSParserString&); |
203 CSSValueID cssValueKeywordID(const CSSParserString&); | 203 CSSValueID cssValueKeywordID(const CSSParserString&); |
204 | 204 |
205 } // namespace blink | 205 } // namespace blink |
206 | 206 |
207 #endif // CSSPropertyParser_h | 207 #endif // CSSPropertyParser_h |
OLD | NEW |