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

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

Issue 29873003: Have LiveNodeList::rootNode() return a reference (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 2 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/LiveNodeList.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/dom/LiveNodeList.cpp
diff --git a/Source/core/dom/LiveNodeList.cpp b/Source/core/dom/LiveNodeList.cpp
index abb485eb2ff5a4b562098c4f6ad9a0f201d58f90..fea8b8aec93122457b43024dfd7e3c285348380d 100644
--- a/Source/core/dom/LiveNodeList.cpp
+++ b/Source/core/dom/LiveNodeList.cpp
@@ -29,19 +29,19 @@
namespace WebCore {
-Node* LiveNodeListBase::rootNode() const
+Node& LiveNodeListBase::rootNode() const
{
if (isRootedAtDocument() && m_ownerNode->inDocument())
- return &m_ownerNode->document();
- return m_ownerNode.get();
+ return m_ownerNode->document();
+ return *m_ownerNode;
}
ContainerNode* LiveNodeListBase::rootContainerNode() const
{
- Node* rootNode = this->rootNode();
- if (!rootNode->isContainerNode())
+ Node& rootNode = this->rootNode();
+ if (!rootNode.isContainerNode())
return 0;
- return toContainerNode(rootNode);
+ return toContainerNode(&rootNode);
}
void LiveNodeListBase::invalidateCache() const
@@ -70,11 +70,11 @@ void LiveNodeListBase::invalidateIdNameCacheMaps() const
Node* LiveNodeList::namedItem(const AtomicString& elementId) const
{
- Node* rootNode = this->rootNode();
+ Node& rootNode = this->rootNode();
- if (rootNode->inDocument()) {
- Element* element = rootNode->treeScope().getElementById(elementId);
- if (element && nodeMatches(element) && element->isDescendantOf(rootNode))
+ if (rootNode.inDocument()) {
+ Element* element = rootNode.treeScope().getElementById(elementId);
+ if (element && nodeMatches(element) && element->isDescendantOf(&rootNode))
return element;
if (!element)
return 0;
« no previous file with comments | « Source/core/dom/LiveNodeList.h ('k') | Source/core/html/HTMLCollection.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698