Skip to content
  • achicu@adobe.com's avatar
    Web Inspector: DOM.performSearch should accept a list of context nodes · 1aa38677
    achicu@adobe.com authored
    https://bugs.webkit.org/show_bug.cgi?id=124390
    
    Reviewed by Timothy Hatcher.
    
    Source/WebCore:
    
    Extracted the code in InspectorDOMAgent::performSearch into its own helper class
    called InspectorNodeFinder. Also added a new array parameter called "nodeIds"
    that can be used to limit the search results to just partial subtrees.
    
    Tests: inspector-protocol/dom/dom-search-crash.html
           inspector-protocol/dom/dom-search-with-context.html
           inspector-protocol/dom/dom-search.html
    
    * CMakeLists.txt:
    * GNUmakefile.list.am:
    * WebCore.vcxproj/WebCore.vcxproj:
    * WebCore.vcxproj/WebCore.vcxproj.filters:
    * WebCore.xcodeproj/project.pbxproj:
    * inspector/protocol/DOM.json:
    * inspector/InspectorAllInOne.cpp:
    * inspector/InspectorDOMAgent.cpp:
    (WebCore::InspectorDOMAgent::performSearch):
    * inspector/InspectorDOMAgent.h:
    * inspector/InspectorNodeFinder.cpp: Added.
    (WebCore::stripCharacters):
    (WebCore::InspectorNodeFinder::InspectorNodeFinder):
    (WebCore::InspectorNodeFinder::performSearch):
    (WebCore::InspectorNodeFinder::searchUsingDOMTreeTraversal):
    (WebCore::InspectorNodeFinder::matchesAttribute):
    (WebCore::InspectorNodeFinder::matchesElement):
    (WebCore::InspectorNodeFinder::searchUsingXPath):
    (WebCore::InspectorNodeFinder::searchUsingCSSSelectors):
    * inspector/InspectorNodeFinder.h: Added.
    (WebCore::InspectorNodeFinder::results):
    
    LayoutTests:
    
    Added new inspector-protocol tests to check for the DOM.performSearch implementation.
    Also, ported an existing test from the old "inspector" format.
    
    * http/tests/inspector-protocol/resources/InspectorDOMListener.js: Added boilerplate code that
    can be used to track node ids and class names.
    (createDOMListener.createNodeAttributesMap):
    (createDOMListener.collectNode):
    (createDOMListener.onSetChildNodes):
    (createDOMListener.onChildNodeRemoved):
    (createDOMListener.onChildNodeInserted):
    (createDOMListener.return.getNodeById):
    (createDOMListener.return.getNodeIdentifier):
    * http/tests/inspector-protocol/resources/InspectorTest.js:
    (InspectorFrontendAPI.dispatchMessageAsync): Added a way to catch all the messages received in the inspector.
    It is useful for debugging the test file.
    (InspectorTest.addEventListener): Helper method to register multiple handlers for the same event.
    * inspector-protocol/dom/dom-search-crash-expected.txt: Added.
    * inspector-protocol/dom/dom-search-crash.html: Added.
    * inspector-protocol/dom/dom-search-expected.txt: Added.
    * inspector-protocol/dom/dom-search-with-context-expected.txt: Added.
    * inspector-protocol/dom/dom-search-with-context.html: Added.
    * inspector-protocol/dom/dom-search.html: Added.
    * inspector-protocol/dom/resources/dom-search-crash-iframe.html: Cloned from inspector/dom/resources/dom-search-crash-iframe.html
    * inspector-protocol/dom/resources/dom-search-iframe.html: Added.
    * inspector-protocol/dom/resources/dom-search-queries.js: Added.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159357 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    1aa38677