WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
108073
Web Inspector: Allow user to change dock side by dragging toolbar
https://bugs.webkit.org/show_bug.cgi?id=108073
Summary
Web Inspector: Allow user to change dock side by dragging toolbar
Dmitry Gozman
Reported
2013-01-28 03:53:38 PST
We should allow user to change dock side (bottom to right and vice versa) by dragging the toolbar.
Attachments
Patch
(7.63 KB, patch)
2013-01-28 04:12 PST
,
Dmitry Gozman
no flags
Details
Formatted Diff
Diff
Patch
(7.84 KB, patch)
2013-01-28 05:57 PST
,
Dmitry Gozman
no flags
Details
Formatted Diff
Diff
Patch
(9.21 KB, patch)
2013-01-30 04:08 PST
,
Dmitry Gozman
no flags
Details
Formatted Diff
Diff
Patch
(8.73 KB, patch)
2013-01-30 04:12 PST
,
Dmitry Gozman
no flags
Details
Formatted Diff
Diff
Patch
(9.76 KB, patch)
2013-01-30 05:36 PST
,
Dmitry Gozman
no flags
Details
Formatted Diff
Diff
Patch
(10.03 KB, patch)
2013-01-31 03:36 PST
,
Dmitry Gozman
no flags
Details
Formatted Diff
Diff
Patch
(10.02 KB, patch)
2013-01-31 04:35 PST
,
Dmitry Gozman
no flags
Details
Formatted Diff
Diff
Patch
(9.89 KB, patch)
2013-02-04 05:48 PST
,
Dmitry Gozman
no flags
Details
Formatted Diff
Diff
Show Obsolete
(7)
View All
Add attachment
proposed patch, testcase, etc.
Dmitry Gozman
Comment 1
2013-01-28 04:12:11 PST
Created
attachment 184968
[details]
Patch
Pavel Feldman
Comment 2
2013-01-28 04:40:19 PST
Comment on
attachment 184968
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=184968&action=review
> Source/WebCore/inspector/front-end/DockController.js:198 > + changeDockSide: function(side) {
Why extracting a method that does pure delegation?
> Source/WebCore/inspector/front-end/Toolbar.js:46 > + this._isWindowMoveSupported = WebInspector.platformFlavor() == WebInspector.PlatformFlavor.MacLeopard || WebInspector.platformFlavor() == WebInspector.PlatformFlavor.MacSnowLeopard;
Why is this platform-specific?
> Source/WebCore/inspector/front-end/Toolbar.js:102 > + * @return {boolean?}
This is a boolean query, why is it nullable? Use !! below instead.
> Source/WebCore/inspector/front-end/Toolbar.js:112 > + _isUndocked: function()
ditto
> Source/WebCore/inspector/front-end/Toolbar.js:137 > + this._startDeltaX = window.innerWidth - event.clientX;
Delta between what and what?
> Source/WebCore/inspector/front-end/Toolbar.js:176 > + // After changing dock side, drag events start working unpredictably, so we disable the handling.
Why is that? It should not be unpredictable
> Source/WebCore/inspector/front-end/Toolbar.js:179 > + if (delta < this._startDeltaX / 2) {
Consider renaming delta to something else - otherwise it is hard to follow the logic.
Dmitry Gozman
Comment 3
2013-01-28 05:55:14 PST
Comment on
attachment 184968
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=184968&action=review
>> Source/WebCore/inspector/front-end/DockController.js:198 >> + changeDockSide: function(side) { > > Why extracting a method that does pure delegation?
Because DockController should own dock-related methods, including this one. Do you mean we should call |InspectorFrontendHost.requestDockSide| in arbitrary places?
>> Source/WebCore/inspector/front-end/Toolbar.js:46 >> + this._isWindowMoveSupported = WebInspector.platformFlavor() == WebInspector.PlatformFlavor.MacLeopard || WebInspector.platformFlavor() == WebInspector.PlatformFlavor.MacSnowLeopard; > > Why is this platform-specific?
I've just moved the code from _toolbarDragStart method. Looks like |moveWindowBy| does not work on other platforms. I will look into this later.
>> Source/WebCore/inspector/front-end/Toolbar.js:102 >> + * @return {boolean?} > > This is a boolean query, why is it nullable? Use !! below instead.
Done.
>> Source/WebCore/inspector/front-end/Toolbar.js:176 >> + // After changing dock side, drag events start working unpredictably, so we disable the handling. > > Why is that? It should not be unpredictable
On linux, you are not able to drag to the top of current position after changing dock side. You have to release mouse and start new drag for it to properly work. Adjusted the comment.
>> Source/WebCore/inspector/front-end/Toolbar.js:179 >> + if (delta < this._startDeltaX / 2) { > > Consider renaming delta to something else - otherwise it is hard to follow the logic.
Done.
Dmitry Gozman
Comment 4
2013-01-28 05:57:15 PST
Created
attachment 184974
[details]
Patch
Pavel Feldman
Comment 5
2013-01-30 03:32:22 PST
Comment on
attachment 184974
[details]
Patch Lets disabled resize via drag for now for better UX.
Dmitry Gozman
Comment 6
2013-01-30 04:08:49 PST
Created
attachment 185464
[details]
Patch
Dmitry Gozman
Comment 7
2013-01-30 04:12:19 PST
Created
attachment 185465
[details]
Patch
Pavel Feldman
Comment 8
2013-01-30 04:34:54 PST
Comment on
attachment 185465
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=185465&action=review
> Source/WebCore/inspector/front-end/DockController.js:198 > + changeDockSide: function(side) {
{ should go to the next line.
> Source/WebCore/inspector/front-end/Toolbar.js:106 > + return !!(WebInspector.dockController && WebInspector.dockController.dockSide() == WebInspector.DockController.State.DockedToBottom);
Should have been !!WebInspector.dockController && WebInspector.dockController.isDockedToBottom();
> Source/WebCore/inspector/front-end/Toolbar.js:-144 > - InspectorFrontendHost.setAttachedWindowHeight(height);
Mac port will get upset about regressing this. Especially given they don't support dock-to-right. You should maintain existing behavior for the ports that have Preferences.showDockToRight === false.
> Source/WebCore/inspector/front-end/UIUtils.js:100 > +WebInspector.cancelDragEvents = function(element)
You should instead keep this private and allow elementDrag handler terminate current drag operation. For example, it could return "true" to terminate the drag. Otherwise this API becomes error prone
Dmitry Gozman
Comment 9
2013-01-30 05:31:17 PST
Comment on
attachment 185465
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=185465&action=review
>> Source/WebCore/inspector/front-end/DockController.js:198 >> + changeDockSide: function(side) { > > { should go to the next line.
Done.
>> Source/WebCore/inspector/front-end/Toolbar.js:106 >> + return !!(WebInspector.dockController && WebInspector.dockController.dockSide() == WebInspector.DockController.State.DockedToBottom); > > Should have been !!WebInspector.dockController && WebInspector.dockController.isDockedToBottom();
Done.
>> Source/WebCore/inspector/front-end/Toolbar.js:-144 >> - InspectorFrontendHost.setAttachedWindowHeight(height); > > Mac port will get upset about regressing this. Especially given they don't support dock-to-right. You should maintain existing behavior for the ports that have Preferences.showDockToRight === false.
Fixed.
>> Source/WebCore/inspector/front-end/UIUtils.js:100 >> +WebInspector.cancelDragEvents = function(element) > > You should instead keep this private and allow elementDrag handler terminate current drag operation. For example, it could return "true" to terminate the drag. Otherwise this API becomes error prone
Done.
Dmitry Gozman
Comment 10
2013-01-30 05:36:36 PST
Created
attachment 185475
[details]
Patch
Dmitry Gozman
Comment 11
2013-01-31 03:36:50 PST
Created
attachment 185736
[details]
Patch
Pavel Feldman
Comment 12
2013-01-31 03:47:43 PST
Comment on
attachment 185736
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=185736&action=review
> Source/WebCore/inspector/front-end/DockController.js:67 > + return this._dockSide;
4 space indentation please.
> Source/WebCore/inspector/front-end/DockController.js:193 > + InspectorFrontendHost.requestSetDockSide(side);
It still looks weird - why introducing a method that does nothing but delegation?
> Source/WebCore/inspector/front-end/Toolbar.js:46 > + this._isWindowMoveSupported = WebInspector.platformFlavor() == WebInspector.PlatformFlavor.MacLeopard || WebInspector.platformFlavor() == WebInspector.PlatformFlavor.MacSnowLeopard;
WebInspector.platformFlavor would return MacLeopard Chromium's Mac port. You want (!Preferences.showDockToRight && WebInspector.isMac())
> Source/WebCore/inspector/front-end/Toolbar.js:122 > + if (WebInspector.port() == "qt")
Scattered platforms checks does not look good. You should only install drag handler in case (this._isWindowMoveSupported || Preferences.showDockToRight). If fact, you probably want different drag handlers for better readability. Otherwise, you mix two different actions into single drag handling pipeline. Sorry for bringing it up so late, but it is so obvious now.
Dmitry Gozman
Comment 13
2013-01-31 04:35:46 PST
Created
attachment 185748
[details]
Patch
Dmitry Gozman
Comment 14
2013-01-31 04:38:16 PST
View in context:
https://bugs.webkit.org/attachment.cgi?id=185736&action=review
>> Source/WebCore/inspector/front-end/DockController.js:67 >> + return this._dockSide; > > 4 space indentation please.
Done :)
>> Source/WebCore/inspector/front-end/DockController.js:193 >> + InspectorFrontendHost.requestSetDockSide(side); > > It still looks weird - why introducing a method that does nothing but delegation?
Ok, let's call InspectorFrontendHost directly.
>> Source/WebCore/inspector/front-end/Toolbar.js:46 >> + this._isWindowMoveSupported = WebInspector.platformFlavor() == WebInspector.PlatformFlavor.MacLeopard || WebInspector.platformFlavor() == WebInspector.PlatformFlavor.MacSnowLeopard; > > WebInspector.platformFlavor would return MacLeopard Chromium's Mac port. You want (!Preferences.showDockToRight && WebInspector.isMac())
Looks like it's supported on each Mac port.
>> Source/WebCore/inspector/front-end/Toolbar.js:122 >> + if (WebInspector.port() == "qt") > > Scattered platforms checks does not look good. You should only install drag handler in case (this._isWindowMoveSupported || Preferences.showDockToRight). If fact, you probably want different drag handlers for better readability. Otherwise, you mix two different actions into single drag handling pipeline. Sorry for bringing it up so late, but it is so obvious now.
It turned to be impossible to install different drag handlers: we should handle both undocked and docked situations always. I've split implementation into 3 methods.
Pavel Feldman
Comment 15
2013-02-04 04:44:09 PST
Comment on
attachment 185748
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=185748&action=review
Looks good! Please fix the style nits and reattach for automated landing!
> Source/WebCore/inspector/front-end/Toolbar.js:158 > + else if (Preferences.showDockToRight)
Remove "else"
> Source/WebCore/inspector/front-end/Toolbar.js:160 > + else
ditto
> Source/WebCore/inspector/front-end/Toolbar.js:170 > + // We cannot call window.moveBy here because it restricts the movement
Just remove this comment...
Dmitry Gozman
Comment 16
2013-02-04 05:48:32 PST
Created
attachment 186358
[details]
Patch
WebKit Review Bot
Comment 17
2013-02-04 06:45:00 PST
Comment on
attachment 186358
[details]
Patch Clearing flags on attachment: 186358 Committed
r141768
: <
http://trac.webkit.org/changeset/141768
>
WebKit Review Bot
Comment 18
2013-02-04 06:45:05 PST
All reviewed patches have been landed. Closing bug.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug