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

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

Issue 2121703002: Change HTMLTokenizer::Attribute::Range.start initial invalid value from 0 -> -1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update check Created 4 years, 5 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 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 if (!size) 228 if (!size)
229 return; 229 return;
230 230
231 m_attributes.clear(); 231 m_attributes.clear();
232 m_attributes.reserveInitialCapacity(size); 232 m_attributes.reserveInitialCapacity(size);
233 for (size_t i = 0; i < size; ++i) { 233 for (size_t i = 0; i < size; ++i) {
234 const HTMLToken::Attribute& attribute = attributes[i]; 234 const HTMLToken::Attribute& attribute = attributes[i];
235 if (attribute.nameAsVector().isEmpty()) 235 if (attribute.nameAsVector().isEmpty())
236 continue; 236 continue;
237 237
238 ASSERT(attribute.nameRange().start); 238 attribute.nameRange().checkValid();
239 ASSERT(attribute.nameRange().end); 239 attribute.valueRange().checkValid();
240 ASSERT(attribute.valueRange().start);
241 ASSERT(attribute.valueRange().end);
242 240
243 AtomicString value(attribute.value8BitIfNecessary()); 241 AtomicString value(attribute.value8BitIfNecessary());
244 const QualifiedName& name = nameForAttribute(attribute); 242 const QualifiedName& name = nameForAttribute(attribute);
245 // FIXME: This is N^2 for the number of attributes. 243 // FIXME: This is N^2 for the number of attributes.
246 if (!findAttributeInVector(m_attributes, name)) 244 if (!findAttributeInVector(m_attributes, name))
247 m_attributes.append(Attribute(name, value)); 245 m_attributes.append(Attribute(name, value));
248 } 246 }
249 } 247 }
250 248
251 } // namespace blink 249 } // namespace blink
252 250
253 #endif 251 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698