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

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: Update WebNodeCollection API 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
Index: Source/core/dom/LiveNodeList.h
diff --git a/Source/core/dom/LiveNodeList.h b/Source/core/dom/LiveNodeList.h
index e7026bf381edd4d6e5496023b1c191e2b7c3b121..45b96fc52e008cc3a4039188b554f895d5ccf1bf 100644
--- a/Source/core/dom/LiveNodeList.h
+++ b/Source/core/dom/LiveNodeList.h
@@ -76,7 +76,6 @@ public:
ContainerNode& rootNode() const;
bool overridesItemAfter() const { return m_overridesItemAfter; }
- 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; }
@@ -100,8 +99,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.
@@ -156,13 +159,14 @@ public:
virtual void invalidateCache() const OVERRIDE FINAL;
// Collection IndexCache API.
+ 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

Powered by Google App Engine
This is Rietveld 408576698