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

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

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/Node.h ('k') | Source/core/dom/NodeList.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/Node.cpp
diff --git a/Source/core/dom/Node.cpp b/Source/core/dom/Node.cpp
index 26efd32e7d0d4d9cecc192988c7d57e86b4cc50a..f24d0eca7f86a02a866a6ea89366338fc09ffe99 100644
--- a/Source/core/dom/Node.cpp
+++ b/Source/core/dom/Node.cpp
@@ -34,7 +34,6 @@
#include "core/dom/Attribute.h"
#include "core/dom/ChildListMutationScope.h"
#include "core/dom/ChildNodeList.h"
-#include "core/dom/ClassNodeList.h"
#include "core/dom/DOMImplementation.h"
#include "core/dom/Document.h"
#include "core/dom/DocumentFragment.h"
@@ -44,7 +43,6 @@
#include "core/dom/ElementRareData.h"
#include "core/dom/ExceptionCode.h"
#include "core/dom/LiveNodeList.h"
-#include "core/dom/NameNodeList.h"
#include "core/dom/NodeRareData.h"
#include "core/dom/NodeTraversal.h"
#include "core/dom/ProcessingInstruction.h"
@@ -79,7 +77,6 @@
#include "core/html/HTMLDialogElement.h"
#include "core/html/HTMLFrameOwnerElement.h"
#include "core/html/HTMLStyleElement.h"
-#include "core/html/RadioNodeList.h"
#include "core/page/ContextMenuController.h"
#include "core/page/EventHandler.h"
#include "core/frame/Frame.h"
@@ -360,7 +357,9 @@ void Node::setNodeValue(const String&)
PassRefPtr<NodeList> Node::childNodes()
{
- return ensureRareData().ensureNodeLists().ensureChildNodeList(this);
+ if (isContainerNode())
+ return ensureRareData().ensureNodeLists().ensureChildNodeList(toContainerNode(this));
+ return ensureRareData().ensureNodeLists().ensureEmptyChildNodeList(this);
}
Node& Node::lastDescendant() const
@@ -1258,48 +1257,6 @@ bool Node::inSameContainingBlockFlowElement(Node *n)
// FIXME: End of obviously misplaced HTML editing functions. Try to move these out of Node.
-PassRefPtr<NodeList> Node::getElementsByTagName(const AtomicString& localName)
-{
- if (localName.isNull())
- return 0;
-
- if (document().isHTMLDocument())
- return ensureRareData().ensureNodeLists().addCacheWithAtomicName<HTMLTagNodeList>(this, HTMLTagNodeListType, localName);
- return ensureRareData().ensureNodeLists().addCacheWithAtomicName<TagNodeList>(this, TagNodeListType, localName);
-}
-
-PassRefPtr<NodeList> Node::getElementsByTagNameNS(const AtomicString& namespaceURI, const AtomicString& localName)
-{
- if (localName.isNull())
- return 0;
-
- if (namespaceURI == starAtom)
- return getElementsByTagName(localName);
-
- return ensureRareData().ensureNodeLists().addCacheWithQualifiedName(this, namespaceURI.isEmpty() ? nullAtom : namespaceURI, localName);
-}
-
-// Takes an AtomicString in argument because it is common for elements to share the same name attribute.
-// Therefore, the NameNodeList factory function expects an AtomicString type.
-PassRefPtr<NodeList> Node::getElementsByName(const AtomicString& elementName)
-{
- return ensureRareData().ensureNodeLists().addCacheWithAtomicName<NameNodeList>(this, NameNodeListType, elementName);
-}
-
-// Takes an AtomicString in argument because it is common for elements to share the same set of class names.
-// Therefore, the ClassNodeList factory function expects an AtomicString type.
-PassRefPtr<NodeList> Node::getElementsByClassName(const AtomicString& classNames)
-{
- return ensureRareData().ensureNodeLists().addCacheWithAtomicName<ClassNodeList>(this, ClassNodeListType, classNames);
-}
-
-PassRefPtr<RadioNodeList> Node::radioNodeList(const AtomicString& name, bool onlyMatchImgElements)
-{
- ASSERT(hasTagName(formTag) || hasTagName(fieldsetTag));
- CollectionType type = onlyMatchImgElements ? RadioImgNodeListType : RadioNodeListType;
- return ensureRareData().ensureNodeLists().addCacheWithAtomicName<RadioNodeList>(this, type, name);
-}
-
PassRefPtr<Element> Node::querySelector(const AtomicString& selectors, ExceptionState& exceptionState)
{
if (selectors.isEmpty()) {
« no previous file with comments | « Source/core/dom/Node.h ('k') | Source/core/dom/NodeList.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698