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

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLCollection.cpp

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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * Copyright (C) 2003-2008, 2011, 2012, 2014 Apple Inc. All rights reserved. 4 * Copyright (C) 2003-2008, 2011, 2012, 2014 Apple Inc. All rights reserved.
5 * Copyright (C) 2014 Samsung Electronics. All rights reserved. 5 * Copyright (C) 2014 Samsung Electronics. All rights reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 // 3. Return result. 450 // 3. Return result.
451 HashSet<AtomicString> existingNames; 451 HashSet<AtomicString> existingNames;
452 unsigned length = this->length(); 452 unsigned length = this->length();
453 for (unsigned i = 0; i < length; ++i) { 453 for (unsigned i = 0; i < length; ++i) {
454 Element* element = item(i); 454 Element* element = item(i);
455 const AtomicString& idAttribute = element->getIdAttribute(); 455 const AtomicString& idAttribute = element->getIdAttribute();
456 if (!idAttribute.isEmpty()) { 456 if (!idAttribute.isEmpty()) {
457 HashSet<AtomicString>::AddResult addResult = 457 HashSet<AtomicString>::AddResult addResult =
458 existingNames.add(idAttribute); 458 existingNames.add(idAttribute);
459 if (addResult.isNewEntry) 459 if (addResult.isNewEntry)
460 names.append(idAttribute); 460 names.push_back(idAttribute);
461 } 461 }
462 if (!element->isHTMLElement()) 462 if (!element->isHTMLElement())
463 continue; 463 continue;
464 const AtomicString& nameAttribute = element->getNameAttribute(); 464 const AtomicString& nameAttribute = element->getNameAttribute();
465 if (!nameAttribute.isEmpty() && 465 if (!nameAttribute.isEmpty() &&
466 (type() != DocAll || 466 (type() != DocAll ||
467 nameShouldBeVisibleInDocumentAll(toHTMLElement(*element)))) { 467 nameShouldBeVisibleInDocumentAll(toHTMLElement(*element)))) {
468 HashSet<AtomicString>::AddResult addResult = 468 HashSet<AtomicString>::AddResult addResult =
469 existingNames.add(nameAttribute); 469 existingNames.add(nameAttribute);
470 if (addResult.isNewEntry) 470 if (addResult.isNewEntry)
471 names.append(nameAttribute); 471 names.push_back(nameAttribute);
472 } 472 }
473 } 473 }
474 } 474 }
475 475
476 void HTMLCollection::namedPropertyEnumerator(Vector<String>& names, 476 void HTMLCollection::namedPropertyEnumerator(Vector<String>& names,
477 ExceptionState&) { 477 ExceptionState&) {
478 supportedPropertyNames(names); 478 supportedPropertyNames(names);
479 } 479 }
480 480
481 void HTMLCollection::updateIdNameCache() const { 481 void HTMLCollection::updateIdNameCache() const {
(...skipping 24 matching lines...) Expand all
506 HeapVector<Member<Element>>& result) const { 506 HeapVector<Member<Element>>& result) const {
507 DCHECK(result.isEmpty()); 507 DCHECK(result.isEmpty());
508 if (name.isEmpty()) 508 if (name.isEmpty())
509 return; 509 return;
510 510
511 updateIdNameCache(); 511 updateIdNameCache();
512 512
513 const NamedItemCache& cache = namedItemCache(); 513 const NamedItemCache& cache = namedItemCache();
514 if (HeapVector<Member<Element>>* idResults = cache.getElementsById(name)) { 514 if (HeapVector<Member<Element>>* idResults = cache.getElementsById(name)) {
515 for (const auto& element : *idResults) 515 for (const auto& element : *idResults)
516 result.append(element); 516 result.push_back(element);
517 } 517 }
518 if (HeapVector<Member<Element>>* nameResults = 518 if (HeapVector<Member<Element>>* nameResults =
519 cache.getElementsByName(name)) { 519 cache.getElementsByName(name)) {
520 for (const auto& element : *nameResults) 520 for (const auto& element : *nameResults)
521 result.append(element); 521 result.push_back(element);
522 } 522 }
523 } 523 }
524 524
525 HTMLCollection::NamedItemCache::NamedItemCache() {} 525 HTMLCollection::NamedItemCache::NamedItemCache() {}
526 526
527 DEFINE_TRACE(HTMLCollection) { 527 DEFINE_TRACE(HTMLCollection) {
528 visitor->trace(m_namedItemCache); 528 visitor->trace(m_namedItemCache);
529 visitor->trace(m_collectionItemsCache); 529 visitor->trace(m_collectionItemsCache);
530 LiveNodeListBase::trace(visitor); 530 LiveNodeListBase::trace(visitor);
531 } 531 }
532 532
533 } // namespace blink 533 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLCollection.h ('k') | third_party/WebKit/Source/core/html/HTMLDimension.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698