Web Inspector: Console: automatically select the "Evaluations" filter whenever runnin...
authordrousso@apple.com <drousso@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 23 Aug 2019 01:43:43 +0000 (01:43 +0000)
committerdrousso@apple.com <drousso@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 23 Aug 2019 01:43:43 +0000 (01:43 +0000)
https://bugs.webkit.org/show_bug.cgi?id=201060

Reviewed by Timothy Hatcher.

If the Console is actively being filtered (e.g. not "All"), it can be confusing to run a
command, only to not see any results. We should automatically enable the "Evaluations"
filter in addition to any other existing filters in these cases.

* UserInterface/Views/LogContentView.js:
(WI.LogContentView.prototype.didAppendConsoleMessageView):
* UserInterface/Views/ScopeBarItem.js:
(WI.ScopeBarItem.prototype.set selected):
(WI.ScopeBarItem.prototype.toggle): Added.

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

Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/UserInterface/Views/LogContentView.js
Source/WebInspectorUI/UserInterface/Views/ScopeBarItem.js

index 4ed1b85..be9c10c 100644 (file)
@@ -1,5 +1,22 @@
 2019-08-22  Devin Rousso  <drousso@apple.com>
 
+        Web Inspector: Console: automatically select the "Evaluations" filter whenever running commands
+        https://bugs.webkit.org/show_bug.cgi?id=201060
+
+        Reviewed by Timothy Hatcher.
+
+        If the Console is actively being filtered (e.g. not "All"), it can be confusing to run a
+        command, only to not see any results. We should automatically enable the "Evaluations"
+        filter in addition to any other existing filters in these cases.
+
+        * UserInterface/Views/LogContentView.js:
+        (WI.LogContentView.prototype.didAppendConsoleMessageView):
+        * UserInterface/Views/ScopeBarItem.js:
+        (WI.ScopeBarItem.prototype.set selected):
+        (WI.ScopeBarItem.prototype.toggle): Added.
+
+2019-08-22  Devin Rousso  <drousso@apple.com>
+
         Web Inspector: REGRESSION(r248485): stack overflow when viewing a source map generated from inline content
         https://bugs.webkit.org/show_bug.cgi?id=201042
         <rdar://problem/54509750>
index 3903445..07cd5ab 100644 (file)
@@ -234,10 +234,12 @@ WI.LogContentView = class LogContentView extends WI.ContentView
         let target = messageView.message ? messageView.message.target : WI.runtimeManager.activeExecutionContext.target;
         target.connection.runAfterPendingDispatches(this._clearFocusableChildren.bind(this));
 
-        if (messageView instanceof WI.ConsoleCommandView || messageView.message instanceof WI.ConsoleCommandResultMessage)
-            this._markScopeBarItemUnread(WI.LogContentView.Scopes.Evaluations);
-        else
-            this._markScopeBarItemForMessageLevelUnread(messageView.message.level);
+        if (!this._scopeBar.item(WI.LogContentView.Scopes.All).selected) {
+            if (messageView instanceof WI.ConsoleCommandView || messageView.message instanceof WI.ConsoleCommandResultMessage)
+                this._scopeBar.item(WI.LogContentView.Scopes.Evaluations).toggle(true, {extendSelection: true});
+            else
+                this._markScopeBarItemForMessageLevelUnread(messageView.message.level);
+        }
 
         console.assert(messageView.element instanceof Element);
         this._filterMessageElements([messageView.element]);
index b38bfd5..429a3f8 100644 (file)
@@ -77,13 +77,7 @@ WI.ScopeBarItem = class ScopeBarItem extends WI.Object
 
     set selected(selected)
     {
-        if (this._selectedSetting.value === selected)
-            return;
-
-        this._element.classList.toggle("selected", selected);
-        this._selectedSetting.value = selected;
-
-        this.dispatchEventToListeners(WI.ScopeBarItem.Event.SelectionChanged, {
+        this.toggle(selected, {
             extendSelection: this._independent || (WI.modifierKeys.metaKey && !WI.modifierKeys.ctrlKey && !WI.modifierKeys.altKey && !WI.modifierKeys.shiftKey),
         });
     }
@@ -105,6 +99,17 @@ WI.ScopeBarItem = class ScopeBarItem extends WI.Object
         this.dispatchEventToListeners(WI.ScopeBarItem.Event.HiddenChanged);
     }
 
+    toggle(selected, {extendSelection} = {})
+    {
+        if (this._selectedSetting.value === selected)
+            return;
+
+        this._element.classList.toggle("selected", selected);
+        this._selectedSetting.value = selected;
+
+        this.dispatchEventToListeners(WI.ScopeBarItem.Event.SelectionChanged, {extendSelection});
+    }
+
     // Private
 
     _handleMouseDown(event)