Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(33)

Side by Side Diff: third_party/WebKit/Source/core/html/parser/HTMLToken.h

Issue 2583233002: Migrate WTF::Vector::append() to ::push_back() [part 7 of N] (Closed)
Patch Set: Created 3 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 int start; 109 int start;
110 int end; 110 int end;
111 }; 111 };
112 112
113 AtomicString name() const { return AtomicString(m_name); } 113 AtomicString name() const { return AtomicString(m_name); }
114 String nameAttemptStaticStringCreation() const { 114 String nameAttemptStaticStringCreation() const {
115 return attemptStaticStringCreation(m_name, Likely8Bit); 115 return attemptStaticStringCreation(m_name, Likely8Bit);
116 } 116 }
117 const Vector<UChar, 32>& nameAsVector() const { return m_name; } 117 const Vector<UChar, 32>& nameAsVector() const { return m_name; }
118 118
119 void appendToName(UChar c) { m_name.append(c); } 119 void appendToName(UChar c) { m_name.push_back(c); }
120 120
121 PassRefPtr<StringImpl> value8BitIfNecessary() const { 121 PassRefPtr<StringImpl> value8BitIfNecessary() const {
122 return StringImpl::create8BitIfPossible(m_value); 122 return StringImpl::create8BitIfPossible(m_value);
123 } 123 }
124 String value() const { return String(m_value); } 124 String value() const { return String(m_value); }
125 125
126 void appendToValue(UChar c) { m_value.append(c); } 126 void appendToValue(UChar c) { m_value.push_back(c); }
127 void appendToValue(const String& value) { value.appendTo(m_value); } 127 void appendToValue(const String& value) { value.appendTo(m_value); }
128 void clearValue() { m_value.clear(); } 128 void clearValue() { m_value.clear(); }
129 129
130 const Range& nameRange() const { return m_nameRange; } 130 const Range& nameRange() const { return m_nameRange; }
131 const Range& valueRange() const { return m_valueRange; } 131 const Range& valueRange() const { return m_valueRange; }
132 Range& mutableNameRange() { return m_nameRange; } 132 Range& mutableNameRange() { return m_nameRange; }
133 Range& mutableValueRange() { return m_valueRange; } 133 Range& mutableValueRange() { return m_valueRange; }
134 134
135 private: 135 private:
136 Vector<UChar, 32> m_name; 136 Vector<UChar, 32> m_name;
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 bool isAll8BitData() const { return (m_orAllData <= 0xff); } 188 bool isAll8BitData() const { return (m_orAllData <= 0xff); }
189 189
190 const DataVector& name() const { 190 const DataVector& name() const {
191 ASSERT(m_type == StartTag || m_type == EndTag || m_type == DOCTYPE); 191 ASSERT(m_type == StartTag || m_type == EndTag || m_type == DOCTYPE);
192 return m_data; 192 return m_data;
193 } 193 }
194 194
195 void appendToName(UChar character) { 195 void appendToName(UChar character) {
196 ASSERT(m_type == StartTag || m_type == EndTag || m_type == DOCTYPE); 196 ASSERT(m_type == StartTag || m_type == EndTag || m_type == DOCTYPE);
197 ASSERT(character); 197 ASSERT(character);
198 m_data.append(character); 198 m_data.push_back(character);
199 m_orAllData |= character; 199 m_orAllData |= character;
200 } 200 }
201 201
202 /* DOCTYPE Tokens */ 202 /* DOCTYPE Tokens */
203 203
204 bool forceQuirks() const { 204 bool forceQuirks() const {
205 ASSERT(m_type == DOCTYPE); 205 ASSERT(m_type == DOCTYPE);
206 return m_doctypeData->m_forceQuirks; 206 return m_doctypeData->m_forceQuirks;
207 } 207 }
208 208
209 void setForceQuirks() { 209 void setForceQuirks() {
210 ASSERT(m_type == DOCTYPE); 210 ASSERT(m_type == DOCTYPE);
211 m_doctypeData->m_forceQuirks = true; 211 m_doctypeData->m_forceQuirks = true;
212 } 212 }
213 213
214 void beginDOCTYPE() { 214 void beginDOCTYPE() {
215 ASSERT(m_type == Uninitialized); 215 ASSERT(m_type == Uninitialized);
216 m_type = DOCTYPE; 216 m_type = DOCTYPE;
217 m_doctypeData = WTF::wrapUnique(new DoctypeData); 217 m_doctypeData = WTF::wrapUnique(new DoctypeData);
218 } 218 }
219 219
220 void beginDOCTYPE(UChar character) { 220 void beginDOCTYPE(UChar character) {
221 ASSERT(character); 221 ASSERT(character);
222 beginDOCTYPE(); 222 beginDOCTYPE();
223 m_data.append(character); 223 m_data.push_back(character);
224 m_orAllData |= character; 224 m_orAllData |= character;
225 } 225 }
226 226
227 // FIXME: Distinguish between a missing public identifer and an empty one. 227 // FIXME: Distinguish between a missing public identifer and an empty one.
228 const WTF::Vector<UChar>& publicIdentifier() const { 228 const WTF::Vector<UChar>& publicIdentifier() const {
229 ASSERT(m_type == DOCTYPE); 229 ASSERT(m_type == DOCTYPE);
230 return m_doctypeData->m_publicIdentifier; 230 return m_doctypeData->m_publicIdentifier;
231 } 231 }
232 232
233 // FIXME: Distinguish between a missing system identifer and an empty one. 233 // FIXME: Distinguish between a missing system identifer and an empty one.
(...skipping 11 matching lines...) Expand all
245 void setSystemIdentifierToEmptyString() { 245 void setSystemIdentifierToEmptyString() {
246 ASSERT(m_type == DOCTYPE); 246 ASSERT(m_type == DOCTYPE);
247 m_doctypeData->m_hasSystemIdentifier = true; 247 m_doctypeData->m_hasSystemIdentifier = true;
248 m_doctypeData->m_systemIdentifier.clear(); 248 m_doctypeData->m_systemIdentifier.clear();
249 } 249 }
250 250
251 void appendToPublicIdentifier(UChar character) { 251 void appendToPublicIdentifier(UChar character) {
252 ASSERT(character); 252 ASSERT(character);
253 ASSERT(m_type == DOCTYPE); 253 ASSERT(m_type == DOCTYPE);
254 ASSERT(m_doctypeData->m_hasPublicIdentifier); 254 ASSERT(m_doctypeData->m_hasPublicIdentifier);
255 m_doctypeData->m_publicIdentifier.append(character); 255 m_doctypeData->m_publicIdentifier.push_back(character);
256 } 256 }
257 257
258 void appendToSystemIdentifier(UChar character) { 258 void appendToSystemIdentifier(UChar character) {
259 ASSERT(character); 259 ASSERT(character);
260 ASSERT(m_type == DOCTYPE); 260 ASSERT(m_type == DOCTYPE);
261 ASSERT(m_doctypeData->m_hasSystemIdentifier); 261 ASSERT(m_doctypeData->m_hasSystemIdentifier);
262 m_doctypeData->m_systemIdentifier.append(character); 262 m_doctypeData->m_systemIdentifier.push_back(character);
263 } 263 }
264 264
265 std::unique_ptr<DoctypeData> releaseDoctypeData() { 265 std::unique_ptr<DoctypeData> releaseDoctypeData() {
266 return std::move(m_doctypeData); 266 return std::move(m_doctypeData);
267 } 267 }
268 268
269 /* Start/End Tag Tokens */ 269 /* Start/End Tag Tokens */
270 270
271 bool selfClosing() const { 271 bool selfClosing() const {
272 ASSERT(m_type == StartTag || m_type == EndTag); 272 ASSERT(m_type == StartTag || m_type == EndTag);
273 return m_selfClosing; 273 return m_selfClosing;
274 } 274 }
275 275
276 void setSelfClosing() { 276 void setSelfClosing() {
277 ASSERT(m_type == StartTag || m_type == EndTag); 277 ASSERT(m_type == StartTag || m_type == EndTag);
278 m_selfClosing = true; 278 m_selfClosing = true;
279 } 279 }
280 280
281 void beginStartTag(UChar character) { 281 void beginStartTag(UChar character) {
282 ASSERT(character); 282 ASSERT(character);
283 ASSERT(m_type == Uninitialized); 283 ASSERT(m_type == Uninitialized);
284 m_type = StartTag; 284 m_type = StartTag;
285 m_selfClosing = false; 285 m_selfClosing = false;
286 m_currentAttribute = 0; 286 m_currentAttribute = 0;
287 m_attributes.clear(); 287 m_attributes.clear();
288 288
289 m_data.append(character); 289 m_data.push_back(character);
290 m_orAllData |= character; 290 m_orAllData |= character;
291 } 291 }
292 292
293 void beginEndTag(LChar character) { 293 void beginEndTag(LChar character) {
294 ASSERT(m_type == Uninitialized); 294 ASSERT(m_type == Uninitialized);
295 m_type = EndTag; 295 m_type = EndTag;
296 m_selfClosing = false; 296 m_selfClosing = false;
297 m_currentAttribute = 0; 297 m_currentAttribute = 0;
298 m_attributes.clear(); 298 m_attributes.clear();
299 299
300 m_data.append(character); 300 m_data.push_back(character);
301 } 301 }
302 302
303 void beginEndTag(const Vector<LChar, 32>& characters) { 303 void beginEndTag(const Vector<LChar, 32>& characters) {
304 ASSERT(m_type == Uninitialized); 304 ASSERT(m_type == Uninitialized);
305 m_type = EndTag; 305 m_type = EndTag;
306 m_selfClosing = false; 306 m_selfClosing = false;
307 m_currentAttribute = 0; 307 m_currentAttribute = 0;
308 m_attributes.clear(); 308 m_attributes.clear();
309 309
310 m_data.appendVector(characters); 310 m_data.appendVector(characters);
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 m_type = Character; 390 m_type = Character;
391 } 391 }
392 392
393 const DataVector& characters() const { 393 const DataVector& characters() const {
394 ASSERT(m_type == Character); 394 ASSERT(m_type == Character);
395 return m_data; 395 return m_data;
396 } 396 }
397 397
398 void appendToCharacter(char character) { 398 void appendToCharacter(char character) {
399 ASSERT(m_type == Character); 399 ASSERT(m_type == Character);
400 m_data.append(character); 400 m_data.push_back(character);
401 } 401 }
402 402
403 void appendToCharacter(UChar character) { 403 void appendToCharacter(UChar character) {
404 ASSERT(m_type == Character); 404 ASSERT(m_type == Character);
405 m_data.append(character); 405 m_data.push_back(character);
406 m_orAllData |= character; 406 m_orAllData |= character;
407 } 407 }
408 408
409 void appendToCharacter(const Vector<LChar, 32>& characters) { 409 void appendToCharacter(const Vector<LChar, 32>& characters) {
410 ASSERT(m_type == Character); 410 ASSERT(m_type == Character);
411 m_data.appendVector(characters); 411 m_data.appendVector(characters);
412 } 412 }
413 413
414 /* Comment Tokens */ 414 /* Comment Tokens */
415 415
416 const DataVector& comment() const { 416 const DataVector& comment() const {
417 ASSERT(m_type == Comment); 417 ASSERT(m_type == Comment);
418 return m_data; 418 return m_data;
419 } 419 }
420 420
421 void beginComment() { 421 void beginComment() {
422 ASSERT(m_type == Uninitialized); 422 ASSERT(m_type == Uninitialized);
423 m_type = Comment; 423 m_type = Comment;
424 } 424 }
425 425
426 void appendToComment(UChar character) { 426 void appendToComment(UChar character) {
427 ASSERT(character); 427 ASSERT(character);
428 ASSERT(m_type == Comment); 428 ASSERT(m_type == Comment);
429 m_data.append(character); 429 m_data.push_back(character);
430 m_orAllData |= character; 430 m_orAllData |= character;
431 } 431 }
432 432
433 // Only for XSSAuditor 433 // Only for XSSAuditor
434 void eraseCharacters() { 434 void eraseCharacters() {
435 ASSERT(m_type == Character); 435 ASSERT(m_type == Character);
436 m_data.clear(); 436 m_data.clear();
437 m_orAllData = 0; 437 m_orAllData = 0;
438 } 438 }
439 439
(...skipping 15 matching lines...) Expand all
455 std::unique_ptr<DoctypeData> m_doctypeData; 455 std::unique_ptr<DoctypeData> m_doctypeData;
456 }; 456 };
457 457
458 #ifndef NDEBUG 458 #ifndef NDEBUG
459 const char* toString(HTMLToken::TokenType); 459 const char* toString(HTMLToken::TokenType);
460 #endif 460 #endif
461 461
462 } // namespace blink 462 } // namespace blink
463 463
464 #endif 464 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698