Title: [186824] trunk/Source/WebInspectorUI
Revision
186824
Author
[email protected]
Date
2015-07-14 16:38:02 -0700 (Tue, 14 Jul 2015)

Log Message

Web Inspector: TimelineRuler minimum selection time range should be configurable
https://bugs.webkit.org/show_bug.cgi?id=146944

Reviewed by Joseph Pecoraro.

* UserInterface/Views/RenderingFrameTimelineOverview.js:
Set minimum selection to 1 frame.

* UserInterface/Views/TimelineOverview.js:
(WebInspector.TimelineOverview.prototype.set selectionDuration):
Use ruler's minimum duration.

* UserInterface/Views/TimelineRuler.js:
(WebInspector.TimelineRuler):
(WebInspector.TimelineRuler.prototype.get minimumSelectionDuration):
(WebInspector.TimelineRuler.prototype.set minimumSelectionDuration):
(WebInspector.TimelineRuler.prototype._handleMouseUp):
(WebInspector.TimelineRuler.prototype._handleSelectionHandleMouseMove):
Added property for setting minimum selection duration. Default minimum duration is 0.01, which is
equal to the old hard-coded minimum selection time range.

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (186823 => 186824)


--- trunk/Source/WebInspectorUI/ChangeLog	2015-07-14 23:13:34 UTC (rev 186823)
+++ trunk/Source/WebInspectorUI/ChangeLog	2015-07-14 23:38:02 UTC (rev 186824)
@@ -1,3 +1,26 @@
+2015-07-14  Matt Baker  <[email protected]>
+
+        Web Inspector: TimelineRuler minimum selection time range should be configurable
+        https://bugs.webkit.org/show_bug.cgi?id=146944
+
+        Reviewed by Joseph Pecoraro.
+
+        * UserInterface/Views/RenderingFrameTimelineOverview.js:
+        Set minimum selection to 1 frame.
+
+        * UserInterface/Views/TimelineOverview.js:
+        (WebInspector.TimelineOverview.prototype.set selectionDuration):
+        Use ruler's minimum duration.
+
+        * UserInterface/Views/TimelineRuler.js:
+        (WebInspector.TimelineRuler):
+        (WebInspector.TimelineRuler.prototype.get minimumSelectionDuration):
+        (WebInspector.TimelineRuler.prototype.set minimumSelectionDuration):
+        (WebInspector.TimelineRuler.prototype._handleMouseUp):
+        (WebInspector.TimelineRuler.prototype._handleSelectionHandleMouseMove):
+        Added property for setting minimum selection duration. Default minimum duration is 0.01, which is
+        equal to the old hard-coded minimum selection time range.
+
 2015-07-13  Joseph Pecoraro  <[email protected]>
 
         Web Inspector: Uncaught exception in inspector for some ConsoleMessages

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/RenderingFrameTimelineOverview.js (186823 => 186824)


--- trunk/Source/WebInspectorUI/UserInterface/Views/RenderingFrameTimelineOverview.js	2015-07-14 23:13:34 UTC (rev 186823)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/RenderingFrameTimelineOverview.js	2015-07-14 23:38:02 UTC (rev 186824)
@@ -38,6 +38,7 @@
     WebInspector.TimelineOverview.call(this, "frames", timelineRecording, minimumDurationPerPixel, maximumDurationPerPixel, defaultSettingsValues);
 
     this.pixelAlignDuration = true;
+    this.timelineRuler.minimumSelectionDuration = 1;
     this.timelineRuler.snapInterval = 1;
     this.timelineRuler.formatLabelCallback = function(value) {
         return value.toFixed(0);

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/TimelineOverview.js (186823 => 186824)


--- trunk/Source/WebInspectorUI/UserInterface/Views/TimelineOverview.js	2015-07-14 23:13:34 UTC (rev 186823)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TimelineOverview.js	2015-07-14 23:38:02 UTC (rev 186824)
@@ -237,7 +237,7 @@
 
     set selectionDuration(x)
     {
-        x = Math.max(WebInspector.TimelineRuler.MinimumSelectionTimeRange, x);
+        x = Math.max(this._timelineRuler.minimumSelectionDuration, x);
 
         this._timelineRuler.selectionEndTime = this._timelineRuler.selectionStartTime + x;
     },

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/TimelineRuler.js (186823 => 186824)


--- trunk/Source/WebInspectorUI/UserInterface/Views/TimelineRuler.js	2015-07-14 23:13:34 UTC (rev 186823)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TimelineRuler.js	2015-07-14 23:38:02 UTC (rev 186824)
@@ -49,6 +49,7 @@
     this._endTimePinned = false;
     this._allowsClippedLabels = false;
     this._allowsTimeRangeSelection = false;
+    this._minimumSelectionDuration = 0.01;
     this._formatLabelCallback = null;
 
     this._markerElementMap = new Map;
@@ -61,8 +62,6 @@
 WebInspector.TimelineRuler.DividerElementStyleClassName = "divider";
 WebInspector.TimelineRuler.DividerLabelElementStyleClassName = "label";
 
-WebInspector.TimelineRuler.MinimumSelectionTimeRange = 0.01;
-
 WebInspector.TimelineRuler.Event = {
     TimeRangeSelectionChanged: "time-ruler-time-range-selection-changed"
 };
@@ -160,6 +159,16 @@
         }
     },
 
+    get minimumSelectionDuration()
+    {
+        return this._minimumSelectionDuration;
+    },
+
+    set minimumSelectionDuration(x)
+    {
+        this._minimumSelectionDuration = x;
+    },
+
     get zeroTime()
     {
         return this._zeroTime;
@@ -715,15 +724,15 @@
     {
         console.assert(event.button === 0);
 
-        if (!this._selectionIsMove && this.selectionEndTime - this.selectionStartTime < WebInspector.TimelineRuler.MinimumSelectionTimeRange) {
+        if (!this._selectionIsMove && this.selectionEndTime - this.selectionStartTime < this.minimumSelectionDuration) {
             // The section is smaller than allowed, grow in the direction of the drag to meet the minumum.
             var currentMousePosition = event.pageX - this._rulerBoundingClientRect.left;
             if (currentMousePosition > this._mouseDownPosition) {
-                this.selectionEndTime = Math.min(this.selectionStartTime + WebInspector.TimelineRuler.MinimumSelectionTimeRange, this.endTime);
-                this.selectionStartTime = this.selectionEndTime - WebInspector.TimelineRuler.MinimumSelectionTimeRange;
+                this.selectionEndTime = Math.min(this.selectionStartTime + this.minimumSelectionDuration, this.endTime);
+                this.selectionStartTime = this.selectionEndTime - this.minimumSelectionDuration;
             } else {
-                this.selectionStartTime = Math.max(this.startTime, this.selectionEndTime - WebInspector.TimelineRuler.MinimumSelectionTimeRange);
-                this.selectionEndTime = this.selectionStartTime + WebInspector.TimelineRuler.MinimumSelectionTimeRange;
+                this.selectionStartTime = Math.max(this.startTime, this.selectionEndTime - this.minimumSelectionDuration);
+                this.selectionEndTime = this.selectionStartTime + this.minimumSelectionDuration;
             }
         }
 
@@ -778,19 +787,19 @@
             // Resize the selection on both sides when the Option keys is held down.
             if (this._dragHandleIsStartTime) {
                 var timeDifference = currentTime - this.selectionStartTime;
-                this.selectionStartTime = Math.max(this.startTime, Math.min(currentTime, this.selectionEndTime - WebInspector.TimelineRuler.MinimumSelectionTimeRange));
-                this.selectionEndTime = Math.min(Math.max(this.selectionStartTime + WebInspector.TimelineRuler.MinimumSelectionTimeRange, this.selectionEndTime - timeDifference), this.endTime);
+                this.selectionStartTime = Math.max(this.startTime, Math.min(currentTime, this.selectionEndTime - this.minimumSelectionDuration));
+                this.selectionEndTime = Math.min(Math.max(this.selectionStartTime + this.minimumSelectionDuration, this.selectionEndTime - timeDifference), this.endTime);
             } else {
                 var timeDifference = currentTime - this.selectionEndTime;
-                this.selectionEndTime = Math.min(Math.max(this.selectionStartTime + WebInspector.TimelineRuler.MinimumSelectionTimeRange, currentTime), this.endTime);
-                this.selectionStartTime = Math.max(this.startTime, Math.min(this.selectionStartTime - timeDifference, this.selectionEndTime - WebInspector.TimelineRuler.MinimumSelectionTimeRange));
+                this.selectionEndTime = Math.min(Math.max(this.selectionStartTime + this.minimumSelectionDuration, currentTime), this.endTime);
+                this.selectionStartTime = Math.max(this.startTime, Math.min(this.selectionStartTime - timeDifference, this.selectionEndTime - this.minimumSelectionDuration));
             }
         } else {
             // Resize the selection on side being dragged.
             if (this._dragHandleIsStartTime)
-                this.selectionStartTime = Math.max(this.startTime, Math.min(currentTime, this.selectionEndTime - WebInspector.TimelineRuler.MinimumSelectionTimeRange));
+                this.selectionStartTime = Math.max(this.startTime, Math.min(currentTime, this.selectionEndTime - this.minimumSelectionDuration));
             else
-                this.selectionEndTime = Math.min(Math.max(this.selectionStartTime + WebInspector.TimelineRuler.MinimumSelectionTimeRange, currentTime), this.endTime);
+                this.selectionEndTime = Math.min(Math.max(this.selectionStartTime + this.minimumSelectionDuration, currentTime), this.endTime);
         }
 
         this._updateSelection(this._element.clientWidth, this.duration);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to