OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google, Inc. All Rights Reserved. | 2 * Copyright (C) 2013 Google, Inc. All Rights Reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 29 matching lines...) Expand all Loading... |
40 STACK_ALLOCATED(); | 40 STACK_ALLOCATED(); |
41 WTF_MAKE_NONCOPYABLE(AtomicHTMLToken); | 41 WTF_MAKE_NONCOPYABLE(AtomicHTMLToken); |
42 public: | 42 public: |
43 | 43 |
44 bool forceQuirks() const | 44 bool forceQuirks() const |
45 { | 45 { |
46 ASSERT(m_type == HTMLToken::DOCTYPE); | 46 ASSERT(m_type == HTMLToken::DOCTYPE); |
47 return m_doctypeData->m_forceQuirks; | 47 return m_doctypeData->m_forceQuirks; |
48 } | 48 } |
49 | 49 |
50 HTMLToken::Type type() const { return m_type; } | 50 HTMLToken::TokenType type() const { return m_type; } |
51 | 51 |
52 const AtomicString& name() const | 52 const AtomicString& name() const |
53 { | 53 { |
54 ASSERT(usesName()); | 54 ASSERT(usesName()); |
55 return m_name; | 55 return m_name; |
56 } | 56 } |
57 | 57 |
58 void setName(const AtomicString& name) | 58 void setName(const AtomicString& name) |
59 { | 59 { |
60 ASSERT(usesName()); | 60 ASSERT(usesName()); |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 m_selfClosing = token.selfClosing(); | 175 m_selfClosing = token.selfClosing(); |
176 m_name = AtomicString(token.data()); | 176 m_name = AtomicString(token.data()); |
177 break; | 177 break; |
178 case HTMLToken::Character: | 178 case HTMLToken::Character: |
179 case HTMLToken::Comment: | 179 case HTMLToken::Comment: |
180 m_data = token.data(); | 180 m_data = token.data(); |
181 break; | 181 break; |
182 } | 182 } |
183 } | 183 } |
184 | 184 |
185 explicit AtomicHTMLToken(HTMLToken::Type type) | 185 explicit AtomicHTMLToken(HTMLToken::TokenType type) |
186 : m_type(type) | 186 : m_type(type) |
187 , m_selfClosing(false) | 187 , m_selfClosing(false) |
188 { | 188 { |
189 } | 189 } |
190 | 190 |
191 AtomicHTMLToken(HTMLToken::Type type, const AtomicString& name, const Vector
<Attribute>& attributes = Vector<Attribute>()) | 191 AtomicHTMLToken(HTMLToken::TokenType type, const AtomicString& name, const V
ector<Attribute>& attributes = Vector<Attribute>()) |
192 : m_type(type) | 192 : m_type(type) |
193 , m_name(name) | 193 , m_name(name) |
194 , m_selfClosing(false) | 194 , m_selfClosing(false) |
195 , m_attributes(attributes) | 195 , m_attributes(attributes) |
196 { | 196 { |
197 ASSERT(usesName()); | 197 ASSERT(usesName()); |
198 } | 198 } |
199 | 199 |
200 private: | 200 private: |
201 HTMLToken::Type m_type; | 201 HTMLToken::TokenType m_type; |
202 | 202 |
203 void initializeAttributes(const HTMLToken::AttributeList& attributes); | 203 void initializeAttributes(const HTMLToken::AttributeList& attributes); |
204 QualifiedName nameForAttribute(const HTMLToken::Attribute&) const; | 204 QualifiedName nameForAttribute(const HTMLToken::Attribute&) const; |
205 | 205 |
206 bool usesName() const; | 206 bool usesName() const; |
207 | 207 |
208 bool usesAttributes() const; | 208 bool usesAttributes() const; |
209 | 209 |
210 // "name" for DOCTYPE, StartTag, and EndTag | 210 // "name" for DOCTYPE, StartTag, and EndTag |
211 AtomicString m_name; | 211 AtomicString m_name; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 const QualifiedName& name = nameForAttribute(attribute); | 244 const QualifiedName& name = nameForAttribute(attribute); |
245 // FIXME: This is N^2 for the number of attributes. | 245 // FIXME: This is N^2 for the number of attributes. |
246 if (!findAttributeInVector(m_attributes, name)) | 246 if (!findAttributeInVector(m_attributes, name)) |
247 m_attributes.append(Attribute(name, value)); | 247 m_attributes.append(Attribute(name, value)); |
248 } | 248 } |
249 } | 249 } |
250 | 250 |
251 } // namespace blink | 251 } // namespace blink |
252 | 252 |
253 #endif | 253 #endif |
OLD | NEW |