Web Inspector: scrolling the editor while debugging shouldn't trigger popovers
authormattbaker@apple.com <mattbaker@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 21 Oct 2017 05:04:28 +0000 (05:04 +0000)
committermattbaker@apple.com <mattbaker@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 21 Oct 2017 05:04:28 +0000 (05:04 +0000)
https://bugs.webkit.org/show_bug.cgi?id=178325

Reviewed by Devin Rousso.

Ignore the next "mousemove" event immediately following a "mousewheel",
when determining the hovered item for purposes of triggering a popover.

* UserInterface/Controllers/CodeMirrorTokenTrackingController.js:
(WI.CodeMirrorTokenTrackingController):
(WI.CodeMirrorTokenTrackingController.prototype._startTracking):
(WI.CodeMirrorTokenTrackingController.prototype._stopTracking):
(WI.CodeMirrorTokenTrackingController.prototype.handleEvent):
(WI.CodeMirrorTokenTrackingController.prototype._mouseMovedOverEditor):

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

Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/UserInterface/Controllers/CodeMirrorTokenTrackingController.js

index ed23ba4..505ea86 100644 (file)
@@ -1,3 +1,20 @@
+2017-10-20  Matt Baker  <mattbaker@apple.com>
+
+        Web Inspector: scrolling the editor while debugging shouldn't trigger popovers
+        https://bugs.webkit.org/show_bug.cgi?id=178325
+
+        Reviewed by Devin Rousso.
+
+        Ignore the next "mousemove" event immediately following a "mousewheel",
+        when determining the hovered item for purposes of triggering a popover.
+
+        * UserInterface/Controllers/CodeMirrorTokenTrackingController.js:
+        (WI.CodeMirrorTokenTrackingController):
+        (WI.CodeMirrorTokenTrackingController.prototype._startTracking):
+        (WI.CodeMirrorTokenTrackingController.prototype._stopTracking):
+        (WI.CodeMirrorTokenTrackingController.prototype.handleEvent):
+        (WI.CodeMirrorTokenTrackingController.prototype._mouseMovedOverEditor):
+
 2017-10-20  Joseph Pecoraro  <pecoraro@apple.com>
 
         Web Inspector: preview content view for MIME type application/json should be a collapsible tree outline
index dce4b96..e8596c7 100644 (file)
@@ -43,6 +43,7 @@ WI.CodeMirrorTokenTrackingController = class CodeMirrorTokenTrackingController e
         this._tracking = false;
         this._previousTokenInfo = null;
         this._hoveredMarker = null;
+        this._ignoreNextMouseMove = false;
 
         const hidePopover = this._hidePopover.bind(this);
 
@@ -198,12 +199,14 @@ WI.CodeMirrorTokenTrackingController = class CodeMirrorTokenTrackingController e
             return;
 
         this._tracking = true;
+        this._ignoreNextMouseMove = false;
 
         var wrapper = this._codeMirror.getWrapperElement();
         wrapper.addEventListener("mousemove", this, true);
         wrapper.addEventListener("mouseout", this, false);
         wrapper.addEventListener("mousedown", this, false);
         wrapper.addEventListener("mouseup", this, false);
+        wrapper.addEventListener("mousewheel", this, false);
         window.addEventListener("blur", this, true);
     }
 
@@ -220,6 +223,7 @@ WI.CodeMirrorTokenTrackingController = class CodeMirrorTokenTrackingController e
         wrapper.removeEventListener("mouseout", this, false);
         wrapper.removeEventListener("mousedown", this, false);
         wrapper.removeEventListener("mouseup", this, false);
+        wrapper.removeEventListener("mousewheel", this, false);
         window.removeEventListener("blur", this, true);
         window.removeEventListener("mousemove", this, true);
 
@@ -252,6 +256,9 @@ WI.CodeMirrorTokenTrackingController = class CodeMirrorTokenTrackingController e
         case "mouseup":
             this._mouseButtonWasReleasedOverEditor(event);
             break;
+        case "mousewheel":
+            this._ignoreNextMouseMove = true;
+            break;
         case "blur":
             this._windowLostFocus(event);
             break;
@@ -318,6 +325,11 @@ WI.CodeMirrorTokenTrackingController = class CodeMirrorTokenTrackingController e
 
     _mouseMovedOverEditor(event)
     {
+        if (this._ignoreNextMouseMove) {
+            this._ignoreNextMouseMove = false;
+            return;
+        }
+
         this._updateHoveredTokenInfo({left: event.pageX, top: event.pageY});
     }