Web Inspector: TimelineOverview clicks do not always behave as expected
authorjoepeck@webkit.org <joepeck@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 6 Mar 2019 22:28:27 +0000 (22:28 +0000)
committerjoepeck@webkit.org <joepeck@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 6 Mar 2019 22:28:27 +0000 (22:28 +0000)
https://bugs.webkit.org/show_bug.cgi?id=195319

Reviewed by Devin Rousso.

* UserInterface/Views/TimelineRuler.js:
(WI.TimelineRuler.prototype._shouldIgnoreMicroMovement):
(WI.TimelineRuler.prototype._handleMouseDown):
(WI.TimelineRuler.prototype._handleMouseMove):
Ignore moves that haven't gone more than 4px. Once the threshold is
passed allow all moves. This improves the click behavior since
previously click would never re-dispatch if there was any movement.

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

Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/UserInterface/Views/TimelineRuler.js

index f3acaf6..76a67e4 100644 (file)
@@ -1,5 +1,20 @@
 2019-03-06  Joseph Pecoraro  <pecoraro@apple.com>
 
+        Web Inspector: TimelineOverview clicks do not always behave as expected
+        https://bugs.webkit.org/show_bug.cgi?id=195319
+
+        Reviewed by Devin Rousso.
+
+        * UserInterface/Views/TimelineRuler.js:
+        (WI.TimelineRuler.prototype._shouldIgnoreMicroMovement):
+        (WI.TimelineRuler.prototype._handleMouseDown):
+        (WI.TimelineRuler.prototype._handleMouseMove):
+        Ignore moves that haven't gone more than 4px. Once the threshold is
+        passed allow all moves. This improves the click behavior since
+        previously click would never re-dispatch if there was any movement.
+
+2019-03-06  Joseph Pecoraro  <pecoraro@apple.com>
+
         Web Inspector: CPU Usage Timeline - Statistics and Sources sections
         https://bugs.webkit.org/show_bug.cgi?id=195202
 
index b3ba45d..d0110e1 100644 (file)
@@ -746,6 +746,19 @@ WI.TimelineRuler = class TimelineRuler extends WI.View
         this._needsMarkerLayout();
     }
 
+    _shouldIgnoreMicroMovement(event)
+    {
+        if (this._mousePassedMicroMovementTest)
+            return false;
+
+        let pixels = Math.abs(event.pageX - this._mouseStartX);
+        if (pixels <= 4)
+            return true;
+
+        this._mousePassedMicroMovementTest = true;
+        return false;
+    }
+
     _handleClick(event)
     {
         if (!this._enabled)
@@ -797,6 +810,9 @@ WI.TimelineRuler = class TimelineRuler extends WI.View
 
         this._mouseMoved = false;
 
+        this._mousePassedMicroMovementTest = false;
+        this._mouseStartX = event.pageX;
+
         this._mouseMoveEventListener = this._handleMouseMove.bind(this);
         this._mouseUpEventListener = this._handleMouseUp.bind(this);
 
@@ -812,6 +828,9 @@ WI.TimelineRuler = class TimelineRuler extends WI.View
     {
         console.assert(event.button === 0);
 
+        if (this._shouldIgnoreMicroMovement(event))
+            return;
+
         this._mouseMoved = true;
 
         let isRTL = WI.resolvedLayoutDirection() === WI.LayoutDirection.RTL;