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

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

Issue 152903002: Move m_overridesItemAfter member from LiveNodeListBase to HTMLCollection (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: No change Created 6 years, 11 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
« no previous file with comments | « Source/core/html/CollectionIndexCache.h ('k') | Source/core/html/HTMLCollection.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/HTMLCollection.h
diff --git a/Source/core/html/HTMLCollection.h b/Source/core/html/HTMLCollection.h
index 26aff438926a2c8925f931130e8822e4ed6ec42a..d37e3cae21771d95d5241bbdb2fab164d0f0d02c 100644
--- a/Source/core/html/HTMLCollection.h
+++ b/Source/core/html/HTMLCollection.h
@@ -33,6 +33,11 @@ namespace WebCore {
class HTMLCollection : public ScriptWrappable, public RefCounted<HTMLCollection>, public LiveNodeListBase {
public:
+ enum ItemAfterOverrideType {
+ OverridesItemAfter,
+ DoesNotOverrideItemAfter,
+ };
+
static PassRefPtr<HTMLCollection> create(ContainerNode* base, CollectionType);
virtual ~HTMLCollection();
virtual void invalidateCache() const OVERRIDE;
@@ -47,15 +52,17 @@ public:
bool isEmpty() const { return m_collectionIndexCache.isEmpty(*this); }
bool hasExactlyOneItem() const { return m_collectionIndexCache.hasExactlyOneNode(*this); }
- virtual Element* virtualItemAfter(Element*) const;
-
// CollectionIndexCache API.
+ bool canTraverseBackward() const { return !overridesItemAfter(); }
Element* traverseToFirstElement(const ContainerNode& root) const;
Element* traverseForwardToOffset(unsigned offset, Node& currentElement, unsigned& currentOffset, const ContainerNode& root) const;
protected:
HTMLCollection(ContainerNode* base, CollectionType, ItemAfterOverrideType);
+ bool overridesItemAfter() const { return m_overridesItemAfter; }
+ virtual Element* virtualItemAfter(Element*) const;
+
virtual void updateNameCache() const;
bool hasNameCache() const { return m_isNameCacheValid; }
void setHasNameCache() const { m_isNameCacheValid = true; }
@@ -78,6 +85,7 @@ private:
m_isNameCacheValid = false;
}
+ const unsigned m_overridesItemAfter : 1;
mutable unsigned m_isNameCacheValid : 1;
mutable NodeCacheMap m_idCache;
mutable NodeCacheMap m_nameCache;
« no previous file with comments | « Source/core/html/CollectionIndexCache.h ('k') | Source/core/html/HTMLCollection.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698