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