WebCore:
authorweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 14 Dec 2007 21:48:20 +0000 (21:48 +0000)
committerweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 14 Dec 2007 21:48:20 +0000 (21:48 +0000)
commit35eebd8a95727222e0b6da5704174651f915d898
treec906965cb0d610cd84538ccf0d8b70240c8d326e
parent40dc452ddd15cdfb4fbb16fe4052b9c2f7cbb0c0
WebCore:

        Reviewed by Mitz.

        - fix http://bugs.webkit.org/show_bug.cgi?id=14955
          Implement getElementsByClassName.

        This patch also renames AtomicStringList to ClassNames to better reflect its actual use,
        and takes advantage of admitting that it's class-specific to encapsulate class attribute
        parsing so it can be shared.  It also changes the class to use a Vector, rather than a linked
        list to store the class names.

        Tests: fast/dom/getElementsByClassName/001.html
               fast/dom/getElementsByClassName/002.html
               fast/dom/getElementsByClassName/003.html
               fast/dom/getElementsByClassName/004.html
               fast/dom/getElementsByClassName/005.html
               fast/dom/getElementsByClassName/006.html
               fast/dom/getElementsByClassName/007.html
               fast/dom/getElementsByClassName/008.html
               fast/dom/getElementsByClassName/009.html
               fast/dom/getElementsByClassName/010.xml
               fast/dom/getElementsByClassName/011.xml
               fast/dom/getElementsByClassName/012.html
               fast/dom/getElementsByClassName/013.html
               fast/dom/getElementsByClassName/014.html
               fast/dom/getElementsByClassName/array/001.html
               fast/dom/getElementsByClassName/array/002.html
               fast/dom/getElementsByClassName/array/003.html
               fast/dom/getElementsByClassName/array/004.html
               fast/dom/getElementsByClassName/dumpNodeList.html

        * WebCore.xcodeproj/project.pbxproj:
        * css/CSSStyleSelector.cpp:
        (WebCore::CSSStyleSelector::matchRules):
        (WebCore::CSSStyleSelector::checkOneSelector):
        * dom/AtomicStringList.h: Removed.
        * dom/ClassNames.cpp: Added.
        (WebCore::ClassNames::contains):
        (WebCore::ClassNames::parseClassAttribute):
        * dom/ClassNames.h: Copied from WebCore/dom/AtomicStringList.h.
        (WebCore::ClassNames::ClassNames):
        (WebCore::ClassNames::size):
        (WebCore::ClassNames::clear):
        (WebCore::ClassNames::operator[]):
        (WebCore::isClassWhitespace):
        * dom/ClassNodeList.cpp: Added.
        (WebCore::ClassNodeList::ClassNodeList):
        (WebCore::ClassNodeList::length):
        (WebCore::ClassNodeList::item):
        (WebCore::ClassNodeList::nodeMatches):
        * dom/ClassNodeList.h: Added.
        * dom/Document.cpp:
        (WebCore::Document::getElementsByName):
        (WebCore::Document::getElementsByClassName):
        * dom/Document.h:
        * dom/Document.idl:
        * dom/Element.cpp:
        (WebCore::Element::getClassNames):
        (WebCore::Element::getElementsByClassName):
        * dom/Element.h:
        * dom/Element.idl:
        * dom/NameNodeList.cpp:
        (WebCore::NameNodeList::NameNodeList):
        (WebCore::NameNodeList::item):
        (WebCore::NameNodeList::nodeMatches):
        * dom/NameNodeList.h:
        * dom/NamedMappedAttrMap.cpp:
        (WebCore::NamedMappedAttrMap::clearAttributes):
        (WebCore::NamedMappedAttrMap::parseClassAttribute):
        * dom/NamedMappedAttrMap.h:
        (WebCore::NamedMappedAttrMap::getClassNames):
        * dom/StyledElement.cpp:
        (WebCore::StyledElement::getClassNames):
        * dom/StyledElement.h:

LayoutTests:

        Reviewed by Mitz.

        - test for http://bugs.webkit.org/show_bug.cgi?id=14955
          Implement getElementsByClassName

        Tests added from http://tc.labs.opera.com/apis/getElementsByClassName/

        * fast/dom/Window/window-properties-expected.txt:
        * fast/dom/getElementsByClassName: Added.
        * fast/dom/getElementsByClassName/001-expected.txt: Added.
        * fast/dom/getElementsByClassName/001.html: Added.
        * fast/dom/getElementsByClassName/002-expected.txt: Added.
        * fast/dom/getElementsByClassName/002.html: Added.
        * fast/dom/getElementsByClassName/003-expected.txt: Added.
        * fast/dom/getElementsByClassName/003.html: Added.
        * fast/dom/getElementsByClassName/004-expected.txt: Added.
        * fast/dom/getElementsByClassName/004.html: Added.
        * fast/dom/getElementsByClassName/005-expected.txt: Added.
        * fast/dom/getElementsByClassName/005.html: Added.
        * fast/dom/getElementsByClassName/006-expected.txt: Added.
        * fast/dom/getElementsByClassName/006.html: Added.
        * fast/dom/getElementsByClassName/007-expected.txt: Added.
        * fast/dom/getElementsByClassName/007.html: Added.
        * fast/dom/getElementsByClassName/008-expected.txt: Added.
        * fast/dom/getElementsByClassName/008.html: Added.
        * fast/dom/getElementsByClassName/009-expected.txt: Added.
        * fast/dom/getElementsByClassName/009.html: Added.
        * fast/dom/getElementsByClassName/010-expected.txt: Added.
        * fast/dom/getElementsByClassName/010.xml: Added.
        * fast/dom/getElementsByClassName/011-expected.txt: Added.
        * fast/dom/getElementsByClassName/011.xml: Added.
        * fast/dom/getElementsByClassName/012-expected.txt: Added.
        * fast/dom/getElementsByClassName/012.html: Added.
        * fast/dom/getElementsByClassName/013-expected.txt: Added.
        * fast/dom/getElementsByClassName/013.html: Added.
        * fast/dom/getElementsByClassName/014-expected.txt: Added.
        * fast/dom/getElementsByClassName/014.html: Added.
        * fast/dom/getElementsByClassName/array: Added.
        * fast/dom/getElementsByClassName/array/001-expected.txt: Added.
        * fast/dom/getElementsByClassName/array/001.html: Added.
        * fast/dom/getElementsByClassName/array/002-expected.txt: Added.
        * fast/dom/getElementsByClassName/array/002.html: Added.
        * fast/dom/getElementsByClassName/array/003-expected.txt: Added.
        * fast/dom/getElementsByClassName/array/003.html: Added.
        * fast/dom/getElementsByClassName/array/004-expected.txt: Added.
        * fast/dom/getElementsByClassName/array/004.html: Added.
        * fast/dom/getElementsByClassName/dumpNodeList-expected.txt: Added.
        * fast/dom/getElementsByClassName/dumpNodeList.html: Added.
        * fast/dom/getElementsByClassName/resources: Added.
        * fast/dom/getElementsByClassName/resources/common.js: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@28722 268f45cc-cd09-0410-ab3c-d52691b4dbfc
61 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/dom/Window/window-properties-expected.txt
LayoutTests/fast/dom/getElementsByClassName/001-expected.txt [new file with mode: 0644]
LayoutTests/fast/dom/getElementsByClassName/001.html [new file with mode: 0644]
LayoutTests/fast/dom/getElementsByClassName/002-expected.txt [new file with mode: 0644]
LayoutTests/fast/dom/getElementsByClassName/002.html [new file with mode: 0644]
LayoutTests/fast/dom/getElementsByClassName/003-expected.txt [new file with mode: 0644]
LayoutTests/fast/dom/getElementsByClassName/003.html [new file with mode: 0644]
LayoutTests/fast/dom/getElementsByClassName/004-expected.txt [new file with mode: 0644]
LayoutTests/fast/dom/getElementsByClassName/004.html [new file with mode: 0644]
LayoutTests/fast/dom/getElementsByClassName/005-expected.txt [new file with mode: 0644]
LayoutTests/fast/dom/getElementsByClassName/005.html [new file with mode: 0644]
LayoutTests/fast/dom/getElementsByClassName/006-expected.txt [new file with mode: 0644]
LayoutTests/fast/dom/getElementsByClassName/006.html [new file with mode: 0644]
LayoutTests/fast/dom/getElementsByClassName/007-expected.txt [new file with mode: 0644]
LayoutTests/fast/dom/getElementsByClassName/007.html [new file with mode: 0644]
LayoutTests/fast/dom/getElementsByClassName/008-expected.txt [new file with mode: 0644]
LayoutTests/fast/dom/getElementsByClassName/008.html [new file with mode: 0644]
LayoutTests/fast/dom/getElementsByClassName/009-expected.txt [new file with mode: 0644]
LayoutTests/fast/dom/getElementsByClassName/009.html [new file with mode: 0644]
LayoutTests/fast/dom/getElementsByClassName/010-expected.txt [new file with mode: 0644]
LayoutTests/fast/dom/getElementsByClassName/010.xml [new file with mode: 0644]
LayoutTests/fast/dom/getElementsByClassName/011-expected.txt [new file with mode: 0644]
LayoutTests/fast/dom/getElementsByClassName/011.xml [new file with mode: 0644]
LayoutTests/fast/dom/getElementsByClassName/012-expected.txt [new file with mode: 0644]
LayoutTests/fast/dom/getElementsByClassName/012.html [new file with mode: 0644]
LayoutTests/fast/dom/getElementsByClassName/013-expected.txt [new file with mode: 0644]
LayoutTests/fast/dom/getElementsByClassName/013.html [new file with mode: 0644]
LayoutTests/fast/dom/getElementsByClassName/014-expected.txt [new file with mode: 0644]
LayoutTests/fast/dom/getElementsByClassName/014.html [new file with mode: 0644]
LayoutTests/fast/dom/getElementsByClassName/array/001-expected.txt [new file with mode: 0644]
LayoutTests/fast/dom/getElementsByClassName/array/001.html [new file with mode: 0644]
LayoutTests/fast/dom/getElementsByClassName/array/002-expected.txt [new file with mode: 0644]
LayoutTests/fast/dom/getElementsByClassName/array/002.html [new file with mode: 0644]
LayoutTests/fast/dom/getElementsByClassName/array/003-expected.txt [new file with mode: 0644]
LayoutTests/fast/dom/getElementsByClassName/array/003.html [new file with mode: 0644]
LayoutTests/fast/dom/getElementsByClassName/array/004-expected.txt [new file with mode: 0644]
LayoutTests/fast/dom/getElementsByClassName/array/004.html [new file with mode: 0644]
LayoutTests/fast/dom/getElementsByClassName/dumpNodeList-expected.txt [new file with mode: 0644]
LayoutTests/fast/dom/getElementsByClassName/dumpNodeList.html [new file with mode: 0644]
LayoutTests/fast/dom/getElementsByClassName/resources/common.js [new file with mode: 0644]
WebCore/ChangeLog
WebCore/WebCore.xcodeproj/project.pbxproj
WebCore/css/CSSStyleSelector.cpp
WebCore/dom/AtomicStringList.h [deleted file]
WebCore/dom/ClassNames.cpp [new file with mode: 0644]
WebCore/dom/ClassNames.h [new file with mode: 0644]
WebCore/dom/ClassNodeList.cpp [new file with mode: 0644]
WebCore/dom/ClassNodeList.h [new file with mode: 0644]
WebCore/dom/Document.cpp
WebCore/dom/Document.h
WebCore/dom/Document.idl
WebCore/dom/Element.cpp
WebCore/dom/Element.h
WebCore/dom/Element.idl
WebCore/dom/NameNodeList.cpp
WebCore/dom/NameNodeList.h
WebCore/dom/NamedMappedAttrMap.cpp
WebCore/dom/NamedMappedAttrMap.h
WebCore/dom/StyledElement.cpp
WebCore/dom/StyledElement.h