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

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

Issue 132923003: Make sure the rootNode of a LiveNodeListBase is always a ContainerNode (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase 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/dom/EmptyNodeList.cpp ('k') | Source/core/dom/LiveNodeList.cpp » ('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 a23ccdfa8e8651888493f80c2a4517eea78b1ed1..331435982b6ada5e220fcd2713859ba15ba3e063 100644
--- a/Source/core/dom/LiveNodeList.h
+++ b/Source/core/dom/LiveNodeList.h
@@ -48,7 +48,7 @@ public:
DoesNotOverrideItemAfter,
};
- LiveNodeListBase(Node* ownerNode, NodeListRootType rootType, NodeListInvalidationType invalidationType,
+ LiveNodeListBase(ContainerNode* ownerNode, NodeListRootType rootType, NodeListInvalidationType invalidationType,
bool shouldOnlyIncludeDirectChildren, CollectionType collectionType, ItemAfterOverrideType itemAfterOverrideType)
: m_ownerNode(ownerNode)
, m_cachedItem(0)
@@ -59,6 +59,7 @@ public:
, m_collectionType(collectionType)
, m_overridesItemAfter(itemAfterOverrideType == OverridesItemAfter)
{
+ ASSERT(m_ownerNode);
ASSERT(m_rootType == static_cast<unsigned>(rootType));
ASSERT(m_invalidationType == static_cast<unsigned>(invalidationType));
ASSERT(m_collectionType == static_cast<unsigned>(collectionType));
@@ -81,7 +82,7 @@ public:
ALWAYS_INLINE bool isRootedAtDocument() const { return m_rootType == NodeListIsRootedAtDocument || m_rootType == NodeListIsRootedAtDocumentIfOwnerHasItemrefAttr; }
ALWAYS_INLINE NodeListInvalidationType invalidationType() const { return static_cast<NodeListInvalidationType>(m_invalidationType); }
ALWAYS_INLINE CollectionType type() const { return static_cast<CollectionType>(m_collectionType); }
- Node* ownerNode() const { return m_ownerNode.get(); }
+ ContainerNode* ownerNode() const { return m_ownerNode.get(); }
ALWAYS_INLINE void invalidateCache(const QualifiedName* attrName) const
{
if (!attrName || shouldInvalidateTypeOnAttributeChange(invalidationType(), *attrName))
@@ -95,8 +96,7 @@ public:
protected:
Document& document() const { return m_ownerNode->document(); }
- Node& rootNode() const;
- ContainerNode* rootContainerNode() const;
+ ContainerNode& rootNode() const;
bool overridesItemAfter() const { return m_overridesItemAfter; }
ALWAYS_INLINE Node* cachedItem() const { return m_cachedItem; }
@@ -127,7 +127,7 @@ private:
Node* itemBefore(const Node* previousItem) const;
void invalidateIdNameCacheMaps() const;
- RefPtr<Node> m_ownerNode;
+ RefPtr<ContainerNode> m_ownerNode; // Cannot be null.
mutable Node* m_cachedItem;
mutable unsigned m_cachedLength;
mutable unsigned m_cachedItemOffset;
@@ -168,7 +168,7 @@ ALWAYS_INLINE bool LiveNodeListBase::shouldInvalidateTypeOnAttributeChange(NodeL
class LiveNodeList : public NodeList, public LiveNodeListBase {
public:
- LiveNodeList(PassRefPtr<Node> ownerNode, CollectionType collectionType, NodeListInvalidationType invalidationType, NodeListRootType rootType = NodeListIsRootedAtNode)
+ LiveNodeList(PassRefPtr<ContainerNode> ownerNode, CollectionType collectionType, NodeListInvalidationType invalidationType, NodeListRootType rootType = NodeListIsRootedAtNode)
: LiveNodeListBase(ownerNode.get(), rootType, invalidationType, collectionType == ChildNodeListType,
collectionType, DoesNotOverrideItemAfter)
{ }
« no previous file with comments | « Source/core/dom/EmptyNodeList.cpp ('k') | Source/core/dom/LiveNodeList.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698