Web Inspector: merge "docked" state into the "dock side" enum.
authorpfeldman@chromium.org <pfeldman@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 19 Oct 2012 20:03:57 +0000 (20:03 +0000)
committerpfeldman@chromium.org <pfeldman@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 19 Oct 2012 20:03:57 +0000 (20:03 +0000)
https://bugs.webkit.org/show_bug.cgi?id=99717

Reviewed by Vsevolod Vlasov.

Source/WebCore:

Otherwise, it is hard to manage these inter-dependent flags.

* inspector/InspectorFrontendClient.h:
(InspectorFrontendClient):
* inspector/InspectorFrontendClientLocal.cpp:
(WebCore::InspectorFrontendClientLocal::requestSetDockSide):
(WebCore::InspectorFrontendClientLocal::setAttachedWindow):
* inspector/InspectorFrontendClientLocal.h:
(InspectorFrontendClientLocal):
* inspector/InspectorFrontendHost.cpp:
(WebCore::InspectorFrontendHost::requestSetDockSide):
* inspector/InspectorFrontendHost.h:
(InspectorFrontendHost):
* inspector/InspectorFrontendHost.idl:
* inspector/front-end/DockController.js:
(WebInspector.DockController):
(WebInspector.DockController.prototype._updateUI.get sides):
(WebInspector.DockController.prototype._updateUI):
(WebInspector.DockController.prototype._toggleDockState):
* inspector/front-end/InspectorFrontendAPI.js:
(InspectorFrontendAPI.setAttachedWindow):
* inspector/front-end/InspectorFrontendHostStub.js:
(.WebInspector.InspectorFrontendHostStub.prototype.requestSetDockSide):

Source/WebKit/chromium:

* public/WebDevToolsFrontendClient.h:
* src/InspectorFrontendClientImpl.cpp:
(WebKit::InspectorFrontendClientImpl::requestSetDockSide):
* src/InspectorFrontendClientImpl.h:
(InspectorFrontendClientImpl):

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

19 files changed:
Source/WebCore/ChangeLog
Source/WebCore/WebCore.exp.in
Source/WebCore/inspector/InspectorFrontendClient.h
Source/WebCore/inspector/InspectorFrontendClientLocal.cpp
Source/WebCore/inspector/InspectorFrontendClientLocal.h
Source/WebCore/inspector/InspectorFrontendHost.cpp
Source/WebCore/inspector/InspectorFrontendHost.h
Source/WebCore/inspector/InspectorFrontendHost.idl
Source/WebCore/inspector/front-end/DockController.js
Source/WebCore/inspector/front-end/InspectorFrontendAPI.js
Source/WebCore/inspector/front-end/InspectorFrontendHostStub.js
Source/WebCore/inspector/front-end/externs.js
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/public/WebDevToolsFrontendClient.h
Source/WebKit/chromium/src/InspectorFrontendClientImpl.cpp
Source/WebKit/chromium/src/InspectorFrontendClientImpl.h
Source/WebKit2/win/WebKit2.def
Source/WebKit2/win/WebKit2CFLite.def
Source/autotools/symbols.filter

index 586e772..e36045d 100644 (file)
@@ -1,3 +1,34 @@
+2012-10-19  Pavel Feldman  <pfeldman@chromium.org>
+
+        Web Inspector: merge "docked" state into the "dock side" enum.
+        https://bugs.webkit.org/show_bug.cgi?id=99717
+
+        Reviewed by Vsevolod Vlasov.
+
+        Otherwise, it is hard to manage these inter-dependent flags.
+
+        * inspector/InspectorFrontendClient.h:
+        (InspectorFrontendClient):
+        * inspector/InspectorFrontendClientLocal.cpp:
+        (WebCore::InspectorFrontendClientLocal::requestSetDockSide):
+        (WebCore::InspectorFrontendClientLocal::setAttachedWindow):
+        * inspector/InspectorFrontendClientLocal.h:
+        (InspectorFrontendClientLocal):
+        * inspector/InspectorFrontendHost.cpp:
+        (WebCore::InspectorFrontendHost::requestSetDockSide):
+        * inspector/InspectorFrontendHost.h:
+        (InspectorFrontendHost):
+        * inspector/InspectorFrontendHost.idl:
+        * inspector/front-end/DockController.js:
+        (WebInspector.DockController):
+        (WebInspector.DockController.prototype._updateUI.get sides):
+        (WebInspector.DockController.prototype._updateUI):
+        (WebInspector.DockController.prototype._toggleDockState):
+        * inspector/front-end/InspectorFrontendAPI.js:
+        (InspectorFrontendAPI.setAttachedWindow):
+        * inspector/front-end/InspectorFrontendHostStub.js:
+        (.WebInspector.InspectorFrontendHostStub.prototype.requestSetDockSide):
+
 2012-10-19  Joshua Bell  <jsbell@chromium.org>
 
         [V8] IndexedDB: Crash when lazy-indexing Date keys
index bf3a96b..d7bc44f 100644 (file)
@@ -2306,8 +2306,7 @@ __ZN7WebCore28InspectorFrontendClientLocal14frontendLoadedEv
 __ZN7WebCore28InspectorFrontendClientLocal15canAttachWindowEv
 __ZN7WebCore28InspectorFrontendClientLocal17setAttachedWindowEb
 __ZN7WebCore28InspectorFrontendClientLocal18isDebuggingEnabledEv
-__ZN7WebCore28InspectorFrontendClientLocal19requestAttachWindowEv
-__ZN7WebCore28InspectorFrontendClientLocal19requestDetachWindowEv
+__ZN7WebCore28InspectorFrontendClientLocal18requestSetDockSideENS_23InspectorFrontendClient8DockSideE
 __ZN7WebCore28InspectorFrontendClientLocal19setDebuggingEnabledEb
 __ZN7WebCore28InspectorFrontendClientLocal19windowObjectClearedEv
 __ZN7WebCore28InspectorFrontendClientLocal20sendMessageToBackendERKN3WTF6StringE
index c461fd9..f7fd85c 100644 (file)
@@ -41,6 +41,12 @@ class Event;
 
 class InspectorFrontendClient {
 public:
+    enum DockSide {
+        UNDOCKED = 0,
+        DOCKED_TO_RIGHT,
+        DOCKED_TO_BOTTOM
+    };
+
     virtual ~InspectorFrontendClient() { }
 
     virtual void windowObjectCleared() = 0;
@@ -54,9 +60,7 @@ public:
     virtual void bringToFront() = 0;
     virtual void closeWindow() = 0;
 
-    virtual void requestAttachWindow() = 0;
-    virtual void requestDetachWindow() = 0;
-    virtual void requestSetDockSide(const String&) = 0;
+    virtual void requestSetDockSide(DockSide) = 0;
     virtual void changeAttachedWindowHeight(unsigned) = 0;
     virtual void openInNewTab(const String& url) = 0;
     virtual bool canSave() = 0;
index 5308273..dbee707 100644 (file)
@@ -148,18 +148,15 @@ void InspectorFrontendClientLocal::frontendLoaded()
     m_evaluateOnLoad.clear();
 }
 
-void InspectorFrontendClientLocal::requestAttachWindow()
+void InspectorFrontendClientLocal::requestSetDockSide(DockSide dockSide)
 {
-    if (!canAttachWindow())
-        return;
-    attachWindow();
-    setAttachedWindow(true);
-}
-
-void InspectorFrontendClientLocal::requestDetachWindow()
-{
-    detachWindow();
-    setAttachedWindow(false);
+    if (dockSide == UNDOCKED) {
+        detachWindow();
+        setAttachedWindow(false);
+    } else if (canAttachWindow()) {
+        attachWindow();
+        setAttachedWindow(true);
+    }
 }
 
 bool InspectorFrontendClientLocal::canAttachWindow()
@@ -214,7 +211,7 @@ void InspectorFrontendClientLocal::moveWindowBy(float x, float y)
 
 void InspectorFrontendClientLocal::setAttachedWindow(bool attached)
 {
-    evaluateOnLoad(String::format("[\"setAttachedWindow\", %s]", attached ? "true" : "false"));
+    evaluateOnLoad(String::format("[\"setDockSide\", %s]", attached ? "bottom" : "undocked"));
 }
 
 void InspectorFrontendClientLocal::restoreAttachedWindowHeight()
index af8493b..ce36287 100644 (file)
@@ -63,9 +63,7 @@ public:
 
     virtual void moveWindowBy(float x, float y);
 
-    virtual void requestAttachWindow();
-    virtual void requestDetachWindow();
-    virtual void requestSetDockSide(const String&) { }
+    virtual void requestSetDockSide(DockSide);
     virtual void changeAttachedWindowHeight(unsigned);
     virtual void openInNewTab(const String& url);
     virtual bool canSave() { return false; }
index 895ab03..82db0bb 100644 (file)
@@ -149,22 +149,16 @@ void InspectorFrontendHost::loaded()
         m_client->frontendLoaded();
 }
 
-void InspectorFrontendHost::requestAttachWindow()
-{
-    if (m_client)
-        m_client->requestAttachWindow();
-}
-
-void InspectorFrontendHost::requestDetachWindow()
-{
-    if (m_client)
-        m_client->requestDetachWindow();
-}
-
 void InspectorFrontendHost::requestSetDockSide(const String& side)
 {
-    if (m_client)
-        m_client->requestSetDockSide(side);
+    if (!m_client)
+        return;
+    if (side == "undocked")
+        m_client->requestSetDockSide(InspectorFrontendClient::UNDOCKED);
+    else if (side == "right")
+        m_client->requestSetDockSide(InspectorFrontendClient::DOCKED_TO_RIGHT);
+    else if (side == "bottom")
+        m_client->requestSetDockSide(InspectorFrontendClient::DOCKED_TO_BOTTOM);
 }
 
 void InspectorFrontendHost::closeWindow()
index 93eb427..ea6d101 100644 (file)
@@ -57,8 +57,6 @@ public:
     void disconnectClient();
 
     void loaded();
-    void requestAttachWindow();
-    void requestDetachWindow();
     void requestSetDockSide(const String&);
     void closeWindow();
     void bringToFront();
index 0edd069..728aa0c 100644 (file)
@@ -39,8 +39,6 @@
     void setZoomFactor(in float zoom);
     void inspectedURLChanged(in DOMString newURL);
 
-    void requestAttachWindow();
-    void requestDetachWindow();
     void requestSetDockSide(in DOMString side);
     void setAttachedWindowHeight(in unsigned long height);
     void moveWindowBy(in float x, in float y);
index 5669468..5c48cab 100644 (file)
@@ -40,8 +40,7 @@ WebInspector.DockController = function()
     if (Preferences.showDockToRight)
         this._dockToggleButton.makeLongClickEnabled(this._createDockOptions.bind(this));
 
-    this._dockSide = WebInspector.queryParamsObject["dockSide"];
-    this._innerSetDocked(WebInspector.queryParamsObject["docked"] === "true");
+    this.setDockSide(WebInspector.queryParamsObject["dockSide"]);
 }
 
 WebInspector.DockController.State = {
@@ -60,33 +59,18 @@ WebInspector.DockController.prototype = {
     },
 
     /**
-     * @param {boolean} docked
+     * @param {string} dockSide
      */
-    setDocked: function(docked)
+    setDockSide: function(dockSide)
     {
-        var isDocked = this._state !== WebInspector.DockController.State.Undocked;
-        if (docked !== isDocked)
-            this._innerSetDocked(docked);
-    },
-
-    /**
-     * @param {boolean} docked
-     */
-    _innerSetDocked: function(docked)
-    {
-        if (this._state)
-            WebInspector.settings.lastDockState.set(this._state);
+        if (this._dockSide)
+            WebInspector.settings.lastDockState.set(this._dockSide);
 
-        if (!docked) {
-            this._state = WebInspector.DockController.State.Undocked;
+        this._dockSide = dockSide;
+        if (dockSide === WebInspector.DockController.State.Undocked) 
             WebInspector.userMetrics.WindowDocked.record();
-        } else if (this._dockSide === "right") {
-            this._state = WebInspector.DockController.State.DockedToRight;
-            WebInspector.userMetrics.WindowUndocked.record();
-        } else {
-            this._state = WebInspector.DockController.State.DockedToBottom;
+        else
             WebInspector.userMetrics.WindowUndocked.record();
-        }
         this._updateUI();
     },
 
@@ -102,7 +86,7 @@ WebInspector.DockController.prototype = {
     _updateUI: function()
     {
         var body = document.body;
-        switch (this._state) {
+        switch (this._dockSide) {
         case WebInspector.DockController.State.DockedToBottom:
             body.removeStyleClass("undocked");
             body.removeStyleClass("dock-to-right");
@@ -129,17 +113,17 @@ WebInspector.DockController.prototype = {
         this._dockToggleButton.disabled = false;
 
         // Choose different last state based on the current one if missing or if is the same.
-        var states = [WebInspector.DockController.State.DockedToBottom, WebInspector.DockController.State.Undocked, WebInspector.DockController.State.DockedToRight];
-        states.remove(this._state);
+        var sides = [WebInspector.DockController.State.DockedToBottom, WebInspector.DockController.State.Undocked, WebInspector.DockController.State.DockedToRight];
+        sides.remove(this._dockSide);
         var lastState = WebInspector.settings.lastDockState.get();
 
-        states.remove(lastState);
-        if (states.length === 2) { // last state was not from the list of potential values
-            lastState = states[0];
-            states.remove(lastState);
+        sides.remove(lastState);
+        if (sides.length === 2) { // last state was not from the list of potential values
+            lastState = sides[0];
+            sides.remove(lastState);
         }
         this._decorateButtonForTargetState(this._dockToggleButton, lastState);
-        this._decorateButtonForTargetState(this._dockToggleButtonOption, states[0]);
+        this._decorateButtonForTargetState(this._dockToggleButtonOption, sides[0]);
     },
 
     /**
@@ -174,22 +158,13 @@ WebInspector.DockController.prototype = {
      */
     _toggleDockState: function(e)
     {
-        var state = e.target.state;
-        switch (state) {
-        case "undock":
-            InspectorFrontendHost.requestDetachWindow();
-            WebInspector.userMetrics.WindowUndocked.record();
-            break;
-        case "right":
-        case "bottom":
-            this._dockSide = state;
-            InspectorFrontendHost.requestSetDockSide(this._dockSide);
-            if (this._state === WebInspector.DockController.State.Undocked)
-                InspectorFrontendHost.requestAttachWindow();
-            else
-                this._innerSetDocked(true);
-            break;
+        var action;
+        switch (e.target.state) {
+        case "bottom": action = "bottom"; break;
+        case "right": action = "right"; break;
+        case "undock": action = "undocked"; break;
         }
+        InspectorFrontendHost.requestSetDockSide(action);
     },
 
     /**
index c0c60db..f1bb82b 100644 (file)
@@ -74,14 +74,15 @@ var InspectorFrontendAPI = {
             WebInspector.CPUProfileType.instance.stopRecordingProfile();
     },
 
-    setAttachedWindow: function(attached)
+    setAttachedWindow: function(side)
     {
-        if (WebInspector.dockController)
-            WebInspector.dockController.setDocked(attached);
+      
     },
 
-    setDockSide: function(dockSide)
+    setDockSide: function(side)
     {
+        if (WebInspector.dockController)
+            WebInspector.dockController.setDockSide(side);
     },
 
     showConsole: function()
index 30494f2..e92348a 100644 (file)
@@ -69,18 +69,9 @@ WebInspector.InspectorFrontendHostStub.prototype = {
         this._windowVisible = false;
     },
 
-    requestAttachWindow: function()
-    {
-        InspectorFrontendAPI.setAttachedWindow(true);
-    },
-
-    requestDetachWindow: function()
-    {
-        InspectorFrontendAPI.setAttachedWindow(false);
-    },
-
-    requestSetDockSide: function()
+    requestSetDockSide: function(side)
     {
+        InspectorFrontendAPI.setDockSide(side);
     },
 
     setAttachedWindowHeight: function(height)
index ab3e5ee..a06ce9e 100644 (file)
@@ -123,8 +123,6 @@ InspectorFrontendHostAPI.prototype.platform = function() {}
 InspectorFrontendHostAPI.prototype.port = function() {}
 InspectorFrontendHostAPI.prototype.bringToFront = function() {}
 InspectorFrontendHostAPI.prototype.closeWindow = function() {}
-InspectorFrontendHostAPI.prototype.requestAttachWindow = function() {}
-InspectorFrontendHostAPI.prototype.requestDetachWindow = function() {}
 InspectorFrontendHostAPI.prototype.requestSetDockSide = function(dockSide) {}
 InspectorFrontendHostAPI.prototype.setAttachedWindowHeight = function(height) {}
 InspectorFrontendHostAPI.prototype.moveWindowBy = function(x, y) {}
index f1597dd..b6a1b23 100644 (file)
@@ -1,3 +1,16 @@
+2012-10-19  Pavel Feldman  <pfeldman@chromium.org>
+
+        Web Inspector: merge "docked" state into the "dock side" enum.
+        https://bugs.webkit.org/show_bug.cgi?id=99717
+
+        Reviewed by Vsevolod Vlasov.
+
+        * public/WebDevToolsFrontendClient.h:
+        * src/InspectorFrontendClientImpl.cpp:
+        (WebKit::InspectorFrontendClientImpl::requestSetDockSide):
+        * src/InspectorFrontendClientImpl.h:
+        (InspectorFrontendClientImpl):
+
 2012-09-08  Alpha Lam  <hclam@chromium.org>
 
         [chromium] Implement deferred image decoding
index 0438cd3..0191429 100644 (file)
@@ -45,8 +45,6 @@ public:
 
     virtual void activateWindow() { }
     virtual void closeWindow() { }
-    virtual void requestDockWindow() { }
-    virtual void requestUndockWindow() { }
     virtual void requestSetDockSide(const WebString& side) { }
     virtual void moveWindowBy(const WebFloatPoint&) { }
     virtual void openInNewTab(const WebString& side) { }
index 763c85d..fcfa25f 100644 (file)
@@ -103,19 +103,15 @@ void InspectorFrontendClientImpl::closeWindow()
     m_client->closeWindow();
 }
 
-void InspectorFrontendClientImpl::requestAttachWindow()
-{
-    m_client->requestDockWindow();
-}
-
-void InspectorFrontendClientImpl::requestDetachWindow()
-{
-    m_client->requestUndockWindow();
-}
-
-void InspectorFrontendClientImpl::requestSetDockSide(const String& side)
-{
-    m_client->requestSetDockSide(side);
+void InspectorFrontendClientImpl::requestSetDockSide(DockSide side)
+{
+    String sideString = "undocked";
+    switch (side) {
+    case DOCKED_TO_RIGHT: sideString = "right"; break;
+    case DOCKED_TO_BOTTOM: sideString = "bottom"; break;
+    case UNDOCKED: sideString = "undocked"; break;
+    }
+    m_client->requestSetDockSide(sideString);
 }
 
 void InspectorFrontendClientImpl::changeAttachedWindowHeight(unsigned)
index 55e57e6..72f8d68 100644 (file)
@@ -62,9 +62,7 @@ public:
     virtual void bringToFront();
     virtual void closeWindow();
 
-    virtual void requestAttachWindow();
-    virtual void requestDetachWindow();
-    virtual void requestSetDockSide(const String&);
+    virtual void requestSetDockSide(DockSide);
     virtual void changeAttachedWindowHeight(unsigned);
 
     virtual void openInNewTab(const String& url);
index d39f14a..5db4447 100644 (file)
@@ -304,8 +304,7 @@ EXPORTS
         ?moveWindowBy@InspectorFrontendClientLocal@WebCore@@UAEXMM@Z
         ?open@DOMWindow@WebCore@@QAE?AV?$PassRefPtr@VDOMWindow@WebCore@@@WTF@@ABVString@4@ABVAtomicString@4@0PAV12@2@Z
         ?openInNewTab@InspectorFrontendClientLocal@WebCore@@UAEXABVString@WTF@@@Z
-        ?requestAttachWindow@InspectorFrontendClientLocal@WebCore@@UAEXXZ
-        ?requestDetachWindow@InspectorFrontendClientLocal@WebCore@@UAEXXZ
+        ?requestSetDockSide@InspectorFrontendClientLocal@WebCore@@UAEXW4DockSide@InspectorFrontendClient@2@@Z
         ?sendMessageToBackend@InspectorFrontendClientLocal@WebCore@@UAEXABVString@WTF@@@Z
         ?setInspectorFrontendClient@InspectorController@WebCore@@QAEXV?$PassOwnPtr@VInspectorFrontendClient@WebCore@@@WTF@@@Z
         ?setProperty@Settings@InspectorFrontendClientLocal@WebCore@@UAEXABVString@WTF@@0@Z
index d6fd9fb..cada54a 100644 (file)
@@ -293,8 +293,7 @@ EXPORTS
         ?moveWindowBy@InspectorFrontendClientLocal@WebCore@@UAEXMM@Z
         ?open@DOMWindow@WebCore@@QAE?AV?$PassRefPtr@VDOMWindow@WebCore@@@WTF@@ABVString@4@ABVAtomicString@4@0PAV12@2@Z
         ?openInNewTab@InspectorFrontendClientLocal@WebCore@@UAEXABVString@WTF@@@Z
-        ?requestAttachWindow@InspectorFrontendClientLocal@WebCore@@UAEXXZ
-        ?requestDetachWindow@InspectorFrontendClientLocal@WebCore@@UAEXXZ
+        ?requestSetDockSide@InspectorFrontendClientLocal@WebCore@@UAEXW4DockSide@InspectorFrontendClient@2@@Z
         ?sendMessageToBackend@InspectorFrontendClientLocal@WebCore@@UAEXABVString@WTF@@@Z
         ?setInspectorFrontendClient@InspectorController@WebCore@@QAEXV?$PassOwnPtr@VInspectorFrontendClient@WebCore@@@WTF@@@Z
         ?setProperty@Settings@InspectorFrontendClientLocal@WebCore@@UAEXABVString@WTF@@0@Z
index aed54af..e81a66a 100644 (file)
@@ -99,8 +99,7 @@ _ZN7WebCore25jsStringWithCacheSlowCaseEPN3JSC9ExecStateERN3WTF7HashMapIPNS3_10St
 _ZN7WebCore28InspectorFrontendClientLocal12moveWindowByEff;
 _ZN7WebCore28InspectorFrontendClientLocal12openInNewTabERKN3WTF6StringE;
 _ZN7WebCore28InspectorFrontendClientLocal14frontendLoadedEv;
-_ZN7WebCore28InspectorFrontendClientLocal19requestAttachWindowEv;
-_ZN7WebCore28InspectorFrontendClientLocal19requestDetachWindowEv;
+_ZN7WebCore28InspectorFrontendClientLocal18requestSetDockSideENS_23InspectorFrontendClient8DockSideE;
 _ZN7WebCore28InspectorFrontendClientLocal19windowObjectClearedEv;
 _ZN7WebCore28InspectorFrontendClientLocal20sendMessageToBackendERKN3WTF6StringE;
 _ZN7WebCore28InspectorFrontendClientLocal26changeAttachedWindowHeightEj;