Changeset 30096

Show
Ignore:
Timestamp:
02/08/08 12:05:24 (10 months ago)
Author:
weinig@apple.com
Message:

WebCore:

Reviewed by Hyatt.

Fix for <rdar://problem/5732491>
http://bugs.webkit.org/show_bug.cgi?id=17213
The querySelectorAll method on an element node does not search only the element's descendants

Test: fast/dom/SelectorAPI/elementRoot.html

  • dom/Node.cpp: (WebCore::Node::querySelector): Make sure to stay within the root node when traversing the tree.
  • dom/SelectorNodeList.cpp: (WebCore::SelectorNodeList::SelectorNodeList): ditto.

LayoutTests:

Reviewed by Hyatt.

Test for <rdar://problem/5732491>
http://bugs.webkit.org/show_bug.cgi?id=17213
The querySelectorAll method on an element node does not search only the element's descendants

  • fast/dom/SelectorAPI/elementRoot-expected.txt: Added.
  • fast/dom/SelectorAPI/elementRoot.html: Added.
  • fast/dom/SelectorAPI/resources: Added.
  • fast/dom/SelectorAPI/resources/TEMPLATE.html: Copied from LayoutTests/fast/js/resources/TEMPLATE.html.
  • fast/dom/SelectorAPI/resources/elementRoot.js: Added.
Location:
trunk
Files:
4 added
4 modified
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r30089 r30096  
     12008-02-08  Sam Weinig  <sam@webkit.org> 
     2 
     3        Reviewed by Hyatt. 
     4 
     5        Test for <rdar://problem/5732491> 
     6        http://bugs.webkit.org/show_bug.cgi?id=17213 
     7        The querySelectorAll method on an element node does not search only the element's descendants 
     8 
     9        * fast/dom/SelectorAPI/elementRoot-expected.txt: Added. 
     10        * fast/dom/SelectorAPI/elementRoot.html: Added. 
     11        * fast/dom/SelectorAPI/resources: Added. 
     12        * fast/dom/SelectorAPI/resources/TEMPLATE.html: Copied from LayoutTests/fast/js/resources/TEMPLATE.html. 
     13        * fast/dom/SelectorAPI/resources/elementRoot.js: Added. 
     14 
    1152008-02-08  Darin Adler  <darin@apple.com> 
    216 
  • trunk/WebCore/ChangeLog

    r30095 r30096  
     12008-02-08  Sam Weinig  <sam@webkit.org> 
     2 
     3        Reviewed by Hyatt. 
     4 
     5        Fix for <rdar://problem/5732491> 
     6        http://bugs.webkit.org/show_bug.cgi?id=17213 
     7        The querySelectorAll method on an element node does not search only the element's descendants 
     8 
     9        Test: fast/dom/SelectorAPI/elementRoot.html 
     10 
     11        * dom/Node.cpp: 
     12        (WebCore::Node::querySelector): Make sure to stay within the root node when traversing the tree. 
     13        * dom/SelectorNodeList.cpp: 
     14        (WebCore::SelectorNodeList::SelectorNodeList): ditto. 
     15 
    1162008-02-08  David Hyatt  <hyatt@apple.com> 
    217 
  • trunk/WebCore/dom/Node.cpp

    r30089 r30096  
    12271227     
    12281228    // FIXME: We can speed this up by implementing caching similar to the one use by getElementById 
    1229     for (Node *n = traverseNextNode(); n; n = n->traverseNextNode()) { 
     1229    for (Node* n = firstChild(); n; n = n->traverseNextNode(this)) { 
    12301230        if (n->isElementNode()) { 
    12311231            Element* element = static_cast<Element*>(n); 
  • trunk/WebCore/dom/SelectorNodeList.cpp

    r29663 r30096  
    4242    Document* document = rootNode->document(); 
    4343    CSSStyleSelector* styleSelector = document->styleSelector(); 
    44     for (Node* n = rootNode->traverseNextNode(); n; n = n->traverseNextNode()) { 
     44    for (Node* n = rootNode->firstChild(); n; n = n->traverseNextNode(rootNode.get())) { 
    4545        if (n->isElementNode()) { 
    4646            styleSelector->initElementAndPseudoState(static_cast<Element*>(n));