Web Inspector: Search: allow DOM searches to be case sensitive
authordrousso@apple.com <drousso@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 20 Mar 2019 16:21:37 +0000 (16:21 +0000)
committerdrousso@apple.com <drousso@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 20 Mar 2019 16:21:37 +0000 (16:21 +0000)
commit4dd9c76b5593bf3aa0dcaf2060d0ce5438e4b7bb
tree89408e3cb4bd03d26b886ba5bb9a74da4edb1c8f
parent60020713014d981c9d2a291ab81ece91cff332fc
Web Inspector: Search: allow DOM searches to be case sensitive
https://bugs.webkit.org/show_bug.cgi?id=194673
<rdar://problem/48087577>

Reviewed by Timothy Hatcher.

Source/JavaScriptCore:

Since `DOM.performSearch` also searches by selector and XPath, some results may appear
as unexpected. As an example, searching for "BoDy" will still return the <body> as a result,
as although the literal node name ("BODY") didn't match, it did match via selector/XPath.

* inspector/protocol/DOM.json:
Allow `DOM.performSearch` to be case sensitive.

Source/WebCore:

Tests: inspector/dom/dom-search.html
       inspector/dom/dom-search-caseSensitive.html

Since `DOM.performSearch` also searches by selector and XPath, some results may appear
as unexpected. As an example, searching for "BoDy" will still return the <body> as a result,
as although the literal node name ("BODY") didn't match, it did match via selector/XPath.

* inspector/agents/InspectorDOMAgent.h:
* inspector/agents/InspectorDOMAgent.cpp:
(WebCore::InspectorDOMAgent::performSearch):

* inspector/InspectorNodeFinder.h:
* inspector/InspectorNodeFinder.cpp:
(WebCore::InspectorNodeFinder::InspectorNodeFinder):
(WebCore::InspectorNodeFinder::searchUsingDOMTreeTraversal):
(WebCore::InspectorNodeFinder::checkEquals): Added.
(WebCore::InspectorNodeFinder::checkContains): Added.
(WebCore::InspectorNodeFinder::checkStartsWith): Added.
(WebCore::InspectorNodeFinder::checkEndsWith): Added.
(WebCore::InspectorNodeFinder::matchesAttribute):
(WebCore::InspectorNodeFinder::matchesElement):
(WebCore::InspectorNodeFinder::searchUsingXPath):
(WebCore::InspectorNodeFinder::searchUsingCSSSelectors):

Source/WebInspectorUI:

* UserInterface/Views/SearchSidebarPanel.js:
(WI.SearchSidebarPanel.prototype.performSearch):

* UserInterface/Views/DOMTreeContentView.js:
(WI.DOMTreeContentView.prototype.performSearch.contextNodesReady):

* UserInterface/Controllers/DOMManager.js:
(WI.DOMManager.prototype.performSearch.callback): Deleted.
(WI.DOMManager.prototype.performSearch): Deleted.
(WI.DOMManager.prototype.searchResult.mycallback): Deleted.
(WI.DOMManager.prototype.searchResult): Deleted.
(WI.DOMManager.prototype.cancelSearch): Deleted.
Drive-by: remove unused code.
LayoutTests:

* inspector/dom/dom-search-caseSensitive.html: Copied from LayoutTests/inspector/dom/dom-search.html.
* inspector/dom/dom-search-caseSensitive-expected.txt: Copied from LayoutTests/inspector/dom/dom-search-expected.txt.
* inspector/dom/dom-search-expected.txt:
* inspector/dom/resources/dom-search-queries.js:
(TestPage.registerInitializer):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243207 268f45cc-cd09-0410-ab3c-d52691b4dbfc
16 files changed:
LayoutTests/ChangeLog
LayoutTests/inspector/dom/dom-search-caseSensitive-expected.txt [new file with mode: 0644]
LayoutTests/inspector/dom/dom-search-caseSensitive.html [new file with mode: 0644]
LayoutTests/inspector/dom/dom-search-expected.txt
LayoutTests/inspector/dom/resources/dom-search-queries.js
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/inspector/protocol/DOM.json
Source/WebCore/ChangeLog
Source/WebCore/inspector/InspectorNodeFinder.cpp
Source/WebCore/inspector/InspectorNodeFinder.h
Source/WebCore/inspector/agents/InspectorDOMAgent.cpp
Source/WebCore/inspector/agents/InspectorDOMAgent.h
Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/UserInterface/Controllers/DOMManager.js
Source/WebInspectorUI/UserInterface/Views/DOMTreeContentView.js
Source/WebInspectorUI/UserInterface/Views/SearchSidebarPanel.js