WebCore:
authordsmith@webkit.org <dsmith@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 26 Dec 2007 00:46:46 +0000 (00:46 +0000)
committerdsmith@webkit.org <dsmith@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 26 Dec 2007 00:46:46 +0000 (00:46 +0000)
commit6887e647a6609e10569143a63a45f430eb43e068
treec8cc93b924214160f72bb298b0eac044cd4c5844
parentc24c9d4ad58041c283c58c967d27e9eac9e79e25
WebCore:

        Reviewed by Oliver.

        - http://bugs.webkit.org/show_bug.cgi?id=16587
        Implement the most useful part of the W3C Selectors API.

        * WebCore.xcodeproj/project.pbxproj:
        * css/CSSStyleSelector.h: Make Node a friend of CSSStyleSelector so it can use checkSelector()
        * dom/ChildNodeList.cpp:
        (WebCore::ChildNodeList::ChildNodeList): Change to being a DynamicNodeList
        * dom/ChildNodeList.h:
        * dom/ClassNodeList.cpp:
        (WebCore::ClassNodeList::ClassNodeList): Change to being a DynamicNodeList
        * dom/ClassNodeList.h:
        * dom/Document.idl: Add the new functions
        * dom/DynamicNodeList.cpp: Copied from WebCore/dom/NodeList.cpp.
        (WebCore::DynamicNodeList::DynamicNodeList): Rename NodeList to DynamicNodeList, to differentiate it from the new StaticNodeList
        (WebCore::DynamicNodeList::~DynamicNodeList):
        (WebCore::DynamicNodeList::recursiveLength):
        (WebCore::DynamicNodeList::itemForwardsFromCurrent):
        (WebCore::DynamicNodeList::itemBackwardsFromCurrent):
        (WebCore::DynamicNodeList::recursiveItem):
        (WebCore::DynamicNodeList::itemWithName):
        (WebCore::DynamicNodeList::rootNodeChildrenChanged):
        (WebCore::DynamicNodeList::Caches::Caches):
        (WebCore::DynamicNodeList::Caches::reset):
        * dom/DynamicNodeList.h: Copied from WebCore/dom/NodeList.h.
        (WebCore::DynamicNodeList::rootNodeAttributeChanged):
        * dom/Element.idl: Add the new functions
        * dom/NameNodeList.cpp: Change to being a DynamicNodeList
        (WebCore::NameNodeList::NameNodeList):
        * dom/NameNodeList.h:
        (WebCore::NameNodeList::rootNodeAttributeChanged):
        * dom/Node.cpp:
        (WebCore::TagNodeList::TagNodeList): Change to being a DynamicNodeList
        (WebCore::Node::registerDynamicNodeList):
        (WebCore::Node::unregisterDynamicNodeList):
        (WebCore::Node::getElementsByName):
        (WebCore::Node::getElementsByClassName):
        (WebCore::Node::querySelector): new
        (WebCore::Node::querySelectorAll): new
        * dom/Node.h:
        * dom/NodeList.cpp: Removed.
        * dom/NodeList.h: This is now an abstract superclass of DynamicNodeList and StaticNodeList
        (WebCore::NodeList::NodeList):
        (WebCore::NodeList::~NodeList):
        * dom/SelectorNodeList.cpp: Added.
        (WebCore::SelectorNodeList::SelectorNodeList): New StaticNodeList subclass that filters elements by CSS selector
        * dom/SelectorNodeList.h: Added.
        * dom/StaticNodeList.cpp: Added.
        (WebCore::StaticNodeList::length):
        (WebCore::StaticNodeList::item):
        (WebCore::StaticNodeList::itemWithName):
        * dom/StaticNodeList.h: Added.
        (WebCore::StaticNodeList::StaticNodeList):
        (WebCore::StaticNodeList::~StaticNodeList):

LayoutTests:

        Reviewed by Oliver.

        - http://bugs.webkit.org/show_bug.cgi?id=16587
        Implement the most useful part of the W3C Selectors API.

        * fast/dom/SelectorAPI: Copied from LayoutTests/fast/dom/getElementsByClassName.
        * fast/dom/SelectorAPI/dumpNodeList-expected.txt:
        * fast/dom/SelectorAPI/dumpNodeList.html: Modified to test querySelector and querySelectorAll instead of getElementsByClassName
        * fast/dom/Window/window-properties-expected.txt: Added querySelector and querySelectorAll

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@28981 268f45cc-cd09-0410-ab3c-d52691b4dbfc
24 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/dom/SelectorAPI/dumpNodeList-expected.txt [new file with mode: 0644]
LayoutTests/fast/dom/SelectorAPI/dumpNodeList.html [new file with mode: 0644]
LayoutTests/fast/dom/Window/window-properties-expected.txt
WebCore/ChangeLog
WebCore/WebCore.xcodeproj/project.pbxproj
WebCore/css/CSSStyleSelector.h
WebCore/dom/ChildNodeList.cpp
WebCore/dom/ChildNodeList.h
WebCore/dom/ClassNodeList.cpp
WebCore/dom/ClassNodeList.h
WebCore/dom/Document.idl
WebCore/dom/DynamicNodeList.cpp [moved from WebCore/dom/NodeList.cpp with 81% similarity]
WebCore/dom/DynamicNodeList.h [new file with mode: 0644]
WebCore/dom/Element.idl
WebCore/dom/NameNodeList.cpp
WebCore/dom/NameNodeList.h
WebCore/dom/Node.cpp
WebCore/dom/Node.h
WebCore/dom/NodeList.h
WebCore/dom/SelectorNodeList.cpp [new file with mode: 0644]
WebCore/dom/SelectorNodeList.h [new file with mode: 0644]
WebCore/dom/StaticNodeList.cpp [new file with mode: 0644]
WebCore/dom/StaticNodeList.h [new file with mode: 0644]