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

Side by Side Diff: Source/core/dom/LiveNodeListBase.h

Issue 180143003: Have LiveNodeListBase::ownerNode() return a reference (Closed) Base URL: svn://svn.chromium.org/blink/trunk
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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/dom/LiveNodeList.cpp ('k') | Source/core/dom/NameNodeList.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved. 5 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved.
6 * Copyright (C) 2014 Samsung Electronics. All rights reserved. 6 * Copyright (C) 2014 Samsung Electronics. All rights reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 document().unregisterNodeList(this); 60 document().unregisterNodeList(this);
61 } 61 }
62 62
63 ContainerNode& rootNode() const; 63 ContainerNode& rootNode() const;
64 64
65 void didMoveToDocument(Document& oldDocument, Document& newDocument); 65 void didMoveToDocument(Document& oldDocument, Document& newDocument);
66 ALWAYS_INLINE bool hasIdNameCache() const { return !isLiveNodeListType(type( )); } 66 ALWAYS_INLINE bool hasIdNameCache() const { return !isLiveNodeListType(type( )); }
67 ALWAYS_INLINE bool isRootedAtDocument() const { return m_rootType == NodeLis tIsRootedAtDocument; } 67 ALWAYS_INLINE bool isRootedAtDocument() const { return m_rootType == NodeLis tIsRootedAtDocument; }
68 ALWAYS_INLINE NodeListInvalidationType invalidationType() const { return sta tic_cast<NodeListInvalidationType>(m_invalidationType); } 68 ALWAYS_INLINE NodeListInvalidationType invalidationType() const { return sta tic_cast<NodeListInvalidationType>(m_invalidationType); }
69 ALWAYS_INLINE CollectionType type() const { return static_cast<CollectionTyp e>(m_collectionType); } 69 ALWAYS_INLINE CollectionType type() const { return static_cast<CollectionTyp e>(m_collectionType); }
70 ContainerNode* ownerNode() const { return m_ownerNode.get(); } 70 ContainerNode& ownerNode() const { return *m_ownerNode; }
71 ALWAYS_INLINE void invalidateCache(const QualifiedName* attrName) const 71 ALWAYS_INLINE void invalidateCache(const QualifiedName* attrName) const
72 { 72 {
73 if (!attrName || shouldInvalidateTypeOnAttributeChange(invalidationType( ), *attrName)) 73 if (!attrName || shouldInvalidateTypeOnAttributeChange(invalidationType( ), *attrName))
74 invalidateCache(); 74 invalidateCache();
75 else if (hasIdNameCache() && (*attrName == HTMLNames::idAttr || *attrNam e == HTMLNames::nameAttr)) 75 else if (hasIdNameCache() && (*attrName == HTMLNames::idAttr || *attrNam e == HTMLNames::nameAttr))
76 invalidateIdNameCacheMaps(); 76 invalidateIdNameCacheMaps();
77 } 77 }
78 virtual void invalidateCache(Document* oldDocument = 0) const = 0; 78 virtual void invalidateCache(Document* oldDocument = 0) const = 0;
79 79
80 static bool shouldInvalidateTypeOnAttributeChange(NodeListInvalidationType, const QualifiedName&); 80 static bool shouldInvalidateTypeOnAttributeChange(NodeListInvalidationType, const QualifiedName&);
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 current = previousNode(collection.rootNode(), *previous, collection.shou ldOnlyIncludeDirectChildren()); 163 current = previousNode(collection.rootNode(), *previous, collection.shou ldOnlyIncludeDirectChildren());
164 else 164 else
165 current = lastNode(collection.rootNode(), collection.shouldOnlyIncludeDi rectChildren()); 165 current = lastNode(collection.rootNode(), collection.shouldOnlyIncludeDi rectChildren());
166 166
167 return iterateForPreviousNode(collection, current); 167 return iterateForPreviousNode(collection, current);
168 } 168 }
169 169
170 } // namespace WebCore 170 } // namespace WebCore
171 171
172 #endif // LiveNodeListBase_h 172 #endif // LiveNodeListBase_h
OLDNEW
« no previous file with comments | « Source/core/dom/LiveNodeList.cpp ('k') | Source/core/dom/NameNodeList.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698