Title: [140543] trunk/Source
Revision
140543
Author
[email protected]
Date
2013-01-23 10:22:37 -0800 (Wed, 23 Jan 2013)

Log Message

Source/WebCore: Web Inspector: allow user to resize inspector window by dragging the toolbar
https://bugs.webkit.org/show_bug.cgi?id=107648

Patch by Dmitry Gozman <[email protected]> on 2013-01-23
Reviewed by Pavel Feldman.

This did not work before you click dock button once.
Also, last drag position was not respected.

No new tests, because of pure inspector UI change.

* inspector/front-end/DockController.js:
(WebInspector.DockController.prototype.isDockedToBottom):
* inspector/front-end/Toolbar.js:
(WebInspector.Toolbar.prototype._isDockedToBottom):
(WebInspector.Toolbar.prototype._toolbarDragStart):
(WebInspector.Toolbar.prototype._toolbarDragEnd):
(WebInspector.Toolbar.prototype._toolbarDrag):

Source/WebKit/chromium: Added changeAttachedWindowHeight method to inspector frontend API, which
allows to change inspector window height from inside.
https://bugs.webkit.org/show_bug.cgi?id=107648

Patch by Dmitry Gozman <[email protected]> on 2013-01-23
Reviewed by Pavel Feldman.

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

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (140542 => 140543)


--- trunk/Source/WebCore/ChangeLog	2013-01-23 18:20:46 UTC (rev 140542)
+++ trunk/Source/WebCore/ChangeLog	2013-01-23 18:22:37 UTC (rev 140543)
@@ -1,3 +1,23 @@
+2013-01-23  Dmitry Gozman  <[email protected]>
+
+        Web Inspector: allow user to resize inspector window by dragging the toolbar
+        https://bugs.webkit.org/show_bug.cgi?id=107648
+
+        Reviewed by Pavel Feldman.
+
+        This did not work before you click dock button once.
+        Also, last drag position was not respected.
+
+        No new tests, because of pure inspector UI change.
+
+        * inspector/front-end/DockController.js:
+        (WebInspector.DockController.prototype.isDockedToBottom):
+        * inspector/front-end/Toolbar.js:
+        (WebInspector.Toolbar.prototype._isDockedToBottom):
+        (WebInspector.Toolbar.prototype._toolbarDragStart):
+        (WebInspector.Toolbar.prototype._toolbarDragEnd):
+        (WebInspector.Toolbar.prototype._toolbarDrag):
+
 2013-01-23  Shinya Kawanaka  <[email protected]>
 
         shadowAncestorNode() should be renamed to deprecatedShadowAncestorNode()

Modified: trunk/Source/WebCore/inspector/front-end/DockController.js (140542 => 140543)


--- trunk/Source/WebCore/inspector/front-end/DockController.js	2013-01-23 18:20:46 UTC (rev 140542)
+++ trunk/Source/WebCore/inspector/front-end/DockController.js	2013-01-23 18:22:37 UTC (rev 140543)
@@ -92,6 +92,14 @@
     },
 
     /**
+     * @return {boolean}
+     */
+    isDockedToBottom: function()
+    {
+        return this._dockSide == WebInspector.DockController.State.DockedToBottom;
+    },
+
+    /**
      * @param {boolean} unavailable
      */
     setDockingUnavailable: function(unavailable)
@@ -121,8 +129,6 @@
             break;
         }
 
-        if (WebInspector.toolbar)
-            WebInspector.toolbar.setDockedToBottom(this._dockSide === WebInspector.DockController.State.DockedToBottom);
         if (WebInspector.settings.showToolbarIcons.get())
             document.body.addStyleClass("show-toolbar-icons");
         else
@@ -199,4 +205,4 @@
 /**
  * @type {?WebInspector.DockController}
  */
-WebInspector.dockController = null;
\ No newline at end of file
+WebInspector.dockController = null;

Modified: trunk/Source/WebCore/inspector/front-end/Toolbar.js (140542 => 140543)


--- trunk/Source/WebCore/inspector/front-end/Toolbar.js	2013-01-23 18:20:46 UTC (rev 140542)
+++ trunk/Source/WebCore/inspector/front-end/Toolbar.js	2013-01-23 18:22:37 UTC (rev 140543)
@@ -97,11 +97,11 @@
     },
 
     /**
-     * @param {boolean} dockedToBottom
+     * @return {boolean}
      */
-    setDockedToBottom: function(dockedToBottom)
+    _isDockedToBottom: function()
     {
-        this._isDockedToBottom = dockedToBottom;
+        return WebInspector.dockController && WebInspector.dockController.isDockedToBottom();
     },
 
     /**
@@ -109,7 +109,7 @@
      */
     _toolbarDragStart: function(event)
     {
-        if ((!this._isDockedToBottom && WebInspector.platformFlavor() !== WebInspector.PlatformFlavor.MacLeopard && WebInspector.platformFlavor() !== WebInspector.PlatformFlavor.MacSnowLeopard) || WebInspector.port() == "qt")
+        if ((!this._isDockedToBottom() && WebInspector.platformFlavor() !== WebInspector.PlatformFlavor.MacLeopard && WebInspector.platformFlavor() !== WebInspector.PlatformFlavor.MacSnowLeopard) || WebInspector.port() == "qt")
             return false;
 
         var target = event.target;
@@ -121,19 +121,25 @@
 
         this.element.lastScreenX = event.screenX;
         this.element.lastScreenY = event.screenY;
+        this._lastHeightDuringDrag = window.innerHeight;
         return true;
     },
 
     _toolbarDragEnd: function(event)
     {
+        // We may not get the drag event at the end.
+        // Apply last changes manually.
+        this._toolbarDrag(event);
         delete this.element.lastScreenX;
         delete this.element.lastScreenY;
+        delete this._lastHeightDuringDrag;
     },
 
     _toolbarDrag: function(event)
     {
-        if (this._isDockedToBottom) {
-            var height = window.innerHeight - (event.screenY - this.element.lastScreenY);
+        if (this._isDockedToBottom()) {
+            var height = this._lastHeightDuringDrag - (event.screenY - this.element.lastScreenY);
+            this._lastHeightDuringDrag = height;
 
             InspectorFrontendHost.setAttachedWindowHeight(height);
         } else {

Modified: trunk/Source/WebKit/chromium/ChangeLog (140542 => 140543)


--- trunk/Source/WebKit/chromium/ChangeLog	2013-01-23 18:20:46 UTC (rev 140542)
+++ trunk/Source/WebKit/chromium/ChangeLog	2013-01-23 18:22:37 UTC (rev 140543)
@@ -1,3 +1,16 @@
+2013-01-23  Dmitry Gozman  <[email protected]>
+
+        Added changeAttachedWindowHeight method to inspector frontend API, which
+        allows to change inspector window height from inside.
+        https://bugs.webkit.org/show_bug.cgi?id=107648
+
+        Reviewed by Pavel Feldman.
+
+        * public/WebDevToolsFrontendClient.h:
+        (WebKit::WebDevToolsFrontendClient::changeAttachedWindowHeight):
+        * src/InspectorFrontendClientImpl.cpp:
+        (WebKit::InspectorFrontendClientImpl::changeAttachedWindowHeight):
+
 2013-01-23  Shinya Kawanaka  <[email protected]>
 
         shadowAncestorNode() should be renamed to deprecatedShadowAncestorNode()

Modified: trunk/Source/WebKit/chromium/public/WebDevToolsFrontendClient.h (140542 => 140543)


--- trunk/Source/WebKit/chromium/public/WebDevToolsFrontendClient.h	2013-01-23 18:20:46 UTC (rev 140542)
+++ trunk/Source/WebKit/chromium/public/WebDevToolsFrontendClient.h	2013-01-23 18:22:37 UTC (rev 140543)
@@ -44,6 +44,7 @@
     virtual void sendMessageToBackend(const WebString&) { }
 
     virtual void activateWindow() { }
+    virtual void changeAttachedWindowHeight(unsigned height) { }
     virtual void closeWindow() { }
     virtual void requestDockWindow() { }
     virtual void requestUndockWindow() { }

Modified: trunk/Source/WebKit/chromium/src/InspectorFrontendClientImpl.cpp (140542 => 140543)


--- trunk/Source/WebKit/chromium/src/InspectorFrontendClientImpl.cpp	2013-01-23 18:20:46 UTC (rev 140542)
+++ trunk/Source/WebKit/chromium/src/InspectorFrontendClientImpl.cpp	2013-01-23 18:22:37 UTC (rev 140543)
@@ -114,9 +114,9 @@
     m_client->requestSetDockSide(sideString);
 }
 
-void InspectorFrontendClientImpl::changeAttachedWindowHeight(unsigned)
+void InspectorFrontendClientImpl::changeAttachedWindowHeight(unsigned height)
 {
-    // Do nothing;
+    m_client->changeAttachedWindowHeight(height);
 }
 
 void InspectorFrontendClientImpl::openInNewTab(const String& url)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to