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 * | 4 * |
5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
9 * | 9 * |
10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
(...skipping 10 matching lines...) Expand all Loading... |
21 #ifndef CSSParserValues_h | 21 #ifndef CSSParserValues_h |
22 #define CSSParserValues_h | 22 #define CSSParserValues_h |
23 | 23 |
24 #include "core/CSSValueKeywords.h" | 24 #include "core/CSSValueKeywords.h" |
25 #include "core/css/CSSPrimitiveValue.h" | 25 #include "core/css/CSSPrimitiveValue.h" |
26 #include "core/css/CSSSelector.h" | 26 #include "core/css/CSSSelector.h" |
27 #include "core/css/CSSValueList.h" | 27 #include "core/css/CSSValueList.h" |
28 #include "core/css/parser/CSSParserString.h" | 28 #include "core/css/parser/CSSParserString.h" |
29 #include "core/css/parser/CSSParserTokenRange.h" | 29 #include "core/css/parser/CSSParserTokenRange.h" |
30 | 30 |
| 31 |
31 namespace blink { | 32 namespace blink { |
32 | 33 |
33 class QualifiedName; | 34 class QualifiedName; |
34 | 35 |
35 struct CSSParserFunction; | 36 struct CSSParserFunction; |
36 struct CSSParserCalcFunction; | 37 struct CSSParserCalcFunction; |
37 class CSSParserValueList; | 38 class CSSParserValueList; |
38 | 39 |
39 struct CSSParserValue { | 40 struct CSSParserValue { |
40 CSSValueID id; | 41 CSSValueID id; |
41 bool isInt; | 42 bool isInt; |
42 union { | 43 union { |
43 double fValue; | 44 double fValue; |
44 int iValue; | 45 int iValue; |
45 CSSParserString string; | 46 CSSParserString string; |
46 CSSParserFunction* function; | 47 CSSParserFunction* function; |
47 CSSParserCalcFunction* calcFunction; | 48 CSSParserCalcFunction* calcFunction; |
48 CSSParserValueList* valueList; | 49 CSSParserValueList* valueList; |
49 struct { | 50 struct { |
50 UChar32 start; | 51 UChar32 start; |
51 UChar32 end; | 52 UChar32 end; |
52 } m_unicodeRange; | 53 } m_unicodeRange; |
| 54 CSSVariableData* variableData; |
53 }; | 55 }; |
54 enum { | 56 enum { |
55 Operator = 0x100000, | 57 Operator = 0x100000, |
56 Function = 0x100001, | 58 Function = 0x100001, |
57 CalcFunction = 0x100002, | 59 CalcFunction = 0x100002, |
58 ValueList = 0x100003, | 60 ValueList = 0x100003, |
59 HexColor = 0x100004, | 61 HexColor = 0x100004, |
60 Identifier = 0x100005, | 62 Identifier = 0x100005, |
61 // Represents a dimension by a list of two values, a UnitType::Number an
d an Identifier | 63 // Represents a dimension by a list of two values, a UnitType::Number an
d an Identifier |
62 DimensionList = 0x100006, | 64 DimensionList = 0x100006, |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 { | 101 { |
100 ASSERT(index < m_values.size()); | 102 ASSERT(index < m_values.size()); |
101 if (index < m_values.size()) | 103 if (index < m_values.size()) |
102 m_current = index; | 104 m_current = index; |
103 } | 105 } |
104 | 106 |
105 CSSParserValue* valueAt(unsigned i) { return i < m_values.size() ? &m_values
[i] : 0; } | 107 CSSParserValue* valueAt(unsigned i) { return i < m_values.size() ? &m_values
[i] : 0; } |
106 | 108 |
107 void clearAndLeakValues() { m_values.clear(); m_current = 0;} | 109 void clearAndLeakValues() { m_values.clear(); m_current = 0;} |
108 void destroyAndClear(); | 110 void destroyAndClear(); |
| 111 private: |
| 112 void checkForVariableReferencesOrDestroyAndClear(const CSSParserTokenRange&
originalRange); |
| 113 void consumeVariableValue(const CSSParserTokenRange&); |
109 | 114 |
110 private: | |
111 unsigned m_current; | 115 unsigned m_current; |
112 Vector<CSSParserValue, 4> m_values; | 116 Vector<CSSParserValue, 4> m_values; |
113 }; | 117 }; |
114 | 118 |
115 struct CSSParserFunction { | 119 struct CSSParserFunction { |
116 WTF_MAKE_FAST_ALLOCATED(CSSParserFunction); | 120 WTF_MAKE_FAST_ALLOCATED(CSSParserFunction); |
117 public: | 121 public: |
118 CSSValueID id; | 122 CSSValueID id; |
119 OwnPtr<CSSParserValueList> args; | 123 OwnPtr<CSSParserValueList> args; |
120 }; | 124 }; |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 } | 203 } |
200 | 204 |
201 inline void CSSParserValue::setFromValueList(PassOwnPtr<CSSParserValueList> valu
eList) | 205 inline void CSSParserValue::setFromValueList(PassOwnPtr<CSSParserValueList> valu
eList) |
202 { | 206 { |
203 id = CSSValueInvalid; | 207 id = CSSValueInvalid; |
204 this->valueList = valueList.leakPtr(); | 208 this->valueList = valueList.leakPtr(); |
205 m_unit = ValueList; | 209 m_unit = ValueList; |
206 isInt = false; | 210 isInt = false; |
207 } | 211 } |
208 | 212 |
209 } | 213 }; |
210 | 214 |
211 #endif | 215 #endif |
OLD | NEW |