OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CSSParserToken_h | 5 #ifndef CSSParserToken_h |
6 #define CSSParserToken_h | 6 #define CSSParserToken_h |
7 | 7 |
8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
9 #include "core/css/CSSPrimitiveValue.h" | 9 #include "core/css/CSSPrimitiveValue.h" |
10 #include "core/css/parser/CSSParserString.h" | 10 #include "core/css/parser/CSSParserString.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 enum NumericValueType { | 56 enum NumericValueType { |
57 IntegerValueType, | 57 IntegerValueType, |
58 NumberValueType, | 58 NumberValueType, |
59 }; | 59 }; |
60 | 60 |
61 enum HashTokenType { | 61 enum HashTokenType { |
62 HashTokenId, | 62 HashTokenId, |
63 HashTokenUnrestricted, | 63 HashTokenUnrestricted, |
64 }; | 64 }; |
65 | 65 |
| 66 class CSSVariableData; |
| 67 |
66 class CORE_EXPORT CSSParserToken { | 68 class CORE_EXPORT CSSParserToken { |
67 public: | 69 public: |
68 enum BlockType { | 70 enum BlockType { |
69 NotBlock, | 71 NotBlock, |
70 BlockStart, | 72 BlockStart, |
71 BlockEnd, | 73 BlockEnd, |
72 }; | 74 }; |
73 | 75 |
74 CSSParserToken(CSSParserTokenType, BlockType = NotBlock); | 76 CSSParserToken(CSSParserTokenType, BlockType = NotBlock); |
75 CSSParserToken(CSSParserTokenType, CSSParserString, BlockType = NotBlock); | 77 CSSParserToken(CSSParserTokenType, CSSParserString, BlockType = NotBlock); |
(...skipping 22 matching lines...) Expand all Loading... |
98 UChar delimiter() const; | 100 UChar delimiter() const; |
99 NumericSign numericSign() const; | 101 NumericSign numericSign() const; |
100 NumericValueType numericValueType() const; | 102 NumericValueType numericValueType() const; |
101 double numericValue() const; | 103 double numericValue() const; |
102 HashTokenType hashTokenType() const { ASSERT(m_type == HashToken); return m_
hashTokenType; } | 104 HashTokenType hashTokenType() const { ASSERT(m_type == HashToken); return m_
hashTokenType; } |
103 BlockType blockType() const { return static_cast<BlockType>(m_blockType); } | 105 BlockType blockType() const { return static_cast<BlockType>(m_blockType); } |
104 CSSPrimitiveValue::UnitType unitType() const { return static_cast<CSSPrimiti
veValue::UnitType>(m_unit); } | 106 CSSPrimitiveValue::UnitType unitType() const { return static_cast<CSSPrimiti
veValue::UnitType>(m_unit); } |
105 UChar32 unicodeRangeStart() const { ASSERT(m_type == UnicodeRangeToken); ret
urn m_unicodeRange.start; } | 107 UChar32 unicodeRangeStart() const { ASSERT(m_type == UnicodeRangeToken); ret
urn m_unicodeRange.start; } |
106 UChar32 unicodeRangeEnd() const { ASSERT(m_type == UnicodeRangeToken); retur
n m_unicodeRange.end; } | 108 UChar32 unicodeRangeEnd() const { ASSERT(m_type == UnicodeRangeToken); retur
n m_unicodeRange.end; } |
107 | 109 |
| 110 bool valueIs8Bit() const { return m_valueIs8Bit; } |
| 111 |
108 CSSPropertyID parseAsUnresolvedCSSPropertyID() const; | 112 CSSPropertyID parseAsUnresolvedCSSPropertyID() const; |
109 | 113 |
110 void serialize(StringBuilder&) const; | 114 void serialize(StringBuilder&) const; |
111 | 115 |
112 private: | 116 private: |
113 void initValueFromCSSParserString(const CSSParserString& value) | 117 void initValueFromCSSParserString(const CSSParserString& value) |
114 { | 118 { |
115 m_valueLength = value.m_length; | 119 m_valueLength = value.m_length; |
116 m_valueIs8Bit = value.m_is8Bit; | 120 m_valueIs8Bit = value.m_is8Bit; |
117 m_valueDataCharRaw = value.m_data.charactersRaw; | 121 m_valueDataCharRaw = value.m_data.charactersRaw; |
(...skipping 13 matching lines...) Expand all Loading... |
131 union { | 135 union { |
132 UChar m_delimiter; | 136 UChar m_delimiter; |
133 HashTokenType m_hashTokenType; | 137 HashTokenType m_hashTokenType; |
134 double m_numericValue; | 138 double m_numericValue; |
135 | 139 |
136 struct { | 140 struct { |
137 UChar32 start; | 141 UChar32 start; |
138 UChar32 end; | 142 UChar32 end; |
139 } m_unicodeRange; | 143 } m_unicodeRange; |
140 }; | 144 }; |
| 145 |
| 146 friend CSSVariableData; |
141 }; | 147 }; |
142 | 148 |
143 } // namespace blink | 149 } // namespace blink |
144 | 150 |
145 namespace WTF { | 151 namespace WTF { |
146 template <> | 152 template <> |
147 struct IsTriviallyMoveAssignable<blink::CSSParserToken> { | 153 struct IsTriviallyMoveAssignable<blink::CSSParserToken> { |
148 static const bool value = true; | 154 static const bool value = true; |
149 }; | 155 }; |
150 } | 156 } |
151 | 157 |
152 #endif // CSSSParserToken_h | 158 #endif // CSSSParserToken_h |
OLD | NEW |