WebCore: Fix for https://bugs.webkit.org/show_bug.cgi?id=29703
authorweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 24 Sep 2009 17:47:32 +0000 (17:47 +0000)
committerweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 24 Sep 2009 17:47:32 +0000 (17:47 +0000)
commitb25d840e7f308100ae8607bac0a6dd93b00e14e9
tree3e3bc50ac6285cac549dac6319372c990945889e
parent9fdb9d1ac0a6d8abfb85584a08a71b7578b8e098
WebCore: Fix for https://bugs.webkit.org/show_bug.cgi?id=29703
Add a function to element to check whether it matches a CSS selector

Reviewed by Dan Bernstein.

Implement Element.webkitMatchesSelector.

* css/CSSSelectorList.cpp:
(WebCore::forEachTagSelector):
(WebCore::forEachSelector):
(WebCore::SelectorNeedsNamespaceResolutionFunctor::operator()):
(WebCore::CSSSelectorList::selectorsNeedNamespaceResolution):
* css/CSSSelectorList.h:
Moved code to iterate the CSSSelectorList and determine if any
selectors need namespace resolution from a static function in
Node.cpp to CSSSelectorList so that it can be used by webkitMatchesSelector
as well as querySelector/querySelectorAll.

* dom/Element.cpp:
(WebCore::Element::webkitMatchesSelector):
* dom/Element.h:
* dom/Element.idl:
Implement the new function. Handles exceptional cases identically to
querySelector/querySelectorAll.

* dom/Node.cpp:
(WebCore::Node::querySelector):
(WebCore::Node::querySelectorAll):
Moved selectorsNeedNamespaceResolution to CSSSelectorList from here.

LayoutTests: Update tests for https://bugs.webkit.org/show_bug.cgi?id=29703
Add a function to element to check whether it matches a CSS selector

Reviewed by Dan Bernstein.

Add webkitMatchesSelector to SelectorAPI tests.

* fast/dom/SelectorAPI/caseID-almost-strict-expected.txt:
* fast/dom/SelectorAPI/caseID-almost-strict.html:
* fast/dom/SelectorAPI/caseID-expected.txt:
* fast/dom/SelectorAPI/caseID-strict-expected.txt:
* fast/dom/SelectorAPI/caseID-strict.html:
* fast/dom/SelectorAPI/caseID.html:
* fast/dom/SelectorAPI/caseTag-expected.txt:
* fast/dom/SelectorAPI/caseTag.html:
* fast/dom/SelectorAPI/caseTagX-expected.txt:
* fast/dom/SelectorAPI/caseTagX.xhtml:
* fast/dom/SelectorAPI/detached-element-expected.txt:
* fast/dom/SelectorAPI/not-supported-namespace-in-selector-expected.txt:
* fast/dom/SelectorAPI/not-supported-namespace-in-selector.html:
* fast/dom/SelectorAPI/script-tests/detached-element.js:
* fast/dom/SelectorAPI/script-tests/undefined-null-stringify.js:
* fast/dom/SelectorAPI/script-tests/viewless-document.js:
* fast/dom/SelectorAPI/undefined-null-stringify-expected.txt:
* fast/dom/SelectorAPI/viewless-document-expected.txt:
* fast/dom/Window/window-properties-expected.txt:
* fast/dom/domListEnumeration-expected.txt:
* fast/dom/script-tests/domListEnumeration.js:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@48723 268f45cc-cd09-0410-ab3c-d52691b4dbfc
29 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/dom/SelectorAPI/caseID-almost-strict-expected.txt
LayoutTests/fast/dom/SelectorAPI/caseID-almost-strict.html
LayoutTests/fast/dom/SelectorAPI/caseID-expected.txt
LayoutTests/fast/dom/SelectorAPI/caseID-strict-expected.txt
LayoutTests/fast/dom/SelectorAPI/caseID-strict.html
LayoutTests/fast/dom/SelectorAPI/caseID.html
LayoutTests/fast/dom/SelectorAPI/caseTag-expected.txt
LayoutTests/fast/dom/SelectorAPI/caseTag.html
LayoutTests/fast/dom/SelectorAPI/caseTagX-expected.txt
LayoutTests/fast/dom/SelectorAPI/caseTagX.xhtml
LayoutTests/fast/dom/SelectorAPI/detached-element-expected.txt
LayoutTests/fast/dom/SelectorAPI/not-supported-namespace-in-selector-expected.txt
LayoutTests/fast/dom/SelectorAPI/not-supported-namespace-in-selector.html
LayoutTests/fast/dom/SelectorAPI/script-tests/detached-element.js
LayoutTests/fast/dom/SelectorAPI/script-tests/undefined-null-stringify.js
LayoutTests/fast/dom/SelectorAPI/script-tests/viewless-document.js
LayoutTests/fast/dom/SelectorAPI/undefined-null-stringify-expected.txt
LayoutTests/fast/dom/SelectorAPI/viewless-document-expected.txt
LayoutTests/fast/dom/Window/window-properties-expected.txt
LayoutTests/fast/dom/domListEnumeration-expected.txt
LayoutTests/fast/dom/script-tests/domListEnumeration.js
WebCore/ChangeLog
WebCore/css/CSSSelectorList.cpp
WebCore/css/CSSSelectorList.h
WebCore/dom/Element.cpp
WebCore/dom/Element.h
WebCore/dom/Element.idl
WebCore/dom/Node.cpp