Bug 167034 - Web Inspector: no discoverable way to dismiss the split console
Summary: Web Inspector: no discoverable way to dismiss the split console
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P2 Normal
Assignee: Matt Baker
URL:
Keywords: InRadar
Depends on:
Blocks: 175365
  Show dependency treegraph
 
Reported: 2017-01-13 16:57 PST by BJ Burg
Modified: 2017-08-08 21:02 PDT (History)
9 users (show)

See Also:


Attachments
Patch (35.82 KB, patch)
2017-06-20 13:16 PDT, Matt Baker
no flags Details | Formatted Diff | Diff
[Image] Dismiss button (95.80 KB, image/png)
2017-06-20 14:15 PDT, Matt Baker
no flags Details
Archive of layout-test-results from ews100 for mac-elcapitan (1.14 MB, application/zip)
2017-06-20 15:53 PDT, Build Bot
no flags Details
Patch (35.91 KB, patch)
2017-06-21 13:58 PDT, Matt Baker
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description BJ Burg 2017-01-13 16:57:03 PST
You have to randomly hit ESC, or click the Show console tab icon and switch back, to get rid of the split console. Maybe we could make the Show Console Tab have a chevron pointing down next to it, or we could add a "hide debug area" style button like Xcode on the left edge of the split console navigation bar.
Comment 1 Radar WebKit Bug Importer 2017-01-13 16:57:21 PST
<rdar://problem/30023436>
Comment 2 Matt Baker 2017-01-13 18:30:33 PST
This is covered by https://bugs.webkit.org/show_bug.cgi?id=165211, which adds a expand/collapse button (styled after Xcode's debugging console).
Comment 3 Matt Baker 2017-01-14 19:20:47 PST
I'll break this change out from the WIP patch I have for the above bug.
Comment 4 Matt Baker 2017-06-20 13:16:48 PDT
Created attachment 313430 [details]
Patch
Comment 5 Nikita Vasilyev 2017-06-20 13:35:14 PDT
Screenshot?
Comment 6 Matt Baker 2017-06-20 14:15:56 PDT
Created attachment 313438 [details]
[Image] Dismiss button

This is a toggle, so it has a "Show Console" state as well. This is unused now, but I'd like to leave it in for future use.
Comment 7 Nikita Vasilyev 2017-06-20 14:26:50 PDT
Comment on attachment 313430 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=313430&action=review

> Source/WebInspectorUI/UserInterface/Images/HideConsoleDrawer.svg:2
> +<!-- Copyright © 2016 Apple Inc. All rights reserved. -->

2017.

> Source/WebInspectorUI/UserInterface/Images/ShowConsoleDrawer.svg:2
> +<!-- Copyright © 2016 Apple Inc. All rights reserved. -->

2017.
Comment 8 Build Bot 2017-06-20 15:53:57 PDT
Comment on attachment 313430 [details]
Patch

Attachment 313430 [details] did not pass mac-ews (mac):
Output: http://webkit-queues.webkit.org/results/3968205

New failing tests:
inspector/canvas/create-canvas-contexts.html
Comment 9 Build Bot 2017-06-20 15:53:58 PDT
Created attachment 313447 [details]
Archive of layout-test-results from ews100 for mac-elcapitan

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: ews100  Port: mac-elcapitan  Platform: Mac OS X 10.11.6
Comment 10 Devin Rousso 2017-06-20 19:21:05 PDT
Comment on attachment 313430 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=313430&action=review

> Source/WebInspectorUI/UserInterface/Base/Main.js:-302
> -    this._consoleTreeElement = new WebInspector.LogTreeElement(this._consoleRepresentedObject);

IIRC, LogTreeElement was created to help with restoring the console tab when reopening the inspector (honestly could be wrong here).  Does this still work?

> Source/WebInspectorUI/UserInterface/Base/Main.js:1597
> +    this._showingSplitConsoleSetting.value = !this.consoleDrawer.collapsed;

NIT: you can use the helper from above:

    this._showingSplitConsoleSetting.value = WebInspector.isShowingSplitConsole();

> Source/WebInspectorUI/UserInterface/Views/ConsoleDrawer.js:30
> +        super(element, null, true, false);

NIT: I think it would be nice to have these constant arguments be named:

    const delegate = null;
    const disableBackForward = true;
    const disableFindBanner = false;
    super(element, delegate, disableBackForward, disableFindBanner);

> Source/WebInspectorUI/UserInterface/Views/ConsoleDrawer.js:42
> +        this.collapsed = true;

Instead of having "_showingSplitConsoleSetting" be on WebInspector, why not move it to this class and ditch much of the event logic for updating it's value.  It would also help avoid unnecessary className churn, since you assume it to be collapsed here and it might not be via the setting.

> Source/WebInspectorUI/UserInterface/Views/ConsoleDrawer.js:69
> +        this.dispatchEventToListeners(WebInspector.ConsoleDrawer.Event.Resized);

I don't really think this makes sense.  Personally, I see the drawer collapsing as more of a "disappear" than a "resized to 0".  I would rather the listeners for CollapsedStateChange understand that collapsing means it changed size than have this event be fired.

> Source/WebInspectorUI/UserInterface/Views/ConsoleDrawer.js:87
> +    layout()

NIT: please call super.layout() just in case we need to do something with ContentBrowser.prototype.layout or View.prototype.layout in the future.

> Source/WebInspectorUI/UserInterface/Views/ConsoleDrawer.js:95
> +        let oldHeight = this.element.offsetHeight;

NIT: you can just call this.height

    let oldHeight = this.height;

> Source/WebInspectorUI/UserInterface/Views/ConsoleDrawer.js:146
> +        if (height === this.element.style.height)

Would it be better to compare to this.height?

    if (height === this.height)

> Source/WebInspectorUI/UserInterface/Views/ConsoleDrawer.js:149
> +        this.element.style.height = height + "px";

NIT: template string

    this.element.style.height = `${height}px`;

> Source/WebInspectorUI/UserInterface/Views/QuickConsole.js:342
> +        let showingLog = WebInspector.isShowingConsoleTab() ? true : !WebInspector.consoleDrawer.collapsed;
> +        this.element.classList.toggle("showing-log", showingLog);

I think this can be simplified:

    this.element.classList.toggle("showing-log", WebInspector.isShowingConsoleTab() || WebInspector.isShowingSplitConsole());
Comment 11 Matt Baker 2017-06-21 13:51:14 PDT
Comment on attachment 313430 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=313430&action=review

>> Source/WebInspectorUI/UserInterface/Base/Main.js:-302
>> -    this._consoleTreeElement = new WebInspector.LogTreeElement(this._consoleRepresentedObject);
> 
> IIRC, LogTreeElement was created to help with restoring the console tab when reopening the inspector (honestly could be wrong here).  Does this still work?

It works, Main.js restores the selected tab from `this._selectedTabIndexSetting`.

>> Source/WebInspectorUI/UserInterface/Views/ConsoleDrawer.js:42
>> +        this.collapsed = true;
> 
> Instead of having "_showingSplitConsoleSetting" be on WebInspector, why not move it to this class and ditch much of the event logic for updating it's value.  It would also help avoid unnecessary className churn, since you assume it to be collapsed here and it might not be via the setting.

WebInspector manages the console's collapsed state, since the selected tab may not support the split console. We could revisit this in the future.

>> Source/WebInspectorUI/UserInterface/Views/ConsoleDrawer.js:149
>> +        this.element.style.height = height + "px";
> 
> NIT: template string
> 
>     this.element.style.height = `${height}px`;

I don't think there is much of a benefit for such simple string concatenations.
Comment 12 Matt Baker 2017-06-21 13:58:26 PDT
Created attachment 313548 [details]
Patch
Comment 13 Devin Rousso 2017-06-23 01:54:56 PDT
Comment on attachment 313548 [details]
Patch

r=me.  Awesome work!
Comment 14 WebKit Commit Bot 2017-06-27 14:01:57 PDT
Comment on attachment 313548 [details]
Patch

Clearing flags on attachment: 313548

Committed r218839: <http://trac.webkit.org/changeset/218839>
Comment 15 WebKit Commit Bot 2017-06-27 14:01:59 PDT
All reviewed patches have been landed.  Closing bug.