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

Unified Diff: Source/core/html/HTMLCollection.h

Issue 113653006: Remove complexity related to m_cachedElementsArrayOffset from LiveNodeListBase (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 6 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 side-by-side diff with in-line comments
Download patch
Index: Source/core/html/HTMLCollection.h
diff --git a/Source/core/html/HTMLCollection.h b/Source/core/html/HTMLCollection.h
index 091201667a2175fb55abd206b3095f9c80c8071f..f0ccfbb67585d045c65213f1dcad409d4254ee1e 100644
--- a/Source/core/html/HTMLCollection.h
+++ b/Source/core/html/HTMLCollection.h
@@ -35,6 +35,7 @@ class HTMLCollection : public ScriptWrappable, public RefCounted<HTMLCollection>
public:
static PassRefPtr<HTMLCollection> create(Node* base, CollectionType);
virtual ~HTMLCollection();
+ virtual void invalidateCache() const OVERRIDE;
// DOM API
virtual Node* namedItem(const AtomicString& name) const;
@@ -58,10 +59,10 @@ public:
return item(0) && !item(1);
}
- virtual Element* virtualItemAfter(unsigned& offsetInArray, Element*) const;
+ virtual Element* virtualItemAfter(Element*) const;
- Element* traverseFirstElement(unsigned& offsetInArray, ContainerNode& root) const;
- Element* traverseForwardToOffset(unsigned offset, Element& currentElement, unsigned& currentOffset, unsigned& offsetInArray, ContainerNode* root) const;
+ Element* traverseFirstElement(ContainerNode& root) const;
+ Element* traverseForwardToOffset(unsigned offset, Element& currentElement, unsigned& currentOffset, ContainerNode* root) const;
protected:
HTMLCollection(Node* base, CollectionType, ItemAfterOverrideType);
@@ -76,13 +77,17 @@ protected:
private:
bool checkForNameMatch(Element*, bool checkName, const AtomicString& name) const;
- Element* traverseNextElement(unsigned& offsetInArray, Element& previous, ContainerNode* root) const;
+ Element* traverseNextElement(Element& previous, ContainerNode* root) const;
static void append(NodeCacheMap&, const AtomicString&, Element*);
+ void invalidateIdNameCacheMaps() const
+ {
+ m_idCache.clear();
+ m_nameCache.clear();
+ }
mutable NodeCacheMap m_idCache;
mutable NodeCacheMap m_nameCache;
- mutable unsigned m_cachedElementsArrayOffset;
friend class LiveNodeListBase;
};

Powered by Google App Engine
This is Rietveld 408576698