+2014-04-09 Ryosuke Niwa <rniwa@webkit.org>
+
+ HTMLCollection::updateNamedElementCach iterates over items twice
+ https://bugs.webkit.org/show_bug.cgi?id=131448
+
+ Reviewed by Andreas Kling.
+
+ Compute the length first and go through the cache interface to traverse through items.
+
+ * html/HTMLCollection.cpp:
+ (WebCore::HTMLCollection::updateNamedElementCache):
+
2014-04-09 Brendan Long <b.long@cablelabs.com>
[GStreamer] Expose MPEG-TS metadata
if (hasNamedElementCache())
return;
- ContainerNode& root = rootNode();
+
CollectionNamedElementCache& cache = createNameItemCache();
- unsigned count;
- for (Element* element = firstElement(root); element; element = traverseForward(*element, 1, count, root)) {
+ unsigned size = m_indexCache.nodeCount(*this);
+ for (unsigned i = 0; i < size; i++) {
+ Element* element = m_indexCache.nodeAt(*this, i);
+ ASSERT(element);
const AtomicString& idAttrVal = element->getIdAttribute();
if (!idAttrVal.isEmpty())
cache.appendIdCache(idAttrVal, element);
cache.appendNameCache(nameAttrVal, element);
}
- m_indexCache.nodeCount(*this);
-
cache.didPopulate();
}