Title: [188809] trunk
Revision
188809
Author
[email protected]
Date
2015-08-21 17:50:13 -0700 (Fri, 21 Aug 2015)

Log Message

document.getElementsByTagName should return an HTMLCollection
https://bugs.webkit.org/show_bug.cgi?id=110611

Reviewed by Darin Adler.

Source/WebCore:

Update getElementsByTagName*() to return an HTMLCollection as per
the specification:
- https://dom.spec.whatwg.org/#interface-document
- https://dom.spec.whatwg.org/#interface-element

Firefox, Chrome and IE all match the specification but WebKit was
returning a NodeList.

Performance:
DOM/get-elements-by-tag-name-traversal-uncached.html is ~4.5% faster.

Test: fast/dom/getElementsByTagName-return-type.html

* CMakeLists.txt:
* WebCore.vcxproj/WebCore.vcxproj:
* WebCore.vcxproj/WebCore.vcxproj.filters:
* WebCore.xcodeproj/project.pbxproj:
Rename TagNodeList.* to TagCollection.*

* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::addRadioButtonGroupMembers):
Update the function to use descendantsOfType<>() instead of
getElementsByTagName(). The code is both shorter and more efficient.

* dom/ContainerNode.cpp:
(WebCore::ContainerNode::getElementsByTagName):
(WebCore::ContainerNode::getElementsByTagNameForObjC):
(WebCore::ContainerNode::getElementsByTagNameNS):
(WebCore::ContainerNode::getElementsByTagNameNSForObjC):
* dom/ContainerNode.h:
- Have getElementsByTagName*() return an HTMLCollection.
- Introduce versions used by the ObjC bindings that return a NodeList
  for API compatibility reasons.
- Move the localName null check to the *ForObjC versions and use a
  simple assertion for the non ObjC versions. This gets rid of a
  branch for our JS bindings as this function is hot. It is currently
  impossible to get a null AtomicString from our JS bindings code because
  getElementsByTagName() and getElementsByTagName(undefined) in JS end up
  calling ContainerNode::getElementsByTagName("undefined").
  Also getElementsByTagName(null) in JS ends up calling
  ContainerNode::getElementsByTagName("null"). I have also gotten rid of
  most of the getElementsByTagName() calls from our native code. The
  remaining ones either call with a non-null AtomicString and they now
  have a null-check.

* dom/Document.idl:
* dom/Element.idl:
Have getElementsByTagName*() return an HTMLCollection except for ObjC
bindings in order to maintain legacy API compatibility.

* dom/Node.cpp:
(WebCore::Document::invalidateNodeListAndCollectionCaches):
(WebCore::NodeListsNodeData::invalidateCaches):
HTMLCollection::invalidateCache(attr) is now renamed to
invalidateCacheForAttribute(attr) to avoid ambiguity with
HTMLCollection::invalidateCache(doc) and for consistency
with LiveNodeList.

* dom/NodeRareData.h:
Make necessary updates now that TagNodeList is renamed to TagCollection
and is an HTMLCollection.

* dom/TagCollection.cpp: Renamed from Source/WebCore/dom/TagNodeList.cpp.
* dom/TagCollection.h: Renamed from Source/WebCore/dom/TagNodeList.h.
Rename TagNodeList / HTMLTagNodeList to TagCollection / HTMLTagCollection
and inherit CachedHTMLCollection instead of CachedLiveNodeList.

* editing/Editor.cpp:
(WebCore::Editor::applyEditingStyleToBodyElement):
Update code using getElementsByTagName() to reflect the fact that it
now returns an HTMLCollection and item() returns an Element*. This
function is matching any Element with "body" tag, not just HTMLBodyElement
so I did not refactor it to use an descendantsOfType<HTMLBodyElement>().
It is not clear to me what the intention of this code is.

* editing/markup.cpp:
(WebCore::createFragmentFromMarkup):
* editing/markup.h:
- Return a Ref<> instead of a PassRefPtr<> as it can never return null.
- Use descendantsOfType<HTMLAttachmentElement>(fragment) instead of
  getElementsByTagName() as it results in both shorter and more efficient
  code.

* html/CollectionType.h:
Add new ByTag / ByHTMLTag collection types for TagCollection /
HTMLTabCollection.

* html/GenericCachedHTMLCollection.cpp:
(WebCore::GenericCachedHTMLCollection<traversalType>::elementMatches):
Handle new ByTag / ByHTMLTag collection types in the switch statement.

* html/HTMLCollection.cpp:
(WebCore::invalidationTypeExcludingIdAndNameAttributes):
(WebCore::HTMLCollection::~HTMLCollection):
Handle new ByTag / ByHTMLTag collection types in switch statements.

(WebCore::HTMLCollection::tags):
Add a null-check on localName() before calling getElementsByTagName().
This function is currently for ObjC bindings only.

* html/HTMLPlugInImageElement.cpp:
(WebCore::HTMLPlugInImageElement::restartSimilarPlugIns):
Simplify / optimize the code by using descendantsOfType<HTMLPlugInImageElement>()
instead of getElementsByTagName().

* html/MediaDocument.cpp:
(WebCore::descendantVideoElement):
Use descendantsOfType<HTMLVideoElement> instead of getElementsByTagNameNS().

Source/WebKit/mac:

* WebView/WebFrame.mm:
(-[WebFrame _documentFragmentWithMarkupString:baseURLString:]):
Use .ptr() as createFragmentFromMarkup() now returns a
Ref<> instead of a RefPtr<>.

Source/WebKit/win:

* DOMCoreClasses.cpp:
(DOMDocument::getElementsByTagName):
(DOMDocument::getElementsByTagNameNS):
Add null checks for localName() before calling
ContainerNode::getElementsByTagName*().

LayoutTests:

* fast/dom/getElementsByTagName-return-type-expected.txt: Added.
* fast/dom/getElementsByTagName-return-type.html: Added.
New test checking that getElementsByTagName*() returns an HTMLcollection.

* fast/dom/NodeList/script-tests/nodelist-item-call-as-function.js:
* fast/dom/domListEnumeration-expected.txt:
* fast/dom/named-items-with-symbol-name-expected.txt:
* fast/dom/script-tests/domListEnumeration.js:
* fast/dom/wrapper-classes-expected.txt:
* fast/dom/wrapper-classes.html:
* js/dom/constructor-expected.txt:
* js/dom/script-tests/constructor.js:
* platform/mac/fast/dom/wrapper-classes-objc-expected.txt:
* platform/mac/fast/dom/wrapper-classes-objc.html:
Rebaseline / update.

* fast/dom/non-numeric-values-numeric-parameters-expected.txt:
One of the checks is now failing because HTMLCollection.item()'s
parameter is optional. The specification says the parameter should
be mandatory so I did not update the test. It was previously passing
because NodeList.item()'s parameter is mandatory.

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (188808 => 188809)


--- trunk/LayoutTests/ChangeLog	2015-08-22 00:49:20 UTC (rev 188808)
+++ trunk/LayoutTests/ChangeLog	2015-08-22 00:50:13 UTC (rev 188809)
@@ -1,3 +1,32 @@
+2015-08-21  Chris Dumez  <[email protected]>
+
+        document.getElementsByTagName should return an HTMLCollection
+        https://bugs.webkit.org/show_bug.cgi?id=110611
+
+        Reviewed by Darin Adler.
+
+        * fast/dom/getElementsByTagName-return-type-expected.txt: Added.
+        * fast/dom/getElementsByTagName-return-type.html: Added.
+        New test checking that getElementsByTagName*() returns an HTMLcollection.
+
+        * fast/dom/NodeList/script-tests/nodelist-item-call-as-function.js:
+        * fast/dom/domListEnumeration-expected.txt:
+        * fast/dom/named-items-with-symbol-name-expected.txt:
+        * fast/dom/script-tests/domListEnumeration.js:
+        * fast/dom/wrapper-classes-expected.txt:
+        * fast/dom/wrapper-classes.html:
+        * js/dom/constructor-expected.txt:
+        * js/dom/script-tests/constructor.js:
+        * platform/mac/fast/dom/wrapper-classes-objc-expected.txt:
+        * platform/mac/fast/dom/wrapper-classes-objc.html:
+        Rebaseline / update.
+
+        * fast/dom/non-numeric-values-numeric-parameters-expected.txt:
+        One of the checks is now failing because HTMLCollection.item()'s
+        parameter is optional. The specification says the parameter should
+        be mandatory so I did not update the test. It was previously passing
+        because NodeList.item()'s parameter is mandatory.
+
 2015-08-21  Tim Horton  <[email protected]>
 
         Re-mark accessibility/mac/search-with-frames.html flaky

Modified: trunk/LayoutTests/fast/dom/NodeList/script-tests/nodelist-item-call-as-function.js (188808 => 188809)


--- trunk/LayoutTests/fast/dom/NodeList/script-tests/nodelist-item-call-as-function.js	2015-08-22 00:49:20 UTC (rev 188808)
+++ trunk/LayoutTests/fast/dom/NodeList/script-tests/nodelist-item-call-as-function.js	2015-08-22 00:50:13 UTC (rev 188809)
@@ -1,5 +1,5 @@
 description('This tests that items in a NodeList cannot be called indexed using [[Call]].');
 
-var nodeList = document.getElementsByTagName('div');
+var nodeList = document.childNodes;
 shouldThrow("nodeList(0)");
 

Modified: trunk/LayoutTests/fast/dom/domListEnumeration-expected.txt (188808 => 188809)


--- trunk/LayoutTests/fast/dom/domListEnumeration-expected.txt	2015-08-22 00:49:20 UTC (rev 188808)
+++ trunk/LayoutTests/fast/dom/domListEnumeration-expected.txt	2015-08-22 00:50:13 UTC (rev 188809)
@@ -5,7 +5,7 @@
 
 
 [object NodeList]
-PASS resultArray.length is 5
+PASS resultArray.length is 11
 PASS resultArray[0].i is '0'
 PASS resultArray[0].item is nodeList.item(0)
 PASS resultArray[1].i is '1'

Added: trunk/LayoutTests/fast/dom/getElementsByTagName-return-type-expected.txt (0 => 188809)


--- trunk/LayoutTests/fast/dom/getElementsByTagName-return-type-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/getElementsByTagName-return-type-expected.txt	2015-08-22 00:50:13 UTC (rev 188809)
@@ -0,0 +1,13 @@
+Tests that getElementsByTagName*() returns an HTMLCollection.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS document.getElementsByTagName("test").__proto__ is HTMLCollection.prototype
+PASS document.getElementsByTagNameNS("*", "test").__proto__ is HTMLCollection.prototype
+PASS document.body.getElementsByTagName("test").__proto__ is HTMLCollection.prototype
+PASS document.body.getElementsByTagNameNS("*", "test").__proto__ is HTMLCollection.prototype
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/dom/getElementsByTagName-return-type.html (0 => 188809)


--- trunk/LayoutTests/fast/dom/getElementsByTagName-return-type.html	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/getElementsByTagName-return-type.html	2015-08-22 00:50:13 UTC (rev 188809)
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+<body>
+<script src=""
+<script>
+description("Tests that getElementsByTagName*() returns an HTMLCollection.");
+
+shouldBe('document.getElementsByTagName("test").__proto__', 'HTMLCollection.prototype');
+shouldBe('document.getElementsByTagNameNS("*", "test").__proto__', 'HTMLCollection.prototype');
+shouldBe('document.body.getElementsByTagName("test").__proto__', 'HTMLCollection.prototype');
+shouldBe('document.body.getElementsByTagNameNS("*", "test").__proto__', 'HTMLCollection.prototype');
+</script>
+<script src=""
+<body>
+</html>

Modified: trunk/LayoutTests/fast/dom/named-items-with-symbol-name-expected.txt (188808 => 188809)


--- trunk/LayoutTests/fast/dom/named-items-with-symbol-name-expected.txt	2015-08-22 00:49:20 UTC (rev 188808)
+++ trunk/LayoutTests/fast/dom/named-items-with-symbol-name-expected.txt	2015-08-22 00:50:13 UTC (rev 188809)
@@ -9,7 +9,7 @@
 PASS querySelectorAllList[Symbol('div')] === undefined is true
 PASS querySelectorAllList['Symbol(div)'] instanceof HTMLDivElement is true
 
-[object NodeList]
+[object HTMLCollection]
 PASS getElementsByTagNameList.length === 4 is true
 PASS getElementsByTagNameList[Symbol()] === undefined is true
 PASS getElementsByTagNameList[Symbol('div')] === undefined is true

Modified: trunk/LayoutTests/fast/dom/non-numeric-values-numeric-parameters-expected.txt (188808 => 188809)


--- trunk/LayoutTests/fast/dom/non-numeric-values-numeric-parameters-expected.txt	2015-08-22 00:49:20 UTC (rev 188808)
+++ trunk/LayoutTests/fast/dom/non-numeric-values-numeric-parameters-expected.txt	2015-08-22 00:50:13 UTC (rev 188809)
@@ -50,7 +50,7 @@
 PASS nonNumericPolicy('document.createEvent("MouseEvent").initMouseEvent("a", false, false, null, 0, 0, 0, 0, 0, false, false, false, false, x, null)') is 'any type allowed'
 PASS nonNumericPolicy('document.body.attributes.item(x)') is 'any type allowed'
 PASS nonNumericPolicy('document.createNodeIterator(document, x, null, false)') is 'any type allowed'
-PASS nonNumericPolicy('document.getElementsByTagName("div").item(x)') is 'any type allowed (but not omitted)'
+FAIL nonNumericPolicy('document.getElementsByTagName("div").item(x)') should be any type allowed (but not omitted). Was any type allowed.
 PASS nonNumericPolicy('document.createRange().setStart(document, x)') is 'any type allowed'
 PASS nonNumericPolicy('document.createRange().setEnd(document, x)') is 'any type allowed'
 PASS nonNumericPolicy('document.createRange().comparePoint(document, x)') is 'any type allowed'

Modified: trunk/LayoutTests/fast/dom/script-tests/domListEnumeration.js (188808 => 188809)


--- trunk/LayoutTests/fast/dom/script-tests/domListEnumeration.js	2015-08-22 00:49:20 UTC (rev 188808)
+++ trunk/LayoutTests/fast/dom/script-tests/domListEnumeration.js	2015-08-22 00:50:13 UTC (rev 188809)
@@ -94,10 +94,10 @@
 var resultArray = new Array();
 
 // NodeList
-var nodeList = document.getElementsByTagName('ol');
+var nodeList = testingGround.childNodes;
 resultArray = iterateList(nodeList);
 
-shouldBe("resultArray.length", "5");
+shouldBe("resultArray.length", "11");
 shouldBe("resultArray[0].i", "'0'");
 shouldBe("resultArray[0].item", "nodeList.item(0)");
 shouldBe("resultArray[1].i", "'1'");

Modified: trunk/LayoutTests/fast/dom/wrapper-classes-expected.txt (188808 => 188809)


--- trunk/LayoutTests/fast/dom/wrapper-classes-expected.txt	2015-08-22 00:49:20 UTC (rev 188808)
+++ trunk/LayoutTests/fast/dom/wrapper-classes-expected.txt	2015-08-22 00:50:13 UTC (rev 188809)
@@ -23,9 +23,9 @@
 PASS jsWrapperClass(document.createNodeIterator(root, 0, null, false)) is 'NodeIterator'
 PASS jsWrapperClass(document.createNodeIterator(root, 0, null, false).__proto__) is 'NodeIteratorPrototype'
 PASS jsWrapperClass(document.createNodeIterator(root, 0, null, false).constructor) is 'NodeIteratorConstructor'
-PASS jsWrapperClass(document.getElementsByTagName('div')) is 'NodeList'
-PASS jsWrapperClass(document.getElementsByTagName('div').__proto__) is 'NodeListPrototype'
-PASS jsWrapperClass(document.getElementsByTagName('div').constructor) is 'NodeListConstructor'
+PASS jsWrapperClass(document.getElementsByTagName('div')) is 'HTMLCollection'
+PASS jsWrapperClass(document.getElementsByTagName('div').__proto__) is 'HTMLCollectionPrototype'
+PASS jsWrapperClass(document.getElementsByTagName('div').constructor) is 'HTMLCollectionConstructor'
 PASS jsWrapperClass(document.createRange()) is 'Range'
 PASS jsWrapperClass(document.createRange().__proto__) is 'RangePrototype'
 PASS jsWrapperClass(document.createRange().constructor) is 'RangeConstructor'

Modified: trunk/LayoutTests/fast/dom/wrapper-classes.html (188808 => 188809)


--- trunk/LayoutTests/fast/dom/wrapper-classes.html	2015-08-22 00:49:20 UTC (rev 188808)
+++ trunk/LayoutTests/fast/dom/wrapper-classes.html	2015-08-22 00:50:13 UTC (rev 188809)
@@ -78,7 +78,7 @@
     test("document.implementation", "DOMImplementation");
     test("root.attributes", "NamedNodeMap");
     test("document.createNodeIterator(root, 0, null, false)", "NodeIterator");
-    test("document.getElementsByTagName('div')", "NodeList");
+    test("document.getElementsByTagName('div')", "HTMLCollection");
     test("document.createRange()", "Range");
     test("document.createTextNode()", "Text");
     test("document.createTreeWalker(root, 0, null, false)", "TreeWalker");

Modified: trunk/LayoutTests/js/dom/constructor-expected.txt (188808 => 188809)


--- trunk/LayoutTests/js/dom/constructor-expected.txt	2015-08-22 00:49:20 UTC (rev 188808)
+++ trunk/LayoutTests/js/dom/constructor-expected.txt	2015-08-22 00:50:13 UTC (rev 188809)
@@ -12,8 +12,8 @@
 PASS window.document.body.constructor.prototype === window.HTMLBodyElement.prototype is true
 PASS window.document.body.constructor.prototype.__proto__ === window.HTMLBodyElement.prototype.__proto__ is true
 PASS window.document.body.constructor.prototype.__proto__ === window.HTMLElement.prototype is true
-PASS nodeList.constructor === window.NodeList is true
-PASS nodeList.constructor.prototype === window.NodeList.prototype is true
+PASS htmlCollection.constructor === window.HTMLCollection is true
+PASS htmlCollection.constructor.prototype === window.HTMLCollection.prototype is true
 PASS mutationEvent.constructor === window.MutationEvent is true
 PASS mutationEvent.constructor.prototype.__proto__ === window.Event.prototype is true
 PASS successfullyParsed is true

Modified: trunk/LayoutTests/js/dom/script-tests/constructor.js (188808 => 188809)


--- trunk/LayoutTests/js/dom/script-tests/constructor.js	2015-08-22 00:49:20 UTC (rev 188808)
+++ trunk/LayoutTests/js/dom/script-tests/constructor.js	2015-08-22 00:50:13 UTC (rev 188809)
@@ -11,9 +11,9 @@
 shouldBeTrue("window.document.body.constructor.prototype.__proto__ === window.HTMLBodyElement.prototype.__proto__");
 shouldBeTrue("window.document.body.constructor.prototype.__proto__ === window.HTMLElement.prototype");
 
-var nodeList = document.getElementsByTagName('script');
-shouldBeTrue("nodeList.constructor === window.NodeList");
-shouldBeTrue("nodeList.constructor.prototype === window.NodeList.prototype");
+var htmlCollection = document.getElementsByTagName('script');
+shouldBeTrue("htmlCollection.constructor === window.HTMLCollection");
+shouldBeTrue("htmlCollection.constructor.prototype === window.HTMLCollection.prototype");
 
 var mutationEvent = document.createEvent("MutationEvent");
 shouldBeTrue("mutationEvent.constructor === window.MutationEvent");

Modified: trunk/LayoutTests/platform/mac/fast/dom/wrapper-classes-objc-expected.txt (188808 => 188809)


--- trunk/LayoutTests/platform/mac/fast/dom/wrapper-classes-objc-expected.txt	2015-08-22 00:49:20 UTC (rev 188808)
+++ trunk/LayoutTests/platform/mac/fast/dom/wrapper-classes-objc-expected.txt	2015-08-22 00:50:13 UTC (rev 188809)
@@ -11,7 +11,7 @@
 PASS objCWrapperClass(document.implementation) is 'DOMImplementation'
 PASS objCWrapperClass(root.attributes) is 'DOMNamedNodeMap'
 PASS objCWrapperClass(document.createNodeIterator(root, 0, null, false)) is 'DOMNodeIterator'
-PASS objCWrapperClass(document.getElementsByTagName('div')) is 'DOMNodeList'
+PASS objCWrapperClass(document.getElementsByTagName('div')) is 'DOMHTMLCollection'
 PASS objCWrapperClass(document.createRange()) is 'DOMRange'
 PASS objCWrapperClass(document.createTextNode()) is 'DOMText'
 PASS objCWrapperClass(document.createTreeWalker(root, 0, null, false)) is 'DOMTreeWalker'

Modified: trunk/LayoutTests/platform/mac/fast/dom/wrapper-classes-objc.html (188808 => 188809)


--- trunk/LayoutTests/platform/mac/fast/dom/wrapper-classes-objc.html	2015-08-22 00:49:20 UTC (rev 188808)
+++ trunk/LayoutTests/platform/mac/fast/dom/wrapper-classes-objc.html	2015-08-22 00:50:13 UTC (rev 188809)
@@ -91,7 +91,7 @@
     test("document.implementation", "DOMImplementation", "DOMImplementation");
     test("root.attributes", "NamedNodeMap");
     test("document.createNodeIterator(root, 0, null, false)", "NodeIterator");
-    test("document.getElementsByTagName('div')", "NodeList");
+    test("document.getElementsByTagName('div')", "HTMLCollection");
     test("document.createRange()", "Range");
     test("document.createTextNode()", "Text");
     test("document.createTreeWalker(root, 0, null, false)", "TreeWalker");

Modified: trunk/Source/WebCore/CMakeLists.txt (188808 => 188809)


--- trunk/Source/WebCore/CMakeLists.txt	2015-08-22 00:49:20 UTC (rev 188808)
+++ trunk/Source/WebCore/CMakeLists.txt	2015-08-22 00:50:13 UTC (rev 188809)
@@ -1464,7 +1464,7 @@
     dom/StaticNodeList.cpp
     dom/StringCallback.cpp
     dom/StyledElement.cpp
-    dom/TagNodeList.cpp
+    dom/TagCollection.cpp
     dom/Text.cpp
     dom/TextEvent.cpp
     dom/TextNodeTraversal.cpp

Modified: trunk/Source/WebCore/ChangeLog (188808 => 188809)


--- trunk/Source/WebCore/ChangeLog	2015-08-22 00:49:20 UTC (rev 188808)
+++ trunk/Source/WebCore/ChangeLog	2015-08-22 00:50:13 UTC (rev 188809)
@@ -1,3 +1,119 @@
+2015-08-21  Chris Dumez  <[email protected]>
+
+        document.getElementsByTagName should return an HTMLCollection
+        https://bugs.webkit.org/show_bug.cgi?id=110611
+
+        Reviewed by Darin Adler.
+
+        Update getElementsByTagName*() to return an HTMLCollection as per
+        the specification:
+        - https://dom.spec.whatwg.org/#interface-document
+        - https://dom.spec.whatwg.org/#interface-element
+
+        Firefox, Chrome and IE all match the specification but WebKit was
+        returning a NodeList.
+
+        Performance:
+        DOM/get-elements-by-tag-name-traversal-uncached.html is ~4.5% faster.
+
+        Test: fast/dom/getElementsByTagName-return-type.html
+
+        * CMakeLists.txt:
+        * WebCore.vcxproj/WebCore.vcxproj:
+        * WebCore.vcxproj/WebCore.vcxproj.filters:
+        * WebCore.xcodeproj/project.pbxproj:
+        Rename TagNodeList.* to TagCollection.*
+
+        * accessibility/AccessibilityRenderObject.cpp:
+        (WebCore::AccessibilityRenderObject::addRadioButtonGroupMembers):
+        Update the function to use descendantsOfType<>() instead of
+        getElementsByTagName(). The code is both shorter and more efficient.
+
+        * dom/ContainerNode.cpp:
+        (WebCore::ContainerNode::getElementsByTagName):
+        (WebCore::ContainerNode::getElementsByTagNameForObjC):
+        (WebCore::ContainerNode::getElementsByTagNameNS):
+        (WebCore::ContainerNode::getElementsByTagNameNSForObjC):
+        * dom/ContainerNode.h:
+        - Have getElementsByTagName*() return an HTMLCollection.
+        - Introduce versions used by the ObjC bindings that return a NodeList
+          for API compatibility reasons.
+        - Move the localName null check to the *ForObjC versions and use a
+          simple assertion for the non ObjC versions. This gets rid of a
+          branch for our JS bindings as this function is hot. It is currently
+          impossible to get a null AtomicString from our JS bindings code because
+          getElementsByTagName() and getElementsByTagName(undefined) in JS end up
+          calling ContainerNode::getElementsByTagName("undefined").
+          Also getElementsByTagName(null) in JS ends up calling
+          ContainerNode::getElementsByTagName("null"). I have also gotten rid of
+          most of the getElementsByTagName() calls from our native code. The
+          remaining ones either call with a non-null AtomicString and they now
+          have a null-check.
+
+        * dom/Document.idl:
+        * dom/Element.idl:
+        Have getElementsByTagName*() return an HTMLCollection except for ObjC
+        bindings in order to maintain legacy API compatibility.
+
+        * dom/Node.cpp:
+        (WebCore::Document::invalidateNodeListAndCollectionCaches):
+        (WebCore::NodeListsNodeData::invalidateCaches):
+        HTMLCollection::invalidateCache(attr) is now renamed to
+        invalidateCacheForAttribute(attr) to avoid ambiguity with
+        HTMLCollection::invalidateCache(doc) and for consistency
+        with LiveNodeList.
+
+        * dom/NodeRareData.h:
+        Make necessary updates now that TagNodeList is renamed to TagCollection
+        and is an HTMLCollection.
+
+        * dom/TagCollection.cpp: Renamed from Source/WebCore/dom/TagNodeList.cpp.
+        * dom/TagCollection.h: Renamed from Source/WebCore/dom/TagNodeList.h.
+        Rename TagNodeList / HTMLTagNodeList to TagCollection / HTMLTagCollection
+        and inherit CachedHTMLCollection instead of CachedLiveNodeList.
+
+        * editing/Editor.cpp:
+        (WebCore::Editor::applyEditingStyleToBodyElement):
+        Update code using getElementsByTagName() to reflect the fact that it
+        now returns an HTMLCollection and item() returns an Element*. This
+        function is matching any Element with "body" tag, not just HTMLBodyElement
+        so I did not refactor it to use an descendantsOfType<HTMLBodyElement>().
+        It is not clear to me what the intention of this code is.
+
+        * editing/markup.cpp:
+        (WebCore::createFragmentFromMarkup):
+        * editing/markup.h:
+        - Return a Ref<> instead of a PassRefPtr<> as it can never return null.
+        - Use descendantsOfType<HTMLAttachmentElement>(fragment) instead of
+          getElementsByTagName() as it results in both shorter and more efficient
+          code.
+
+        * html/CollectionType.h:
+        Add new ByTag / ByHTMLTag collection types for TagCollection /
+        HTMLTabCollection.
+
+        * html/GenericCachedHTMLCollection.cpp:
+        (WebCore::GenericCachedHTMLCollection<traversalType>::elementMatches):
+        Handle new ByTag / ByHTMLTag collection types in the switch statement.
+
+        * html/HTMLCollection.cpp:
+        (WebCore::invalidationTypeExcludingIdAndNameAttributes):
+        (WebCore::HTMLCollection::~HTMLCollection):
+        Handle new ByTag / ByHTMLTag collection types in switch statements.
+
+        (WebCore::HTMLCollection::tags):
+        Add a null-check on localName() before calling getElementsByTagName().
+        This function is currently for ObjC bindings only.
+
+        * html/HTMLPlugInImageElement.cpp:
+        (WebCore::HTMLPlugInImageElement::restartSimilarPlugIns):
+        Simplify / optimize the code by using descendantsOfType<HTMLPlugInImageElement>()
+        instead of getElementsByTagName().
+
+        * html/MediaDocument.cpp:
+        (WebCore::descendantVideoElement):
+        Use descendantsOfType<HTMLVideoElement> instead of getElementsByTagNameNS().
+
 2015-08-21  Geoffrey Garen  <[email protected]>
 
         Debugger's VM should never be null

Modified: trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj (188808 => 188809)


--- trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj	2015-08-22 00:49:20 UTC (rev 188808)
+++ trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj	2015-08-22 00:50:13 UTC (rev 188809)
@@ -15020,7 +15020,7 @@
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|Win32'">true</ExcludedFromBuild>
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|x64'">true</ExcludedFromBuild>
     </ClCompile>
-    <ClCompile Include="..\dom\TagNodeList.cpp">
+    <ClCompile Include="..\dom\TagCollection.cpp">
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|Win32'">true</ExcludedFromBuild>
@@ -22145,7 +22145,7 @@
     <ClInclude Include="..\dom\StaticNodeList.h" />
     <ClInclude Include="..\dom\StringCallback.h" />
     <ClInclude Include="..\dom\StyledElement.h" />
-    <ClInclude Include="..\dom\TagNodeList.h" />
+    <ClInclude Include="..\dom\TagCollection.h" />
     <ClInclude Include="..\dom\TemplateContentDocumentFragment.h" />
     <ClInclude Include="..\dom\Text.h" />
     <ClInclude Include="..\dom\TextEvent.h" />

Modified: trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters (188808 => 188809)


--- trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters	2015-08-22 00:49:20 UTC (rev 188808)
+++ trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters	2015-08-22 00:50:13 UTC (rev 188809)
@@ -3333,7 +3333,7 @@
     <ClCompile Include="..\dom\StyledElement.cpp">
       <Filter>dom</Filter>
     </ClCompile>
-    <ClCompile Include="..\dom\TagNodeList.cpp">
+    <ClCompile Include="..\dom\TagCollection.cpp">
       <Filter>dom</Filter>
     </ClCompile>
     <ClCompile Include="..\dom\Text.cpp">
@@ -10460,7 +10460,7 @@
     <ClInclude Include="..\dom\StyledElement.h">
       <Filter>dom</Filter>
     </ClInclude>
-    <ClInclude Include="..\dom\TagNodeList.h">
+    <ClInclude Include="..\dom\TagCollection.h">
       <Filter>dom</Filter>
     </ClInclude>
     <ClInclude Include="..\dom\TemplateContentDocumentFragment.h">

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (188808 => 188809)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2015-08-22 00:49:20 UTC (rev 188808)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2015-08-22 00:50:13 UTC (rev 188809)
@@ -1683,6 +1683,8 @@
 		45FEA5D0156DDE8C00654101 /* Decimal.h in Headers */ = {isa = PBXBuildFile; fileRef = 45FEA5CE156DDE8C00654101 /* Decimal.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		4634592C1AC2271000ECB71C /* PowerObserverMac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4634592B1AC2271000ECB71C /* PowerObserverMac.cpp */; };
 		4634592E1AC2273C00ECB71C /* SharedTimerCF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4634592D1AC2273C00ECB71C /* SharedTimerCF.cpp */; };
+		463EB6221B8789E00096ED51 /* TagCollection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 463EB6201B8789CB0096ED51 /* TagCollection.cpp */; };
+		463EB6231B8789E00096ED51 /* TagCollection.h in Headers */ = {isa = PBXBuildFile; fileRef = 463EB6211B8789CB0096ED51 /* TagCollection.h */; };
 		4669B2871B852A0B000F905F /* JSDOMNamedFlowCollectionCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 46F2768E1B85297F005C2556 /* JSDOMNamedFlowCollectionCustom.cpp */; };
 		4689F1AF1267BAE100E8D380 /* FileMetadata.h in Headers */ = {isa = PBXBuildFile; fileRef = 4689F1AE1267BAE100E8D380 /* FileMetadata.h */; };
 		46C83EFD1A9BBE2900A79A41 /* GeoNotifier.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 46C83EFB1A9BBE2900A79A41 /* GeoNotifier.cpp */; };
@@ -5545,8 +5547,6 @@
 		BCE1C4400D9830F4003B02F2 /* JSLocationCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCE1C43F0D9830F4003B02F2 /* JSLocationCustom.cpp */; };
 		BCE32B9C1517C0B200F542EC /* RenderMultiColumnSet.h in Headers */ = {isa = PBXBuildFile; fileRef = BCE32B9B1517C0B100F542EC /* RenderMultiColumnSet.h */; };
 		BCE32B9E1517C22700F542EC /* RenderMultiColumnSet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCE32B9D1517C22700F542EC /* RenderMultiColumnSet.cpp */; };
-		BCE3BEC20D222B1D007E06E4 /* TagNodeList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCE3BEC00D222B1D007E06E4 /* TagNodeList.cpp */; };
-		BCE3BEC30D222B1D007E06E4 /* TagNodeList.h in Headers */ = {isa = PBXBuildFile; fileRef = BCE3BEC10D222B1D007E06E4 /* TagNodeList.h */; };
 		BCE4389C140B1BA8005E437E /* JSDictionary.h in Headers */ = {isa = PBXBuildFile; fileRef = BCE4389B140B1BA7005E437E /* JSDictionary.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		BCE438A2140C0DC0005E437E /* JSDictionary.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCE438A1140C0DBF005E437E /* JSDictionary.cpp */; };
 		BCE4413312F748E2009B84B8 /* RenderCombineText.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCE4413112F748E2009B84B8 /* RenderCombineText.cpp */; };
@@ -8928,6 +8928,8 @@
 		45FEA5CE156DDE8C00654101 /* Decimal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Decimal.h; sourceTree = "<group>"; };
 		4634592B1AC2271000ECB71C /* PowerObserverMac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PowerObserverMac.cpp; sourceTree = "<group>"; };
 		4634592D1AC2273C00ECB71C /* SharedTimerCF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SharedTimerCF.cpp; sourceTree = "<group>"; };
+		463EB6201B8789CB0096ED51 /* TagCollection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TagCollection.cpp; sourceTree = "<group>"; };
+		463EB6211B8789CB0096ED51 /* TagCollection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TagCollection.h; sourceTree = "<group>"; };
 		4689F1AE1267BAE100E8D380 /* FileMetadata.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileMetadata.h; sourceTree = "<group>"; };
 		46C83EFB1A9BBE2900A79A41 /* GeoNotifier.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GeoNotifier.cpp; sourceTree = "<group>"; };
 		46C83EFC1A9BBE2900A79A41 /* GeoNotifier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GeoNotifier.h; sourceTree = "<group>"; };
@@ -13149,8 +13151,6 @@
 		BCE1C43F0D9830F4003B02F2 /* JSLocationCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSLocationCustom.cpp; sourceTree = "<group>"; };
 		BCE32B9B1517C0B100F542EC /* RenderMultiColumnSet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderMultiColumnSet.h; sourceTree = "<group>"; };
 		BCE32B9D1517C22700F542EC /* RenderMultiColumnSet.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderMultiColumnSet.cpp; sourceTree = "<group>"; };
-		BCE3BEC00D222B1D007E06E4 /* TagNodeList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TagNodeList.cpp; sourceTree = "<group>"; };
-		BCE3BEC10D222B1D007E06E4 /* TagNodeList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TagNodeList.h; sourceTree = "<group>"; };
 		BCE4389B140B1BA7005E437E /* JSDictionary.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSDictionary.h; sourceTree = "<group>"; };
 		BCE438A1140C0DBF005E437E /* JSDictionary.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDictionary.cpp; sourceTree = "<group>"; };
 		BCE4413112F748E2009B84B8 /* RenderCombineText.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderCombineText.cpp; sourceTree = "<group>"; };
@@ -23487,8 +23487,8 @@
 				81AC6C34131C57C20009A7E0 /* StringCallback.idl */,
 				A8C4A7EC09D563270003AC8D /* StyledElement.cpp */,
 				A8C4A7EB09D563270003AC8D /* StyledElement.h */,
-				BCE3BEC00D222B1D007E06E4 /* TagNodeList.cpp */,
-				BCE3BEC10D222B1D007E06E4 /* TagNodeList.h */,
+				463EB6201B8789CB0096ED51 /* TagCollection.cpp */,
+				463EB6211B8789CB0096ED51 /* TagCollection.h */,
 				C65046A8167BFB5500CC2A4D /* TemplateContentDocumentFragment.h */,
 				6550B69B099DF0270090D781 /* Text.cpp */,
 				6550B69C099DF0270090D781 /* Text.h */,
@@ -24259,6 +24259,7 @@
 				9746AF2114F4DDE6003E7A71 /* Coordinates.h in Headers */,
 				CE1252371A15BDBE00864480 /* CoreGraphicsSPI.h in Headers */,
 				443818001A91B2F8006E04F2 /* CoreMediaSoftLink.h in Headers */,
+				463EB6231B8789E00096ED51 /* TagCollection.h in Headers */,
 				4449A4051A964B0000B64AD5 /* CoreMediaSPI.h in Headers */,
 				1C6466251A12C38E0094603C /* CoreTextSPI.h in Headers */,
 				CE1252431A16C01A00864480 /* CoreUISPI.h in Headers */,
@@ -27118,7 +27119,6 @@
 				CDA07FC218E0A22B004699FA /* SystemSleepListenerMac.h in Headers */,
 				5D5975B319635F1100D00878 /* SystemVersion.h in Headers */,
 				A8CFF0510A154F09000A4234 /* TableLayout.h in Headers */,
-				BCE3BEC30D222B1D007E06E4 /* TagNodeList.h in Headers */,
 				F55B3DD61251F12D003EF269 /* TelephoneInputType.h in Headers */,
 				7CC564B818BABEA6001B9652 /* TelephoneNumberDetector.h in Headers */,
 				C65046A9167BFB5500CC2A4D /* TemplateContentDocumentFragment.h in Headers */,
@@ -29561,6 +29561,7 @@
 				E1C36D340EB0A094007410BC /* JSWorkerGlobalScopeBase.cpp in Sources */,
 				E18258AC0EF3CD7000933242 /* JSWorkerGlobalScopeCustom.cpp in Sources */,
 				E1C362F00EAF2AA9007410BC /* JSWorkerLocation.cpp in Sources */,
+				463EB6221B8789E00096ED51 /* TagCollection.cpp in Sources */,
 				E1271A590EEECDE400F61213 /* JSWorkerNavigator.cpp in Sources */,
 				BC348BD30DB7F804004ABAB9 /* JSXMLHttpRequest.cpp in Sources */,
 				BC348BBE0DB7F531004ABAB9 /* JSXMLHttpRequestCustom.cpp in Sources */,
@@ -30503,7 +30504,6 @@
 				CDA07FBD18E0A16A004699FA /* SystemSleepListener.cpp in Sources */,
 				CDA07FC118E0A22B004699FA /* SystemSleepListenerMac.mm in Sources */,
 				5D5975B419635F1100D00878 /* SystemVersion.mm in Sources */,
-				BCE3BEC20D222B1D007E06E4 /* TagNodeList.cpp in Sources */,
 				F55B3DD51251F12D003EF269 /* TelephoneInputType.cpp in Sources */,
 				7CC564BA18BAC720001B9652 /* TelephoneNumberDetectorCocoa.cpp in Sources */,
 				7A29BA6A187B7C1D00F29CEB /* TemporaryOpenGLSetting.cpp in Sources */,

Modified: trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp (188808 => 188809)


--- trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp	2015-08-22 00:49:20 UTC (rev 188808)
+++ trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp	2015-08-22 00:50:13 UTC (rev 188809)
@@ -956,16 +956,10 @@
                 linkedUIElements.append(object);        
         } 
     } else {
-        RefPtr<NodeList> list = node->document().getElementsByTagName(inputTag.localName());
-        unsigned length = list->length();
-        for (unsigned i = 0; i < length; ++i) {
-            Node* item = list->item(i);
-            if (is<HTMLInputElement>(*item)) {
-                HTMLInputElement& associateElement = downcast<HTMLInputElement>(*item);
-                if (associateElement.isRadioButton() && associateElement.name() == input.name()) {
-                    if (AccessibilityObject* object = axObjectCache()->getOrCreate(&associateElement))
-                        linkedUIElements.append(object);
-                }
+        for (auto& associateElement : descendantsOfType<HTMLInputElement>(node->document())) {
+            if (associateElement.isRadioButton() && associateElement.name() == input.name()) {
+                if (AccessibilityObject* object = axObjectCache()->getOrCreate(&associateElement))
+                    linkedUIElements.append(object);
             }
         }
     }

Modified: trunk/Source/WebCore/bindings/objc/DOMHTML.mm (188808 => 188809)


--- trunk/Source/WebCore/bindings/objc/DOMHTML.mm	2015-08-22 00:49:20 UTC (rev 188808)
+++ trunk/Source/WebCore/bindings/objc/DOMHTML.mm	2015-08-22 00:50:13 UTC (rev 188809)
@@ -146,7 +146,7 @@
 
 - (DOMDocumentFragment *)createDocumentFragmentWithMarkupString:(NSString *)markupString baseURL:(NSURL *)baseURL
 {
-    return kit(createFragmentFromMarkup(*core(self), markupString, [baseURL absoluteString]).get());
+    return kit(createFragmentFromMarkup(*core(self), markupString, [baseURL absoluteString]).ptr());
 }
 
 - (DOMDocumentFragment *)createDocumentFragmentWithText:(NSString *)text

Modified: trunk/Source/WebCore/dom/ContainerNode.cpp (188808 => 188809)


--- trunk/Source/WebCore/dom/ContainerNode.cpp	2015-08-22 00:49:20 UTC (rev 188808)
+++ trunk/Source/WebCore/dom/ContainerNode.cpp	2015-08-22 00:50:13 UTC (rev 188809)
@@ -864,27 +864,41 @@
     return nullptr;
 }
 
-RefPtr<NodeList> ContainerNode::getElementsByTagName(const AtomicString& localName)
+Ref<HTMLCollection> ContainerNode::getElementsByTagName(const AtomicString& localName)
 {
-    if (localName.isNull())
-        return nullptr;
+    ASSERT(!localName.isNull());
 
     if (document().isHTMLDocument())
-        return ensureRareData().ensureNodeLists().addCacheWithAtomicName<HTMLTagNodeList>(*this, localName);
-    return ensureRareData().ensureNodeLists().addCacheWithAtomicName<TagNodeList>(*this, localName);
+        return ensureRareData().ensureNodeLists().addCachedCollection<HTMLTagCollection>(*this, ByHTMLTag, localName);
+    return ensureRareData().ensureNodeLists().addCachedCollection<TagCollection>(*this, ByTag, localName);
 }
 
-RefPtr<NodeList> ContainerNode::getElementsByTagNameNS(const AtomicString& namespaceURI, const AtomicString& localName)
+RefPtr<NodeList> ContainerNode::getElementsByTagNameForObjC(const AtomicString& localName)
 {
     if (localName.isNull())
         return nullptr;
 
+    return getElementsByTagName(localName);
+}
+
+Ref<HTMLCollection> ContainerNode::getElementsByTagNameNS(const AtomicString& namespaceURI, const AtomicString& localName)
+{
+    ASSERT(!localName.isNull());
+
     if (namespaceURI == starAtom)
         return getElementsByTagName(localName);
 
-    return ensureRareData().ensureNodeLists().addCacheWithQualifiedName(*this, namespaceURI.isEmpty() ? nullAtom : namespaceURI, localName);
+    return ensureRareData().ensureNodeLists().addCachedCollectionWithQualifiedName(*this, namespaceURI.isEmpty() ? nullAtom : namespaceURI, localName);
 }
 
+RefPtr<NodeList> ContainerNode::getElementsByTagNameNSForObjC(const AtomicString& namespaceURI, const AtomicString& localName)
+{
+    if (localName.isNull())
+        return nullptr;
+
+    return getElementsByTagNameNS(namespaceURI, localName);
+}
+
 Ref<NodeList> ContainerNode::getElementsByName(const String& elementName)
 {
     return ensureRareData().ensureNodeLists().addCacheWithAtomicName<NameNodeList>(*this, elementName);

Modified: trunk/Source/WebCore/dom/ContainerNode.h (188808 => 188809)


--- trunk/Source/WebCore/dom/ContainerNode.h	2015-08-22 00:49:20 UTC (rev 188808)
+++ trunk/Source/WebCore/dom/ContainerNode.h	2015-08-22 00:50:13 UTC (rev 188809)
@@ -143,8 +143,10 @@
     Element* querySelector(const String& selectors, ExceptionCode&);
     RefPtr<NodeList> querySelectorAll(const String& selectors, ExceptionCode&);
 
-    RefPtr<NodeList> getElementsByTagName(const AtomicString&);
-    RefPtr<NodeList> getElementsByTagNameNS(const AtomicString& namespaceURI, const AtomicString& localName);
+    Ref<HTMLCollection> getElementsByTagName(const AtomicString&);
+    RefPtr<NodeList> getElementsByTagNameForObjC(const AtomicString&);
+    Ref<HTMLCollection> getElementsByTagNameNS(const AtomicString& namespaceURI, const AtomicString& localName);
+    RefPtr<NodeList> getElementsByTagNameNSForObjC(const AtomicString& namespaceURI, const AtomicString& localName);
     Ref<NodeList> getElementsByName(const String& elementName);
     Ref<HTMLCollection> getElementsByClassName(const AtomicString& classNames);
     Ref<NodeList> getElementsByClassNameForObjC(const AtomicString& classNames);

Modified: trunk/Source/WebCore/dom/DOMAllInOne.cpp (188808 => 188809)


--- trunk/Source/WebCore/dom/DOMAllInOne.cpp	2015-08-22 00:49:20 UTC (rev 188808)
+++ trunk/Source/WebCore/dom/DOMAllInOne.cpp	2015-08-22 00:50:13 UTC (rev 188809)
@@ -144,7 +144,7 @@
 #include "StaticNodeList.cpp"
 #include "StringCallback.cpp"
 #include "StyledElement.cpp"
-#include "TagNodeList.cpp"
+#include "TagCollection.cpp"
 #include "Text.cpp"
 #include "TextEvent.cpp"
 #include "TextNodeTraversal.cpp"

Modified: trunk/Source/WebCore/dom/Document.idl (188808 => 188809)


--- trunk/Source/WebCore/dom/Document.idl	2015-08-22 00:49:20 UTC (rev 188808)
+++ trunk/Source/WebCore/dom/Document.idl	2015-08-22 00:50:13 UTC (rev 188809)
@@ -40,8 +40,13 @@
                                                                                  [Default=Undefined] optional DOMString data);
     [ReturnNewObject, RaisesException] Attr createAttribute([Default=Undefined] optional DOMString name);
     [ReturnNewObject, RaisesException] EntityReference createEntityReference([Default=Undefined] optional DOMString name);
-    NodeList getElementsByTagName([Default=Undefined] optional DOMString tagname);
 
+#if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C
+    [ImplementedAs=getElementsByTagNameForObjC] NodeList getElementsByTagName([Default=Undefined] optional DOMString tagname);
+#else
+    HTMLCollection getElementsByTagName([Default=Undefined] optional DOMString tagname);
+#endif
+
     // Introduced in DOM Level 2:
 
     [ObjCLegacyUnnamedParameters, ReturnNewObject, RaisesException] Node importNode([Default=Undefined] optional Node importedNode,
@@ -50,9 +55,13 @@
                             [TreatNullAs=NullString,Default=Undefined] optional DOMString qualifiedName);
     [ObjCLegacyUnnamedParameters, ReturnNewObject, RaisesException] Attr createAttributeNS([TreatNullAs=NullString,Default=Undefined] optional DOMString namespaceURI,
                                                                           [TreatNullAs=NullString,Default=Undefined] optional DOMString qualifiedName);
-    [ObjCLegacyUnnamedParameters] NodeList getElementsByTagNameNS([TreatNullAs=NullString,Default=Undefined] optional DOMString namespaceURI,
-                                                   [Default=Undefined] optional DOMString localName);
 
+#if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C
+    [ObjCLegacyUnnamedParameters, ImplementedAs=getElementsByTagNameNSForObjC] NodeList getElementsByTagNameNS([TreatNullAs=NullString,Default=Undefined] optional DOMString namespaceURI, [Default=Undefined] optional DOMString localName);
+#else
+    HTMLCollection getElementsByTagNameNS([TreatNullAs=NullString,Default=Undefined] optional DOMString namespaceURI, [Default=Undefined] optional DOMString localName);
+#endif
+
     // DOM Level 3 Core
 
     [TreatReturnedNullStringAs=Null] readonly attribute DOMString inputEncoding;

Modified: trunk/Source/WebCore/dom/Element.idl (188808 => 188809)


--- trunk/Source/WebCore/dom/Element.idl	2015-08-22 00:49:20 UTC (rev 188808)
+++ trunk/Source/WebCore/dom/Element.idl	2015-08-22 00:50:13 UTC (rev 188809)
@@ -34,8 +34,13 @@
     Attr getAttributeNode([Default=Undefined] optional DOMString name);
     [RaisesException] Attr setAttributeNode([Default=Undefined] optional Attr newAttr);
     [RaisesException] Attr removeAttributeNode([Default=Undefined] optional Attr oldAttr);
-    NodeList getElementsByTagName([Default=Undefined] optional DOMString name);
 
+#if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C
+    [ImplementedAs=getElementsByTagNameForObjC] NodeList getElementsByTagName([Default=Undefined] optional DOMString name);
+#else
+    HTMLCollection getElementsByTagName([Default=Undefined] optional DOMString name);
+#endif
+
 #if !defined(LANGUAGE_OBJECTIVE_C)
     // For ObjC this is defined on Node for legacy support.
     readonly attribute NamedNodeMap     attributes;
@@ -51,8 +56,12 @@
                                        [Default=Undefined] optional DOMString value);
     [ObjCLegacyUnnamedParameters] void removeAttributeNS([TreatNullAs=NullString] DOMString namespaceURI,
                                           DOMString localName);
-    [ObjCLegacyUnnamedParameters] NodeList getElementsByTagNameNS([TreatNullAs=NullString,Default=Undefined] optional DOMString namespaceURI,
-                                                   [Default=Undefined] optional DOMString localName);
+
+#if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C
+    [ObjCLegacyUnnamedParameters, ImplementedAs=getElementsByTagNameNSForObjC] NodeList getElementsByTagNameNS([TreatNullAs=NullString,Default=Undefined] optional DOMString namespaceURI, [Default=Undefined] optional DOMString localName);
+#else
+    HTMLCollection getElementsByTagNameNS([TreatNullAs=NullString,Default=Undefined] optional DOMString namespaceURI, [Default=Undefined] optional DOMString localName);
+#endif
     [ObjCLegacyUnnamedParameters] Attr getAttributeNodeNS([TreatNullAs=NullString,Default=Undefined] optional DOMString namespaceURI,
                                            [Default=Undefined] optional DOMString localName);
     [RaisesException] Attr setAttributeNodeNS([Default=Undefined] optional Attr newAttr);

Modified: trunk/Source/WebCore/dom/LiveNodeList.cpp (188808 => 188809)


--- trunk/Source/WebCore/dom/LiveNodeList.cpp	2015-08-22 00:49:20 UTC (rev 188808)
+++ trunk/Source/WebCore/dom/LiveNodeList.cpp	2015-08-22 00:50:13 UTC (rev 188809)
@@ -27,7 +27,6 @@
 #include "Element.h"
 #include "ElementTraversal.h"
 #include "HTMLCollection.h"
-#include "TagNodeList.h"
 
 namespace WebCore {
 

Modified: trunk/Source/WebCore/dom/Node.cpp (188808 => 188809)


--- trunk/Source/WebCore/dom/Node.cpp	2015-08-22 00:49:20 UTC (rev 188808)
+++ trunk/Source/WebCore/dom/Node.cpp	2015-08-22 00:50:13 UTC (rev 188809)
@@ -818,7 +818,7 @@
         list->invalidateCacheForAttribute(attrName);
     HashSet<HTMLCollection*> collections = WTF::move(m_collectionsInvalidatedAtDocument);
     for (auto* collection : collections)
-        collection->invalidateCache(attrName);
+        collection->invalidateCacheForAttribute(attrName);
 #if !ASSERT_DISABLED
     m_inInvalidateNodeListAndCollectionCaches = false;
 #endif
@@ -1768,13 +1768,13 @@
         atomicName.value->invalidateCacheForAttribute(attrName);
 
     for (auto& collection : m_cachedCollections)
-        collection.value->invalidateCache(attrName);
+        collection.value->invalidateCacheForAttribute(attrName);
 
     if (attrName)
         return;
 
-    for (auto& tagNodeList : m_tagNodeListCacheNS)
-        tagNodeList.value->invalidateCacheForAttribute(nullptr);
+    for (auto& tagCollection : m_tagCollectionCacheNS)
+        tagCollection.value->invalidateCacheForAttribute(nullptr);
 }
 
 void Node::getSubresourceURLs(ListHashSet<URL>& urls) const

Modified: trunk/Source/WebCore/dom/Node.h (188808 => 188809)


--- trunk/Source/WebCore/dom/Node.h	2015-08-22 00:49:20 UTC (rev 188808)
+++ trunk/Source/WebCore/dom/Node.h	2015-08-22 00:50:13 UTC (rev 188809)
@@ -73,7 +73,7 @@
 class RenderStyle;
 class SVGQualifiedName;
 class ShadowRoot;
-class TagNodeList;
+class TagCollection;
 
 #if ENABLE(INDIE_UI)
 class UIRequestEvent;

Modified: trunk/Source/WebCore/dom/NodeRareData.h (188808 => 188809)


--- trunk/Source/WebCore/dom/NodeRareData.h	2015-08-22 00:49:20 UTC (rev 188808)
+++ trunk/Source/WebCore/dom/NodeRareData.h	2015-08-22 00:50:13 UTC (rev 188809)
@@ -32,7 +32,7 @@
 #include "MutationObserverRegistration.h"
 #include "Page.h"
 #include "QualifiedName.h"
-#include "TagNodeList.h"
+#include "TagCollection.h"
 #include <wtf/HashSet.h>
 #include <wtf/text/AtomicString.h>
 
@@ -48,10 +48,8 @@
 
 template <class ListType> struct NodeListTypeIdentifier;
 template <> struct NodeListTypeIdentifier<NameNodeList> { static int value() { return 0; } };
-template <> struct NodeListTypeIdentifier<TagNodeList> { static int value() { return 1; } };
-template <> struct NodeListTypeIdentifier<HTMLTagNodeList> { static int value() { return 2; } };
-template <> struct NodeListTypeIdentifier<RadioNodeList> { static int value() { return 3; } };
-template <> struct NodeListTypeIdentifier<LabelsNodeList> { static int value() { return 4; } };
+template <> struct NodeListTypeIdentifier<RadioNodeList> { static int value() { return 1; } };
+template <> struct NodeListTypeIdentifier<LabelsNodeList> { static int value() { return 2; } };
 
 class NodeListsNodeData {
     WTF_MAKE_NONCOPYABLE(NodeListsNodeData); WTF_MAKE_FAST_ALLOCATED;
@@ -115,7 +113,7 @@
 
     typedef HashMap<std::pair<unsigned char, AtomicString>, LiveNodeList*, NodeListCacheMapEntryHash> NodeListAtomicNameCacheMap;
     typedef HashMap<std::pair<unsigned char, AtomicString>, HTMLCollection*, NodeListCacheMapEntryHash> CollectionCacheMap;
-    typedef HashMap<QualifiedName, TagNodeList*> TagNodeListCacheNS;
+    typedef HashMap<QualifiedName, TagCollection*> TagCollectionCacheNS;
 
     template<typename T, typename ContainerType>
     ALWAYS_INLINE Ref<T> addCacheWithAtomicName(ContainerType& container, const AtomicString& name)
@@ -129,14 +127,14 @@
         return list;
     }
 
-    ALWAYS_INLINE Ref<TagNodeList> addCacheWithQualifiedName(ContainerNode& node, const AtomicString& namespaceURI, const AtomicString& localName)
+    ALWAYS_INLINE Ref<TagCollection> addCachedCollectionWithQualifiedName(ContainerNode& node, const AtomicString& namespaceURI, const AtomicString& localName)
     {
         QualifiedName name(nullAtom, localName, namespaceURI);
-        TagNodeListCacheNS::AddResult result = m_tagNodeListCacheNS.fastAdd(name, nullptr);
+        TagCollectionCacheNS::AddResult result = m_tagCollectionCacheNS.fastAdd(name, nullptr);
         if (!result.isNewEntry)
             return *result.iterator->value;
 
-        auto list = TagNodeList::create(node, namespaceURI, localName);
+        auto list = TagCollection::create(node, namespaceURI, localName);
         result.iterator->value = list.ptr();
         return list;
     }
@@ -180,13 +178,13 @@
         m_atomicNameCaches.remove(namedNodeListKey<NodeListType>(name));
     }
 
-    void removeCacheWithQualifiedName(LiveNodeList* list, const AtomicString& namespaceURI, const AtomicString& localName)
+    void removeCachedCollectionWithQualifiedName(HTMLCollection& collection, const AtomicString& namespaceURI, const AtomicString& localName)
     {
         QualifiedName name(nullAtom, localName, namespaceURI);
-        ASSERT(list == m_tagNodeListCacheNS.get(name));
-        if (deleteThisAndUpdateNodeRareDataIfAboutToRemoveLastList(list->ownerNode()))
+        ASSERT(&collection == m_tagCollectionCacheNS.get(name));
+        if (deleteThisAndUpdateNodeRareDataIfAboutToRemoveLastList(collection.ownerNode()))
             return;
-        m_tagNodeListCacheNS.remove(name);
+        m_tagCollectionCacheNS.remove(name);
     }
 
     void removeCachedCollection(HTMLCollection* collection, const AtomicString& name = starAtom)
@@ -200,7 +198,7 @@
     void invalidateCaches(const QualifiedName* attrName = 0);
     bool isEmpty() const
     {
-        return m_atomicNameCaches.isEmpty() && m_cachedCollections.isEmpty() && m_tagNodeListCacheNS.isEmpty();
+        return m_atomicNameCaches.isEmpty() && m_cachedCollections.isEmpty() && m_tagCollectionCacheNS.isEmpty();
     }
 
     void adoptTreeScope()
@@ -219,7 +217,7 @@
         for (auto& cache : m_atomicNameCaches.values())
             cache->invalidateCache(*oldDocument);
 
-        for (auto& list : m_tagNodeListCacheNS.values()) {
+        for (auto& list : m_tagCollectionCacheNS.values()) {
             ASSERT(!list->isRootedAtDocument());
             list->invalidateCache(*oldDocument);
         }
@@ -247,7 +245,7 @@
     EmptyNodeList* m_emptyChildNodeList;
 
     NodeListAtomicNameCacheMap m_atomicNameCaches;
-    TagNodeListCacheNS m_tagNodeListCacheNS;
+    TagCollectionCacheNS m_tagCollectionCacheNS;
     CollectionCacheMap m_cachedCollections;
 };
 
@@ -308,7 +306,7 @@
 {
     ASSERT(ownerNode.nodeLists() == this);
     if ((m_childNodeList ? 1 : 0) + (m_emptyChildNodeList ? 1 : 0) + m_atomicNameCaches.size()
-        + m_tagNodeListCacheNS.size() + m_cachedCollections.size() != 1)
+        + m_tagCollectionCacheNS.size() + m_cachedCollections.size() != 1)
         return false;
     ownerNode.clearNodeLists();
     return true;

Copied: trunk/Source/WebCore/dom/TagCollection.cpp (from rev 188807, trunk/Source/WebCore/dom/TagNodeList.cpp) (0 => 188809)


--- trunk/Source/WebCore/dom/TagCollection.cpp	                        (rev 0)
+++ trunk/Source/WebCore/dom/TagCollection.cpp	2015-08-22 00:50:13 UTC (rev 188809)
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 1999 Lars Knoll ([email protected])
+ *           (C) 1999 Antti Koivisto ([email protected])
+ *           (C) 2001 Dirk Mueller ([email protected])
+ * Copyright (C) 2004-2007, 2014, 2015 Apple Inc. All rights reserved.
+ * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+#include "TagCollection.h"
+
+#include "NodeRareData.h"
+
+namespace WebCore {
+
+TagCollection::TagCollection(ContainerNode& rootNode, const AtomicString& namespaceURI, const AtomicString& localName)
+    : CachedHTMLCollection<TagCollection, CollectionTypeTraits<ByTag>::traversalType>(rootNode, ByTag)
+    , m_namespaceURI(namespaceURI)
+    , m_localName(localName)
+{
+    ASSERT(m_namespaceURI.isNull() || !m_namespaceURI.isEmpty());
+}
+
+TagCollection::~TagCollection()
+{
+    if (m_namespaceURI == starAtom)
+        ownerNode().nodeLists()->removeCachedCollection(this, m_localName);
+    else
+        ownerNode().nodeLists()->removeCachedCollectionWithQualifiedName(*this, m_namespaceURI, m_localName);
+}
+
+HTMLTagCollection::HTMLTagCollection(ContainerNode& rootNode, const AtomicString& localName)
+    : CachedHTMLCollection<HTMLTagCollection, CollectionTypeTraits<ByHTMLTag>::traversalType>(rootNode, ByHTMLTag)
+    , m_localName(localName)
+    , m_loweredLocalName(localName.convertToASCIILowercase())
+{
+}
+
+HTMLTagCollection::~HTMLTagCollection()
+{
+    ownerNode().nodeLists()->removeCachedCollection(this, m_localName);
+}
+
+} // namespace WebCore

Copied: trunk/Source/WebCore/dom/TagCollection.h (from rev 188807, trunk/Source/WebCore/dom/TagNodeList.h) (0 => 188809)


--- trunk/Source/WebCore/dom/TagCollection.h	                        (rev 0)
+++ trunk/Source/WebCore/dom/TagCollection.h	2015-08-22 00:50:13 UTC (rev 188809)
@@ -0,0 +1,97 @@
+/*
+ * Copyright (C) 1999 Lars Knoll ([email protected])
+ *           (C) 1999 Antti Koivisto ([email protected])
+ *           (C) 2001 Dirk Mueller ([email protected])
+ * Copyright (C) 2004-2008, 2014, 2015 Apple Inc. All rights reserved.
+ * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef TagCollection_h
+#define TagCollection_h
+
+#include "CachedHTMLCollection.h"
+#include <wtf/text/AtomicString.h>
+
+namespace WebCore {
+
+// HTMLCollection that limits to a particular tag.
+class TagCollection final : public CachedHTMLCollection<TagCollection, CollectionTypeTraits<ByTag>::traversalType> {
+public:
+    static Ref<TagCollection> create(ContainerNode& rootNode, const AtomicString& namespaceURI, const AtomicString& localName)
+    {
+        ASSERT(namespaceURI != starAtom);
+        return adoptRef(*new TagCollection(rootNode, namespaceURI, localName));
+    }
+
+    static Ref<TagCollection> create(ContainerNode& rootNode, CollectionType type, const AtomicString& localName)
+    {
+        ASSERT_UNUSED(type, type == ByTag);
+        return adoptRef(*new TagCollection(rootNode, starAtom, localName));
+    }
+
+    virtual ~TagCollection();
+
+    bool elementMatches(Element&) const;
+
+protected:
+    TagCollection(ContainerNode& rootNode, const AtomicString& namespaceURI, const AtomicString& localName);
+
+    AtomicString m_namespaceURI;
+    AtomicString m_localName;
+};
+
+inline bool TagCollection::elementMatches(Element& element) const
+{
+    // Implements http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-getelementsbytagnamens
+    if (m_localName != starAtom && m_localName != element.localName())
+        return false;
+
+    return m_namespaceURI == starAtom || m_namespaceURI == element.namespaceURI();
+}
+
+class HTMLTagCollection final : public CachedHTMLCollection<HTMLTagCollection, CollectionTypeTraits<ByHTMLTag>::traversalType> {
+public:
+    static Ref<HTMLTagCollection> create(ContainerNode& rootNode, CollectionType type, const AtomicString& localName)
+    {
+        ASSERT_UNUSED(type, type == ByHTMLTag);
+        return adoptRef(*new HTMLTagCollection(rootNode, localName));
+    }
+
+    virtual ~HTMLTagCollection();
+
+    bool elementMatches(Element&) const;
+
+private:
+    HTMLTagCollection(ContainerNode& rootNode, const AtomicString& localName);
+
+    AtomicString m_localName;
+    AtomicString m_loweredLocalName;
+};
+
+inline bool HTMLTagCollection::elementMatches(Element& element) const
+{
+    // Implements http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-getelementsbytagname
+    if (m_localName == starAtom)
+        return true;
+    const AtomicString& localName = element.isHTMLElement() ? m_loweredLocalName : m_localName;
+    return localName == element.localName();
+}
+
+} // namespace WebCore
+
+#endif // TagCollection_h

Deleted: trunk/Source/WebCore/dom/TagNodeList.cpp (188808 => 188809)


--- trunk/Source/WebCore/dom/TagNodeList.cpp	2015-08-22 00:49:20 UTC (rev 188808)
+++ trunk/Source/WebCore/dom/TagNodeList.cpp	2015-08-22 00:50:13 UTC (rev 188809)
@@ -1,59 +0,0 @@
-/*
- * Copyright (C) 1999 Lars Knoll ([email protected])
- *           (C) 1999 Antti Koivisto ([email protected])
- *           (C) 2001 Dirk Mueller ([email protected])
- * Copyright (C) 2004-2007, 2014 Apple Inc. All rights reserved.
- * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include "config.h"
-#include "TagNodeList.h"
-
-#include "NodeRareData.h"
-
-namespace WebCore {
-
-TagNodeList::TagNodeList(ContainerNode& rootNode, const AtomicString& namespaceURI, const AtomicString& localName)
-    : CachedLiveNodeList(rootNode, DoNotInvalidateOnAttributeChanges)
-    , m_namespaceURI(namespaceURI)
-    , m_localName(localName)
-{
-    ASSERT(m_namespaceURI.isNull() || !m_namespaceURI.isEmpty());
-}
-
-TagNodeList::~TagNodeList()
-{
-    if (m_namespaceURI == starAtom)
-        ownerNode().nodeLists()->removeCacheWithAtomicName(this, m_localName);
-    else
-        ownerNode().nodeLists()->removeCacheWithQualifiedName(this, m_namespaceURI, m_localName);
-}
-
-HTMLTagNodeList::HTMLTagNodeList(ContainerNode& rootNode, const AtomicString& localName)
-    : CachedLiveNodeList(rootNode, DoNotInvalidateOnAttributeChanges)
-    , m_localName(localName)
-    , m_loweredLocalName(localName.lower())
-{
-}
-
-HTMLTagNodeList::~HTMLTagNodeList()
-{
-    ownerNode().nodeLists()->removeCacheWithAtomicName(this, m_localName);
-}
-
-} // namespace WebCore

Deleted: trunk/Source/WebCore/dom/TagNodeList.h (188808 => 188809)


--- trunk/Source/WebCore/dom/TagNodeList.h	2015-08-22 00:49:20 UTC (rev 188808)
+++ trunk/Source/WebCore/dom/TagNodeList.h	2015-08-22 00:50:13 UTC (rev 188809)
@@ -1,98 +0,0 @@
-/*
- * Copyright (C) 1999 Lars Knoll ([email protected])
- *           (C) 1999 Antti Koivisto ([email protected])
- *           (C) 2001 Dirk Mueller ([email protected])
- * Copyright (C) 2004-2008, 2014 Apple Inc. All rights reserved.
- * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef TagNodeList_h
-#define TagNodeList_h
-
-#include "Element.h"
-#include "LiveNodeList.h"
-#include <wtf/text/AtomicString.h>
-
-namespace WebCore {
-
-// NodeList that limits to a particular tag.
-class TagNodeList final : public CachedLiveNodeList<TagNodeList> {
-public:
-    static Ref<TagNodeList> create(ContainerNode& rootNode, const AtomicString& namespaceURI, const AtomicString& localName)
-    {
-        ASSERT(namespaceURI != starAtom);
-        return adoptRef(*new TagNodeList(rootNode, namespaceURI, localName));
-    }
-
-    static Ref<TagNodeList> create(ContainerNode& rootNode, const AtomicString& localName)
-    {
-        return adoptRef(*new TagNodeList(rootNode, starAtom, localName));
-    }
-
-    virtual ~TagNodeList();
-
-    virtual bool elementMatches(Element&) const override;
-    virtual bool isRootedAtDocument() const override { return false; }
-
-protected:
-    TagNodeList(ContainerNode& rootNode, const AtomicString& namespaceURI, const AtomicString& localName);
-
-    AtomicString m_namespaceURI;
-    AtomicString m_localName;
-};
-
-inline bool TagNodeList::elementMatches(Element& element) const
-{
-    // Implements http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-getelementsbytagnamens
-    if (m_localName != starAtom && m_localName != element.localName())
-        return false;
-
-    return m_namespaceURI == starAtom || m_namespaceURI == element.namespaceURI();
-}
-
-class HTMLTagNodeList final : public CachedLiveNodeList<HTMLTagNodeList> {
-public:
-    static Ref<HTMLTagNodeList> create(ContainerNode& rootNode, const AtomicString& localName)
-    {
-        return adoptRef(*new HTMLTagNodeList(rootNode, localName));
-    }
-
-    virtual ~HTMLTagNodeList();
-
-    virtual bool elementMatches(Element&) const override;
-    virtual bool isRootedAtDocument() const override { return false; }
-
-private:
-    HTMLTagNodeList(ContainerNode& rootNode, const AtomicString& localName);
-
-    AtomicString m_localName;
-    AtomicString m_loweredLocalName;
-};
-
-inline bool HTMLTagNodeList::elementMatches(Element& element) const
-{
-    // Implements http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-getelementsbytagname
-    if (m_localName == starAtom)
-        return true;
-    const AtomicString& localName = element.isHTMLElement() ? m_loweredLocalName : m_localName;
-    return localName == element.localName();
-}
-
-} // namespace WebCore
-
-#endif // TagNodeList_h

Modified: trunk/Source/WebCore/editing/Editor.cpp (188808 => 188809)


--- trunk/Source/WebCore/editing/Editor.cpp	2015-08-22 00:49:20 UTC (rev 188808)
+++ trunk/Source/WebCore/editing/Editor.cpp	2015-08-22 00:50:13 UTC (rev 188809)
@@ -51,6 +51,7 @@
 #include "FrameTree.h"
 #include "FrameView.h"
 #include "GraphicsContext.h"
+#include "HTMLCollection.h"
 #include "HTMLFormControlElement.h"
 #include "HTMLFrameOwnerElement.h"
 #include "HTMLImageElement.h"
@@ -3051,10 +3052,10 @@
 
 void Editor::applyEditingStyleToBodyElement() const
 {
-    RefPtr<NodeList> list = document().getElementsByTagName("body");
-    unsigned len = list->length();
-    for (unsigned i = 0; i < len; i++)
-        applyEditingStyleToElement(downcast<Element>(list->item(i)));
+    auto collection = document().getElementsByTagName(HTMLNames::bodyTag.localName());
+    unsigned length = collection->length();
+    for (unsigned i = 0; i < length; ++i)
+        applyEditingStyleToElement(collection->item(i));
 }
 
 void Editor::applyEditingStyleToElement(Element* element) const

Modified: trunk/Source/WebCore/editing/markup.cpp (188808 => 188809)


--- trunk/Source/WebCore/editing/markup.cpp	2015-08-22 00:49:20 UTC (rev 188808)
+++ trunk/Source/WebCore/editing/markup.cpp	2015-08-22 00:50:13 UTC (rev 188809)
@@ -59,6 +59,7 @@
 #include "Settings.h"
 #include "StyleProperties.h"
 #include "TextIterator.h"
+#include "TypedElementDescendantIterator.h"
 #include "VisibleSelection.h"
 #include "VisibleUnits.h"
 #include "htmlediting.h"
@@ -672,29 +673,29 @@
     return createMarkupInternal(range.ownerDocument(), range, nodes, shouldAnnotate, convertBlocksToInlines, shouldResolveURLs);
 }
 
-PassRefPtr<DocumentFragment> createFragmentFromMarkup(Document& document, const String& markup, const String& baseURL, ParserContentPolicy parserContentPolicy)
+Ref<DocumentFragment> createFragmentFromMarkup(Document& document, const String& markup, const String& baseURL, ParserContentPolicy parserContentPolicy)
 {
     // We use a fake body element here to trick the HTML parser to using the InBody insertion mode.
-    RefPtr<HTMLBodyElement> fakeBody = HTMLBodyElement::create(document);
-    RefPtr<DocumentFragment> fragment = DocumentFragment::create(document);
+    auto fakeBody = HTMLBodyElement::create(document);
+    auto fragment = DocumentFragment::create(document);
 
-    fragment->parseHTML(markup, fakeBody.get(), parserContentPolicy);
+    fragment->parseHTML(markup, fakeBody.ptr(), parserContentPolicy);
 
 #if ENABLE(ATTACHMENT_ELEMENT)
     // When creating a fragment we must strip the webkit-attachment-path attribute after restoring the File object.
-    RefPtr<NodeList> nodes = fragment->getElementsByTagName("attachment");
-    for (size_t i = 0; i < nodes->length(); ++i) {
-        if (!is<HTMLAttachmentElement>(*nodes->item(i)))
-            continue;
-        HTMLAttachmentElement& element = downcast<HTMLAttachmentElement>(*nodes->item(i));
-        element.setFile(File::create(element.fastGetAttribute(webkitattachmentpathAttr)).ptr());
-        element.removeAttribute(webkitattachmentpathAttr);
+    Vector<Ref<HTMLAttachmentElement>> attachments;
+    for (auto& attachment : descendantsOfType<HTMLAttachmentElement>(fragment))
+        attachments.append(attachment);
+
+    for (auto& attachment : attachments) {
+        attachment->setFile(File::create(attachment->fastGetAttribute(webkitattachmentpathAttr)).ptr());
+        attachment->removeAttribute(webkitattachmentpathAttr);
     }
 #endif
     if (!baseURL.isEmpty() && baseURL != blankURL() && baseURL != document.baseURL())
-        completeURLs(fragment.get(), baseURL);
+        completeURLs(fragment.ptr(), baseURL);
 
-    return fragment.release();
+    return fragment;
 }
 
 String createMarkup(const Node& node, EChildrenOnly childrenOnly, Vector<Node*>* nodes, EAbsoluteURLs shouldResolveURLs, Vector<QualifiedName>* tagNamesToSkip, EFragmentSerialization fragmentSerialization)

Modified: trunk/Source/WebCore/editing/markup.h (188808 => 188809)


--- trunk/Source/WebCore/editing/markup.h	2015-08-22 00:49:20 UTC (rev 188808)
+++ trunk/Source/WebCore/editing/markup.h	2015-08-22 00:50:13 UTC (rev 188809)
@@ -50,7 +50,7 @@
 enum EFragmentSerialization { HTMLFragmentSerialization, XMLFragmentSerialization };
 
 WEBCORE_EXPORT PassRefPtr<DocumentFragment> createFragmentFromText(Range& context, const String& text);
-WEBCORE_EXPORT PassRefPtr<DocumentFragment> createFragmentFromMarkup(Document&, const String& markup, const String& baseURL, ParserContentPolicy = AllowScriptingContent);
+WEBCORE_EXPORT Ref<DocumentFragment> createFragmentFromMarkup(Document&, const String& markup, const String& baseURL, ParserContentPolicy = AllowScriptingContent);
 PassRefPtr<DocumentFragment> createFragmentForInnerOuterHTML(const String&, Element*, ParserContentPolicy, ExceptionCode&);
 PassRefPtr<DocumentFragment> createFragmentForTransformToFragment(const String&, const String& sourceMIMEType, Document* outputDoc);
 PassRefPtr<DocumentFragment> createContextualFragment(const String&, HTMLElement*, ParserContentPolicy, ExceptionCode&);

Modified: trunk/Source/WebCore/html/CollectionType.h (188808 => 188809)


--- trunk/Source/WebCore/html/CollectionType.h	2015-08-22 00:49:20 UTC (rev 188808)
+++ trunk/Source/WebCore/html/CollectionType.h	2015-08-22 00:50:13 UTC (rev 188809)
@@ -52,6 +52,8 @@
     MapAreas,
     FormControls,
     ByClass,
+    ByTag,
+    ByHTMLTag,
 };
 
 enum class CollectionTraversalType { Descendants, ChildrenOnly, CustomForwardOnly };

Modified: trunk/Source/WebCore/html/GenericCachedHTMLCollection.cpp (188808 => 188809)


--- trunk/Source/WebCore/html/GenericCachedHTMLCollection.cpp	2015-08-22 00:49:20 UTC (rev 188808)
+++ trunk/Source/WebCore/html/GenericCachedHTMLCollection.cpp	2015-08-22 00:50:13 UTC (rev 188809)
@@ -72,6 +72,8 @@
     case DocAnchors:
         return element.hasTagName(aTag) && element.fastHasAttribute(nameAttr);
     case ByClass:
+    case ByTag:
+    case ByHTMLTag:
     case DocAll:
     case DocumentNamedItems:
     case FormControls:

Modified: trunk/Source/WebCore/html/HTMLCollection.cpp (188808 => 188809)


--- trunk/Source/WebCore/html/HTMLCollection.cpp	2015-08-22 00:49:20 UTC (rev 188808)
+++ trunk/Source/WebCore/html/HTMLCollection.cpp	2015-08-22 00:50:13 UTC (rev 188809)
@@ -47,6 +47,8 @@
     case FormControls:
         return HTMLCollection::IsRootedAtDocument;
     case ByClass:
+    case ByTag:
+    case ByHTMLTag:
     case NodeChildren:
     case TableTBodies:
     case TSectionRows:
@@ -65,6 +67,8 @@
 static NodeListInvalidationType invalidationTypeExcludingIdAndNameAttributes(CollectionType type)
 {
     switch (type) {
+    case ByTag:
+    case ByHTMLTag:
     case DocImages:
     case DocEmbeds:
     case DocForms:
@@ -120,6 +124,8 @@
     // FIXME: We need a cleaner way to handle this.
     switch (type()) {
     case ByClass:
+    case ByTag:
+    case ByHTMLTag:
     case WindowNamedItems:
     case DocumentNamedItems:
         break;
@@ -213,8 +219,11 @@
     return elements;
 }
 
-PassRefPtr<NodeList> HTMLCollection::tags(const String& name)
+RefPtr<NodeList> HTMLCollection::tags(const String& name)
 {
+    if (name.isNull())
+        return nullptr;
+
     return ownerNode().getElementsByTagName(name);
 }
 

Modified: trunk/Source/WebCore/html/HTMLCollection.h (188808 => 188809)


--- trunk/Source/WebCore/html/HTMLCollection.h	2015-08-22 00:49:20 UTC (rev 188808)
+++ trunk/Source/WebCore/html/HTMLCollection.h	2015-08-22 00:50:13 UTC (rev 188809)
@@ -66,7 +66,7 @@
     // DOM API
     virtual Element* item(unsigned index) const override = 0; // Tighten return type from NodeList::item().
     virtual Element* namedItem(const AtomicString& name) const override = 0; // Tighten return type from NodeList::namedItem().
-    PassRefPtr<NodeList> tags(const String&);
+    RefPtr<NodeList> tags(const String&);
 
     // Non-DOM API
     Vector<Ref<Element>> namedItems(const AtomicString& name) const;
@@ -77,7 +77,7 @@
     CollectionType type() const;
     ContainerNode& ownerNode() const;
     ContainerNode& rootNode() const;
-    void invalidateCache(const QualifiedName* attributeName);
+    void invalidateCacheForAttribute(const QualifiedName* attributeName);
     virtual void invalidateCache(Document&);
 
     bool hasNamedElementCache() const;
@@ -191,7 +191,7 @@
     return m_ownerNode->document();
 }
 
-inline void HTMLCollection::invalidateCache(const QualifiedName* attributeName)
+inline void HTMLCollection::invalidateCacheForAttribute(const QualifiedName* attributeName)
 {
     if (!attributeName || shouldInvalidateTypeOnAttributeChange(invalidationType(), *attributeName))
         invalidateCache(document());

Modified: trunk/Source/WebCore/html/HTMLPlugInImageElement.cpp (188808 => 188809)


--- trunk/Source/WebCore/html/HTMLPlugInImageElement.cpp	2015-08-22 00:49:20 UTC (rev 188808)
+++ trunk/Source/WebCore/html/HTMLPlugInImageElement.cpp	2015-08-22 00:50:13 UTC (rev 188809)
@@ -50,6 +50,7 @@
 #include "ShadowRoot.h"
 #include "StyleResolver.h"
 #include "SubframeLoader.h"
+#include "TypedElementDescendantIterator.h"
 #include <_javascript_Core/APICast.h>
 #include <_javascript_Core/JSBase.h>
 #include <wtf/HashMap.h>
@@ -59,7 +60,7 @@
 
 using namespace HTMLNames;
 
-typedef Vector<RefPtr<HTMLPlugInImageElement>> HTMLPlugInImageElementList;
+typedef Vector<Ref<HTMLPlugInImageElement>> HTMLPlugInImageElementList;
 typedef HashMap<String, String> MimeTypeToLocalizedStringMap;
 
 static const int sizingTinyDimensionThreshold = 40;
@@ -424,20 +425,6 @@
         renderer()->repaint();
 }
 
-static void addPlugInsFromNodeListMatchingPlugInOrigin(HTMLPlugInImageElementList& plugInList, PassRefPtr<NodeList> collection, const String& plugInOrigin, const String& mimeType)
-{
-    for (unsigned i = 0, length = collection->length(); i < length; i++) {
-        Node* node = collection->item(i);
-        if (is<HTMLPlugInImageElement>(*node)) {
-            HTMLPlugInImageElement& plugInImageElement = downcast<HTMLPlugInImageElement>(*node);
-            const URL& loadedURL = plugInImageElement.loadedUrl();
-            String otherMimeType = plugInImageElement.loadedMimeType();
-            if (plugInOrigin == loadedURL.host() && mimeType == otherMimeType)
-                plugInList.append(&plugInImageElement);
-        }
-    }
-}
-
 void HTMLPlugInImageElement::restartSimilarPlugIns()
 {
     // Restart any other snapshotted plugins in the page with the same origin. Note that they
@@ -457,19 +444,15 @@
         if (!frame->document())
             continue;
 
-        RefPtr<NodeList> plugIns = frame->document()->getElementsByTagName(embedTag.localName());
-        if (plugIns)
-            addPlugInsFromNodeListMatchingPlugInOrigin(similarPlugins, plugIns, plugInOrigin, mimeType);
-
-        plugIns = frame->document()->getElementsByTagName(objectTag.localName());
-        if (plugIns)
-            addPlugInsFromNodeListMatchingPlugInOrigin(similarPlugins, plugIns, plugInOrigin, mimeType);
+        for (auto& element : descendantsOfType<HTMLPlugInImageElement>(*frame->document())) {
+            if (plugInOrigin == element.loadedUrl().host() && mimeType == element.loadedMimeType())
+                similarPlugins.append(element);
+        }
     }
 
-    for (size_t i = 0, length = similarPlugins.size(); i < length; ++i) {
-        HTMLPlugInImageElement* plugInToRestart = similarPlugins[i].get();
+    for (auto& plugInToRestart : similarPlugins) {
         if (plugInToRestart->displayState() <= HTMLPlugInElement::DisplayingSnapshot) {
-            LOG(Plugins, "%p Plug-in looks similar to a restarted plug-in. Restart.", plugInToRestart);
+            LOG(Plugins, "%p Plug-in looks similar to a restarted plug-in. Restart.", plugInToRestart.ptr());
             plugInToRestart->restartSnapshottedPlugIn();
         }
         plugInToRestart->m_snapshotDecision = NeverSnapshot;

Modified: trunk/Source/WebCore/html/MediaDocument.cpp (188808 => 188809)


--- trunk/Source/WebCore/html/MediaDocument.cpp	2015-08-22 00:49:20 UTC (rev 188808)
+++ trunk/Source/WebCore/html/MediaDocument.cpp	2015-08-22 00:50:13 UTC (rev 188809)
@@ -46,6 +46,7 @@
 #include "RawDataDocumentParser.h"
 #include "ScriptController.h"
 #include "ShadowRoot.h"
+#include "TypedElementDescendantIterator.h"
 
 namespace WebCore {
 
@@ -160,17 +161,12 @@
     return MediaDocumentParser::create(*this);
 }
 
-static inline HTMLVideoElement* descendentVideoElement(ContainerNode& node)
+static inline HTMLVideoElement* descendantVideoElement(ContainerNode& node)
 {
     if (is<HTMLVideoElement>(node))
         return downcast<HTMLVideoElement>(&node);
 
-    RefPtr<NodeList> nodeList = node.getElementsByTagNameNS(videoTag.namespaceURI(), videoTag.localName());
-   
-    if (nodeList->length() > 0)
-        return downcast<HTMLVideoElement>(nodeList->item(0));
-
-    return nullptr;
+    return descendantsOfType<HTMLVideoElement>(node).first();
 }
 
 static inline HTMLVideoElement* ancestorVideoElement(Node* node)
@@ -207,7 +203,7 @@
         return;
     ContainerNode& targetContainer = downcast<ContainerNode>(*targetNode);
     if (event->type() == eventNames().keydownEvent && is<KeyboardEvent>(*event)) {
-        HTMLVideoElement* video = descendentVideoElement(targetContainer);
+        HTMLVideoElement* video = descendantVideoElement(targetContainer);
         if (!video)
             return;
 
@@ -243,7 +239,7 @@
     htmlBody->setAttribute(marginwidthAttr, "0");
     htmlBody->setAttribute(marginheightAttr, "0");
 
-    if (HTMLVideoElement* videoElement = descendentVideoElement(*htmlBody)) {
+    if (HTMLVideoElement* videoElement = descendantVideoElement(*htmlBody)) {
         RefPtr<Element> element = Document::createElement(embedTag, false);
         HTMLEmbedElement& embedElement = downcast<HTMLEmbedElement>(*element);
 

Modified: trunk/Source/WebKit/mac/ChangeLog (188808 => 188809)


--- trunk/Source/WebKit/mac/ChangeLog	2015-08-22 00:49:20 UTC (rev 188808)
+++ trunk/Source/WebKit/mac/ChangeLog	2015-08-22 00:50:13 UTC (rev 188809)
@@ -1,3 +1,15 @@
+2015-08-21  Chris Dumez  <[email protected]>
+
+        document.getElementsByTagName should return an HTMLCollection
+        https://bugs.webkit.org/show_bug.cgi?id=110611
+
+        Reviewed by Darin Adler.
+
+        * WebView/WebFrame.mm:
+        (-[WebFrame _documentFragmentWithMarkupString:baseURLString:]):
+        Use .ptr() as createFragmentFromMarkup() now returns a
+        Ref<> instead of a RefPtr<>.
+
 2015-08-21  Anders Carlsson  <[email protected]>
 
         Get rid of uses of the old callOnMainThread function that takes a function ptr + context

Modified: trunk/Source/WebKit/mac/WebView/WebFrame.mm (188808 => 188809)


--- trunk/Source/WebKit/mac/WebView/WebFrame.mm	2015-08-22 00:49:20 UTC (rev 188808)
+++ trunk/Source/WebKit/mac/WebView/WebFrame.mm	2015-08-22 00:50:13 UTC (rev 188809)
@@ -868,7 +868,7 @@
     if (!document)
         return nil;
 
-    return kit(createFragmentFromMarkup(*document, markupString, baseURLString, DisallowScriptingContent).get());
+    return kit(createFragmentFromMarkup(*document, markupString, baseURLString, DisallowScriptingContent).ptr());
 }
 
 - (DOMDocumentFragment *)_documentFragmentWithNodesAsParagraphs:(NSArray *)nodes

Modified: trunk/Source/WebKit/win/ChangeLog (188808 => 188809)


--- trunk/Source/WebKit/win/ChangeLog	2015-08-22 00:49:20 UTC (rev 188808)
+++ trunk/Source/WebKit/win/ChangeLog	2015-08-22 00:50:13 UTC (rev 188809)
@@ -1,3 +1,16 @@
+2015-08-21  Chris Dumez  <[email protected]>
+
+        document.getElementsByTagName should return an HTMLCollection
+        https://bugs.webkit.org/show_bug.cgi?id=110611
+
+        Reviewed by Darin Adler.
+
+        * DOMCoreClasses.cpp:
+        (DOMDocument::getElementsByTagName):
+        (DOMDocument::getElementsByTagNameNS):
+        Add null checks for localName() before calling
+        ContainerNode::getElementsByTagName*().
+
 2015-08-21  Anders Carlsson  <[email protected]>
 
         Stop using the old callOnMainThread variant on Windows

Modified: trunk/Source/WebKit/win/DOMCoreClasses.cpp (188808 => 188809)


--- trunk/Source/WebKit/win/DOMCoreClasses.cpp	2015-08-22 00:49:20 UTC (rev 188808)
+++ trunk/Source/WebKit/win/DOMCoreClasses.cpp	2015-08-22 00:50:13 UTC (rev 188809)
@@ -40,6 +40,7 @@
 #include <WebCore/Font.h>
 #include <WebCore/FontCascade.h>
 #include <WebCore/Frame.h>
+#include <WebCore/HTMLCollection.h>
 #include <WebCore/HTMLFormElement.h>
 #include <WebCore/HTMLInputElement.h>
 #include <WebCore/HTMLNames.h>
@@ -708,7 +709,10 @@
         return E_FAIL;
 
     String tagNameString(tagName);
-    *result = DOMNodeList::createInstance(m_document->getElementsByTagName(tagNameString).get());
+    RefPtr<WebCore::NodeList> elements;
+    if (!tagNameString.isNull())
+        elements = m_document->getElementsByTagName(tagNameString);
+    *result = DOMNodeList::createInstance(elements.get());
     return *result ? S_OK : E_FAIL;
 }
 
@@ -749,7 +753,10 @@
 
     String namespaceURIString(namespaceURI);
     String localNameString(localName);
-    *result = DOMNodeList::createInstance(m_document->getElementsByTagNameNS(namespaceURIString, localNameString).get());
+    RefPtr<WebCore::NodeList> elements;
+    if (!localNameString.isNull())
+        elements = m_document->getElementsByTagNameNS(namespaceURIString, localNameString);
+    *result = DOMNodeList::createInstance(elements.get());
     return *result ? S_OK : E_FAIL;
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to