Title: [187207] trunk/Source/WebInspectorUI
Revision
187207
Author
mattba...@apple.com
Date
2015-07-22 20:54:33 -0700 (Wed, 22 Jul 2015)

Log Message

Web Inspector: TimelineRuler shouldn't dispatch selection changed event unless it actually changes
https://bugs.webkit.org/show_bug.cgi?id=147219

Reviewed by Timothy Hatcher.

Moved to a "suppress next" model for suppressing dispatch of TimelineRuler's selection changed event. The
ruler's _timeRangeSelectionChanged flag is now reset only when an event is finally dispatched.

* UserInterface/Views/TimelineRuler.js:
(WebInspector.TimelineRuler):
(WebInspector.TimelineRuler.prototype._updateSelection):
(WebInspector.TimelineRuler.prototype._dispatchTimeRangeSelectionChangedEvent):
Check for this._timeRangeSelectionChanged moved into dispatch function.
(WebInspector.TimelineRuler.prototype._handleMouseDown):
(WebInspector.TimelineRuler.prototype._handleMouseMove):
(WebInspector.TimelineRuler.prototype._handleMouseUp):
We now suppress the next dispatch only, rather than a toggle.

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (187206 => 187207)


--- trunk/Source/WebInspectorUI/ChangeLog	2015-07-23 03:36:31 UTC (rev 187206)
+++ trunk/Source/WebInspectorUI/ChangeLog	2015-07-23 03:54:33 UTC (rev 187207)
@@ -1,3 +1,23 @@
+2015-07-22  Matt Baker  <mattba...@apple.com>
+
+        Web Inspector: TimelineRuler shouldn't dispatch selection changed event unless it actually changes
+        https://bugs.webkit.org/show_bug.cgi?id=147219
+
+        Reviewed by Timothy Hatcher.
+
+        Moved to a "suppress next" model for suppressing dispatch of TimelineRuler's selection changed event. The
+        ruler's _timeRangeSelectionChanged flag is now reset only when an event is finally dispatched.
+
+        * UserInterface/Views/TimelineRuler.js:
+        (WebInspector.TimelineRuler):
+        (WebInspector.TimelineRuler.prototype._updateSelection):
+        (WebInspector.TimelineRuler.prototype._dispatchTimeRangeSelectionChangedEvent):
+        Check for this._timeRangeSelectionChanged moved into dispatch function.
+        (WebInspector.TimelineRuler.prototype._handleMouseDown):
+        (WebInspector.TimelineRuler.prototype._handleMouseMove):
+        (WebInspector.TimelineRuler.prototype._handleMouseUp):
+        We now suppress the next dispatch only, rather than a toggle.
+
 2015-07-22  Devin Rousso  <drou...@apple.com>
 
         Web Inspector: REGRESSION (Safari 7): Pseudo element rules are not labelled with media queries in Styles panel

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/TimelineRuler.js (187206 => 187207)


--- trunk/Source/WebInspectorUI/UserInterface/Views/TimelineRuler.js	2015-07-23 03:36:31 UTC (rev 187206)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TimelineRuler.js	2015-07-23 03:54:33 UTC (rev 187207)
@@ -51,6 +51,8 @@
     this._allowsTimeRangeSelection = false;
     this._minimumSelectionDuration = 0.01;
     this._formatLabelCallback = null;
+    this._suppressNextTimeRangeSelectionChangedEvent = false;
+    this._timeRangeSelectionChanged = false;
 
     this._markerElementMap = new Map;
 };
@@ -616,8 +618,7 @@
             this._element.appendChild(this._rightSelectionHandleElement);
         }
 
-        if (this._timeRangeSelectionChanged)
-            this._dispatchTimeRangeSelectionChangedEvent();
+        this._dispatchTimeRangeSelectionChangedEvent();
     },
 
     _formatDividerLabelText: function(value)
@@ -638,11 +639,16 @@
 
     _dispatchTimeRangeSelectionChangedEvent: function()
     {
-        delete this._timeRangeSelectionChanged;
+        if (!this._timeRangeSelectionChanged)
+            return;
 
-        if (this._suppressTimeRangeSelectionChangedEvent)
+        if (this._suppressNextTimeRangeSelectionChangedEvent) {
+            this._suppressNextTimeRangeSelectionChangedEvent = false;
             return;
+        }
 
+        this._timeRangeSelectionChanged = false;
+
         this.dispatchEventToListeners(WebInspector.TimelineRuler.Event.TimeRangeSelectionChanged);
     },
 
@@ -658,7 +664,6 @@
             return;
 
         this._selectionIsMove = event.target === this._selectionDragElement;
-        this._suppressTimeRangeSelectionChangedEvent = !this._selectionIsMove;
         this._rulerBoundingClientRect = this._element.getBoundingClientRect();
 
         if (this._selectionIsMove) {
@@ -684,6 +689,8 @@
     {
         console.assert(event.button === 0);
 
+        this._suppressNextTimeRangeSelectionChangedEvent = !this._selectionIsMove;
+
         if (this._selectionIsMove) {
             var currentMousePosition = Math.max(this._moveSelectionMaximumLeftOffset, Math.min(this._moveSelectionMaximumRightOffset, event.pageX));
 
@@ -736,8 +743,6 @@
             }
         }
 
-        delete this._suppressTimeRangeSelectionChangedEvent;
-
         this._dispatchTimeRangeSelectionChangedEvent();
 
         document.removeEventListener("mousemove", this._mouseMoveEventListener);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to