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 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); | 41 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); |
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, |
64 // Represents a unicode range by a pair of UChar32 values | 66 // Represents a unicode range by a pair of UChar32 values |
65 UnicodeRange = 0x100007, | 67 UnicodeRange = 0x100007, |
66 String = 0x100008, | 68 String = 0x100008, |
67 URI = 0x100009, | 69 URI = 0x100009, |
| 70 VariableReference = 0x100010, |
68 }; | 71 }; |
69 int m_unit; | 72 int m_unit; |
70 CSSPrimitiveValue::UnitType unit() const { return static_cast<CSSPrimitiveVa
lue::UnitType>(m_unit); } | 73 CSSPrimitiveValue::UnitType unit() const { return static_cast<CSSPrimitiveVa
lue::UnitType>(m_unit); } |
71 void setUnit(CSSPrimitiveValue::UnitType unit) { m_unit = static_cast<int>(u
nit); } | 74 void setUnit(CSSPrimitiveValue::UnitType unit) { m_unit = static_cast<int>(u
nit); } |
72 | 75 |
73 inline void setFromNumber(double value, CSSPrimitiveValue::UnitType); | 76 inline void setFromNumber(double value, CSSPrimitiveValue::UnitType); |
74 inline void setFromOperator(UChar); | 77 inline void setFromOperator(UChar); |
75 inline void setFromValueList(PassOwnPtr<CSSParserValueList>); | 78 inline void setFromValueList(PassOwnPtr<CSSParserValueList>); |
76 }; | 79 }; |
77 | 80 |
(...skipping 26 matching lines...) Expand all Loading... |
104 if (index < m_values.size()) | 107 if (index < m_values.size()) |
105 m_current = index; | 108 m_current = index; |
106 } | 109 } |
107 | 110 |
108 CSSParserValue* valueAt(unsigned i) { return i < m_values.size() ? &m_values
[i] : nullptr; } | 111 CSSParserValue* valueAt(unsigned i) { return i < m_values.size() ? &m_values
[i] : nullptr; } |
109 | 112 |
110 void clearAndLeakValues() { m_values.clear(); m_current = 0;} | 113 void clearAndLeakValues() { m_values.clear(); m_current = 0;} |
111 void destroyAndClear(); | 114 void destroyAndClear(); |
112 | 115 |
113 private: | 116 private: |
| 117 void checkForVariableReferencesOrDestroyAndClear(const CSSParserTokenRange&
originalRange); |
| 118 void consumeVariableValue(const CSSParserTokenRange&); |
| 119 |
114 unsigned m_current; | 120 unsigned m_current; |
115 Vector<CSSParserValue, 4> m_values; | 121 Vector<CSSParserValue, 4> m_values; |
116 }; | 122 }; |
117 | 123 |
118 struct CSSParserFunction { | 124 struct CSSParserFunction { |
119 USING_FAST_MALLOC(CSSParserFunction); | 125 USING_FAST_MALLOC(CSSParserFunction); |
120 public: | 126 public: |
121 CSSValueID id; | 127 CSSValueID id; |
122 OwnPtr<CSSParserValueList> args; | 128 OwnPtr<CSSParserValueList> args; |
123 }; | 129 }; |
(...skipping 25 matching lines...) Expand all Loading... |
149 { | 155 { |
150 id = CSSValueInvalid; | 156 id = CSSValueInvalid; |
151 this->valueList = valueList.leakPtr(); | 157 this->valueList = valueList.leakPtr(); |
152 m_unit = ValueList; | 158 m_unit = ValueList; |
153 isInt = false; | 159 isInt = false; |
154 } | 160 } |
155 | 161 |
156 } | 162 } |
157 | 163 |
158 #endif | 164 #endif |
OLD | NEW |