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 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 ownerNode().nodeLists()->removeCache(this, type()); | 184 ownerNode().nodeLists()->removeCache(this, type()); |
185 #endif | 185 #endif |
186 } | 186 } |
187 | 187 |
188 void HTMLCollection::invalidateCache(Document* oldDocument) const | 188 void HTMLCollection::invalidateCache(Document* oldDocument) const |
189 { | 189 { |
190 m_collectionIndexCache.invalidate(); | 190 m_collectionIndexCache.invalidate(); |
191 invalidateIdNameCacheMaps(oldDocument); | 191 invalidateIdNameCacheMaps(oldDocument); |
192 } | 192 } |
193 | 193 |
| 194 unsigned HTMLCollection::length() const |
| 195 { |
| 196 return m_collectionIndexCache.nodeCount(*this); |
| 197 } |
| 198 |
| 199 Element* HTMLCollection::item(unsigned offset) const |
| 200 { |
| 201 return m_collectionIndexCache.nodeAt(*this, offset); |
| 202 } |
| 203 |
194 static inline bool isMatchingHTMLElement(const HTMLCollection& htmlCollection, c
onst HTMLElement& element) | 204 static inline bool isMatchingHTMLElement(const HTMLCollection& htmlCollection, c
onst HTMLElement& element) |
195 { | 205 { |
196 switch (htmlCollection.type()) { | 206 switch (htmlCollection.type()) { |
197 case DocImages: | 207 case DocImages: |
198 return element.hasTagName(imgTag); | 208 return element.hasTagName(imgTag); |
199 case DocScripts: | 209 case DocScripts: |
200 return element.hasTagName(scriptTag); | 210 return element.hasTagName(scriptTag); |
201 case DocForms: | 211 case DocForms: |
202 return element.hasTagName(formTag); | 212 return element.hasTagName(formTag); |
203 case TableTBodies: | 213 case TableTBodies: |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
515 } | 525 } |
516 | 526 |
517 void HTMLCollection::trace(Visitor* visitor) | 527 void HTMLCollection::trace(Visitor* visitor) |
518 { | 528 { |
519 visitor->trace(m_namedItemCache); | 529 visitor->trace(m_namedItemCache); |
520 visitor->trace(m_collectionIndexCache); | 530 visitor->trace(m_collectionIndexCache); |
521 LiveNodeListBase::trace(visitor); | 531 LiveNodeListBase::trace(visitor); |
522 } | 532 } |
523 | 533 |
524 } // namespace blink | 534 } // namespace blink |
OLD | NEW |