2010-09-24 Ilya Tikhonovsky <loislo@chromium.org>
authorloislo@chromium.org <loislo@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 24 Sep 2010 15:45:22 +0000 (15:45 +0000)
committerloislo@chromium.org <loislo@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 24 Sep 2010 15:45:22 +0000 (15:45 +0000)
        Reviewed by Pavel Feldman.

        Web Inspector: move searchingForNode flag in InspectorController under control of InspectorCookies.

        Four functions from Inspector IDL go away.
        Searching for node feature of Inspector keeps alive even after navigation.

        https://bugs.webkit.org/show_bug.cgi?id=46462

        * inspector/Inspector.idl:
        * inspector/InspectorController.cpp:
        (WebCore::InspectorController::updateInspectorStateCookie):
        (WebCore::InspectorController::restoreInspectorStateFromCookie):
        (WebCore::InspectorController::setSearchingForNode):
        (WebCore::InspectorController::populateScriptObjects):
        * inspector/InspectorController.h:
        * inspector/front-end/ElementsPanel.js:
        (WebInspector.ElementsPanel.prototype.hide):
        (WebInspector.ElementsPanel.prototype.updateFocusedNode):
        (WebInspector.ElementsPanel.prototype._setSearchingForNode):
        (WebInspector.ElementsPanel.prototype.setSearchingForNode):
        (WebInspector.ElementsPanel.prototype.toggleSearchingForNode):
        * inspector/front-end/inspector.js:
        (WebInspector._updateFocusedNode):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@68256 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog
WebCore/inspector/Inspector.idl
WebCore/inspector/InspectorController.cpp
WebCore/inspector/InspectorController.h
WebCore/inspector/front-end/ElementsPanel.js
WebCore/inspector/front-end/inspector.js

index b75acf8f49c740ea4f3e120715f4d2a9b6e91bfc..57da804d73a61cd1678d2a8ef78e775c7888799e 100644 (file)
@@ -1,3 +1,30 @@
+2010-09-24  Ilya Tikhonovsky  <loislo@chromium.org>
+
+        Reviewed by Pavel Feldman.
+
+        Web Inspector: move searchingForNode flag in InspectorController under control of InspectorCookies.
+
+        Four functions from Inspector IDL go away.
+        Searching for node feature of Inspector keeps alive even after navigation.
+
+        https://bugs.webkit.org/show_bug.cgi?id=46462
+
+        * inspector/Inspector.idl:
+        * inspector/InspectorController.cpp:
+        (WebCore::InspectorController::updateInspectorStateCookie):
+        (WebCore::InspectorController::restoreInspectorStateFromCookie):
+        (WebCore::InspectorController::setSearchingForNode):
+        (WebCore::InspectorController::populateScriptObjects):
+        * inspector/InspectorController.h:
+        * inspector/front-end/ElementsPanel.js:
+        (WebInspector.ElementsPanel.prototype.hide):
+        (WebInspector.ElementsPanel.prototype.updateFocusedNode):
+        (WebInspector.ElementsPanel.prototype._setSearchingForNode):
+        (WebInspector.ElementsPanel.prototype.setSearchingForNode):
+        (WebInspector.ElementsPanel.prototype.toggleSearchingForNode):
+        * inspector/front-end/inspector.js:
+        (WebInspector._updateFocusedNode):
+
 2010-09-24  Andrei Popescu  <andreip@google.com>
 
         Reviewed by Jeremy Orlow.
index 9a1b94be071636b0197f7c4de8236fa20906233e..ce2b03f10522c89b7662045c3f234e2d7a717518 100644 (file)
@@ -49,8 +49,6 @@ module core {
         [notify] void removeResource(out unsigned long identifier);
         [notify] void reset();
         [notify] void resetProfilesPanel();
-        [notify] void searchingForNodeWasEnabled();
-        [notify] void searchingForNodeWasDisabled();
         [notify] void setChildNodes(out long parentId, out Array nodes);
         [notify] void setDetachedRoot(out Object root);
         [notify] void setDocument(out Value root);
@@ -105,8 +103,7 @@ module core {
         [handler=Controller] void saveApplicationSettings(in String settings);
         [handler=Controller] void saveSessionSettings(in String settings);
 
-        [handler=Controller] void enableSearchingForNode();
-        [handler=Controller] void disableSearchingForNode();
+        [handler=Controller] void setSearchingForNode(in boolean enabled, out boolean newState);
 
         [handler=Controller] void setMonitoringXHREnabled(in boolean enable, out boolean newState);
 
index 7ea15b96e29e4d48afa343beca876230a223e3c1..769ead43b47ba388c9e00549ceff6b8dd5dc616c 100644 (file)
@@ -127,9 +127,10 @@ static const char* const monitoringXHRSettingName = "xhrMonitor";
 static const char* const resourceTrackingAlwaysEnabledSettingName = "resourceTrackingEnabled";
 static const char* const profilerAlwaysEnabledSettingName = "profilerEnabled";
 
-static const char* const timelineProfilerEnabledStateName = "timelineProfilerEnabled";
-static const char* const resourceTrackingEnabledStateName = "resourceTrackingEnabled";
 static const char* const monitoringXHRStateName = "monitoringXHREnabled";
+static const char* const resourceTrackingEnabledStateName = "resourceTrackingEnabled";
+static const char* const searchingForNodeEnabledStateName = "searchingForNodeEnabled";
+static const char* const timelineProfilerEnabledStateName = "timelineProfilerEnabled";
 
 static const char* const inspectorAttachedHeightName = "inspectorAttachedHeight";
 
@@ -265,6 +266,7 @@ void InspectorController::updateInspectorStateCookie()
     state->setBoolean(monitoringXHRStateName, m_monitoringXHR);
     state->setBoolean(resourceTrackingEnabledStateName, m_resourceTrackingEnabled);
     state->setBoolean(timelineProfilerEnabledStateName, m_timelineAgent);
+    state->setBoolean(searchingForNodeEnabledStateName, m_searchingForNode);
     m_client->updateInspectorStateCookie(state->toJSONString());
 }
 
@@ -280,6 +282,7 @@ void InspectorController::restoreInspectorStateFromCookie(const String& inspecto
 
     inspectorState->getBoolean(monitoringXHRStateName, &m_monitoringXHR);
     inspectorState->getBoolean(resourceTrackingEnabledStateName, &m_resourceTrackingEnabled);
+    inspectorState->getBoolean(searchingForNodeEnabledStateName, &m_searchingForNode);
 
     bool timelineProfilerEnabled = false;
     inspectorState->getBoolean(timelineProfilerEnabledStateName, &timelineProfilerEnabled);
@@ -493,12 +496,13 @@ void InspectorController::setSearchingForNode(bool enabled)
     m_searchingForNode = enabled;
     if (!m_searchingForNode)
         hideHighlight();
-    if (m_frontend) {
-        if (enabled)
-            m_frontend->searchingForNodeWasEnabled();
-        else
-            m_frontend->searchingForNodeWasDisabled();
-    }
+    updateInspectorStateCookie();
+}
+
+void InspectorController::setSearchingForNode(bool enabled, bool* newState)
+{
+    *newState = enabled;
+    setSearchingForNode(enabled);
 }
 
 void InspectorController::setMonitoringXHREnabled(bool enabled, bool* newState)
@@ -651,10 +655,6 @@ void InspectorController::populateScriptObjects()
 
     showPanel(m_showAfterVisible);
 
-    if (m_searchingForNode)
-        m_frontend->searchingForNodeWasEnabled();
-
-
 #if ENABLE(JAVASCRIPT_DEBUGGER)
     if (m_profilerAgent->enabled())
         m_frontend->profilerWasEnabled();
index f3a17c2f5ce367503001baa1be0901f912d156ea..9e63f01e51786533f5e71eee24f1bd1f565d1466 100644 (file)
@@ -297,11 +297,10 @@ private:
     void restoreDebugger();
     void restoreProfiler();
     void unbindAllResources();
+    void setSearchingForNode(bool enabled);
 
     // Following are used from InspectorBackend and internally.
-    void setSearchingForNode(bool enabled);
-    void enableSearchingForNode() { setSearchingForNode(true); }
-    void disableSearchingForNode() { setSearchingForNode(false); }
+    void setSearchingForNode(bool enabled, bool* newState);
 
     void setMonitoringXHREnabled(bool enabled, bool* newState);
     void storeLastActivePanel(const String& panelName);
index f57dea53cff3d55c6e4138d7ac7cc115e56ada2f..d6437fcc64bbeeaa89ec5a3be3a728cae7e874b2 100644 (file)
@@ -148,7 +148,7 @@ WebInspector.ElementsPanel.prototype = {
         WebInspector.Panel.prototype.hide.call(this);
 
         WebInspector.highlightDOMNode(0);
-        InspectorBackend.disableSearchingForNode();
+        this.setSearchingForNode(false);
     },
 
     resize: function()
@@ -248,16 +248,6 @@ WebInspector.ElementsPanel.prototype = {
         InspectorBackend.performSearch(whitespaceTrimmedQuery, false);
     },
 
-    searchingForNodeWasEnabled: function()
-    {
-        this._nodeSearchButton.toggled = true;
-    },
-
-    searchingForNodeWasDisabled: function()
-    {
-        this._nodeSearchButton.toggled = false;
-    },
-
     populateHrefContextMenu: function(contextMenu, event, anchorElement)
     {
         if (!anchorElement.href)
@@ -1160,12 +1150,29 @@ WebInspector.ElementsPanel.prototype = {
         this.treeOutline.updateSelection();
     },
 
+    updateFocusedNode: function(nodeId)
+    {
+        var node = WebInspector.domAgent.nodeForId(nodeId);
+        if (!node)
+            return;
+
+        this.focusedDOMNode = node;
+        this._nodeSearchButton.toggled = false;
+    },
+
+    _setSearchingForNode: function(enabled)
+    {
+        this._nodeSearchButton.toggled = enabled;
+    },
+
+    setSearchingForNode: function(enabled)
+    {
+        InspectorBackend.setSearchingForNode(enabled, this._setSearchingForNode.bind(this));
+    },
+
     toggleSearchingForNode: function()
     {
-        if (!this._nodeSearchButton.toggled)
-            InspectorBackend.enableSearchingForNode();
-        else
-            InspectorBackend.disableSearchingForNode();
+        this.setSearchingForNode(!this._nodeSearchButton.toggled);
     },
 
     elementsToRestoreScrollPositionsFor: function()
index f6fa06be554d7bc0de5b1c60d542a4f218d129ea..3e68d4418a763c0986a07beaca611f7cfaa325c2 100644 (file)
@@ -435,12 +435,8 @@ var WebInspector = {
 
     _updateFocusedNode: function(nodeId)
     {
-        var node = WebInspector.domAgent.nodeForId(nodeId);
-        if (!node)
-            return;
-
         this.currentPanel = this.panels.elements;
-        this.panels.elements.focusedDOMNode = node;
+        this.panels.elements.updateFocusedNode(nodeId);
     }
 }