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

Unified Diff: Source/core/dom/LiveNodeList.h

Issue 137433008: Have HTMLCollection::item() return an Element as per specification (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 6 years, 10 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/dom/Document.cpp ('k') | Source/core/html/CollectionIndexCache.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/LiveNodeList.h
diff --git a/Source/core/dom/LiveNodeList.h b/Source/core/dom/LiveNodeList.h
index 4e7f20087525af20bb9dd1fc0702197953de02c4..77d86956b4808411938a78d17865b454a936d492 100644
--- a/Source/core/dom/LiveNodeList.h
+++ b/Source/core/dom/LiveNodeList.h
@@ -68,7 +68,6 @@ public:
}
ContainerNode& rootNode() const;
- Node* itemBefore(const Node* previousItem) const;
ALWAYS_INLINE bool hasIdNameCache() const { return !isLiveNodeListType(type()); }
ALWAYS_INLINE bool isRootedAtDocument() const { return m_rootType == NodeListIsRootedAtDocument || m_rootType == NodeListIsRootedAtDocumentIfOwnerHasItemrefAttr; }
@@ -92,8 +91,12 @@ protected:
ALWAYS_INLINE NodeListRootType rootType() const { return static_cast<NodeListRootType>(m_rootType); }
bool shouldOnlyIncludeDirectChildren() const { return m_shouldOnlyIncludeDirectChildren; }
+ template <typename Collection>
+ static Element* iterateForPreviousNode(const Collection&, Node* current);
+ template <typename Collection>
+ static Element* itemBefore(const Collection&, const Node* previousItem);
+
private:
- Node* iterateForPreviousNode(Node* current) const;
void invalidateIdNameCacheMaps() const;
RefPtr<ContainerNode> m_ownerNode; // Cannot be null.
@@ -145,13 +148,14 @@ public:
// Collection IndexCache API.
bool canTraverseBackward() const { return true; }
+ Node* itemBefore(const Node* previousItem) const;
Node* traverseToFirstElement(const ContainerNode& root) const;
Node* traverseForwardToOffset(unsigned offset, Node& currentNode, unsigned& currentOffset, const ContainerNode& root) const;
private:
virtual bool isLiveNodeList() const OVERRIDE FINAL { return true; }
- mutable CollectionIndexCache<LiveNodeList> m_collectionIndexCache;
+ mutable CollectionIndexCache<LiveNodeList, Node> m_collectionIndexCache;
};
} // namespace WebCore
« no previous file with comments | « Source/core/dom/Document.cpp ('k') | Source/core/html/CollectionIndexCache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698