<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[188735] trunk</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/188735">188735</a></dd>
<dt>Author</dt> <dd>cdumez@apple.com</dd>
<dt>Date</dt> <dd>2015-08-20 19:10:29 -0700 (Thu, 20 Aug 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>getElementsByClassName() should return an HTMLCollection
https://bugs.webkit.org/show_bug.cgi?id=147980
Reviewed by Darin Adler.
Source/WebCore:
Update Document.getElementsByClassName() and Element.getElementsByClassName()
to return an HTMLCollection instead of a NodeList, as per the specification:
- https://dom.spec.whatwg.org/#interface-document
- https://dom.spec.whatwg.org/#interface-element
This behavior is also consistent with other major browsers. Due to this and
the fact that NodeList / HTMLCollection pretty much the same API, the
compatibility risk should be fairly low.
I also verified that the performance is the same according to the following
performance test:
PerformanceTests/DOM/get-elements-by-class-name-traversal-uncached.html
Tests: fast/dom/getElementsByClassName/dumpHTMLCollection.html
fast/dom/getElementsByClassName/return-type.html
* CMakeLists.txt:
* WebCore.vcxproj/WebCore.vcxproj:
* WebCore.xcodeproj/project.pbxproj:
Rename ClassNodeList.cpp file.
* bindings/scripts/CodeGeneratorObjC.pm:
(GetImplClassName):
Indicate that NodeList is implemented as NodeListBase. This is
needed so that DOMNodeList can have either an HTMLCollection or
a NodeList as internal representation. NodeListBase is a new
common base class for HTMLCollection and NodeList.
* dom/ClassCollection.cpp: Renamed from Source/WebCore/dom/ClassNodeList.cpp.
(WebCore::ClassCollection::create):
(WebCore::ClassCollection::~ClassCollection):
* dom/ClassCollection.h: Renamed from Source/WebCore/dom/ClassNodeList.h.
(WebCore::ClassCollection::ClassCollection):
(WebCore::ClassCollection::elementMatches):
Rename ClassNodeList to ClassCollection and have it subclass
CachedHTMLCollection instead of ClassNodeList.
* dom/ContainerNode.cpp:
(WebCore::ContainerNode::getElementsByClassName):
Have getElementsByClassName return an HTMLCollection instead of a
NodeList.
(WebCore::ContainerNode::getElementsByClassNameForObjC):
New method returns a NodeListBase for ObjC bindings, so they can
convert the return value into a DOMNodeList. We need this to not
break ObjC API compatibility.
* dom/Document.idl:
* dom/Element.idl:
Have getElementsByClassName return an HTMLCollection instead of a
NodeList, except for ObjC bindings.
* dom/NodeList.h:
Have NodeList subclass NodeListBase.
* dom/NodeListBase.h: Added.
New common base interface for HTMLCollection and NodeList. This is
so that the internal representation for ObjC's DOMNodeList can be
a NodeListBase instead of a NodeList. This way, the ObjC API can
keep returning a DOMNodeList, even though our implementation now
returns an HTMLCollection instead of a NodeList.
* dom/NodeRareData.h:
(WebCore::NodeListTypeIdentifier<NameNodeList>::value):
(WebCore::NodeListTypeIdentifier<TagNodeList>::value):
(WebCore::NodeListTypeIdentifier<HTMLTagNodeList>::value):
(WebCore::NodeListTypeIdentifier<RadioNodeList>::value):
(WebCore::NodeListTypeIdentifier<LabelsNodeList>::value):
Drop ClassNodeList from the NodeListTypeIndentifiers.
* html/CollectionType.h:
Add new ByClass CollectionType for ClassCollection.
* html/GenericCachedHTMLCollection.cpp:
(WebCore::GenericCachedHTMLCollection<traversalType>::elementMatches):
Handle new ByClass CollectionType in the switch statement.
* html/HTMLCollection.cpp:
(WebCore::invalidationTypeExcludingIdAndNameAttributes):
(WebCore::HTMLCollection::~HTMLCollection):
Add support for new ByClass Collection type.
* html/HTMLCollection.h:
Have HTMLCollection subclass the NodeListBase interface.
LayoutTests:
* fast/dom/getElementsByClassName/dumpHTMLCollection-expected.txt: Renamed from LayoutTests/fast/dom/getElementsByClassName/dumpNodeList-expected.txt.
* fast/dom/getElementsByClassName/dumpHTMLCollection.html: Renamed from LayoutTests/fast/dom/getElementsByClassName/dumpNodeList.html.
Rename test now that getElementsByClassName returns an HTMLCollection
and update the test to update the HTMLCollection prototype instead
of the NodeList one.
* fast/dom/getElementsByClassName/return-type-expected.txt: Added.
* fast/dom/getElementsByClassName/return-type.html: Added.
New test that checks that getElementsByClassName() returns an
HTMLCollection.
* inspector/model/remote-object-expected.txt:
Rebaseline.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsinspectormodelremoteobjectexpectedtxt">trunk/LayoutTests/inspector/model/remote-object-expected.txt</a></li>
<li><a href="#trunkSourceWebCoreCMakeListstxt">trunk/Source/WebCore/CMakeLists.txt</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreWebCorevcxprojWebCorevcxproj">trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj</a></li>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptsCodeGeneratorObjCpm">trunk/Source/WebCore/bindings/scripts/CodeGeneratorObjC.pm</a></li>
<li><a href="#trunkSourceWebCoredomContainerNodecpp">trunk/Source/WebCore/dom/ContainerNode.cpp</a></li>
<li><a href="#trunkSourceWebCoredomContainerNodeh">trunk/Source/WebCore/dom/ContainerNode.h</a></li>
<li><a href="#trunkSourceWebCoredomDOMAllInOnecpp">trunk/Source/WebCore/dom/DOMAllInOne.cpp</a></li>
<li><a href="#trunkSourceWebCoredomDocumentidl">trunk/Source/WebCore/dom/Document.idl</a></li>
<li><a href="#trunkSourceWebCoredomElementidl">trunk/Source/WebCore/dom/Element.idl</a></li>
<li><a href="#trunkSourceWebCoredomLiveNodeListcpp">trunk/Source/WebCore/dom/LiveNodeList.cpp</a></li>
<li><a href="#trunkSourceWebCoredomNodeh">trunk/Source/WebCore/dom/Node.h</a></li>
<li><a href="#trunkSourceWebCoredomNodeListh">trunk/Source/WebCore/dom/NodeList.h</a></li>
<li><a href="#trunkSourceWebCoredomNodeRareDatah">trunk/Source/WebCore/dom/NodeRareData.h</a></li>
<li><a href="#trunkSourceWebCorehtmlCollectionTypeh">trunk/Source/WebCore/html/CollectionType.h</a></li>
<li><a href="#trunkSourceWebCorehtmlGenericCachedHTMLCollectioncpp">trunk/Source/WebCore/html/GenericCachedHTMLCollection.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLCollectioncpp">trunk/Source/WebCore/html/HTMLCollection.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLCollectionh">trunk/Source/WebCore/html/HTMLCollection.h</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfastdomgetElementsByClassNamedumpHTMLCollectionexpectedtxt">trunk/LayoutTests/fast/dom/getElementsByClassName/dumpHTMLCollection-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastdomgetElementsByClassNamedumpHTMLCollectionhtml">trunk/LayoutTests/fast/dom/getElementsByClassName/dumpHTMLCollection.html</a></li>
<li><a href="#trunkLayoutTestsfastdomgetElementsByClassNamereturntypeexpectedtxt">trunk/LayoutTests/fast/dom/getElementsByClassName/return-type-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastdomgetElementsByClassNamereturntypehtml">trunk/LayoutTests/fast/dom/getElementsByClassName/return-type.html</a></li>
<li><a href="#trunkSourceWebCoredomClassCollectioncpp">trunk/Source/WebCore/dom/ClassCollection.cpp</a></li>
<li><a href="#trunkSourceWebCoredomClassCollectionh">trunk/Source/WebCore/dom/ClassCollection.h</a></li>
<li><a href="#trunkSourceWebCoredomNodeListBaseh">trunk/Source/WebCore/dom/NodeListBase.h</a></li>
</ul>
<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfastdomgetElementsByClassNamedumpNodeListexpectedtxt">trunk/LayoutTests/fast/dom/getElementsByClassName/dumpNodeList-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastdomgetElementsByClassNamedumpNodeListhtml">trunk/LayoutTests/fast/dom/getElementsByClassName/dumpNodeList.html</a></li>
<li><a href="#trunkSourceWebCoredomClassNodeListcpp">trunk/Source/WebCore/dom/ClassNodeList.cpp</a></li>
<li><a href="#trunkSourceWebCoredomClassNodeListh">trunk/Source/WebCore/dom/ClassNodeList.h</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (188734 => 188735)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2015-08-21 01:46:36 UTC (rev 188734)
+++ trunk/LayoutTests/ChangeLog        2015-08-21 02:10:29 UTC (rev 188735)
</span><span class="lines">@@ -1,3 +1,24 @@
</span><ins>+2015-08-20 Chris Dumez <cdumez@apple.com>
+
+ getElementsByClassName() should return an HTMLCollection
+ https://bugs.webkit.org/show_bug.cgi?id=147980
+
+ Reviewed by Darin Adler.
+
+ * fast/dom/getElementsByClassName/dumpHTMLCollection-expected.txt: Renamed from LayoutTests/fast/dom/getElementsByClassName/dumpNodeList-expected.txt.
+ * fast/dom/getElementsByClassName/dumpHTMLCollection.html: Renamed from LayoutTests/fast/dom/getElementsByClassName/dumpNodeList.html.
+ Rename test now that getElementsByClassName returns an HTMLCollection
+ and update the test to update the HTMLCollection prototype instead
+ of the NodeList one.
+
+ * fast/dom/getElementsByClassName/return-type-expected.txt: Added.
+ * fast/dom/getElementsByClassName/return-type.html: Added.
+ New test that checks that getElementsByClassName() returns an
+ HTMLCollection.
+
+ * inspector/model/remote-object-expected.txt:
+ Rebaseline.
+
</ins><span class="cx"> 2015-08-20 Myles C. Maxfield <mmaxfield@apple.com>
</span><span class="cx">
</span><span class="cx"> Test gardening after r188167
</span></span></pre></div>
<a id="trunkLayoutTestsfastdomgetElementsByClassNamedumpHTMLCollectionexpectedtxtfromrev188734trunkLayoutTestsfastdomgetElementsByClassNamedumpNodeListexpectedtxt"></a>
<div class="copfile"><h4>Copied: trunk/LayoutTests/fast/dom/getElementsByClassName/dumpHTMLCollection-expected.txt (from rev 188734, trunk/LayoutTests/fast/dom/getElementsByClassName/dumpNodeList-expected.txt) (0 => 188735)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/getElementsByClassName/dumpHTMLCollection-expected.txt         (rev 0)
+++ trunk/LayoutTests/fast/dom/getElementsByClassName/dumpHTMLCollection-expected.txt        2015-08-21 02:10:29 UTC (rev 188735)
</span><span class="lines">@@ -0,0 +1,26 @@
</span><ins>+Line 1
+Line 2
+Line 3
+
+line 4
+line 5
+
+[object HTMLDivElement], [object HTMLDivElement], [object HTMLDivElement], length: 3
+[object HTMLDivElement], [object HTMLDivElement], [object HTMLDivElement], [object HTMLParagraphElement], length: 4
+[object HTMLDivElement], [object HTMLDivElement], length: 2
+[object HTMLDivElement], [object HTMLDivElement], length: 2
+length: 0
+length: 0
+length: 0
+length: 0
+length: 0
+[object HTMLDivElement], length: 1
+[object HTMLDivElement], [object HTMLParagraphElement], length: 2
+[object HTMLDivElement], length: 1
+[object HTMLDivElement], length: 1
+length: 0
+length: 0
+length: 0
+length: 0
+length: 0
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastdomgetElementsByClassNamedumpHTMLCollectionhtmlfromrev188734trunkLayoutTestsfastdomgetElementsByClassNamedumpNodeListhtml"></a>
<div class="copfile"><h4>Copied: trunk/LayoutTests/fast/dom/getElementsByClassName/dumpHTMLCollection.html (from rev 188734, trunk/LayoutTests/fast/dom/getElementsByClassName/dumpNodeList.html) (0 => 188735)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/getElementsByClassName/dumpHTMLCollection.html         (rev 0)
+++ trunk/LayoutTests/fast/dom/getElementsByClassName/dumpHTMLCollection.html        2015-08-21 02:10:29 UTC (rev 188735)
</span><span class="lines">@@ -0,0 +1,54 @@
</span><ins>+<html>
+<body>
+<div class="one">Line 1<div class="two">Line 2</div><p>Line <i>3</i></p></div>
+<div id="test" class="one two"><div class="one two">line 4</div><p class="two">line 5</p></div>
+<p><ol id="console"></ol></p>
+<script type="text/javascript">
+ if (window.testRunner)
+ testRunner.dumpAsText();
+
+ function log(message)
+ {
+ var item = document.createElement("li");
+ item.appendChild(document.createTextNode(message));
+ document.getElementById("console").appendChild(item);
+ }
+
+ HTMLCollection.prototype.dump = function()
+ {
+ var result = "";
+ var i = 0;
+ for (; i < this.length; i++)
+ result += this[i] + ", ";
+ result += "length: " + i;
+ return result;
+ }
+
+ try {
+ var elm = document.getElementById("test");
+
+ log(document.getElementsByClassName("one").dump());
+ log(document.getElementsByClassName("two").dump());
+ log(document.getElementsByClassName("one two").dump());
+ log(document.getElementsByClassName("one\t\t\n \ftwo").dump());
+ log(document.getElementsByClassName("").dump());
+ log(document.getElementsByClassName("onetwo").dump());
+ log(document.getElementsByClassName().dump());
+ log(document.getElementsByClassName(null).dump());
+ log(document.getElementsByClassName(undefined).dump());
+
+ log(elm.getElementsByClassName("one").dump());
+ log(elm.getElementsByClassName("two").dump());
+ log(elm.getElementsByClassName("one two").dump());
+ log(elm.getElementsByClassName("one\t\t\n \ftwo").dump());
+ log(elm.getElementsByClassName("").dump());
+ log(elm.getElementsByClassName("onetwo").dump());
+ log(elm.getElementsByClassName().dump());
+ log(elm.getElementsByClassName(null).dump());
+ log(elm.getElementsByClassName(undefined).dump());
+ } catch (ex) {
+ log("Exception: " + ex.description);
+ }
+</script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsfastdomgetElementsByClassNamedumpNodeListexpectedtxt"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/fast/dom/getElementsByClassName/dumpNodeList-expected.txt (188734 => 188735)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/getElementsByClassName/dumpNodeList-expected.txt        2015-08-21 01:46:36 UTC (rev 188734)
+++ trunk/LayoutTests/fast/dom/getElementsByClassName/dumpNodeList-expected.txt        2015-08-21 02:10:29 UTC (rev 188735)
</span><span class="lines">@@ -1,26 +0,0 @@
</span><del>-Line 1
-Line 2
-Line 3
-
-line 4
-line 5
-
-[object HTMLDivElement], [object HTMLDivElement], [object HTMLDivElement], length: 3
-[object HTMLDivElement], [object HTMLDivElement], [object HTMLDivElement], [object HTMLParagraphElement], length: 4
-[object HTMLDivElement], [object HTMLDivElement], length: 2
-[object HTMLDivElement], [object HTMLDivElement], length: 2
-length: 0
-length: 0
-length: 0
-length: 0
-length: 0
-[object HTMLDivElement], length: 1
-[object HTMLDivElement], [object HTMLParagraphElement], length: 2
-[object HTMLDivElement], length: 1
-[object HTMLDivElement], length: 1
-length: 0
-length: 0
-length: 0
-length: 0
-length: 0
-
</del></span></pre></div>
<a id="trunkLayoutTestsfastdomgetElementsByClassNamedumpNodeListhtml"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/fast/dom/getElementsByClassName/dumpNodeList.html (188734 => 188735)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/getElementsByClassName/dumpNodeList.html        2015-08-21 01:46:36 UTC (rev 188734)
+++ trunk/LayoutTests/fast/dom/getElementsByClassName/dumpNodeList.html        2015-08-21 02:10:29 UTC (rev 188735)
</span><span class="lines">@@ -1,54 +0,0 @@
</span><del>-<html>
-<body>
-<div class="one">Line 1<div class="two">Line 2</div><p>Line <i>3</i></p></div>
-<div id="test" class="one two"><div class="one two">line 4</div><p class="two">line 5</p></div>
-<p><ol id="console"></ol></p>
-<script type="text/javascript">
- if (window.testRunner)
- testRunner.dumpAsText();
-
- function log(message)
- {
- var item = document.createElement("li");
- item.appendChild(document.createTextNode(message));
- document.getElementById("console").appendChild(item);
- }
-
- NodeList.prototype.dump = function()
- {
- var result = "";
- var i = 0;
- for (; i < this.length; i++)
- result += this[i] + ", ";
- result += "length: " + i;
- return result;
- }
-
- try {
- var elm = document.getElementById("test");
-
- log(document.getElementsByClassName("one").dump());
- log(document.getElementsByClassName("two").dump());
- log(document.getElementsByClassName("one two").dump());
- log(document.getElementsByClassName("one\t\t\n \ftwo").dump());
- log(document.getElementsByClassName("").dump());
- log(document.getElementsByClassName("onetwo").dump());
- log(document.getElementsByClassName().dump());
- log(document.getElementsByClassName(null).dump());
- log(document.getElementsByClassName(undefined).dump());
-
- log(elm.getElementsByClassName("one").dump());
- log(elm.getElementsByClassName("two").dump());
- log(elm.getElementsByClassName("one two").dump());
- log(elm.getElementsByClassName("one\t\t\n \ftwo").dump());
- log(elm.getElementsByClassName("").dump());
- log(elm.getElementsByClassName("onetwo").dump());
- log(elm.getElementsByClassName().dump());
- log(elm.getElementsByClassName(null).dump());
- log(elm.getElementsByClassName(undefined).dump());
- } catch (ex) {
- log("Exception: " + ex.description);
- }
-</script>
-</body>
-</html>
</del></span></pre></div>
<a id="trunkLayoutTestsfastdomgetElementsByClassNamereturntypeexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/dom/getElementsByClassName/return-type-expected.txt (0 => 188735)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/getElementsByClassName/return-type-expected.txt         (rev 0)
+++ trunk/LayoutTests/fast/dom/getElementsByClassName/return-type-expected.txt        2015-08-21 02:10:29 UTC (rev 188735)
</span><span class="lines">@@ -0,0 +1,11 @@
</span><ins>+Tests that getElementsByTagName() returns an HTMLCollection.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS document.getElementsByClassName("test").__proto__ is HTMLCollection.prototype
+PASS document.body.getElementsByClassName("test").__proto__ is HTMLCollection.prototype
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastdomgetElementsByClassNamereturntypehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/dom/getElementsByClassName/return-type.html (0 => 188735)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/getElementsByClassName/return-type.html         (rev 0)
+++ trunk/LayoutTests/fast/dom/getElementsByClassName/return-type.html        2015-08-21 02:10:29 UTC (rev 188735)
</span><span class="lines">@@ -0,0 +1,13 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<body>
+<script src="../../../resources/js-test.js"></script>
+<script>
+description("Tests that getElementsByTagName() returns an HTMLCollection.");
+
+shouldBe('document.getElementsByClassName("test").__proto__', 'HTMLCollection.prototype');
+shouldBe('document.body.getElementsByClassName("test").__proto__', 'HTMLCollection.prototype');
+</script>
+<script src="../../../resources/js-post.js"></script>
+<body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsinspectormodelremoteobjectexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/inspector/model/remote-object-expected.txt (188734 => 188735)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/model/remote-object-expected.txt        2015-08-21 01:46:36 UTC (rev 188734)
+++ trunk/LayoutTests/inspector/model/remote-object-expected.txt        2015-08-21 02:10:29 UTC (rev 188735)
</span><span class="lines">@@ -2004,12 +2004,12 @@
</span><span class="cx"> "_type": "object",
</span><span class="cx"> "_subtype": "array",
</span><span class="cx"> "_objectId": "<filtered>",
</span><del>- "_description": "NodeList",
</del><ins>+ "_description": "HTMLCollection",
</ins><span class="cx"> "_size": 3,
</span><span class="cx"> "_preview": {
</span><span class="cx"> "_type": "object",
</span><span class="cx"> "_subtype": "array",
</span><del>- "_description": "NodeList",
</del><ins>+ "_description": "HTMLCollection",
</ins><span class="cx"> "_lossless": false,
</span><span class="cx"> "_overflow": false,
</span><span class="cx"> "_size": 3,
</span></span></pre></div>
<a id="trunkSourceWebCoreCMakeListstxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/CMakeLists.txt (188734 => 188735)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/CMakeLists.txt        2015-08-21 01:46:36 UTC (rev 188734)
+++ trunk/Source/WebCore/CMakeLists.txt        2015-08-21 02:10:29 UTC (rev 188735)
</span><span class="lines">@@ -1357,7 +1357,7 @@
</span><span class="cx"> dom/CheckedRadioButtons.cpp
</span><span class="cx"> dom/ChildListMutationScope.cpp
</span><span class="cx"> dom/ChildNodeList.cpp
</span><del>- dom/ClassNodeList.cpp
</del><ins>+ dom/ClassCollection.cpp
</ins><span class="cx"> dom/ClientRect.cpp
</span><span class="cx"> dom/ClientRectList.cpp
</span><span class="cx"> dom/ClipboardEvent.cpp
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (188734 => 188735)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-08-21 01:46:36 UTC (rev 188734)
+++ trunk/Source/WebCore/ChangeLog        2015-08-21 02:10:29 UTC (rev 188735)
</span><span class="lines">@@ -1,3 +1,95 @@
</span><ins>+2015-08-20 Chris Dumez <cdumez@apple.com>
+
+ getElementsByClassName() should return an HTMLCollection
+ https://bugs.webkit.org/show_bug.cgi?id=147980
+
+ Reviewed by Darin Adler.
+
+ Update Document.getElementsByClassName() and Element.getElementsByClassName()
+ to return an HTMLCollection instead of a NodeList, as per the specification:
+ - https://dom.spec.whatwg.org/#interface-document
+ - https://dom.spec.whatwg.org/#interface-element
+
+ This behavior is also consistent with other major browsers. Due to this and
+ the fact that NodeList / HTMLCollection pretty much the same API, the
+ compatibility risk should be fairly low.
+
+ I also verified that the performance is the same according to the following
+ performance test:
+ PerformanceTests/DOM/get-elements-by-class-name-traversal-uncached.html
+
+ Tests: fast/dom/getElementsByClassName/dumpHTMLCollection.html
+ fast/dom/getElementsByClassName/return-type.html
+
+ * CMakeLists.txt:
+ * WebCore.vcxproj/WebCore.vcxproj:
+ * WebCore.xcodeproj/project.pbxproj:
+ Rename ClassNodeList.cpp file.
+
+ * bindings/scripts/CodeGeneratorObjC.pm:
+ (GetImplClassName):
+ Indicate that NodeList is implemented as NodeListBase. This is
+ needed so that DOMNodeList can have either an HTMLCollection or
+ a NodeList as internal representation. NodeListBase is a new
+ common base class for HTMLCollection and NodeList.
+
+ * dom/ClassCollection.cpp: Renamed from Source/WebCore/dom/ClassNodeList.cpp.
+ (WebCore::ClassCollection::create):
+ (WebCore::ClassCollection::~ClassCollection):
+ * dom/ClassCollection.h: Renamed from Source/WebCore/dom/ClassNodeList.h.
+ (WebCore::ClassCollection::ClassCollection):
+ (WebCore::ClassCollection::elementMatches):
+ Rename ClassNodeList to ClassCollection and have it subclass
+ CachedHTMLCollection instead of ClassNodeList.
+
+ * dom/ContainerNode.cpp:
+ (WebCore::ContainerNode::getElementsByClassName):
+ Have getElementsByClassName return an HTMLCollection instead of a
+ NodeList.
+
+ (WebCore::ContainerNode::getElementsByClassNameForObjC):
+ New method returns a NodeListBase for ObjC bindings, so they can
+ convert the return value into a DOMNodeList. We need this to not
+ break ObjC API compatibility.
+
+ * dom/Document.idl:
+ * dom/Element.idl:
+ Have getElementsByClassName return an HTMLCollection instead of a
+ NodeList, except for ObjC bindings.
+
+ * dom/NodeList.h:
+ Have NodeList subclass NodeListBase.
+
+ * dom/NodeListBase.h: Added.
+ New common base interface for HTMLCollection and NodeList. This is
+ so that the internal representation for ObjC's DOMNodeList can be
+ a NodeListBase instead of a NodeList. This way, the ObjC API can
+ keep returning a DOMNodeList, even though our implementation now
+ returns an HTMLCollection instead of a NodeList.
+
+ * dom/NodeRareData.h:
+ (WebCore::NodeListTypeIdentifier<NameNodeList>::value):
+ (WebCore::NodeListTypeIdentifier<TagNodeList>::value):
+ (WebCore::NodeListTypeIdentifier<HTMLTagNodeList>::value):
+ (WebCore::NodeListTypeIdentifier<RadioNodeList>::value):
+ (WebCore::NodeListTypeIdentifier<LabelsNodeList>::value):
+ Drop ClassNodeList from the NodeListTypeIndentifiers.
+
+ * html/CollectionType.h:
+ Add new ByClass CollectionType for ClassCollection.
+
+ * html/GenericCachedHTMLCollection.cpp:
+ (WebCore::GenericCachedHTMLCollection<traversalType>::elementMatches):
+ Handle new ByClass CollectionType in the switch statement.
+
+ * html/HTMLCollection.cpp:
+ (WebCore::invalidationTypeExcludingIdAndNameAttributes):
+ (WebCore::HTMLCollection::~HTMLCollection):
+ Add support for new ByClass Collection type.
+
+ * html/HTMLCollection.h:
+ Have HTMLCollection subclass the NodeListBase interface.
+
</ins><span class="cx"> 2015-08-20 Myles C. Maxfield <mmaxfield@apple.com>
</span><span class="cx">
</span><span class="cx"> Fix the iOS build after r188726
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorevcxprojWebCorevcxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj (188734 => 188735)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj        2015-08-21 01:46:36 UTC (rev 188734)
+++ trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj        2015-08-21 02:10:29 UTC (rev 188735)
</span><span class="lines">@@ -13603,7 +13603,7 @@
</span><span class="cx"> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|Win32'">true</ExcludedFromBuild>
</span><span class="cx"> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|x64'">true</ExcludedFromBuild>
</span><span class="cx"> </ClCompile>
</span><del>- <ClCompile Include="..\dom\ClassNodeList.cpp">
</del><ins>+ <ClCompile Include="..\dom\ClassCollection.cpp">
</ins><span class="cx"> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
</span><span class="cx"> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
</span><span class="cx"> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|Win32'">true</ExcludedFromBuild>
</span><span class="lines">@@ -22020,7 +22020,7 @@
</span><span class="cx"> <ClInclude Include="..\dom\CheckedRadioButtons.h" />
</span><span class="cx"> <ClInclude Include="..\dom\ChildListMutationScope.h" />
</span><span class="cx"> <ClInclude Include="..\dom\ChildNodeList.h" />
</span><del>- <ClInclude Include="..\dom\ClassNodeList.h" />
</del><ins>+ <ClInclude Include="..\dom\ClassCollection.h" />
</ins><span class="cx"> <ClInclude Include="..\dom\ClientRect.h" />
</span><span class="cx"> <ClInclude Include="..\dom\ClientRectList.h" />
</span><span class="cx"> <ClInclude Include="..\dom\ClipboardEvent.h" />
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (188734 => 188735)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2015-08-21 01:46:36 UTC (rev 188734)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2015-08-21 02:10:29 UTC (rev 188735)
</span><span class="lines">@@ -2677,10 +2677,10 @@
</span><span class="cx">                 830030F51B7D33B500ED3AAC /* GenericCachedHTMLCollection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 830030F31B7D33A600ED3AAC /* GenericCachedHTMLCollection.cpp */; };
</span><span class="cx">                 830030F61B7D33B500ED3AAC /* GenericCachedHTMLCollection.h in Headers */ = {isa = PBXBuildFile; fileRef = 830030F41B7D33A600ED3AAC /* GenericCachedHTMLCollection.h */; };
</span><span class="cx">                 830030F81B7D3B7800ED3AAC /* CachedHTMLCollection.h in Headers */ = {isa = PBXBuildFile; fileRef = 830030F71B7D398800ED3AAC /* CachedHTMLCollection.h */; };
</span><del>-                831D48C01B7D9A52006DE39A /* ClassNodeList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 831D48BE1B7D9A46006DE39A /* ClassNodeList.cpp */; };
-                831D48C11B7D9A52006DE39A /* ClassNodeList.h in Headers */ = {isa = PBXBuildFile; fileRef = 831D48BF1B7D9A46006DE39A /* ClassNodeList.h */; };
</del><span class="cx">                 832B843419D8E55100B26055 /* SVGAnimateElementBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 832B843319D8E55100B26055 /* SVGAnimateElementBase.h */; };
</span><span class="cx">                 832B843619D8E57400B26055 /* SVGAnimateElementBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 832B843519D8E57400B26055 /* SVGAnimateElementBase.cpp */; };
</span><ins>+                8348BFAB1B85729800912F36 /* ClassCollection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8348BFA91B85729500912F36 /* ClassCollection.cpp */; };
+                8348BFAC1B85729800912F36 /* ClassCollection.h in Headers */ = {isa = PBXBuildFile; fileRef = 8348BFAA1B85729500912F36 /* ClassCollection.h */; };
</ins><span class="cx">                 83520C7E1A71BFCC006BD2AA /* CSSFontFamily.h in Headers */ = {isa = PBXBuildFile; fileRef = 83520C7D1A71BFCC006BD2AA /* CSSFontFamily.h */; };
</span><span class="cx">                 835D363719FF6193004C93AB /* StyleBuilderCustom.h in Headers */ = {isa = PBXBuildFile; fileRef = 835D363619FF6193004C93AB /* StyleBuilderCustom.h */; };
</span><span class="cx">                 836FBCEA178C113200B21A15 /* SVGAnimatedTypeAnimator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 836FBCE9178C113200B21A15 /* SVGAnimatedTypeAnimator.cpp */; };
</span><span class="lines">@@ -2690,6 +2690,7 @@
</span><span class="cx">                 8386A97019F61E4F00E1EC4A /* StyleBuilder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8386A96E19F61E4F00E1EC4A /* StyleBuilder.cpp */; };
</span><span class="cx">                 839AAFEC1A0C0C8D00605F99 /* HTMLWBRElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 839AAFEA1A0C0C8D00605F99 /* HTMLWBRElement.cpp */; };
</span><span class="cx">                 839AAFED1A0C0C8D00605F99 /* HTMLWBRElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 839AAFEB1A0C0C8D00605F99 /* HTMLWBRElement.h */; };
</span><ins>+                83AAE64A1B85816B009FAF70 /* NodeListBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 83AAE6491B858168009FAF70 /* NodeListBase.h */; settings = {ATTRIBUTES = (Private, ); }; };
</ins><span class="cx">                 83B9687B19F8AB83004EF7AF /* StyleBuilderConverter.h in Headers */ = {isa = PBXBuildFile; fileRef = 83B9687919F8AB83004EF7AF /* StyleBuilderConverter.h */; };
</span><span class="cx">                 83C05A5A1A686212007E5DEA /* StylePropertyShorthandFunctions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83C05A581A686212007E5DEA /* StylePropertyShorthandFunctions.cpp */; };
</span><span class="cx">                 83C05A5B1A686212007E5DEA /* StylePropertyShorthandFunctions.h in Headers */ = {isa = PBXBuildFile; fileRef = 83C05A591A686212007E5DEA /* StylePropertyShorthandFunctions.h */; };
</span><span class="lines">@@ -10040,10 +10041,10 @@
</span><span class="cx">                 830030F31B7D33A600ED3AAC /* GenericCachedHTMLCollection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GenericCachedHTMLCollection.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 830030F41B7D33A600ED3AAC /* GenericCachedHTMLCollection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GenericCachedHTMLCollection.h; sourceTree = "<group>"; };
</span><span class="cx">                 830030F71B7D398800ED3AAC /* CachedHTMLCollection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CachedHTMLCollection.h; sourceTree = "<group>"; };
</span><del>-                831D48BE1B7D9A46006DE39A /* ClassNodeList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ClassNodeList.cpp; sourceTree = "<group>"; };
-                831D48BF1B7D9A46006DE39A /* ClassNodeList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ClassNodeList.h; sourceTree = "<group>"; };
</del><span class="cx">                 832B843319D8E55100B26055 /* SVGAnimateElementBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAnimateElementBase.h; sourceTree = "<group>"; };
</span><span class="cx">                 832B843519D8E57400B26055 /* SVGAnimateElementBase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGAnimateElementBase.cpp; sourceTree = "<group>"; };
</span><ins>+                8348BFA91B85729500912F36 /* ClassCollection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ClassCollection.cpp; sourceTree = "<group>"; };
+                8348BFAA1B85729500912F36 /* ClassCollection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ClassCollection.h; sourceTree = "<group>"; };
</ins><span class="cx">                 83520C7D1A71BFCC006BD2AA /* CSSFontFamily.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSFontFamily.h; sourceTree = "<group>"; };
</span><span class="cx">                 835D363619FF6193004C93AB /* StyleBuilderCustom.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StyleBuilderCustom.h; sourceTree = "<group>"; };
</span><span class="cx">                 8369E58F1AFDD0300087DF68 /* NonDocumentTypeChildNode.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = NonDocumentTypeChildNode.idl; sourceTree = "<group>"; };
</span><span class="lines">@@ -10054,6 +10055,7 @@
</span><span class="cx">                 8386A96E19F61E4F00E1EC4A /* StyleBuilder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StyleBuilder.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 839AAFEA1A0C0C8D00605F99 /* HTMLWBRElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLWBRElement.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 839AAFEB1A0C0C8D00605F99 /* HTMLWBRElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTMLWBRElement.h; sourceTree = "<group>"; };
</span><ins>+                83AAE6491B858168009FAF70 /* NodeListBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NodeListBase.h; sourceTree = "<group>"; };
</ins><span class="cx">                 83B9687919F8AB83004EF7AF /* StyleBuilderConverter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StyleBuilderConverter.h; sourceTree = "<group>"; };
</span><span class="cx">                 83C05A581A686212007E5DEA /* StylePropertyShorthandFunctions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StylePropertyShorthandFunctions.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 83C05A591A686212007E5DEA /* StylePropertyShorthandFunctions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StylePropertyShorthandFunctions.h; sourceTree = "<group>"; };
</span><span class="lines">@@ -23177,8 +23179,8 @@
</span><span class="cx">                                 83D26D3C1AFDCC50001B3873 /* ChildNode.idl */,
</span><span class="cx">                                 A818721A0977D3C0005826D9 /* ChildNodeList.cpp */,
</span><span class="cx">                                 A81872150977D3C0005826D9 /* ChildNodeList.h */,
</span><del>-                                831D48BE1B7D9A46006DE39A /* ClassNodeList.cpp */,
-                                831D48BF1B7D9A46006DE39A /* ClassNodeList.h */,
</del><ins>+                                8348BFA91B85729500912F36 /* ClassCollection.cpp */,
+                                8348BFAA1B85729500912F36 /* ClassCollection.h */,
</ins><span class="cx">                                 BCC065770F3CE1B700CD2D87 /* ClientRect.cpp */,
</span><span class="cx">                                 BCC065780F3CE1B700CD2D87 /* ClientRect.h */,
</span><span class="cx">                                 BCC065790F3CE1B700CD2D87 /* ClientRect.idl */,
</span><span class="lines">@@ -23402,6 +23404,7 @@
</span><span class="cx">                                 1A750D870A90E394000FF215 /* NodeIterator.idl */,
</span><span class="cx">                                 A81872100977D3C0005826D9 /* NodeList.h */,
</span><span class="cx">                                 85ACA9FA0A9B631000671E90 /* NodeList.idl */,
</span><ins>+                                83AAE6491B858168009FAF70 /* NodeListBase.h */,
</ins><span class="cx">                                 7CEAC1081B483D7F00334482 /* NodeOrString.cpp */,
</span><span class="cx">                                 7CEAC1061B483D1D00334482 /* NodeOrString.h */,
</span><span class="cx">                                 4FAB48661643A67E00F70C07 /* NodeRareData.cpp */,
</span><span class="lines">@@ -24571,7 +24574,6 @@
</span><span class="cx">                                 85E711960AC5D5350053270F /* DOMDocumentTypeInternal.h in Headers */,
</span><span class="cx">                                 8518DCE90A9CC80D0091B7A6 /* DOMDOMImplementation.h in Headers */,
</span><span class="cx">                                 85E711970AC5D5350053270F /* DOMDOMImplementationInternal.h in Headers */,
</span><del>-                                831D48C11B7D9A52006DE39A /* ClassNodeList.h in Headers */,
</del><span class="cx">                                 52CCA9E815E3F64C0053C77F /* DOMDOMNamedFlowCollection.h in Headers */,
</span><span class="cx">                                 52CCA9EA15E3F64C0053C77F /* DOMDOMNamedFlowCollectionInternal.h in Headers */,
</span><span class="cx">                                 2D9A247415B9C2E300D34527 /* DOMDOMSecurityPolicy.h in Headers */,
</span><span class="lines">@@ -24796,6 +24798,7 @@
</span><span class="cx">                                 85E711D90AC5D5350053270F /* DOMTextInternal.h in Headers */,
</span><span class="cx">                                 188604B40F2E654A000B6443 /* DOMTimer.h in Headers */,
</span><span class="cx">                                 05FD69E012845D4300B2BEB3 /* DOMTimeStamp.h in Headers */,
</span><ins>+                                8348BFAC1B85729800912F36 /* ClassCollection.h in Headers */,
</ins><span class="cx">                                 76FC2B0C12370DA0006A991A /* DOMTokenList.h in Headers */,
</span><span class="cx">                                 0F54DCD51880F867003EEDBB /* DOMTouch.h in Headers */,
</span><span class="cx">                                 0F54DCD71880F867003EEDBB /* DOMTouchEvent.h in Headers */,
</span><span class="lines">@@ -26233,6 +26236,7 @@
</span><span class="cx">                                 1477E7770BF4134A00152872 /* PageCache.h in Headers */,
</span><span class="cx">                                 CD5E5B5F1A15CE54000C609E /* PageConfiguration.h in Headers */,
</span><span class="cx">                                 F3820893147D35F90010BC06 /* PageConsoleAgent.h in Headers */,
</span><ins>+                                83AAE64A1B85816B009FAF70 /* NodeListBase.h in Headers */,
</ins><span class="cx">                                 DAED203116F244480070EC0F /* PageConsoleClient.h in Headers */,
</span><span class="cx">                                 A5A2AF0C1829734300DE1729 /* PageDebuggable.h in Headers */,
</span><span class="cx">                                 F34742DD134362F000531BC2 /* PageDebuggerAgent.h in Headers */,
</span><span class="lines">@@ -28997,7 +29001,6 @@
</span><span class="cx">                                 A9C6E64C0D7465E7006442E9 /* JSDOMPluginArrayCustom.cpp in Sources */,
</span><span class="cx">                                 A9C6E64D0D7465E7006442E9 /* JSDOMPluginCustom.cpp in Sources */,
</span><span class="cx">                                 E172AF8F1811BC3700FBADB9 /* JSDOMPromise.cpp in Sources */,
</span><del>-                                831D48C01B7D9A52006DE39A /* ClassNodeList.cpp in Sources */,
</del><span class="cx">                                 BC5A86B50C3367E800EEA649 /* JSDOMSelection.cpp in Sources */,
</span><span class="cx">                                 4ACBC0CA12713D0A0094F9B2 /* JSDOMSettableTokenList.cpp in Sources */,
</span><span class="cx">                                 C5137CF211A58378004ADB99 /* JSDOMStringList.cpp in Sources */,
</span><span class="lines">@@ -29884,6 +29887,7 @@
</span><span class="cx">                                 B776D43D1104527500BEB0EC /* PrintContext.cpp in Sources */,
</span><span class="cx">                                 A8EA7EBD0A1945D000A8EF5F /* ProcessingInstruction.cpp in Sources */,
</span><span class="cx">                                 E44613EB0CD681B400FADA75 /* ProgressEvent.cpp in Sources */,
</span><ins>+                                8348BFAB1B85729800912F36 /* ClassCollection.cpp in Sources */,
</ins><span class="cx">                                 A715E652134BBBEC00D8E713 /* ProgressShadowElement.cpp in Sources */,
</span><span class="cx">                                 1A2A68230B5BEDE70002A480 /* ProgressTracker.cpp in Sources */,
</span><span class="cx">                                 E4BBED0E14F4025D003F0B98 /* PropertySetCSSStyleDeclaration.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptsCodeGeneratorObjCpm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorObjC.pm (188734 => 188735)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorObjC.pm        2015-08-21 01:46:36 UTC (rev 188734)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorObjC.pm        2015-08-21 02:10:29 UTC (rev 188735)
</span><span class="lines">@@ -420,6 +420,7 @@
</span><span class="cx"> {
</span><span class="cx"> my $name = shift;
</span><span class="cx">
</span><ins>+ return "NodeListBase" if $name eq "NodeList";
</ins><span class="cx"> return "DOMWindow" if $name eq "AbstractView";
</span><span class="cx"> return $name;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoredomClassCollectioncppfromrev188734trunkSourceWebCoredomClassNodeListcpp"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/dom/ClassCollection.cpp (from rev 188734, trunk/Source/WebCore/dom/ClassNodeList.cpp) (0 => 188735)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/ClassCollection.cpp         (rev 0)
+++ trunk/Source/WebCore/dom/ClassCollection.cpp        2015-08-21 02:10:29 UTC (rev 188735)
</span><span class="lines">@@ -0,0 +1,49 @@
</span><ins>+/*
+ * Copyright (C) 2007-2008, 2014, 2015 Apple Inc. All rights reserved.
+ * Copyright (C) 2007 David Smith (catfish.man@gmail.com)
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "ClassCollection.h"
+
+#include "NodeRareData.h"
+#include "StyledElement.h"
+
+namespace WebCore {
+
+Ref<ClassCollection> ClassCollection::create(ContainerNode& rootNode, CollectionType type, const AtomicString& classNames)
+{
+ ASSERT(type == ByClass);
+ return adoptRef(*new ClassCollection(rootNode, type, classNames));
+}
+
+ClassCollection::~ClassCollection()
+{
+ ownerNode().nodeLists()->removeCachedCollection(this, m_originalClassNames);
+}
+
+} // namespace WebCore
</ins></span></pre></div>
<a id="trunkSourceWebCoredomClassCollectionhfromrev188734trunkSourceWebCoredomClassNodeListh"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/dom/ClassCollection.h (from rev 188734, trunk/Source/WebCore/dom/ClassNodeList.h) (0 => 188735)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/ClassCollection.h         (rev 0)
+++ trunk/Source/WebCore/dom/ClassCollection.h        2015-08-21 02:10:29 UTC (rev 188735)
</span><span class="lines">@@ -0,0 +1,78 @@
</span><ins>+/*
+ * Copyright (C) 2007, 2014, 2015 Apple Inc. All rights reserved.
+ * Copyright (C) 2007 David Smith (catfish.man@gmail.com)
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ClassCollection_h
+#define ClassCollection_h
+
+#include "CachedHTMLCollection.h"
+#include "Element.h"
+#include "SpaceSplitString.h"
+
+namespace WebCore {
+
+class ClassCollection final : public CachedHTMLCollection<ClassCollection, CollectionTypeTraits<ByClass>::traversalType> {
+public:
+ static Ref<ClassCollection> create(ContainerNode&, CollectionType, const AtomicString& classNames);
+
+ virtual ~ClassCollection();
+
+ bool elementMatches(Element&) const;
+
+private:
+ ClassCollection(ContainerNode& rootNode, CollectionType, const AtomicString& classNames);
+
+ SpaceSplitString m_classNames;
+ AtomicString m_originalClassNames;
+};
+
+inline ClassCollection::ClassCollection(ContainerNode& rootNode, CollectionType type, const AtomicString& classNames)
+ : CachedHTMLCollection<ClassCollection, CollectionTypeTraits<ByClass>::traversalType>(rootNode, type)
+ , m_classNames(classNames, rootNode.document().inQuirksMode())
+ , m_originalClassNames(classNames)
+{
+}
+
+inline bool ClassCollection::elementMatches(Element& element) const
+{
+ if (!element.hasClass())
+ return false;
+ if (!m_classNames.size())
+ return false;
+ // FIXME: DOM4 allows getElementsByClassName to return non StyledElement.
+ // https://bugs.webkit.org/show_bug.cgi?id=94718
+ if (!element.isStyledElement())
+ return false;
+ return element.classNames().containsAll(m_classNames);
+}
+
+} // namespace WebCore
+
+SPECIALIZE_TYPE_TRAITS_HTMLCOLLECTION(ClassCollection, ByClass)
+
+#endif // ClassCollection_h
</ins></span></pre></div>
<a id="trunkSourceWebCoredomClassNodeListcpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/dom/ClassNodeList.cpp (188734 => 188735)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/ClassNodeList.cpp        2015-08-21 01:46:36 UTC (rev 188734)
+++ trunk/Source/WebCore/dom/ClassNodeList.cpp        2015-08-21 02:10:29 UTC (rev 188735)
</span><span class="lines">@@ -1,48 +0,0 @@
</span><del>-/*
- * Copyright (C) 2007-2008, 2014 Apple Inc. All rights reserved.
- * Copyright (C) 2007 David Smith (catfish.man@gmail.com)
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Apple Inc. ("Apple") nor the names of
- * its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "ClassNodeList.h"
-
-#include "NodeRareData.h"
-#include "StyledElement.h"
-
-namespace WebCore {
-
-Ref<ClassNodeList> ClassNodeList::create(ContainerNode& rootNode, const AtomicString& classNames)
-{
- return adoptRef(*new ClassNodeList(rootNode, classNames));
-}
-
-ClassNodeList::~ClassNodeList()
-{
- ownerNode().nodeLists()->removeCacheWithAtomicName(this, m_originalClassNames);
-}
-
-} // namespace WebCore
</del></span></pre></div>
<a id="trunkSourceWebCoredomClassNodeListh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/dom/ClassNodeList.h (188734 => 188735)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/ClassNodeList.h        2015-08-21 01:46:36 UTC (rev 188734)
+++ trunk/Source/WebCore/dom/ClassNodeList.h        2015-08-21 02:10:29 UTC (rev 188735)
</span><span class="lines">@@ -1,78 +0,0 @@
</span><del>-/*
- * Copyright (C) 2007, 2014 Apple Inc. All rights reserved.
- * Copyright (C) 2007 David Smith (catfish.man@gmail.com)
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Apple Inc. ("Apple") nor the names of
- * its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef ClassNodeList_h
-#define ClassNodeList_h
-
-#include "Element.h"
-#include "LiveNodeList.h"
-#include "Node.h"
-#include "SpaceSplitString.h"
-
-namespace WebCore {
-
-class ClassNodeList final : public CachedLiveNodeList<ClassNodeList> {
-public:
- static Ref<ClassNodeList> create(ContainerNode&, const AtomicString& classNames);
-
- virtual ~ClassNodeList();
-
- virtual bool elementMatches(Element&) const override;
- virtual bool isRootedAtDocument() const override { return false; }
-
-private:
- ClassNodeList(ContainerNode& rootNode, const AtomicString& classNames);
-
- SpaceSplitString m_classNames;
- AtomicString m_originalClassNames;
-};
-
-inline ClassNodeList::ClassNodeList(ContainerNode& rootNode, const AtomicString& classNames)
- : CachedLiveNodeList(rootNode, InvalidateOnClassAttrChange)
- , m_classNames(classNames, document().inQuirksMode())
- , m_originalClassNames(classNames)
-{
-}
-
-inline bool ClassNodeList::elementMatches(Element& element) const
-{
- if (!element.hasClass())
- return false;
- if (!m_classNames.size())
- return false;
- // FIXME: DOM4 allows getElementsByClassName to return non StyledElement.
- // https://bugs.webkit.org/show_bug.cgi?id=94718
- if (!element.isStyledElement())
- return false;
- return element.classNames().containsAll(m_classNames);
-}
-
-} // namespace WebCore
-
-#endif // ClassNodeList_h
</del></span></pre></div>
<a id="trunkSourceWebCoredomContainerNodecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/ContainerNode.cpp (188734 => 188735)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/ContainerNode.cpp        2015-08-21 01:46:36 UTC (rev 188734)
+++ trunk/Source/WebCore/dom/ContainerNode.cpp        2015-08-21 02:10:29 UTC (rev 188735)
</span><span class="lines">@@ -27,7 +27,7 @@
</span><span class="cx"> #include "ChildListMutationScope.h"
</span><span class="cx"> #include "Chrome.h"
</span><span class="cx"> #include "ChromeClient.h"
</span><del>-#include "ClassNodeList.h"
</del><ins>+#include "ClassCollection.h"
</ins><span class="cx"> #include "ContainerNodeAlgorithms.h"
</span><span class="cx"> #include "Editor.h"
</span><span class="cx"> #include "FloatRect.h"
</span><span class="lines">@@ -890,11 +890,16 @@
</span><span class="cx"> return ensureRareData().ensureNodeLists().addCacheWithAtomicName<NameNodeList>(*this, elementName);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-RefPtr<NodeList> ContainerNode::getElementsByClassName(const AtomicString& classNames)
</del><ins>+RefPtr<HTMLCollection> ContainerNode::getElementsByClassName(const AtomicString& classNames)
</ins><span class="cx"> {
</span><del>- return ensureRareData().ensureNodeLists().addCacheWithAtomicName<ClassNodeList>(*this, classNames);
</del><ins>+ return ensureRareData().ensureNodeLists().addCachedCollection<ClassCollection>(*this, ByClass, classNames);
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+RefPtr<NodeListBase> ContainerNode::getElementsByClassNameForObjC(const AtomicString& classNames)
+{
+ return getElementsByClassName(classNames);
+}
+
</ins><span class="cx"> RefPtr<RadioNodeList> ContainerNode::radioNodeList(const AtomicString& name)
</span><span class="cx"> {
</span><span class="cx"> ASSERT(hasTagName(HTMLNames::formTag) || hasTagName(HTMLNames::fieldsetTag));
</span></span></pre></div>
<a id="trunkSourceWebCoredomContainerNodeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/ContainerNode.h (188734 => 188735)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/ContainerNode.h        2015-08-21 01:46:36 UTC (rev 188734)
+++ trunk/Source/WebCore/dom/ContainerNode.h        2015-08-21 02:10:29 UTC (rev 188735)
</span><span class="lines">@@ -31,6 +31,7 @@
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><span class="cx"> class HTMLCollection;
</span><ins>+class NodeListBase;
</ins><span class="cx"> class NodeOrString;
</span><span class="cx"> class QualifiedName;
</span><span class="cx"> class RenderElement;
</span><span class="lines">@@ -145,7 +146,8 @@
</span><span class="cx"> RefPtr<NodeList> getElementsByTagName(const AtomicString&);
</span><span class="cx"> RefPtr<NodeList> getElementsByTagNameNS(const AtomicString& namespaceURI, const AtomicString& localName);
</span><span class="cx"> RefPtr<NodeList> getElementsByName(const String& elementName);
</span><del>- RefPtr<NodeList> getElementsByClassName(const AtomicString& classNames);
</del><ins>+ RefPtr<HTMLCollection> getElementsByClassName(const AtomicString& classNames);
+ RefPtr<NodeListBase> getElementsByClassNameForObjC(const AtomicString& classNames);
</ins><span class="cx"> RefPtr<RadioNodeList> radioNodeList(const AtomicString&);
</span><span class="cx">
</span><span class="cx"> // From the ParentNode interface - https://dom.spec.whatwg.org/#interface-parentnode
</span></span></pre></div>
<a id="trunkSourceWebCoredomDOMAllInOnecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/DOMAllInOne.cpp (188734 => 188735)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/DOMAllInOne.cpp        2015-08-21 01:46:36 UTC (rev 188734)
+++ trunk/Source/WebCore/dom/DOMAllInOne.cpp        2015-08-21 02:10:29 UTC (rev 188735)
</span><span class="lines">@@ -35,7 +35,7 @@
</span><span class="cx"> #include "CheckedRadioButtons.cpp"
</span><span class="cx"> #include "ChildListMutationScope.cpp"
</span><span class="cx"> #include "ChildNodeList.cpp"
</span><del>-#include "ClassNodeList.cpp"
</del><ins>+#include "ClassCollection.cpp"
</ins><span class="cx"> #include "ClientRect.cpp"
</span><span class="cx"> #include "ClientRectList.cpp"
</span><span class="cx"> #include "ClipboardEvent.cpp"
</span></span></pre></div>
<a id="trunkSourceWebCoredomDocumentidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Document.idl (188734 => 188735)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Document.idl        2015-08-21 01:46:36 UTC (rev 188734)
+++ trunk/Source/WebCore/dom/Document.idl        2015-08-21 02:10:29 UTC (rev 188735)
</span><span class="lines">@@ -210,7 +210,11 @@
</span><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> // HTML 5
</span><del>- NodeList getElementsByClassName([Default=Undefined] optional DOMString classNames);
</del><ins>+#if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C
+ [ImplementedAs=getElementsByClassNameForObjC] NodeList getElementsByClassName([Default=Undefined] optional DOMString classNames);
+#else
+ HTMLCollection getElementsByClassName([Default=Undefined] optional DOMString classNames);
+#endif
</ins><span class="cx">
</span><span class="cx"> readonly attribute Element activeElement;
</span><span class="cx"> boolean hasFocus();
</span></span></pre></div>
<a id="trunkSourceWebCoredomElementidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Element.idl (188734 => 188735)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Element.idl        2015-08-21 01:46:36 UTC (rev 188734)
+++ trunk/Source/WebCore/dom/Element.idl        2015-08-21 02:10:29 UTC (rev 188735)
</span><span class="lines">@@ -107,7 +107,11 @@
</span><span class="cx"> void scrollByPages([Default=Undefined] optional long pages);
</span><span class="cx">
</span><span class="cx"> // HTML 5
</span><del>- NodeList getElementsByClassName([Default=Undefined] optional DOMString name);
</del><ins>+#if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C
+ [ImplementedAs=getElementsByClassNameForObjC] NodeList getElementsByClassName([Default=Undefined] optional DOMString name);
+#else
+ HTMLCollection getElementsByClassName([Default=Undefined] optional DOMString name);
+#endif
</ins><span class="cx"> [TreatNullAs=NullString, SetterRaisesException] attribute DOMString innerHTML;
</span><span class="cx"> [TreatNullAs=NullString, SetterRaisesException] attribute DOMString outerHTML;
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoredomLiveNodeListcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/LiveNodeList.cpp (188734 => 188735)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/LiveNodeList.cpp        2015-08-21 01:46:36 UTC (rev 188734)
+++ trunk/Source/WebCore/dom/LiveNodeList.cpp        2015-08-21 02:10:29 UTC (rev 188735)
</span><span class="lines">@@ -23,7 +23,7 @@
</span><span class="cx"> #include "config.h"
</span><span class="cx"> #include "LiveNodeList.h"
</span><span class="cx">
</span><del>-#include "ClassNodeList.h"
</del><ins>+#include "ClassCollection.h"
</ins><span class="cx"> #include "Element.h"
</span><span class="cx"> #include "ElementTraversal.h"
</span><span class="cx"> #include "HTMLCollection.h"
</span></span></pre></div>
<a id="trunkSourceWebCoredomNodeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Node.h (188734 => 188735)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Node.h        2015-08-21 01:46:36 UTC (rev 188734)
+++ trunk/Source/WebCore/dom/Node.h        2015-08-21 02:10:29 UTC (rev 188735)
</span><span class="lines">@@ -43,7 +43,7 @@
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><span class="cx"> class Attribute;
</span><del>-class ClassNodeList;
</del><ins>+class ClassCollection;
</ins><span class="cx"> class ContainerNode;
</span><span class="cx"> class DOMSettableTokenList;
</span><span class="cx"> class Document;
</span></span></pre></div>
<a id="trunkSourceWebCoredomNodeListh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/NodeList.h (188734 => 188735)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/NodeList.h        2015-08-21 01:46:36 UTC (rev 188734)
+++ trunk/Source/WebCore/dom/NodeList.h        2015-08-21 02:10:29 UTC (rev 188735)
</span><span class="lines">@@ -24,21 +24,19 @@
</span><span class="cx"> #ifndef NodeList_h
</span><span class="cx"> #define NodeList_h
</span><span class="cx">
</span><ins>+#include "NodeListBase.h"
</ins><span class="cx"> #include "ScriptWrappable.h"
</span><span class="cx"> #include <wtf/Forward.h>
</span><del>-#include <wtf/RefCounted.h>
</del><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><span class="cx"> class Node;
</span><span class="cx">
</span><del>-class NodeList : public ScriptWrappable, public RefCounted<NodeList> {
</del><ins>+class NodeList : public NodeListBase, public ScriptWrappable {
</ins><span class="cx"> public:
</span><span class="cx"> virtual ~NodeList() { }
</span><span class="cx">
</span><span class="cx"> // DOM methods & attributes for NodeList
</span><del>- virtual unsigned length() const = 0;
- virtual Node* item(unsigned index) const = 0;
</del><span class="cx"> virtual Node* namedItem(const AtomicString&) const = 0;
</span><span class="cx">
</span><span class="cx"> // Other methods (not part of DOM)
</span></span></pre></div>
<a id="trunkSourceWebCoredomNodeListBaseh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/dom/NodeListBase.h (0 => 188735)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/NodeListBase.h         (rev 0)
+++ trunk/Source/WebCore/dom/NodeListBase.h        2015-08-21 02:10:29 UTC (rev 188735)
</span><span class="lines">@@ -0,0 +1,47 @@
</span><ins>+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef NodeListBase_h
+#define NodeListBase_h
+
+#include <wtf/RefCounted.h>
+
+namespace WebCore {
+
+class Node;
+
+// This is a common base class for NodeList / HTMLCollection to maintain legacy ObjC API compatibility.
+class NodeListBase : public RefCounted<NodeListBase> {
+public:
+ virtual ~NodeListBase() { }
+
+ virtual unsigned length() const = 0;
+ virtual Node* item(unsigned index) const = 0;
+};
+
+} // namespace WebCore.
+
+#endif // NodeListBase_h
+
</ins></span></pre></div>
<a id="trunkSourceWebCoredomNodeRareDatah"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/NodeRareData.h (188734 => 188735)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/NodeRareData.h        2015-08-21 01:46:36 UTC (rev 188734)
+++ trunk/Source/WebCore/dom/NodeRareData.h        2015-08-21 02:10:29 UTC (rev 188735)
</span><span class="lines">@@ -23,7 +23,7 @@
</span><span class="cx"> #define NodeRareData_h
</span><span class="cx">
</span><span class="cx"> #include "ChildNodeList.h"
</span><del>-#include "ClassNodeList.h"
</del><ins>+#include "ClassCollection.h"
</ins><span class="cx"> #include "DOMSettableTokenList.h"
</span><span class="cx"> #include "HTMLCollection.h"
</span><span class="cx"> #include "HTMLNames.h"
</span><span class="lines">@@ -47,12 +47,11 @@
</span><span class="cx"> class TreeScope;
</span><span class="cx">
</span><span class="cx"> template <class ListType> struct NodeListTypeIdentifier;
</span><del>-template <> struct NodeListTypeIdentifier<ClassNodeList> { static int value() { return 0; } };
-template <> struct NodeListTypeIdentifier<NameNodeList> { static int value() { return 1; } };
-template <> struct NodeListTypeIdentifier<TagNodeList> { static int value() { return 2; } };
-template <> struct NodeListTypeIdentifier<HTMLTagNodeList> { static int value() { return 3; } };
-template <> struct NodeListTypeIdentifier<RadioNodeList> { static int value() { return 4; } };
-template <> struct NodeListTypeIdentifier<LabelsNodeList> { static int value() { return 5; } };
</del><ins>+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; } };
</ins><span class="cx">
</span><span class="cx"> class NodeListsNodeData {
</span><span class="cx"> WTF_MAKE_NONCOPYABLE(NodeListsNodeData); WTF_MAKE_FAST_ALLOCATED;
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlCollectionTypeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/CollectionType.h (188734 => 188735)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/CollectionType.h        2015-08-21 01:46:36 UTC (rev 188734)
+++ trunk/Source/WebCore/html/CollectionType.h        2015-08-21 02:10:29 UTC (rev 188735)
</span><span class="lines">@@ -50,7 +50,8 @@
</span><span class="cx"> SelectedOptions,
</span><span class="cx"> DataListOptions,
</span><span class="cx"> MapAreas,
</span><del>- FormControls
</del><ins>+ FormControls,
+ ByClass,
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> enum class CollectionTraversalType { Descendants, ChildrenOnly, CustomForwardOnly };
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlGenericCachedHTMLCollectioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/GenericCachedHTMLCollection.cpp (188734 => 188735)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/GenericCachedHTMLCollection.cpp        2015-08-21 01:46:36 UTC (rev 188734)
+++ trunk/Source/WebCore/html/GenericCachedHTMLCollection.cpp        2015-08-21 02:10:29 UTC (rev 188735)
</span><span class="lines">@@ -71,6 +71,7 @@
</span><span class="cx"> return (element.hasTagName(aTag) || element.hasTagName(areaTag)) && element.fastHasAttribute(hrefAttr);
</span><span class="cx"> case DocAnchors:
</span><span class="cx"> return element.hasTagName(aTag) && element.fastHasAttribute(nameAttr);
</span><ins>+ case ByClass:
</ins><span class="cx"> case DocAll:
</span><span class="cx"> case DocumentNamedItems:
</span><span class="cx"> case FormControls:
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLCollectioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLCollection.cpp (188734 => 188735)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLCollection.cpp        2015-08-21 01:46:36 UTC (rev 188734)
+++ trunk/Source/WebCore/html/HTMLCollection.cpp        2015-08-21 02:10:29 UTC (rev 188735)
</span><span class="lines">@@ -46,6 +46,7 @@
</span><span class="cx"> case DocumentNamedItems:
</span><span class="cx"> case FormControls:
</span><span class="cx"> return HTMLCollection::IsRootedAtDocument;
</span><ins>+ case ByClass:
</ins><span class="cx"> case NodeChildren:
</span><span class="cx"> case TableTBodies:
</span><span class="cx"> case TSectionRows:
</span><span class="lines">@@ -82,6 +83,8 @@
</span><span class="cx"> case DataListOptions:
</span><span class="cx"> // FIXME: We can do better some day.
</span><span class="cx"> return InvalidateOnAnyAttrChange;
</span><ins>+ case ByClass:
+ return InvalidateOnClassAttrChange;
</ins><span class="cx"> case DocAnchors:
</span><span class="cx"> return InvalidateOnNameAttrChange;
</span><span class="cx"> case DocLinks:
</span><span class="lines">@@ -113,9 +116,16 @@
</span><span class="cx"> if (hasNamedElementCache())
</span><span class="cx"> document().collectionWillClearIdNameMap(*this);
</span><span class="cx">
</span><del>- // HTMLNameCollection removes cache by itself.
- if (type() != WindowNamedItems && type() != DocumentNamedItems)
</del><ins>+ // HTMLNameCollection & ClassCollection remove cache by themselves.
+ // FIXME: We need a cleaner way to handle this.
+ switch (type()) {
+ case ByClass:
+ case WindowNamedItems:
+ case DocumentNamedItems:
+ break;
+ default:
</ins><span class="cx"> ownerNode().nodeLists()->removeCachedCollection(this);
</span><ins>+ }
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void HTMLCollection::invalidateCache(Document& document)
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLCollectionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLCollection.h (188734 => 188735)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLCollection.h        2015-08-21 01:46:36 UTC (rev 188734)
+++ trunk/Source/WebCore/html/HTMLCollection.h        2015-08-21 02:10:29 UTC (rev 188735)
</span><span class="lines">@@ -58,13 +58,12 @@
</span><span class="cx"> #endif
</span><span class="cx"> };
</span><span class="cx">
</span><del>-class HTMLCollection : public ScriptWrappable, public RefCounted<HTMLCollection> {
</del><ins>+class HTMLCollection : public NodeListBase, public ScriptWrappable {
</ins><span class="cx"> public:
</span><span class="cx"> virtual ~HTMLCollection();
</span><span class="cx">
</span><span class="cx"> // DOM API
</span><del>- virtual unsigned length() const = 0;
- virtual Element* item(unsigned offset) const = 0;
</del><ins>+ virtual Element* item(unsigned index) const = 0; // Tighten return type from NodeListBase::item().
</ins><span class="cx"> virtual Element* namedItem(const AtomicString& name) const = 0;
</span><span class="cx"> PassRefPtr<NodeList> tags(const String&);
</span><span class="cx">
</span></span></pre>
</div>
</div>
</body>
</html>