| Summary: | Web Inspector: Dragging a timeline ruler handle when both handles clamped is broken | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | WebKit | Reporter: | Matt Baker <mattbaker> | ||||||||
| Component: | Web Inspector | Assignee: | Matt Baker <mattbaker> | ||||||||
| Status: | RESOLVED FIXED | ||||||||||
| Severity: | Normal | CC: | bburg, commit-queue, graouts, hi, joepeck, mattbaker, nvasilyev, timothy, webkit-bug-importer | ||||||||
| Priority: | P2 | ||||||||||
| Version: | 528+ (Nightly build) | ||||||||||
| Hardware: | All | ||||||||||
| OS: | All | ||||||||||
| Attachments: |
|
||||||||||
|
Description
Matt Baker
2015-08-11 16:37:42 PDT
Created attachment 258781 [details]
[Patch] Proposed Fix
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. Created attachment 258788 [details]
[Patch] Proposed Fix
Created attachment 258790 [details]
[Video] New behavior
Comment on attachment 258788 [details] [Patch] Proposed Fix Clearing flags on attachment: 258788 Committed r188328: <http://trac.webkit.org/changeset/188328> All reviewed patches have been landed. Closing bug. 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); (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. > We should remove clamp and adopt Number.constrain. https://bugs.webkit.org/show_bug.cgi?id=147952 |