Title: [218623] trunk/Source/WebInspectorUI
Revision
218623
Author
drou...@apple.com
Date
2017-06-20 20:13:18 -0700 (Tue, 20 Jun 2017)

Log Message

Web Inspector: change the selected ScopeBarItem on mousedown instead of click
https://bugs.webkit.org/show_bug.cgi?id=173586

Reviewed by Matt Baker.

Both the Tab bar and Sidebar navigation bar switch the active item on "mousedown" instead of
on "click". ScopeBarItem should follow this pattern, as it is faster and keeps consistency.

* UserInterface/Views/MultipleScopeBarItem.js:
(WebInspector.MultipleScopeBarItem):
(WebInspector.MultipleScopeBarItem.prototype._handleMouseDown):
(WebInspector.MultipleScopeBarItem.prototype._clicked): Deleted.
* UserInterface/Views/ScopeBarItem.js:
(WebInspector.ScopeBarItem):
(WebInspector.ScopeBarItem.prototype._handleMouseDown):
(WebInspector.ScopeBarItem.prototype._clicked): Deleted.

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (218622 => 218623)


--- trunk/Source/WebInspectorUI/ChangeLog	2017-06-21 03:05:39 UTC (rev 218622)
+++ trunk/Source/WebInspectorUI/ChangeLog	2017-06-21 03:13:18 UTC (rev 218623)
@@ -1,5 +1,24 @@
 2017-06-20  Devin Rousso  <drou...@apple.com>
 
+        Web Inspector: change the selected ScopeBarItem on mousedown instead of click
+        https://bugs.webkit.org/show_bug.cgi?id=173586
+
+        Reviewed by Matt Baker.
+
+        Both the Tab bar and Sidebar navigation bar switch the active item on "mousedown" instead of
+        on "click". ScopeBarItem should follow this pattern, as it is faster and keeps consistency.
+
+        * UserInterface/Views/MultipleScopeBarItem.js:
+        (WebInspector.MultipleScopeBarItem):
+        (WebInspector.MultipleScopeBarItem.prototype._handleMouseDown):
+        (WebInspector.MultipleScopeBarItem.prototype._clicked): Deleted.
+        * UserInterface/Views/ScopeBarItem.js:
+        (WebInspector.ScopeBarItem):
+        (WebInspector.ScopeBarItem.prototype._handleMouseDown):
+        (WebInspector.ScopeBarItem.prototype._clicked): Deleted.
+
+2017-06-20  Devin Rousso  <drou...@apple.com>
+
         Web Inspector: Send context attributes for tracked canvases
         https://bugs.webkit.org/show_bug.cgi?id=173327
 

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/MultipleScopeBarItem.js (218622 => 218623)


--- trunk/Source/WebInspectorUI/UserInterface/Views/MultipleScopeBarItem.js	2017-06-21 03:05:39 UTC (rev 218622)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/MultipleScopeBarItem.js	2017-06-21 03:13:18 UTC (rev 218623)
@@ -34,7 +34,7 @@
 
         this._titleElement = document.createElement("span");
         this._element.appendChild(this._titleElement);
-        this._element.addEventListener("click", this._clicked.bind(this));
+        this._element.addEventListener("mousedown", this._handleMouseDown.bind(this));
 
         this._selectElement = document.createElement("select");
         this._selectElement.addEventListener("change", this._selectElementSelectionChanged.bind(this));
@@ -164,12 +164,17 @@
 
     // Private
 
-    _clicked(event)
+    _handleMouseDown(event)
     {
+        // Only handle left mouse clicks.
+        if (event.button !== 0)
+            return;
+
         // Only support click to select when the item is not selected yet.
         // Clicking when selected will cause the menu it appear instead.
         if (this._element.classList.contains("selected"))
             return;
+
         this.selected = true;
     }
 

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ScopeBarItem.js (218622 => 218623)


--- trunk/Source/WebInspectorUI/UserInterface/Views/ScopeBarItem.js	2017-06-21 03:05:39 UTC (rev 218622)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ScopeBarItem.js	2017-06-21 03:13:18 UTC (rev 218623)
@@ -34,7 +34,7 @@
         if (className)
             this._element.classList.add(className);
         this._element.textContent = label;
-        this._element.addEventListener("click", this._clicked.bind(this));
+        this._element.addEventListener("mousedown", this._handleMouseDown.bind(this));
 
         this._id = id;
         this._label = label;
@@ -90,8 +90,12 @@
 
     // Private
 
-    _clicked(event)
+    _handleMouseDown(event)
     {
+        // Only handle left mouse clicks.
+        if (event.button !== 0)
+            return;
+
         this.setSelected(!this.selected, event.metaKey && !event.ctrlKey && !event.altKey && !event.shiftKey);
     }
 };
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to