| OLD | NEW |
| 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 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 505 void HTMLCollection::namedItems(const AtomicString& name, | 505 void HTMLCollection::namedItems(const AtomicString& name, |
| 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 (unsigned i = 0; i < idResults->size(); ++i) | 515 for (const auto& element : *idResults) |
| 516 result.append(idResults->at(i)); | 516 result.append(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 (unsigned i = 0; i < nameResults->size(); ++i) | 520 for (const auto& element : *nameResults) |
| 521 result.append(nameResults->at(i)); | 521 result.append(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 |
| OLD | NEW |