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

Unified Diff: third_party/WebKit/Source/core/dom/ContainerNode.cpp

Issue 2868823002: getElementsByTagName() should take a qualifiedName in parameter (Closed)
Patch Set: Rebased And Align with review comments Created 3 years, 7 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: third_party/WebKit/Source/core/dom/ContainerNode.cpp
diff --git a/third_party/WebKit/Source/core/dom/ContainerNode.cpp b/third_party/WebKit/Source/core/dom/ContainerNode.cpp
index a28c419047cceacc3d03784dd27c1b84c67eb90f..5efc3ea16546eaf85bf15c11d26775e446f5f40a 100644
--- a/third_party/WebKit/Source/core/dom/ContainerNode.cpp
+++ b/third_party/WebKit/Source/core/dom/ContainerNode.cpp
@@ -1440,23 +1440,24 @@ void ContainerNode::InvalidateNodeListCachesInAncestors(
}
}
-TagCollection* ContainerNode::getElementsByTagName(
- const AtomicString& local_name) {
- if (GetDocument().IsHTMLDocument())
+HTMLCollection* ContainerNode::getElementsByTagName(
+ const AtomicString& qualified_name) {
+ DCHECK(!qualified_name.IsNull());
+
+ if (GetDocument().IsHTMLDocument()) {
return EnsureCachedCollection<HTMLTagCollection>(kHTMLTagCollectionType,
- local_name);
- return EnsureCachedCollection<TagCollection>(kTagCollectionType, local_name);
+ qualified_name);
+ }
+ return EnsureCachedCollection<TagCollection>(kTagCollectionType,
+ qualified_name);
}
-TagCollection* ContainerNode::getElementsByTagNameNS(
+HTMLCollection* ContainerNode::getElementsByTagNameNS(
const AtomicString& namespace_uri,
const AtomicString& local_name) {
- if (namespace_uri == g_star_atom)
- return getElementsByTagName(local_name);
-
- return EnsureCachedCollection<TagCollection>(
- kTagCollectionType, namespace_uri.IsEmpty() ? g_null_atom : namespace_uri,
- local_name);
+ return EnsureCachedCollection<TagCollectionNS>(
+ kTagCollectionNSType,
+ namespace_uri.IsEmpty() ? g_null_atom : namespace_uri, local_name);
}
// Takes an AtomicString in argument because it is common for elements to share
« no previous file with comments | « third_party/WebKit/Source/core/dom/ContainerNode.h ('k') | third_party/WebKit/Source/core/dom/NodeListsNodeData.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698