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 11 matching lines...) Expand all Loading... |
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
24 */ | 24 */ |
25 | 25 |
26 #ifndef HTMLToken_h | 26 #ifndef HTMLToken_h |
27 #define HTMLToken_h | 27 #define HTMLToken_h |
28 | 28 |
29 #include "core/dom/Attribute.h" | 29 #include "core/dom/Attribute.h" |
30 #include "core/html/parser/HTMLParserIdioms.h" | 30 #include "core/html/parser/HTMLParserIdioms.h" |
31 #include "wtf/Forward.h" | 31 #include "wtf/Forward.h" |
32 #include "wtf/PtrUtil.h" | 32 #include "wtf/PassOwnPtr.h" |
33 #include <memory> | |
34 | 33 |
35 namespace blink { | 34 namespace blink { |
36 | 35 |
37 class DoctypeData { | 36 class DoctypeData { |
38 USING_FAST_MALLOC(DoctypeData); | 37 USING_FAST_MALLOC(DoctypeData); |
39 WTF_MAKE_NONCOPYABLE(DoctypeData); | 38 WTF_MAKE_NONCOPYABLE(DoctypeData); |
40 public: | 39 public: |
41 DoctypeData() | 40 DoctypeData() |
42 : m_hasPublicIdentifier(false) | 41 : m_hasPublicIdentifier(false) |
43 , m_hasSystemIdentifier(false) | 42 , m_hasSystemIdentifier(false) |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 void setForceQuirks() | 192 void setForceQuirks() |
194 { | 193 { |
195 ASSERT(m_type == DOCTYPE); | 194 ASSERT(m_type == DOCTYPE); |
196 m_doctypeData->m_forceQuirks = true; | 195 m_doctypeData->m_forceQuirks = true; |
197 } | 196 } |
198 | 197 |
199 void beginDOCTYPE() | 198 void beginDOCTYPE() |
200 { | 199 { |
201 ASSERT(m_type == Uninitialized); | 200 ASSERT(m_type == Uninitialized); |
202 m_type = DOCTYPE; | 201 m_type = DOCTYPE; |
203 m_doctypeData = wrapUnique(new DoctypeData); | 202 m_doctypeData = adoptPtr(new DoctypeData); |
204 } | 203 } |
205 | 204 |
206 void beginDOCTYPE(UChar character) | 205 void beginDOCTYPE(UChar character) |
207 { | 206 { |
208 ASSERT(character); | 207 ASSERT(character); |
209 beginDOCTYPE(); | 208 beginDOCTYPE(); |
210 m_data.append(character); | 209 m_data.append(character); |
211 m_orAllData |= character; | 210 m_orAllData |= character; |
212 } | 211 } |
213 | 212 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 } | 247 } |
249 | 248 |
250 void appendToSystemIdentifier(UChar character) | 249 void appendToSystemIdentifier(UChar character) |
251 { | 250 { |
252 ASSERT(character); | 251 ASSERT(character); |
253 ASSERT(m_type == DOCTYPE); | 252 ASSERT(m_type == DOCTYPE); |
254 ASSERT(m_doctypeData->m_hasSystemIdentifier); | 253 ASSERT(m_doctypeData->m_hasSystemIdentifier); |
255 m_doctypeData->m_systemIdentifier.append(character); | 254 m_doctypeData->m_systemIdentifier.append(character); |
256 } | 255 } |
257 | 256 |
258 std::unique_ptr<DoctypeData> releaseDoctypeData() | 257 PassOwnPtr<DoctypeData> releaseDoctypeData() |
259 { | 258 { |
260 return std::move(m_doctypeData); | 259 return std::move(m_doctypeData); |
261 } | 260 } |
262 | 261 |
263 /* Start/End Tag Tokens */ | 262 /* Start/End Tag Tokens */ |
264 | 263 |
265 bool selfClosing() const | 264 bool selfClosing() const |
266 { | 265 { |
267 ASSERT(m_type == StartTag || m_type == EndTag); | 266 ASSERT(m_type == StartTag || m_type == EndTag); |
268 return m_selfClosing; | 267 return m_selfClosing; |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
466 UChar m_orAllData; | 465 UChar m_orAllData; |
467 | 466 |
468 // For StartTag and EndTag | 467 // For StartTag and EndTag |
469 bool m_selfClosing; | 468 bool m_selfClosing; |
470 AttributeList m_attributes; | 469 AttributeList m_attributes; |
471 | 470 |
472 // A pointer into m_attributes used during lexing. | 471 // A pointer into m_attributes used during lexing. |
473 Attribute* m_currentAttribute; | 472 Attribute* m_currentAttribute; |
474 | 473 |
475 // For DOCTYPE | 474 // For DOCTYPE |
476 std::unique_ptr<DoctypeData> m_doctypeData; | 475 OwnPtr<DoctypeData> m_doctypeData; |
477 }; | 476 }; |
478 | 477 |
479 } // namespace blink | 478 } // namespace blink |
480 | 479 |
481 #endif | 480 #endif |
OLD | NEW |