RESOLVED FIXED 147912
Web Inspector: Dragging a timeline ruler handle when both handles clamped is broken
https://bugs.webkit.org/show_bug.cgi?id=147912
Summary Web Inspector: Dragging a timeline ruler handle when both handles clamped is ...
Matt Baker
Reported 2015-08-11 16:37:42 PDT
* SUMMARY Dragging a timeline ruler handle when both handles clamped is broken. Overlapping handles are also styled incorrectly. When only one handle is clamped it should be styled white with a gray border (currently works), but when both are clamped the handle background color should match the ruler header. * STEPS TO REPRODUCE 1. Record a timeline 2. Make a ruler selection near the beginning of the graph 3. Scroll graph until selection falls off the left edge and both handles are clamped 4. Click and drag the ruler handle to the right => The expected behavior is that the right handle was selected and that dragging will modify the selection end time. Instead the left handle is selected and selection behavior is erratic.
Attachments
[Patch] Proposed Fix (6.88 KB, patch)
2015-08-11 16:50 PDT, Matt Baker
no flags
[Patch] Proposed Fix (6.85 KB, patch)
2015-08-11 17:59 PDT, Matt Baker
no flags
[Video] New behavior (4.35 MB, video/quicktime)
2015-08-11 18:06 PDT, Matt Baker
no flags
Matt Baker
Comment 1 2015-08-11 16:50:42 PDT
Created attachment 258781 [details] [Patch] Proposed Fix
Devin Rousso
Comment 2 2015-08-11 17:18:25 PDT
Comment on attachment 258781 [details] [Patch] Proposed Fix View in context: https://bugs.webkit.org/attachment.cgi?id=258781&action=review > Source/WebInspectorUI/UserInterface/Views/TimelineRuler.js:591 > + let endTimeClamped = this._selectionEndTime > this._endTime || this._selectionEndTime < this._startTime; NIT: I would switch the order of these two expressions so that the "<" and ">" match on either side of the "||" compared to the line above. > Source/WebInspectorUI/UserInterface/Views/TimelineRuler.js:598 > + let newLeftPosition = Math.max(0, Math.min(1, (this._selectionStartTime - this._startTime) / duration)); We actually have a function called "clamp" in Utilities for this exact purpose. > Source/WebInspectorUI/UserInterface/Views/TimelineRuler.js:607 > + let newRightPosition = 1 - Math.max(0, Math.min(1, (this._selectionEndTime - this._startTime) / duration)); See line 598.
Matt Baker
Comment 3 2015-08-11 17:59:38 PDT
Created attachment 258788 [details] [Patch] Proposed Fix
Matt Baker
Comment 4 2015-08-11 18:06:21 PDT
Created attachment 258790 [details] [Video] New behavior
WebKit Commit Bot
Comment 5 2015-08-11 22:54:35 PDT
Comment on attachment 258788 [details] [Patch] Proposed Fix Clearing flags on attachment: 258788 Committed r188328: <http://trac.webkit.org/changeset/188328>
WebKit Commit Bot
Comment 6 2015-08-11 22:54:38 PDT
All reviewed patches have been landed. Closing bug.
Blaze Burg
Comment 7 2015-08-12 08:38:51 PDT
Comment on attachment 258781 [details] [Patch] Proposed Fix View in context: https://bugs.webkit.org/attachment.cgi?id=258781&action=review >> Source/WebInspectorUI/UserInterface/Views/TimelineRuler.js:598 >> + let newLeftPosition = Math.max(0, Math.min(1, (this._selectionStartTime - this._startTime) / duration)); > > We actually have a function called "clamp" in Utilities for this exact purpose. Number.constrain((this._selectionStartTime - this._startTime) / duration, 0, 1);
Timothy Hatcher
Comment 8 2015-08-12 10:09:15 PDT
(In reply to comment #7) > Comment on attachment 258781 [details] > [Patch] Proposed Fix > > View in context: > https://bugs.webkit.org/attachment.cgi?id=258781&action=review > > >> Source/WebInspectorUI/UserInterface/Views/TimelineRuler.js:598 > >> + let newLeftPosition = Math.max(0, Math.min(1, (this._selectionStartTime - this._startTime) / duration)); > > > > We actually have a function called "clamp" in Utilities for this exact purpose. > > Number.constrain((this._selectionStartTime - this._startTime) / duration, 0, > 1); We should remove clamp and adopt Number.constrain.
Matt Baker
Comment 9 2015-08-12 13:47:45 PDT
> We should remove clamp and adopt Number.constrain. https://bugs.webkit.org/show_bug.cgi?id=147952
Note You need to log in before you can comment on or make changes to this bug.