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 17 matching lines...) Expand all Loading... |
28 #include "core/css/parser/CSSParserTokenRange.h" | 28 #include "core/css/parser/CSSParserTokenRange.h" |
29 #include "wtf/Allocator.h" | 29 #include "wtf/Allocator.h" |
30 | 30 |
31 namespace blink { | 31 namespace blink { |
32 | 32 |
33 class QualifiedName; | 33 class QualifiedName; |
34 | 34 |
35 struct CSSParserFunction; | 35 struct CSSParserFunction; |
36 struct CSSParserCalcFunction; | 36 struct CSSParserCalcFunction; |
37 class CSSParserValueList; | 37 class CSSParserValueList; |
| 38 class CSSVariableData; |
38 | 39 |
39 struct CSSParserValue { | 40 struct CSSParserValue { |
40 ALLOW_ONLY_INLINE_ALLOCATION(); | 41 ALLOW_ONLY_INLINE_ALLOCATION(); |
41 CSSValueID id; | 42 CSSValueID id; |
42 bool isInt; | 43 bool isInt; |
43 union { | 44 union { |
44 double fValue; | 45 double fValue; |
45 int iValue; | 46 int iValue; |
46 CSSParserString string; | 47 CSSParserString string; |
47 CSSParserFunction* function; | 48 CSSParserFunction* function; |
48 CSSParserCalcFunction* calcFunction; | 49 CSSParserCalcFunction* calcFunction; |
49 CSSParserValueList* valueList; | 50 CSSParserValueList* valueList; |
50 struct { | 51 struct { |
51 UChar32 start; | 52 UChar32 start; |
52 UChar32 end; | 53 UChar32 end; |
53 } m_unicodeRange; | 54 } m_unicodeRange; |
| 55 CSSVariableData* variableData; |
54 }; | 56 }; |
55 enum { | 57 enum { |
56 Operator = 0x100000, | 58 Operator = 0x100000, |
57 Function = 0x100001, | 59 Function = 0x100001, |
58 CalcFunction = 0x100002, | 60 CalcFunction = 0x100002, |
59 ValueList = 0x100003, | 61 ValueList = 0x100003, |
60 HexColor = 0x100004, | 62 HexColor = 0x100004, |
61 Identifier = 0x100005, | 63 Identifier = 0x100005, |
62 // Represents a dimension by a list of two values, a UnitType::Number an
d an Identifier | 64 // Represents a dimension by a list of two values, a UnitType::Number an
d an Identifier |
63 DimensionList = 0x100006, | 65 DimensionList = 0x100006, |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 if (index < m_values.size()) | 106 if (index < m_values.size()) |
105 m_current = index; | 107 m_current = index; |
106 } | 108 } |
107 | 109 |
108 CSSParserValue* valueAt(unsigned i) { return i < m_values.size() ? &m_values
[i] : nullptr; } | 110 CSSParserValue* valueAt(unsigned i) { return i < m_values.size() ? &m_values
[i] : nullptr; } |
109 | 111 |
110 void clearAndLeakValues() { m_values.clear(); m_current = 0;} | 112 void clearAndLeakValues() { m_values.clear(); m_current = 0;} |
111 void destroyAndClear(); | 113 void destroyAndClear(); |
112 | 114 |
113 private: | 115 private: |
| 116 void checkForVariableReferencesOrDestroyAndClear(const CSSParserTokenRange&
originalRange); |
| 117 void consumeVariableValue(const CSSParserTokenRange&); |
| 118 |
114 unsigned m_current; | 119 unsigned m_current; |
115 Vector<CSSParserValue, 4> m_values; | 120 Vector<CSSParserValue, 4> m_values; |
116 }; | 121 }; |
117 | 122 |
118 struct CSSParserFunction { | 123 struct CSSParserFunction { |
119 WTF_MAKE_FAST_ALLOCATED(CSSParserFunction); | 124 WTF_MAKE_FAST_ALLOCATED(CSSParserFunction); |
120 public: | 125 public: |
121 CSSValueID id; | 126 CSSValueID id; |
122 OwnPtr<CSSParserValueList> args; | 127 OwnPtr<CSSParserValueList> args; |
123 }; | 128 }; |
(...skipping 25 matching lines...) Expand all Loading... |
149 { | 154 { |
150 id = CSSValueInvalid; | 155 id = CSSValueInvalid; |
151 this->valueList = valueList.leakPtr(); | 156 this->valueList = valueList.leakPtr(); |
152 m_unit = ValueList; | 157 m_unit = ValueList; |
153 isInt = false; | 158 isInt = false; |
154 } | 159 } |
155 | 160 |
156 } | 161 } |
157 | 162 |
158 #endif | 163 #endif |
OLD | NEW |