Title: [159475] trunk/Source/WebInspectorUI
Revision
159475
Author
[email protected]
Date
2013-11-18 17:13:38 -0800 (Mon, 18 Nov 2013)

Log Message

Web Inspector: Update WebInspectorUI to use the new "nodeIds" parameter for DOM.performSearch
https://bugs.webkit.org/show_bug.cgi?id=124544

Reviewed by Joseph Pecoraro.

Added the new DOM.performSearch "nodeIds" parameter and made the two implementations
of DOMTreeContentView provide the right context node ids.

DOMTreeContentView is just using the id of the document node while ContentFlowDOMTreeContentView
is passing the list of content nodes.

Note that adding an extra optional parameter to DOM.performSearch does not break iOS 6 and 7 compatibility.

* UserInterface/ContentFlowDOMTreeContentView.js:
(WebInspector.ContentFlowDOMTreeContentView.prototype.getSearchContextNodes):
* UserInterface/DOMTreeContentView.js:
(WebInspector.DOMTreeContentView.prototype.performSearch.contextNodesReady):
(WebInspector.DOMTreeContentView.prototype.performSearch):
(WebInspector.DOMTreeContentView.prototype.getSearchContextNodes):
* UserInterface/FrameDOMTreeContentView.js:
(WebInspector.FrameDOMTreeContentView.prototype.getSearchContextNodes):
* UserInterface/InspectorBackendCommands.js:

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (159474 => 159475)


--- trunk/Source/WebInspectorUI/ChangeLog	2013-11-19 01:00:36 UTC (rev 159474)
+++ trunk/Source/WebInspectorUI/ChangeLog	2013-11-19 01:13:38 UTC (rev 159475)
@@ -1,3 +1,28 @@
+2013-11-18  Alexandru Chiculita  <[email protected]>
+
+        Web Inspector: Update WebInspectorUI to use the new "nodeIds" parameter for DOM.performSearch
+        https://bugs.webkit.org/show_bug.cgi?id=124544
+
+        Reviewed by Joseph Pecoraro.
+
+        Added the new DOM.performSearch "nodeIds" parameter and made the two implementations
+        of DOMTreeContentView provide the right context node ids.
+
+        DOMTreeContentView is just using the id of the document node while ContentFlowDOMTreeContentView
+        is passing the list of content nodes.
+
+        Note that adding an extra optional parameter to DOM.performSearch does not break iOS 6 and 7 compatibility.
+
+        * UserInterface/ContentFlowDOMTreeContentView.js:
+        (WebInspector.ContentFlowDOMTreeContentView.prototype.getSearchContextNodes):
+        * UserInterface/DOMTreeContentView.js:
+        (WebInspector.DOMTreeContentView.prototype.performSearch.contextNodesReady):
+        (WebInspector.DOMTreeContentView.prototype.performSearch):
+        (WebInspector.DOMTreeContentView.prototype.getSearchContextNodes):
+        * UserInterface/FrameDOMTreeContentView.js:
+        (WebInspector.FrameDOMTreeContentView.prototype.getSearchContextNodes):
+        * UserInterface/InspectorBackendCommands.js:
+
 2013-11-18  Joseph Pecoraro  <[email protected]>
 
         Web Inspector: Update localizedStrings, remove stale string

Modified: trunk/Source/WebInspectorUI/UserInterface/ContentFlowDOMTreeContentView.js (159474 => 159475)


--- trunk/Source/WebInspectorUI/UserInterface/ContentFlowDOMTreeContentView.js	2013-11-19 01:00:36 UTC (rev 159474)
+++ trunk/Source/WebInspectorUI/UserInterface/ContentFlowDOMTreeContentView.js	2013-11-19 01:13:38 UTC (rev 159475)
@@ -52,6 +52,13 @@
         WebInspector.DOMTreeContentView.prototype.closed.call(this);
     },
 
+    getSearchContextNodes: function(callback)
+    {
+        callback(this.domTreeOutline.children.map(function(treeOutline) {
+            return treeOutline.representedObject.id;
+        }));
+    },
+
     // Private
 
     _createContentTrees: function()

Modified: trunk/Source/WebInspectorUI/UserInterface/DOMTreeContentView.js (159474 => 159475)


--- trunk/Source/WebInspectorUI/UserInterface/DOMTreeContentView.js	2013-11-19 01:00:36 UTC (rev 159474)
+++ trunk/Source/WebInspectorUI/UserInterface/DOMTreeContentView.js	2013-11-19 01:13:38 UTC (rev 159475)
@@ -209,9 +209,21 @@
                 this.revealNextSearchResult();
         }
 
-        DOMAgent.performSearch(query, searchResultsReady.bind(this));
+        function contextNodesReady(nodeIds)
+        {
+            DOMAgent.performSearch(query, nodeIds, searchResultsReady.bind(this));
+        }
+
+        this.getSearchContextNodes(contextNodesReady.bind(this));
     },
 
+    getSearchContextNodes: function(callback)
+    {
+        // Overwrite this to limit the search to just a subtree.
+        // Passing undefined will make DOMAgent.performSearch search through all the documents.
+        callback(undefined);
+    },
+
     searchCleared: function()
     {
         if (this._searchIdentifier)

Modified: trunk/Source/WebInspectorUI/UserInterface/FrameDOMTreeContentView.js (159474 => 159475)


--- trunk/Source/WebInspectorUI/UserInterface/FrameDOMTreeContentView.js	2013-11-19 01:00:36 UTC (rev 159474)
+++ trunk/Source/WebInspectorUI/UserInterface/FrameDOMTreeContentView.js	2013-11-19 01:13:38 UTC (rev 159475)
@@ -53,6 +53,13 @@
         WebInspector.DOMTreeContentView.prototype.closed.call(this);
     },
 
+    getSearchContextNodes: function(callback)
+    {
+        this._domTree.requestRootDOMNode(function(rootDOMNode) {
+            callback([rootDOMNode.id]);
+        });
+    },
+
     // Private
 
     _rootDOMNodeAvailable: function(rootDOMNode)

Modified: trunk/Source/WebInspectorUI/UserInterface/InspectorBackendCommands.js (159474 => 159475)


--- trunk/Source/WebInspectorUI/UserInterface/InspectorBackendCommands.js	2013-11-19 01:00:36 UTC (rev 159474)
+++ trunk/Source/WebInspectorUI/UserInterface/InspectorBackendCommands.js	2013-11-19 01:13:38 UTC (rev 159475)
@@ -148,7 +148,7 @@
 InspectorBackend.registerCommand("DOM.getEventListenersForNode", [{"name": "nodeId", "type": "number", "optional": false}, {"name": "objectGroup", "type": "string", "optional": true}], ["listeners"]);
 InspectorBackend.registerCommand("DOM.getOuterHTML", [{"name": "nodeId", "type": "number", "optional": false}], ["outerHTML"]);
 InspectorBackend.registerCommand("DOM.setOuterHTML", [{"name": "nodeId", "type": "number", "optional": false}, {"name": "outerHTML", "type": "string", "optional": false}], []);
-InspectorBackend.registerCommand("DOM.performSearch", [{"name": "query", "type": "string", "optional": false}], ["searchId", "resultCount"]);
+InspectorBackend.registerCommand("DOM.performSearch", [{"name": "query", "type": "string", "optional": false}, {"name": "nodeIds", "type": "object", "optional": true}], ["searchId", "resultCount"]);
 InspectorBackend.registerCommand("DOM.getSearchResults", [{"name": "searchId", "type": "string", "optional": false}, {"name": "fromIndex", "type": "number", "optional": false}, {"name": "toIndex", "type": "number", "optional": false}], ["nodeIds"]);
 InspectorBackend.registerCommand("DOM.discardSearchResults", [{"name": "searchId", "type": "string", "optional": false}], []);
 InspectorBackend.registerCommand("DOM.requestNode", [{"name": "objectId", "type": "string", "optional": false}], ["nodeId"]);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to