Changeset 185734 in webkit
- Timestamp:
- Jun 18, 2015, 9:45:34 PM (11 years ago)
- Location:
- trunk/Source/WebInspectorUI
- Files:
-
- 5 edited
-
ChangeLog (modified) (1 diff)
-
UserInterface/Views/RenderingFrameTimelineOverview.js (modified) (1 diff)
-
UserInterface/Views/TimelineRecordingContentView.js (modified) (2 diffs)
-
UserInterface/Views/TimelineRuler.js (modified) (5 diffs)
-
UserInterface/Views/TimelineSidebarPanel.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebInspectorUI/ChangeLog
r185723 r185734 1 2015-06-18 Matt Baker <mattbaker@apple.com> 2 3 Web Inspector: Rendering Frames timeline selection should snap to frame boundaries 4 https://bugs.webkit.org/show_bug.cgi?id=146120 5 6 Reviewed by Timothy Hatcher. 7 8 * UserInterface/Views/RenderingFrameTimelineOverview.js: 9 Enable snapping to frame boundaries. 10 11 * UserInterface/Views/TimelineRecordingContentView.js: 12 (WebInspector.TimelineRecordingContentView.prototype._updateFrameSelection): 13 Updated filtering to account for ruler snapping. 14 15 * UserInterface/Views/TimelineRuler.js: 16 (WebInspector.TimelineRuler.prototype.get snapInterval): 17 (WebInspector.TimelineRuler.prototype.set snapInterval): 18 (WebInspector.TimelineRuler.prototype.set selectionStartTime): 19 (WebInspector.TimelineRuler.prototype.set selectionEndTime): 20 (WebInspector.TimelineRuler.prototype._snapValue): 21 (WebInspector.TimelineRuler.prototype._handleMouseMove): 22 Added support for snapping to a specified interval. 23 24 * UserInterface/Views/TimelineSidebarPanel.js: 25 Removed unnecessary code. 26 1 27 2015-06-18 Devin Rousso <drousso@apple.com> 2 28 -
trunk/Source/WebInspectorUI/UserInterface/Views/RenderingFrameTimelineOverview.js
r183469 r185734 38 38 WebInspector.TimelineOverview.call(this, "frames", timelineRecording, minimumDurationPerPixel, maximumDurationPerPixel, defaultSettingsValues); 39 39 40 this.timelineRuler.snapInterval = 1; 40 41 this.timelineRuler.formatLabelCallback = function(value) { 41 42 return value.toFixed(0); -
trunk/Source/WebInspectorUI/UserInterface/Views/TimelineRecordingContentView.js
r185349 r185734 266 266 if (this._renderingFrameTimeline && this._renderingFrameTimeline.records.length) { 267 267 var records = this._renderingFrameTimeline.records; 268 var startIndex = Math.floor(startTime);268 var startIndex = this._currentTimelineOverview.timelineRuler.snapInterval ? startTime : Math.floor(startTime); 269 269 if (startIndex >= records.length) 270 270 return false; 271 271 272 var endIndex = Math.min(Math.floor(endTime), records.length - 1); 272 var endIndex = this._currentTimelineOverview.timelineRuler.snapInterval ? endTime - 1: Math.floor(endTime); 273 endIndex = Math.min(endIndex, records.length - 1); 273 274 console.assert(startIndex <= endIndex, startIndex); 274 275 … … 672 673 673 674 var startIndex = this._renderingFrameTimelineOverview.selectionStartTime; 674 var endIndex = startIndex + this._renderingFrameTimelineOverview.selectionDuration ;675 var endIndex = startIndex + this._renderingFrameTimelineOverview.selectionDuration - 1; 675 676 this._timelineSidebarPanel.updateFrameSelection(startIndex, endIndex); 676 677 } -
trunk/Source/WebInspectorUI/UserInterface/Views/TimelineRuler.js
r184819 r185734 254 254 }, 255 255 256 get snapInterval() 257 { 258 return this._snapInterval; 259 }, 260 261 set snapInterval(x) 262 { 263 if (this._snapInterval === x) 264 return; 265 266 this._snapInterval = x; 267 }, 268 256 269 get selectionStartTime() 257 270 { … … 261 274 set selectionStartTime(x) 262 275 { 276 x = this._snapValue(x); 263 277 if (this._selectionStartTime === x) 264 278 return; … … 277 291 set selectionEndTime(x) 278 292 { 293 x = this._snapValue(x); 279 294 if (this._selectionEndTime === x) 280 295 return; … … 603 618 604 619 return Number.secondsToString(value, true); 620 }, 621 622 _snapValue: function(value) 623 { 624 if (!value || !this.snapInterval) 625 return value; 626 627 return Math.round(value / this.snapInterval) * this.snapInterval; 605 628 }, 606 629 … … 658 681 var offsetTime = (currentMousePosition - this._lastMousePosition) * this.secondsPerPixel; 659 682 var selectionDuration = this.selectionEndTime - this.selectionStartTime; 683 var oldSelectionStartTime = this.selectionStartTime; 660 684 661 685 this.selectionStartTime = Math.max(this.startTime, Math.min(this.selectionStartTime + offsetTime, this.endTime - selectionDuration)); 662 686 this.selectionEndTime = this.selectionStartTime + selectionDuration; 687 688 if (this.snapInterval) { 689 // When snapping we need to check the mouse position delta relative to the last snap, rather than the 690 // last mouse move. If a snap occurs we adjust for the amount the cursor drifted, so that the mouse 691 // position relative to the selection remains constant. 692 var snapOffset = this.selectionStartTime - oldSelectionStartTime; 693 if (!snapOffset) 694 return; 695 696 var positionDrift = (offsetTime - snapOffset * this.snapInterval) / this.secondsPerPixel; 697 currentMousePosition -= positionDrift; 698 } 663 699 664 700 this._lastMousePosition = currentMousePosition; -
trunk/Source/WebInspectorUI/UserInterface/Views/TimelineSidebarPanel.js
r185455 r185734 318 318 console.assert(startFrameIndex <= endFrameIndex); 319 319 console.assert(this.viewMode === WebInspector.TimelineSidebarPanel.ViewMode.RenderingFrames, this._viewMode); 320 321 startFrameIndex = Math.floor(startFrameIndex);322 endFrameIndex = Math.floor(endFrameIndex);323 320 if (this._startFrameIndex === startFrameIndex && this._endFrameIndex === endFrameIndex) 324 321 return;
Note:
See TracChangeset
for help on using the changeset viewer.