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

Side by Side 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 unified diff | Download patch
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, 2005, 2006, 2007, 2008, 2009, 2013 Apple Inc. All rights 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2013 Apple Inc. All rights
6 * reserved. 6 * 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 1422 matching lines...) Expand 10 before | Expand all | Expand 10 after
1433 return; 1433 return;
1434 1434
1435 GetDocument().InvalidateNodeListCaches(attr_name); 1435 GetDocument().InvalidateNodeListCaches(attr_name);
1436 1436
1437 for (ContainerNode* node = this; node; node = node->parentNode()) { 1437 for (ContainerNode* node = this; node; node = node->parentNode()) {
1438 if (NodeListsNodeData* lists = node->NodeLists()) 1438 if (NodeListsNodeData* lists = node->NodeLists())
1439 lists->InvalidateCaches(attr_name); 1439 lists->InvalidateCaches(attr_name);
1440 } 1440 }
1441 } 1441 }
1442 1442
1443 TagCollection* ContainerNode::getElementsByTagName( 1443 HTMLCollection* ContainerNode::getElementsByTagName(
1444 const AtomicString& local_name) { 1444 const AtomicString& qualified_name) {
1445 if (GetDocument().IsHTMLDocument()) 1445 DCHECK(!qualified_name.IsNull());
1446
1447 if (GetDocument().IsHTMLDocument()) {
1446 return EnsureCachedCollection<HTMLTagCollection>(kHTMLTagCollectionType, 1448 return EnsureCachedCollection<HTMLTagCollection>(kHTMLTagCollectionType,
1447 local_name); 1449 qualified_name);
1448 return EnsureCachedCollection<TagCollection>(kTagCollectionType, local_name); 1450 }
1451 return EnsureCachedCollection<TagCollection>(kTagCollectionType,
1452 qualified_name);
1449 } 1453 }
1450 1454
1451 TagCollection* ContainerNode::getElementsByTagNameNS( 1455 HTMLCollection* ContainerNode::getElementsByTagNameNS(
1452 const AtomicString& namespace_uri, 1456 const AtomicString& namespace_uri,
1453 const AtomicString& local_name) { 1457 const AtomicString& local_name) {
1454 if (namespace_uri == g_star_atom) 1458 return EnsureCachedCollection<TagCollectionNS>(
1455 return getElementsByTagName(local_name); 1459 kTagCollectionNSType,
1456 1460 namespace_uri.IsEmpty() ? g_null_atom : namespace_uri, local_name);
1457 return EnsureCachedCollection<TagCollection>(
1458 kTagCollectionType, namespace_uri.IsEmpty() ? g_null_atom : namespace_uri,
1459 local_name);
1460 } 1461 }
1461 1462
1462 // Takes an AtomicString in argument because it is common for elements to share 1463 // Takes an AtomicString in argument because it is common for elements to share
1463 // the same name attribute. Therefore, the NameNodeList factory function 1464 // the same name attribute. Therefore, the NameNodeList factory function
1464 // expects an AtomicString type. 1465 // expects an AtomicString type.
1465 NameNodeList* ContainerNode::getElementsByName( 1466 NameNodeList* ContainerNode::getElementsByName(
1466 const AtomicString& element_name) { 1467 const AtomicString& element_name) {
1467 return EnsureCachedCollection<NameNodeList>(kNameNodeListType, element_name); 1468 return EnsureCachedCollection<NameNodeList>(kNameNodeListType, element_name);
1468 } 1469 }
1469 1470
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
1520 return true; 1521 return true;
1521 1522
1522 if (node->IsElementNode() && ToElement(node)->Shadow()) 1523 if (node->IsElementNode() && ToElement(node)->Shadow())
1523 return true; 1524 return true;
1524 1525
1525 return false; 1526 return false;
1526 } 1527 }
1527 #endif 1528 #endif
1528 1529
1529 } // namespace blink 1530 } // namespace blink
OLDNEW
« 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