| Differences between
and this patch
- a/LayoutTests/fast/dom/getElementsByClassName/dumpHTMLCollection-expected.txt +26 lines
Line 0 a/LayoutTests/fast/dom/getElementsByClassName/dumpHTMLCollection-expected.txt_sec1
1
Line 1
2
Line 2
3
Line 3
4
5
line 4
6
line 5
7
8
[object HTMLDivElement], [object HTMLDivElement], [object HTMLDivElement], length: 3
9
[object HTMLDivElement], [object HTMLDivElement], [object HTMLDivElement], [object HTMLParagraphElement], length: 4
10
[object HTMLDivElement], [object HTMLDivElement], length: 2
11
[object HTMLDivElement], [object HTMLDivElement], length: 2
12
length: 0
13
length: 0
14
length: 0
15
length: 0
16
length: 0
17
[object HTMLDivElement], length: 1
18
[object HTMLDivElement], [object HTMLParagraphElement], length: 2
19
[object HTMLDivElement], length: 1
20
[object HTMLDivElement], length: 1
21
length: 0
22
length: 0
23
length: 0
24
length: 0
25
length: 0
26
- a/LayoutTests/fast/dom/getElementsByClassName/dumpHTMLCollection.html +54 lines
Line 0 a/LayoutTests/fast/dom/getElementsByClassName/dumpHTMLCollection.html_sec1
1
<html>
2
<body>
3
<div class="one">Line 1<div class="two">Line 2</div><p>Line <i>3</i></p></div>
4
<div id="test" class="one two"><div class="one two">line 4</div><p class="two">line 5</p></div>
5
<p><ol id="console"></ol></p>
6
<script type="text/javascript">
7
    if (window.testRunner)
8
        testRunner.dumpAsText();
9
10
    function log(message)
11
    {
12
        var item = document.createElement("li");
13
        item.appendChild(document.createTextNode(message));
14
        document.getElementById("console").appendChild(item);
15
    }
16
    
17
    HTMLCollection.prototype.dump = function()
18
    {
19
        var result = "";
20
        var i = 0;
21
        for (; i < this.length; i++)
22
            result += this[i] + ", ";
23
        result += "length: " + i;
24
        return result;
25
    }
26
27
    try {
28
        var elm = document.getElementById("test");
29
30
        log(document.getElementsByClassName("one").dump());
31
        log(document.getElementsByClassName("two").dump());
32
        log(document.getElementsByClassName("one two").dump());
33
        log(document.getElementsByClassName("one\t\t\n \ftwo").dump());
34
        log(document.getElementsByClassName("").dump());
35
        log(document.getElementsByClassName("onetwo").dump());
36
        log(document.getElementsByClassName().dump());
37
        log(document.getElementsByClassName(null).dump());
38
        log(document.getElementsByClassName(undefined).dump());
39
40
        log(elm.getElementsByClassName("one").dump());
41
        log(elm.getElementsByClassName("two").dump());
42
        log(elm.getElementsByClassName("one two").dump());
43
        log(elm.getElementsByClassName("one\t\t\n \ftwo").dump());
44
        log(elm.getElementsByClassName("").dump());
45
        log(elm.getElementsByClassName("onetwo").dump());
46
        log(elm.getElementsByClassName().dump());
47
        log(elm.getElementsByClassName(null).dump());
48
        log(elm.getElementsByClassName(undefined).dump());
49
    } catch (ex) {
50
        log("Exception: " + ex.description);
51
    }
52
</script>
53
</body>
54
</html>
- a/LayoutTests/fast/dom/getElementsByClassName/dumpNodeList-expected.txt -26 lines
Lines 1-26 a/LayoutTests/fast/dom/getElementsByClassName/dumpNodeList-expected.txt_sec1
1
Line 1
2
Line 2
3
Line 3
4
5
line 4
6
line 5
7
8
[object HTMLDivElement], [object HTMLDivElement], [object HTMLDivElement], length: 3
9
[object HTMLDivElement], [object HTMLDivElement], [object HTMLDivElement], [object HTMLParagraphElement], length: 4
10
[object HTMLDivElement], [object HTMLDivElement], length: 2
11
[object HTMLDivElement], [object HTMLDivElement], length: 2
12
length: 0
13
length: 0
14
length: 0
15
length: 0
16
length: 0
17
[object HTMLDivElement], length: 1
18
[object HTMLDivElement], [object HTMLParagraphElement], length: 2
19
[object HTMLDivElement], length: 1
20
[object HTMLDivElement], length: 1
21
length: 0
22
length: 0
23
length: 0
24
length: 0
25
length: 0
26
- a/LayoutTests/fast/dom/getElementsByClassName/dumpNodeList.html -54 lines
Lines 1-54 a/LayoutTests/fast/dom/getElementsByClassName/dumpNodeList.html_sec1
1
<html>
2
<body>
3
<div class="one">Line 1<div class="two">Line 2</div><p>Line <i>3</i></p></div>
4
<div id="test" class="one two"><div class="one two">line 4</div><p class="two">line 5</p></div>
5
<p><ol id="console"></ol></p>
6
<script type="text/javascript">
7
    if (window.testRunner)
8
        testRunner.dumpAsText();
9
10
    function log(message)
11
    {
12
        var item = document.createElement("li");
13
        item.appendChild(document.createTextNode(message));
14
        document.getElementById("console").appendChild(item);
15
    }
16
    
17
    NodeList.prototype.dump = function()
18
    {
19
        var result = "";
20
        var i = 0;
21
        for (; i < this.length; i++)
22
            result += this[i] + ", ";
23
        result += "length: " + i;
24
        return result;
25
    }
26
27
    try {
28
        var elm = document.getElementById("test");
29
30
        log(document.getElementsByClassName("one").dump());
31
        log(document.getElementsByClassName("two").dump());
32
        log(document.getElementsByClassName("one two").dump());
33
        log(document.getElementsByClassName("one\t\t\n \ftwo").dump());
34
        log(document.getElementsByClassName("").dump());
35
        log(document.getElementsByClassName("onetwo").dump());
36
        log(document.getElementsByClassName().dump());
37
        log(document.getElementsByClassName(null).dump());
38
        log(document.getElementsByClassName(undefined).dump());
39
40
        log(elm.getElementsByClassName("one").dump());
41
        log(elm.getElementsByClassName("two").dump());
42
        log(elm.getElementsByClassName("one two").dump());
43
        log(elm.getElementsByClassName("one\t\t\n \ftwo").dump());
44
        log(elm.getElementsByClassName("").dump());
45
        log(elm.getElementsByClassName("onetwo").dump());
46
        log(elm.getElementsByClassName().dump());
47
        log(elm.getElementsByClassName(null).dump());
48
        log(elm.getElementsByClassName(undefined).dump());
49
    } catch (ex) {
50
        log("Exception: " + ex.description);
51
    }
52
</script>
53
</body>
54
</html>
- a/LayoutTests/fast/dom/getElementsByClassName/return-type-expected.txt +11 lines
Line 0 a/LayoutTests/fast/dom/getElementsByClassName/return-type-expected.txt_sec1
1
Tests that getElementsByTagName() returns an HTMLCollection.
2
3
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
4
5
6
PASS document.getElementsByClassName("test").__proto__ is HTMLCollection.prototype
7
PASS document.body.getElementsByClassName("test").__proto__ is HTMLCollection.prototype
8
PASS successfullyParsed is true
9
10
TEST COMPLETE
11
- a/LayoutTests/fast/dom/getElementsByClassName/return-type.html +13 lines
Line 0 a/LayoutTests/fast/dom/getElementsByClassName/return-type.html_sec1
1
<!DOCTYPE html>
2
<html>
3
<body>
4
<script src="../../../resources/js-test.js"></script>
5
<script>
6
description("Tests that getElementsByTagName() returns an HTMLCollection.");
7
8
shouldBe('document.getElementsByClassName("test").__proto__', 'HTMLCollection.prototype');
9
shouldBe('document.body.getElementsByClassName("test").__proto__', 'HTMLCollection.prototype');
10
</script>
11
<script src="../../../resources/js-post.js"></script>
12
<body>
13
</html>
- a/Source/WebCore/CMakeLists.txt -1 / +1 lines
Lines 1357-1363 set(WebCore_SOURCES a/Source/WebCore/CMakeLists.txt_sec1
1357
    dom/CheckedRadioButtons.cpp
1357
    dom/CheckedRadioButtons.cpp
1358
    dom/ChildListMutationScope.cpp
1358
    dom/ChildListMutationScope.cpp
1359
    dom/ChildNodeList.cpp
1359
    dom/ChildNodeList.cpp
1360
    dom/ClassNodeList.cpp
1360
    dom/ClassCollection.cpp
1361
    dom/ClientRect.cpp
1361
    dom/ClientRect.cpp
1362
    dom/ClientRectList.cpp
1362
    dom/ClientRectList.cpp
1363
    dom/ClipboardEvent.cpp
1363
    dom/ClipboardEvent.cpp
- a/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj -2 / +2 lines
Lines 13603-13609 a/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj_sec1
13603
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|Win32'">true</ExcludedFromBuild>
13603
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|Win32'">true</ExcludedFromBuild>
13604
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|x64'">true</ExcludedFromBuild>
13604
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|x64'">true</ExcludedFromBuild>
13605
    </ClCompile>
13605
    </ClCompile>
13606
    <ClCompile Include="..\dom\ClassNodeList.cpp">
13606
    <ClCompile Include="..\dom\ClassCollection.cpp">
13607
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
13607
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
13608
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
13608
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
13609
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|Win32'">true</ExcludedFromBuild>
13609
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|Win32'">true</ExcludedFromBuild>
Lines 22020-22026 a/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj_sec2
22020
    <ClInclude Include="..\dom\CheckedRadioButtons.h" />
22020
    <ClInclude Include="..\dom\CheckedRadioButtons.h" />
22021
    <ClInclude Include="..\dom\ChildListMutationScope.h" />
22021
    <ClInclude Include="..\dom\ChildListMutationScope.h" />
22022
    <ClInclude Include="..\dom\ChildNodeList.h" />
22022
    <ClInclude Include="..\dom\ChildNodeList.h" />
22023
    <ClInclude Include="..\dom\ClassNodeList.h" />
22023
    <ClInclude Include="..\dom\ClassCollection.h" />
22024
    <ClInclude Include="..\dom\ClientRect.h" />
22024
    <ClInclude Include="..\dom\ClientRect.h" />
22025
    <ClInclude Include="..\dom\ClientRectList.h" />
22025
    <ClInclude Include="..\dom\ClientRectList.h" />
22026
    <ClInclude Include="..\dom\ClipboardEvent.h" />
22026
    <ClInclude Include="..\dom\ClipboardEvent.h" />
- a/Source/WebCore/WebCore.xcodeproj/project.pbxproj -8 / +12 lines
Lines 2677-2686 a/Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec1
2677
		830030F51B7D33B500ED3AAC /* GenericCachedHTMLCollection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 830030F31B7D33A600ED3AAC /* GenericCachedHTMLCollection.cpp */; };
2677
		830030F51B7D33B500ED3AAC /* GenericCachedHTMLCollection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 830030F31B7D33A600ED3AAC /* GenericCachedHTMLCollection.cpp */; };
2678
		830030F61B7D33B500ED3AAC /* GenericCachedHTMLCollection.h in Headers */ = {isa = PBXBuildFile; fileRef = 830030F41B7D33A600ED3AAC /* GenericCachedHTMLCollection.h */; };
2678
		830030F61B7D33B500ED3AAC /* GenericCachedHTMLCollection.h in Headers */ = {isa = PBXBuildFile; fileRef = 830030F41B7D33A600ED3AAC /* GenericCachedHTMLCollection.h */; };
2679
		830030F81B7D3B7800ED3AAC /* CachedHTMLCollection.h in Headers */ = {isa = PBXBuildFile; fileRef = 830030F71B7D398800ED3AAC /* CachedHTMLCollection.h */; };
2679
		830030F81B7D3B7800ED3AAC /* CachedHTMLCollection.h in Headers */ = {isa = PBXBuildFile; fileRef = 830030F71B7D398800ED3AAC /* CachedHTMLCollection.h */; };
2680
		831D48C01B7D9A52006DE39A /* ClassNodeList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 831D48BE1B7D9A46006DE39A /* ClassNodeList.cpp */; };
2681
		831D48C11B7D9A52006DE39A /* ClassNodeList.h in Headers */ = {isa = PBXBuildFile; fileRef = 831D48BF1B7D9A46006DE39A /* ClassNodeList.h */; };
2682
		832B843419D8E55100B26055 /* SVGAnimateElementBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 832B843319D8E55100B26055 /* SVGAnimateElementBase.h */; };
2680
		832B843419D8E55100B26055 /* SVGAnimateElementBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 832B843319D8E55100B26055 /* SVGAnimateElementBase.h */; };
2683
		832B843619D8E57400B26055 /* SVGAnimateElementBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 832B843519D8E57400B26055 /* SVGAnimateElementBase.cpp */; };
2681
		832B843619D8E57400B26055 /* SVGAnimateElementBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 832B843519D8E57400B26055 /* SVGAnimateElementBase.cpp */; };
2682
		8348BFAB1B85729800912F36 /* ClassCollection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8348BFA91B85729500912F36 /* ClassCollection.cpp */; };
2683
		8348BFAC1B85729800912F36 /* ClassCollection.h in Headers */ = {isa = PBXBuildFile; fileRef = 8348BFAA1B85729500912F36 /* ClassCollection.h */; };
2684
		83520C7E1A71BFCC006BD2AA /* CSSFontFamily.h in Headers */ = {isa = PBXBuildFile; fileRef = 83520C7D1A71BFCC006BD2AA /* CSSFontFamily.h */; };
2684
		83520C7E1A71BFCC006BD2AA /* CSSFontFamily.h in Headers */ = {isa = PBXBuildFile; fileRef = 83520C7D1A71BFCC006BD2AA /* CSSFontFamily.h */; };
2685
		835D363719FF6193004C93AB /* StyleBuilderCustom.h in Headers */ = {isa = PBXBuildFile; fileRef = 835D363619FF6193004C93AB /* StyleBuilderCustom.h */; };
2685
		835D363719FF6193004C93AB /* StyleBuilderCustom.h in Headers */ = {isa = PBXBuildFile; fileRef = 835D363619FF6193004C93AB /* StyleBuilderCustom.h */; };
2686
		836FBCEA178C113200B21A15 /* SVGAnimatedTypeAnimator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 836FBCE9178C113200B21A15 /* SVGAnimatedTypeAnimator.cpp */; };
2686
		836FBCEA178C113200B21A15 /* SVGAnimatedTypeAnimator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 836FBCE9178C113200B21A15 /* SVGAnimatedTypeAnimator.cpp */; };
Lines 2690-2695 a/Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec2
2690
		8386A97019F61E4F00E1EC4A /* StyleBuilder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8386A96E19F61E4F00E1EC4A /* StyleBuilder.cpp */; };
2690
		8386A97019F61E4F00E1EC4A /* StyleBuilder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8386A96E19F61E4F00E1EC4A /* StyleBuilder.cpp */; };
2691
		839AAFEC1A0C0C8D00605F99 /* HTMLWBRElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 839AAFEA1A0C0C8D00605F99 /* HTMLWBRElement.cpp */; };
2691
		839AAFEC1A0C0C8D00605F99 /* HTMLWBRElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 839AAFEA1A0C0C8D00605F99 /* HTMLWBRElement.cpp */; };
2692
		839AAFED1A0C0C8D00605F99 /* HTMLWBRElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 839AAFEB1A0C0C8D00605F99 /* HTMLWBRElement.h */; };
2692
		839AAFED1A0C0C8D00605F99 /* HTMLWBRElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 839AAFEB1A0C0C8D00605F99 /* HTMLWBRElement.h */; };
2693
		83AAE64A1B85816B009FAF70 /* NodeListBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 83AAE6491B858168009FAF70 /* NodeListBase.h */; settings = {ATTRIBUTES = (Private, ); }; };
2693
		83B9687B19F8AB83004EF7AF /* StyleBuilderConverter.h in Headers */ = {isa = PBXBuildFile; fileRef = 83B9687919F8AB83004EF7AF /* StyleBuilderConverter.h */; };
2694
		83B9687B19F8AB83004EF7AF /* StyleBuilderConverter.h in Headers */ = {isa = PBXBuildFile; fileRef = 83B9687919F8AB83004EF7AF /* StyleBuilderConverter.h */; };
2694
		83C05A5A1A686212007E5DEA /* StylePropertyShorthandFunctions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83C05A581A686212007E5DEA /* StylePropertyShorthandFunctions.cpp */; };
2695
		83C05A5A1A686212007E5DEA /* StylePropertyShorthandFunctions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83C05A581A686212007E5DEA /* StylePropertyShorthandFunctions.cpp */; };
2695
		83C05A5B1A686212007E5DEA /* StylePropertyShorthandFunctions.h in Headers */ = {isa = PBXBuildFile; fileRef = 83C05A591A686212007E5DEA /* StylePropertyShorthandFunctions.h */; };
2696
		83C05A5B1A686212007E5DEA /* StylePropertyShorthandFunctions.h in Headers */ = {isa = PBXBuildFile; fileRef = 83C05A591A686212007E5DEA /* StylePropertyShorthandFunctions.h */; };
Lines 10040-10049 a/Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec3
10040
		830030F31B7D33A600ED3AAC /* GenericCachedHTMLCollection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GenericCachedHTMLCollection.cpp; sourceTree = "<group>"; };
10041
		830030F31B7D33A600ED3AAC /* GenericCachedHTMLCollection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GenericCachedHTMLCollection.cpp; sourceTree = "<group>"; };
10041
		830030F41B7D33A600ED3AAC /* GenericCachedHTMLCollection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GenericCachedHTMLCollection.h; sourceTree = "<group>"; };
10042
		830030F41B7D33A600ED3AAC /* GenericCachedHTMLCollection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GenericCachedHTMLCollection.h; sourceTree = "<group>"; };
10042
		830030F71B7D398800ED3AAC /* CachedHTMLCollection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CachedHTMLCollection.h; sourceTree = "<group>"; };
10043
		830030F71B7D398800ED3AAC /* CachedHTMLCollection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CachedHTMLCollection.h; sourceTree = "<group>"; };
10043
		831D48BE1B7D9A46006DE39A /* ClassNodeList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ClassNodeList.cpp; sourceTree = "<group>"; };
10044
		831D48BF1B7D9A46006DE39A /* ClassNodeList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ClassNodeList.h; sourceTree = "<group>"; };
10045
		832B843319D8E55100B26055 /* SVGAnimateElementBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAnimateElementBase.h; sourceTree = "<group>"; };
10044
		832B843319D8E55100B26055 /* SVGAnimateElementBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAnimateElementBase.h; sourceTree = "<group>"; };
10046
		832B843519D8E57400B26055 /* SVGAnimateElementBase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGAnimateElementBase.cpp; sourceTree = "<group>"; };
10045
		832B843519D8E57400B26055 /* SVGAnimateElementBase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGAnimateElementBase.cpp; sourceTree = "<group>"; };
10046
		8348BFA91B85729500912F36 /* ClassCollection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ClassCollection.cpp; sourceTree = "<group>"; };
10047
		8348BFAA1B85729500912F36 /* ClassCollection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ClassCollection.h; sourceTree = "<group>"; };
10047
		83520C7D1A71BFCC006BD2AA /* CSSFontFamily.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSFontFamily.h; sourceTree = "<group>"; };
10048
		83520C7D1A71BFCC006BD2AA /* CSSFontFamily.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSFontFamily.h; sourceTree = "<group>"; };
10048
		835D363619FF6193004C93AB /* StyleBuilderCustom.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StyleBuilderCustom.h; sourceTree = "<group>"; };
10049
		835D363619FF6193004C93AB /* StyleBuilderCustom.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StyleBuilderCustom.h; sourceTree = "<group>"; };
10049
		8369E58F1AFDD0300087DF68 /* NonDocumentTypeChildNode.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = NonDocumentTypeChildNode.idl; sourceTree = "<group>"; };
10050
		8369E58F1AFDD0300087DF68 /* NonDocumentTypeChildNode.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = NonDocumentTypeChildNode.idl; sourceTree = "<group>"; };
Lines 10054-10059 a/Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec4
10054
		8386A96E19F61E4F00E1EC4A /* StyleBuilder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StyleBuilder.cpp; sourceTree = "<group>"; };
10055
		8386A96E19F61E4F00E1EC4A /* StyleBuilder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StyleBuilder.cpp; sourceTree = "<group>"; };
10055
		839AAFEA1A0C0C8D00605F99 /* HTMLWBRElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLWBRElement.cpp; sourceTree = "<group>"; };
10056
		839AAFEA1A0C0C8D00605F99 /* HTMLWBRElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLWBRElement.cpp; sourceTree = "<group>"; };
10056
		839AAFEB1A0C0C8D00605F99 /* HTMLWBRElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTMLWBRElement.h; sourceTree = "<group>"; };
10057
		839AAFEB1A0C0C8D00605F99 /* HTMLWBRElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTMLWBRElement.h; sourceTree = "<group>"; };
10058
		83AAE6491B858168009FAF70 /* NodeListBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NodeListBase.h; sourceTree = "<group>"; };
10057
		83B9687919F8AB83004EF7AF /* StyleBuilderConverter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StyleBuilderConverter.h; sourceTree = "<group>"; };
10059
		83B9687919F8AB83004EF7AF /* StyleBuilderConverter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StyleBuilderConverter.h; sourceTree = "<group>"; };
10058
		83C05A581A686212007E5DEA /* StylePropertyShorthandFunctions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StylePropertyShorthandFunctions.cpp; sourceTree = "<group>"; };
10060
		83C05A581A686212007E5DEA /* StylePropertyShorthandFunctions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StylePropertyShorthandFunctions.cpp; sourceTree = "<group>"; };
10059
		83C05A591A686212007E5DEA /* StylePropertyShorthandFunctions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StylePropertyShorthandFunctions.h; sourceTree = "<group>"; };
10061
		83C05A591A686212007E5DEA /* StylePropertyShorthandFunctions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StylePropertyShorthandFunctions.h; sourceTree = "<group>"; };
Lines 23177-23184 a/Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec5
23177
				83D26D3C1AFDCC50001B3873 /* ChildNode.idl */,
23179
				83D26D3C1AFDCC50001B3873 /* ChildNode.idl */,
23178
				A818721A0977D3C0005826D9 /* ChildNodeList.cpp */,
23180
				A818721A0977D3C0005826D9 /* ChildNodeList.cpp */,
23179
				A81872150977D3C0005826D9 /* ChildNodeList.h */,
23181
				A81872150977D3C0005826D9 /* ChildNodeList.h */,
23180
				831D48BE1B7D9A46006DE39A /* ClassNodeList.cpp */,
23182
				8348BFA91B85729500912F36 /* ClassCollection.cpp */,
23181
				831D48BF1B7D9A46006DE39A /* ClassNodeList.h */,
23183
				8348BFAA1B85729500912F36 /* ClassCollection.h */,
23182
				BCC065770F3CE1B700CD2D87 /* ClientRect.cpp */,
23184
				BCC065770F3CE1B700CD2D87 /* ClientRect.cpp */,
23183
				BCC065780F3CE1B700CD2D87 /* ClientRect.h */,
23185
				BCC065780F3CE1B700CD2D87 /* ClientRect.h */,
23184
				BCC065790F3CE1B700CD2D87 /* ClientRect.idl */,
23186
				BCC065790F3CE1B700CD2D87 /* ClientRect.idl */,
Lines 23402-23407 a/Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec6
23402
				1A750D870A90E394000FF215 /* NodeIterator.idl */,
23404
				1A750D870A90E394000FF215 /* NodeIterator.idl */,
23403
				A81872100977D3C0005826D9 /* NodeList.h */,
23405
				A81872100977D3C0005826D9 /* NodeList.h */,
23404
				85ACA9FA0A9B631000671E90 /* NodeList.idl */,
23406
				85ACA9FA0A9B631000671E90 /* NodeList.idl */,
23407
				83AAE6491B858168009FAF70 /* NodeListBase.h */,
23405
				7CEAC1081B483D7F00334482 /* NodeOrString.cpp */,
23408
				7CEAC1081B483D7F00334482 /* NodeOrString.cpp */,
23406
				7CEAC1061B483D1D00334482 /* NodeOrString.h */,
23409
				7CEAC1061B483D1D00334482 /* NodeOrString.h */,
23407
				4FAB48661643A67E00F70C07 /* NodeRareData.cpp */,
23410
				4FAB48661643A67E00F70C07 /* NodeRareData.cpp */,
Lines 24571-24577 a/Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec7
24571
				85E711960AC5D5350053270F /* DOMDocumentTypeInternal.h in Headers */,
24574
				85E711960AC5D5350053270F /* DOMDocumentTypeInternal.h in Headers */,
24572
				8518DCE90A9CC80D0091B7A6 /* DOMDOMImplementation.h in Headers */,
24575
				8518DCE90A9CC80D0091B7A6 /* DOMDOMImplementation.h in Headers */,
24573
				85E711970AC5D5350053270F /* DOMDOMImplementationInternal.h in Headers */,
24576
				85E711970AC5D5350053270F /* DOMDOMImplementationInternal.h in Headers */,
24574
				831D48C11B7D9A52006DE39A /* ClassNodeList.h in Headers */,
24575
				52CCA9E815E3F64C0053C77F /* DOMDOMNamedFlowCollection.h in Headers */,
24577
				52CCA9E815E3F64C0053C77F /* DOMDOMNamedFlowCollection.h in Headers */,
24576
				52CCA9EA15E3F64C0053C77F /* DOMDOMNamedFlowCollectionInternal.h in Headers */,
24578
				52CCA9EA15E3F64C0053C77F /* DOMDOMNamedFlowCollectionInternal.h in Headers */,
24577
				2D9A247415B9C2E300D34527 /* DOMDOMSecurityPolicy.h in Headers */,
24579
				2D9A247415B9C2E300D34527 /* DOMDOMSecurityPolicy.h in Headers */,
Lines 24796-24801 a/Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec8
24796
				85E711D90AC5D5350053270F /* DOMTextInternal.h in Headers */,
24798
				85E711D90AC5D5350053270F /* DOMTextInternal.h in Headers */,
24797
				188604B40F2E654A000B6443 /* DOMTimer.h in Headers */,
24799
				188604B40F2E654A000B6443 /* DOMTimer.h in Headers */,
24798
				05FD69E012845D4300B2BEB3 /* DOMTimeStamp.h in Headers */,
24800
				05FD69E012845D4300B2BEB3 /* DOMTimeStamp.h in Headers */,
24801
				8348BFAC1B85729800912F36 /* ClassCollection.h in Headers */,
24799
				76FC2B0C12370DA0006A991A /* DOMTokenList.h in Headers */,
24802
				76FC2B0C12370DA0006A991A /* DOMTokenList.h in Headers */,
24800
				0F54DCD51880F867003EEDBB /* DOMTouch.h in Headers */,
24803
				0F54DCD51880F867003EEDBB /* DOMTouch.h in Headers */,
24801
				0F54DCD71880F867003EEDBB /* DOMTouchEvent.h in Headers */,
24804
				0F54DCD71880F867003EEDBB /* DOMTouchEvent.h in Headers */,
Lines 26233-26238 a/Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec9
26233
				1477E7770BF4134A00152872 /* PageCache.h in Headers */,
26236
				1477E7770BF4134A00152872 /* PageCache.h in Headers */,
26234
				CD5E5B5F1A15CE54000C609E /* PageConfiguration.h in Headers */,
26237
				CD5E5B5F1A15CE54000C609E /* PageConfiguration.h in Headers */,
26235
				F3820893147D35F90010BC06 /* PageConsoleAgent.h in Headers */,
26238
				F3820893147D35F90010BC06 /* PageConsoleAgent.h in Headers */,
26239
				83AAE64A1B85816B009FAF70 /* NodeListBase.h in Headers */,
26236
				DAED203116F244480070EC0F /* PageConsoleClient.h in Headers */,
26240
				DAED203116F244480070EC0F /* PageConsoleClient.h in Headers */,
26237
				A5A2AF0C1829734300DE1729 /* PageDebuggable.h in Headers */,
26241
				A5A2AF0C1829734300DE1729 /* PageDebuggable.h in Headers */,
26238
				F34742DD134362F000531BC2 /* PageDebuggerAgent.h in Headers */,
26242
				F34742DD134362F000531BC2 /* PageDebuggerAgent.h in Headers */,
Lines 28997-29003 a/Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec10
28997
				A9C6E64C0D7465E7006442E9 /* JSDOMPluginArrayCustom.cpp in Sources */,
29001
				A9C6E64C0D7465E7006442E9 /* JSDOMPluginArrayCustom.cpp in Sources */,
28998
				A9C6E64D0D7465E7006442E9 /* JSDOMPluginCustom.cpp in Sources */,
29002
				A9C6E64D0D7465E7006442E9 /* JSDOMPluginCustom.cpp in Sources */,
28999
				E172AF8F1811BC3700FBADB9 /* JSDOMPromise.cpp in Sources */,
29003
				E172AF8F1811BC3700FBADB9 /* JSDOMPromise.cpp in Sources */,
29000
				831D48C01B7D9A52006DE39A /* ClassNodeList.cpp in Sources */,
29001
				BC5A86B50C3367E800EEA649 /* JSDOMSelection.cpp in Sources */,
29004
				BC5A86B50C3367E800EEA649 /* JSDOMSelection.cpp in Sources */,
29002
				4ACBC0CA12713D0A0094F9B2 /* JSDOMSettableTokenList.cpp in Sources */,
29005
				4ACBC0CA12713D0A0094F9B2 /* JSDOMSettableTokenList.cpp in Sources */,
29003
				C5137CF211A58378004ADB99 /* JSDOMStringList.cpp in Sources */,
29006
				C5137CF211A58378004ADB99 /* JSDOMStringList.cpp in Sources */,
Lines 29884-29889 a/Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec11
29884
				B776D43D1104527500BEB0EC /* PrintContext.cpp in Sources */,
29887
				B776D43D1104527500BEB0EC /* PrintContext.cpp in Sources */,
29885
				A8EA7EBD0A1945D000A8EF5F /* ProcessingInstruction.cpp in Sources */,
29888
				A8EA7EBD0A1945D000A8EF5F /* ProcessingInstruction.cpp in Sources */,
29886
				E44613EB0CD681B400FADA75 /* ProgressEvent.cpp in Sources */,
29889
				E44613EB0CD681B400FADA75 /* ProgressEvent.cpp in Sources */,
29890
				8348BFAB1B85729800912F36 /* ClassCollection.cpp in Sources */,
29887
				A715E652134BBBEC00D8E713 /* ProgressShadowElement.cpp in Sources */,
29891
				A715E652134BBBEC00D8E713 /* ProgressShadowElement.cpp in Sources */,
29888
				1A2A68230B5BEDE70002A480 /* ProgressTracker.cpp in Sources */,
29892
				1A2A68230B5BEDE70002A480 /* ProgressTracker.cpp in Sources */,
29889
				E4BBED0E14F4025D003F0B98 /* PropertySetCSSStyleDeclaration.cpp in Sources */,
29893
				E4BBED0E14F4025D003F0B98 /* PropertySetCSSStyleDeclaration.cpp in Sources */,
- a/Source/WebCore/bindings/scripts/CodeGeneratorObjC.pm +1 lines
Lines 420-425 sub GetImplClassName a/Source/WebCore/bindings/scripts/CodeGeneratorObjC.pm_sec1
420
{
420
{
421
    my $name = shift;
421
    my $name = shift;
422
422
423
    return "NodeListBase" if $name eq "NodeList";
423
    return "DOMWindow" if $name eq "AbstractView";
424
    return "DOMWindow" if $name eq "AbstractView";
424
    return $name;
425
    return $name;
425
}
426
}
- a/Source/WebCore/dom/ClassCollection.cpp +49 lines
Line 0 a/Source/WebCore/dom/ClassCollection.cpp_sec1
1
/*
2
 * Copyright (C) 2007-2008, 2014, 2015 Apple Inc. All rights reserved.
3
 * Copyright (C) 2007 David Smith (catfish.man@gmail.com)
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 *
9
 * 1.  Redistributions of source code must retain the above copyright
10
 *     notice, this list of conditions and the following disclaimer.
11
 * 2.  Redistributions in binary form must reproduce the above copyright
12
 *     notice, this list of conditions and the following disclaimer in the
13
 *     documentation and/or other materials provided with the distribution.
14
 * 3.  Neither the name of Apple Inc. ("Apple") nor the names of
15
 *     its contributors may be used to endorse or promote products derived
16
 *     from this software without specific prior written permission.
17
 *
18
 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
19
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21
 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
22
 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
 */
29
30
#include "config.h"
31
#include "ClassCollection.h"
32
33
#include "NodeRareData.h"
34
#include "StyledElement.h"
35
36
namespace WebCore {
37
38
Ref<ClassCollection> ClassCollection::create(ContainerNode& rootNode, CollectionType type, const AtomicString& classNames)
39
{
40
    ASSERT(type == ByClass);
41
    return adoptRef(*new ClassCollection(rootNode, type, classNames));
42
}
43
44
ClassCollection::~ClassCollection()
45
{
46
    ownerNode().nodeLists()->removeCachedCollection(this, m_originalClassNames);
47
}
48
49
} // namespace WebCore
- a/Source/WebCore/dom/ClassCollection.h +78 lines
Line 0 a/Source/WebCore/dom/ClassCollection.h_sec1
1
/*
2
 * Copyright (C) 2007, 2014, 2015 Apple Inc. All rights reserved.
3
 * Copyright (C) 2007 David Smith (catfish.man@gmail.com)
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 *
9
 * 1.  Redistributions of source code must retain the above copyright
10
 *     notice, this list of conditions and the following disclaimer.
11
 * 2.  Redistributions in binary form must reproduce the above copyright
12
 *     notice, this list of conditions and the following disclaimer in the
13
 *     documentation and/or other materials provided with the distribution.
14
 * 3.  Neither the name of Apple Inc. ("Apple") nor the names of
15
 *     its contributors may be used to endorse or promote products derived
16
 *     from this software without specific prior written permission.
17
 *
18
 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
19
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21
 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
22
 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
 */
29
30
#ifndef ClassCollection_h
31
#define ClassCollection_h
32
33
#include "CachedHTMLCollection.h"
34
#include "Element.h"
35
#include "SpaceSplitString.h"
36
37
namespace WebCore {
38
39
class ClassCollection final : public CachedHTMLCollection<ClassCollection, CollectionTypeTraits<ByClass>::traversalType> {
40
public:
41
    static Ref<ClassCollection> create(ContainerNode&, CollectionType, const AtomicString& classNames);
42
43
    virtual ~ClassCollection();
44
45
    bool elementMatches(Element&) const;
46
47
private:
48
    ClassCollection(ContainerNode& rootNode, CollectionType, const AtomicString& classNames);
49
50
    SpaceSplitString m_classNames;
51
    AtomicString m_originalClassNames;
52
};
53
54
inline ClassCollection::ClassCollection(ContainerNode& rootNode, CollectionType type, const AtomicString& classNames)
55
    : CachedHTMLCollection<ClassCollection, CollectionTypeTraits<ByClass>::traversalType>(rootNode, type)
56
    , m_classNames(classNames, rootNode.document().inQuirksMode())
57
    , m_originalClassNames(classNames)
58
{
59
}
60
61
inline bool ClassCollection::elementMatches(Element& element) const
62
{
63
    if (!element.hasClass())
64
        return false;
65
    if (!m_classNames.size())
66
        return false;
67
    // FIXME: DOM4 allows getElementsByClassName to return non StyledElement.
68
    // https://bugs.webkit.org/show_bug.cgi?id=94718
69
    if (!element.isStyledElement())
70
        return false;
71
    return element.classNames().containsAll(m_classNames);
72
}
73
74
} // namespace WebCore
75
76
SPECIALIZE_TYPE_TRAITS_HTMLCOLLECTION(ClassCollection, ByClass)
77
78
#endif // ClassCollection_h
- a/Source/WebCore/dom/ClassNodeList.cpp -48 lines
Lines 1-48 a/Source/WebCore/dom/ClassNodeList.cpp_sec1
1
/*
2
 * Copyright (C) 2007-2008, 2014 Apple Inc. All rights reserved.
3
 * Copyright (C) 2007 David Smith (catfish.man@gmail.com)
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 *
9
 * 1.  Redistributions of source code must retain the above copyright
10
 *     notice, this list of conditions and the following disclaimer.
11
 * 2.  Redistributions in binary form must reproduce the above copyright
12
 *     notice, this list of conditions and the following disclaimer in the
13
 *     documentation and/or other materials provided with the distribution.
14
 * 3.  Neither the name of Apple Inc. ("Apple") nor the names of
15
 *     its contributors may be used to endorse or promote products derived
16
 *     from this software without specific prior written permission.
17
 *
18
 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
19
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21
 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
22
 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
 */
29
30
#include "config.h"
31
#include "ClassNodeList.h"
32
33
#include "NodeRareData.h"
34
#include "StyledElement.h"
35
36
namespace WebCore {
37
38
Ref<ClassNodeList> ClassNodeList::create(ContainerNode& rootNode, const AtomicString& classNames)
39
{
40
    return adoptRef(*new ClassNodeList(rootNode, classNames));
41
}
42
43
ClassNodeList::~ClassNodeList()
44
{
45
    ownerNode().nodeLists()->removeCacheWithAtomicName(this, m_originalClassNames);
46
}
47
48
} // namespace WebCore
- a/Source/WebCore/dom/ClassNodeList.h -78 lines
Lines 1-78 a/Source/WebCore/dom/ClassNodeList.h_sec1
1
/*
2
 * Copyright (C) 2007, 2014 Apple Inc. All rights reserved.
3
 * Copyright (C) 2007 David Smith (catfish.man@gmail.com)
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 *
9
 * 1.  Redistributions of source code must retain the above copyright
10
 *     notice, this list of conditions and the following disclaimer.
11
 * 2.  Redistributions in binary form must reproduce the above copyright
12
 *     notice, this list of conditions and the following disclaimer in the
13
 *     documentation and/or other materials provided with the distribution.
14
 * 3.  Neither the name of Apple Inc. ("Apple") nor the names of
15
 *     its contributors may be used to endorse or promote products derived
16
 *     from this software without specific prior written permission.
17
 *
18
 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
19
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21
 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
22
 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
 */
29
30
#ifndef ClassNodeList_h
31
#define ClassNodeList_h
32
33
#include "Element.h"
34
#include "LiveNodeList.h"
35
#include "Node.h"
36
#include "SpaceSplitString.h"
37
38
namespace WebCore {
39
40
class ClassNodeList final : public CachedLiveNodeList<ClassNodeList> {
41
public:
42
    static Ref<ClassNodeList> create(ContainerNode&, const AtomicString& classNames);
43
44
    virtual ~ClassNodeList();
45
46
    virtual bool elementMatches(Element&) const override;
47
    virtual bool isRootedAtDocument() const override { return false; }
48
49
private:
50
    ClassNodeList(ContainerNode& rootNode, const AtomicString& classNames);
51
52
    SpaceSplitString m_classNames;
53
    AtomicString m_originalClassNames;
54
};
55
56
inline ClassNodeList::ClassNodeList(ContainerNode& rootNode, const AtomicString& classNames)
57
    : CachedLiveNodeList(rootNode, InvalidateOnClassAttrChange)
58
    , m_classNames(classNames, document().inQuirksMode())
59
    , m_originalClassNames(classNames)
60
{
61
}
62
63
inline bool ClassNodeList::elementMatches(Element& element) const
64
{
65
    if (!element.hasClass())
66
        return false;
67
    if (!m_classNames.size())
68
        return false;
69
    // FIXME: DOM4 allows getElementsByClassName to return non StyledElement.
70
    // https://bugs.webkit.org/show_bug.cgi?id=94718
71
    if (!element.isStyledElement())
72
        return false;
73
    return element.classNames().containsAll(m_classNames);
74
}
75
76
} // namespace WebCore
77
78
#endif // ClassNodeList_h
- a/Source/WebCore/dom/ContainerNode.cpp -3 / +8 lines
Lines 27-33 a/Source/WebCore/dom/ContainerNode.cpp_sec1
27
#include "ChildListMutationScope.h"
27
#include "ChildListMutationScope.h"
28
#include "Chrome.h"
28
#include "Chrome.h"
29
#include "ChromeClient.h"
29
#include "ChromeClient.h"
30
#include "ClassNodeList.h"
30
#include "ClassCollection.h"
31
#include "ContainerNodeAlgorithms.h"
31
#include "ContainerNodeAlgorithms.h"
32
#include "Editor.h"
32
#include "Editor.h"
33
#include "FloatRect.h"
33
#include "FloatRect.h"
Lines 890-898 RefPtr<NodeList> ContainerNode::getElementsByName(const String& elementName) a/Source/WebCore/dom/ContainerNode.cpp_sec2
890
    return ensureRareData().ensureNodeLists().addCacheWithAtomicName<NameNodeList>(*this, elementName);
890
    return ensureRareData().ensureNodeLists().addCacheWithAtomicName<NameNodeList>(*this, elementName);
891
}
891
}
892
892
893
RefPtr<NodeList> ContainerNode::getElementsByClassName(const AtomicString& classNames)
893
RefPtr<HTMLCollection> ContainerNode::getElementsByClassName(const AtomicString& classNames)
894
{
894
{
895
    return ensureRareData().ensureNodeLists().addCacheWithAtomicName<ClassNodeList>(*this, classNames);
895
    return ensureRareData().ensureNodeLists().addCachedCollection<ClassCollection>(*this, ByClass, classNames);
896
}
897
898
RefPtr<NodeListBase> ContainerNode::getElementsByClassNameForObjC(const AtomicString& classNames)
899
{
900
    return getElementsByClassName(classNames);
896
}
901
}
897
902
898
RefPtr<RadioNodeList> ContainerNode::radioNodeList(const AtomicString& name)
903
RefPtr<RadioNodeList> ContainerNode::radioNodeList(const AtomicString& name)
- a/Source/WebCore/dom/ContainerNode.h -1 / +3 lines
Lines 31-36 a/Source/WebCore/dom/ContainerNode.h_sec1
31
namespace WebCore {
31
namespace WebCore {
32
32
33
class HTMLCollection;
33
class HTMLCollection;
34
class NodeListBase;
34
class NodeOrString;
35
class NodeOrString;
35
class QualifiedName;
36
class QualifiedName;
36
class RenderElement;
37
class RenderElement;
Lines 145-151 public: a/Source/WebCore/dom/ContainerNode.h_sec2
145
    RefPtr<NodeList> getElementsByTagName(const AtomicString&);
146
    RefPtr<NodeList> getElementsByTagName(const AtomicString&);
146
    RefPtr<NodeList> getElementsByTagNameNS(const AtomicString& namespaceURI, const AtomicString& localName);
147
    RefPtr<NodeList> getElementsByTagNameNS(const AtomicString& namespaceURI, const AtomicString& localName);
147
    RefPtr<NodeList> getElementsByName(const String& elementName);
148
    RefPtr<NodeList> getElementsByName(const String& elementName);
148
    RefPtr<NodeList> getElementsByClassName(const AtomicString& classNames);
149
    RefPtr<HTMLCollection> getElementsByClassName(const AtomicString& classNames);
150
    RefPtr<NodeListBase> getElementsByClassNameForObjC(const AtomicString& classNames);
149
    RefPtr<RadioNodeList> radioNodeList(const AtomicString&);
151
    RefPtr<RadioNodeList> radioNodeList(const AtomicString&);
150
152
151
    // From the ParentNode interface - https://dom.spec.whatwg.org/#interface-parentnode
153
    // From the ParentNode interface - https://dom.spec.whatwg.org/#interface-parentnode
- a/Source/WebCore/dom/DOMAllInOne.cpp -1 / +1 lines
Lines 35-41 a/Source/WebCore/dom/DOMAllInOne.cpp_sec1
35
#include "CheckedRadioButtons.cpp"
35
#include "CheckedRadioButtons.cpp"
36
#include "ChildListMutationScope.cpp"
36
#include "ChildListMutationScope.cpp"
37
#include "ChildNodeList.cpp"
37
#include "ChildNodeList.cpp"
38
#include "ClassNodeList.cpp"
38
#include "ClassCollection.cpp"
39
#include "ClientRect.cpp"
39
#include "ClientRect.cpp"
40
#include "ClientRectList.cpp"
40
#include "ClientRectList.cpp"
41
#include "ClipboardEvent.cpp"
41
#include "ClipboardEvent.cpp"
- a/Source/WebCore/dom/Document.idl -1 / +5 lines
Lines 210-216 a/Source/WebCore/dom/Document.idl_sec1
210
#endif
210
#endif
211
211
212
    // HTML 5
212
    // HTML 5
213
    NodeList getElementsByClassName([Default=Undefined] optional DOMString classNames);
213
#if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C
214
    [ImplementedAs=getElementsByClassNameForObjC] NodeList getElementsByClassName([Default=Undefined] optional DOMString classNames);
215
#else
216
    HTMLCollection getElementsByClassName([Default=Undefined] optional DOMString classNames);
217
#endif
214
218
215
    readonly attribute Element activeElement;
219
    readonly attribute Element activeElement;
216
    boolean hasFocus();
220
    boolean hasFocus();
- a/Source/WebCore/dom/Element.idl -1 / +5 lines
Lines 107-113 a/Source/WebCore/dom/Element.idl_sec1
107
    void scrollByPages([Default=Undefined] optional long pages);
107
    void scrollByPages([Default=Undefined] optional long pages);
108
108
109
    // HTML 5
109
    // HTML 5
110
    NodeList getElementsByClassName([Default=Undefined] optional DOMString name);
110
#if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C
111
    [ImplementedAs=getElementsByClassNameForObjC] NodeList getElementsByClassName([Default=Undefined] optional DOMString name);
112
#else
113
    HTMLCollection getElementsByClassName([Default=Undefined] optional DOMString name);
114
#endif
111
    [TreatNullAs=NullString, SetterRaisesException] attribute DOMString innerHTML;
115
    [TreatNullAs=NullString, SetterRaisesException] attribute DOMString innerHTML;
112
    [TreatNullAs=NullString, SetterRaisesException] attribute DOMString outerHTML;
116
    [TreatNullAs=NullString, SetterRaisesException] attribute DOMString outerHTML;
113
             
117
             
- a/Source/WebCore/dom/LiveNodeList.cpp -1 / +1 lines
Lines 23-29 a/Source/WebCore/dom/LiveNodeList.cpp_sec1
23
#include "config.h"
23
#include "config.h"
24
#include "LiveNodeList.h"
24
#include "LiveNodeList.h"
25
25
26
#include "ClassNodeList.h"
26
#include "ClassCollection.h"
27
#include "Element.h"
27
#include "Element.h"
28
#include "ElementTraversal.h"
28
#include "ElementTraversal.h"
29
#include "HTMLCollection.h"
29
#include "HTMLCollection.h"
- a/Source/WebCore/dom/Node.h -1 / +1 lines
Lines 43-49 a/Source/WebCore/dom/Node.h_sec1
43
namespace WebCore {
43
namespace WebCore {
44
44
45
class Attribute;
45
class Attribute;
46
class ClassNodeList;
46
class ClassCollection;
47
class ContainerNode;
47
class ContainerNode;
48
class DOMSettableTokenList;
48
class DOMSettableTokenList;
49
class Document;
49
class Document;
- a/Source/WebCore/dom/NodeList.h -4 / +2 lines
Lines 24-44 a/Source/WebCore/dom/NodeList.h_sec1
24
#ifndef NodeList_h
24
#ifndef NodeList_h
25
#define NodeList_h
25
#define NodeList_h
26
26
27
#include "NodeListBase.h"
27
#include "ScriptWrappable.h"
28
#include "ScriptWrappable.h"
28
#include <wtf/Forward.h>
29
#include <wtf/Forward.h>
29
#include <wtf/RefCounted.h>
30
30
31
namespace WebCore {
31
namespace WebCore {
32
32
33
class Node;
33
class Node;
34
34
35
class NodeList : public ScriptWrappable, public RefCounted<NodeList> {
35
class NodeList : public NodeListBase, public ScriptWrappable {
36
public:
36
public:
37
    virtual ~NodeList() { }
37
    virtual ~NodeList() { }
38
38
39
    // DOM methods & attributes for NodeList
39
    // DOM methods & attributes for NodeList
40
    virtual unsigned length() const = 0;
41
    virtual Node* item(unsigned index) const = 0;
42
    virtual Node* namedItem(const AtomicString&) const = 0;
40
    virtual Node* namedItem(const AtomicString&) const = 0;
43
41
44
    // Other methods (not part of DOM)
42
    // Other methods (not part of DOM)
- a/Source/WebCore/dom/NodeList.idl -1 / +1 lines
Lines 25-31 a/Source/WebCore/dom/NodeList.idl_sec1
25
    JSCustomHeader,
25
    JSCustomHeader,
26
    SkipVTableValidation,
26
    SkipVTableValidation,
27
    ReportExtraMemoryCost,
27
    ReportExtraMemoryCost,
28
] interface NodeList {
28
] interface NodeList{
29
29
30
    getter Node item(unsigned long index);
30
    getter Node item(unsigned long index);
31
31
- a/Source/WebCore/dom/NodeListBase.h +47 lines
Line 0 a/Source/WebCore/dom/NodeListBase.h_sec1
1
/*
2
 * Copyright (C) 2015 Apple Inc. All rights reserved.
3
 *
4
 * Redistribution and use in source and binary forms, with or without
5
 * modification, are permitted provided that the following conditions
6
 * are met:
7
 * 1. Redistributions of source code must retain the above copyright
8
 *    notice, this list of conditions and the following disclaimer.
9
 * 2. Redistributions in binary form must reproduce the above copyright
10
 *    notice, this list of conditions and the following disclaimer in the
11
 *    documentation and/or other materials provided with the distribution.
12
 *
13
 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23
 * THE POSSIBILITY OF SUCH DAMAGE.
24
 */
25
26
#ifndef NodeListBase_h
27
#define NodeListBase_h
28
29
#include <wtf/RefCounted.h>
30
31
namespace WebCore {
32
33
class Node;
34
35
// This is a common base class for NodeList / HTMLCollection to maintain legacy ObjC API compatibility.
36
class NodeListBase : public RefCounted<NodeListBase> {
37
public:
38
    virtual ~NodeListBase() { }
39
40
    virtual unsigned length() const = 0;
41
    virtual Node* item(unsigned index) const = 0;
42
};
43
44
} // namespace WebCore.
45
46
#endif // NodeListBase_h
47
- a/Source/WebCore/dom/NodeRareData.h -7 / +6 lines
Lines 23-29 a/Source/WebCore/dom/NodeRareData.h_sec1
23
#define NodeRareData_h
23
#define NodeRareData_h
24
24
25
#include "ChildNodeList.h"
25
#include "ChildNodeList.h"
26
#include "ClassNodeList.h"
26
#include "ClassCollection.h"
27
#include "DOMSettableTokenList.h"
27
#include "DOMSettableTokenList.h"
28
#include "HTMLCollection.h"
28
#include "HTMLCollection.h"
29
#include "HTMLNames.h"
29
#include "HTMLNames.h"
Lines 47-58 class RadioNodeList; a/Source/WebCore/dom/NodeRareData.h_sec2
47
class TreeScope;
47
class TreeScope;
48
48
49
template <class ListType> struct NodeListTypeIdentifier;
49
template <class ListType> struct NodeListTypeIdentifier;
50
template <> struct NodeListTypeIdentifier<ClassNodeList> { static int value() { return 0; } };
50
template <> struct NodeListTypeIdentifier<NameNodeList> { static int value() { return 0; } };
51
template <> struct NodeListTypeIdentifier<NameNodeList> { static int value() { return 1; } };
51
template <> struct NodeListTypeIdentifier<TagNodeList> { static int value() { return 1; } };
52
template <> struct NodeListTypeIdentifier<TagNodeList> { static int value() { return 2; } };
52
template <> struct NodeListTypeIdentifier<HTMLTagNodeList> { static int value() { return 2; } };
53
template <> struct NodeListTypeIdentifier<HTMLTagNodeList> { static int value() { return 3; } };
53
template <> struct NodeListTypeIdentifier<RadioNodeList> { static int value() { return 3; } };
54
template <> struct NodeListTypeIdentifier<RadioNodeList> { static int value() { return 4; } };
54
template <> struct NodeListTypeIdentifier<LabelsNodeList> { static int value() { return 4; } };
55
template <> struct NodeListTypeIdentifier<LabelsNodeList> { static int value() { return 5; } };
56
55
57
class NodeListsNodeData {
56
class NodeListsNodeData {
58
    WTF_MAKE_NONCOPYABLE(NodeListsNodeData); WTF_MAKE_FAST_ALLOCATED;
57
    WTF_MAKE_NONCOPYABLE(NodeListsNodeData); WTF_MAKE_FAST_ALLOCATED;
- a/Source/WebCore/html/CollectionType.h -1 / +2 lines
Lines 50-56 enum CollectionType { a/Source/WebCore/html/CollectionType.h_sec1
50
    SelectedOptions,
50
    SelectedOptions,
51
    DataListOptions,
51
    DataListOptions,
52
    MapAreas,
52
    MapAreas,
53
    FormControls
53
    FormControls,
54
    ByClass,
54
};
55
};
55
56
56
enum class CollectionTraversalType { Descendants, ChildrenOnly, CustomForwardOnly };
57
enum class CollectionTraversalType { Descendants, ChildrenOnly, CustomForwardOnly };
- a/Source/WebCore/html/GenericCachedHTMLCollection.cpp +1 lines
Lines 71-76 bool GenericCachedHTMLCollection<traversalType>::elementMatches(Element& element a/Source/WebCore/html/GenericCachedHTMLCollection.cpp_sec1
71
        return (element.hasTagName(aTag) || element.hasTagName(areaTag)) && element.fastHasAttribute(hrefAttr);
71
        return (element.hasTagName(aTag) || element.hasTagName(areaTag)) && element.fastHasAttribute(hrefAttr);
72
    case DocAnchors:
72
    case DocAnchors:
73
        return element.hasTagName(aTag) && element.fastHasAttribute(nameAttr);
73
        return element.hasTagName(aTag) && element.fastHasAttribute(nameAttr);
74
    case ByClass:
74
    case DocAll:
75
    case DocAll:
75
    case DocumentNamedItems:
76
    case DocumentNamedItems:
76
    case FormControls:
77
    case FormControls:
- a/Source/WebCore/html/HTMLCollection.cpp -2 / +12 lines
Lines 46-51 inline auto HTMLCollection::rootTypeFromCollectionType(CollectionType type) -> R a/Source/WebCore/html/HTMLCollection.cpp_sec1
46
    case DocumentNamedItems:
46
    case DocumentNamedItems:
47
    case FormControls:
47
    case FormControls:
48
        return HTMLCollection::IsRootedAtDocument;
48
        return HTMLCollection::IsRootedAtDocument;
49
    case ByClass:
49
    case NodeChildren:
50
    case NodeChildren:
50
    case TableTBodies:
51
    case TableTBodies:
51
    case TSectionRows:
52
    case TSectionRows:
Lines 82-87 static NodeListInvalidationType invalidationTypeExcludingIdAndNameAttributes(Col a/Source/WebCore/html/HTMLCollection.cpp_sec2
82
    case DataListOptions:
83
    case DataListOptions:
83
        // FIXME: We can do better some day.
84
        // FIXME: We can do better some day.
84
        return InvalidateOnAnyAttrChange;
85
        return InvalidateOnAnyAttrChange;
86
    case ByClass:
87
        return InvalidateOnClassAttrChange;
85
    case DocAnchors:
88
    case DocAnchors:
86
        return InvalidateOnNameAttrChange;
89
        return InvalidateOnNameAttrChange;
87
    case DocLinks:
90
    case DocLinks:
Lines 113-121 HTMLCollection::~HTMLCollection() a/Source/WebCore/html/HTMLCollection.cpp_sec3
113
    if (hasNamedElementCache())
116
    if (hasNamedElementCache())
114
        document().collectionWillClearIdNameMap(*this);
117
        document().collectionWillClearIdNameMap(*this);
115
118
116
    // HTMLNameCollection removes cache by itself.
119
    // HTMLNameCollection & ClassCollection remove cache by themselves.
117
    if (type() != WindowNamedItems && type() != DocumentNamedItems)
120
    // FIXME: We need a cleaner way to handle this.
121
    switch (type()) {
122
    case ByClass:
123
    case WindowNamedItems:
124
    case DocumentNamedItems:
125
        break;
126
    default:
118
        ownerNode().nodeLists()->removeCachedCollection(this);
127
        ownerNode().nodeLists()->removeCachedCollection(this);
128
    }
119
}
129
}
120
130
121
void HTMLCollection::invalidateCache(Document& document)
131
void HTMLCollection::invalidateCache(Document& document)
- a/Source/WebCore/html/HTMLCollection.h -3 / +2 lines
Lines 58-70 private: a/Source/WebCore/html/HTMLCollection.h_sec1
58
#endif
58
#endif
59
};
59
};
60
60
61
class HTMLCollection : public ScriptWrappable, public RefCounted<HTMLCollection> {
61
class HTMLCollection : public NodeListBase, public ScriptWrappable {
62
public:
62
public:
63
    virtual ~HTMLCollection();
63
    virtual ~HTMLCollection();
64
64
65
    // DOM API
65
    // DOM API
66
    virtual unsigned length() const = 0;
66
    virtual Element* item(unsigned index) const = 0; // Tighten return type from NodeListBase::item().
67
    virtual Element* item(unsigned offset) const = 0;
68
    virtual Element* namedItem(const AtomicString& name) const = 0;
67
    virtual Element* namedItem(const AtomicString& name) const = 0;
69
    PassRefPtr<NodeList> tags(const String&);
68
    PassRefPtr<NodeList> tags(const String&);
70
69

Return to Bug 147980