Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(935)

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/ui_lazy/ChartViewport.js

Issue 2493373002: DevTools: rename WebInspector into modules. (Closed)
Patch Set: for bots Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 /** 4 /**
5 * @unrestricted 5 * @unrestricted
6 */ 6 */
7 WebInspector.ChartViewport = class extends WebInspector.VBox { 7 UI.ChartViewport = class extends UI.VBox {
8 constructor() { 8 constructor() {
9 super(true); 9 super(true);
10 10
11 this.contentElement.addEventListener('mousewheel', this._onMouseWheel.bind(t his), false); 11 this.contentElement.addEventListener('mousewheel', this._onMouseWheel.bind(t his), false);
12 this.contentElement.addEventListener('keydown', this._handleZoomPanKeys.bind (this), false); 12 this.contentElement.addEventListener('keydown', this._handleZoomPanKeys.bind (this), false);
13 13
14 this.viewportElement = this.contentElement.createChild('div', 'fill'); 14 this.viewportElement = this.contentElement.createChild('div', 'fill');
15 WebInspector.installInertialDragHandle( 15 UI.installInertialDragHandle(
16 this.viewportElement, this._startDragging.bind(this), this._dragging.bin d(this), this._endDragging.bind(this), 16 this.viewportElement, this._startDragging.bind(this), this._dragging.bin d(this), this._endDragging.bind(this),
17 '-webkit-grabbing', null); 17 '-webkit-grabbing', null);
18 WebInspector.installDragHandle( 18 UI.installDragHandle(
19 this.viewportElement, this._startRangeSelection.bind(this), this._rangeS electionDragging.bind(this), 19 this.viewportElement, this._startRangeSelection.bind(this), this._rangeS electionDragging.bind(this),
20 this._endRangeSelection.bind(this), 'text', null); 20 this._endRangeSelection.bind(this), 'text', null);
21 21
22 this._vScrollElement = this.contentElement.createChild('div', 'flame-chart-v -scroll'); 22 this._vScrollElement = this.contentElement.createChild('div', 'flame-chart-v -scroll');
23 this._vScrollContent = this._vScrollElement.createChild('div'); 23 this._vScrollContent = this._vScrollElement.createChild('div');
24 this._vScrollElement.addEventListener('scroll', this._onScroll.bind(this), f alse); 24 this._vScrollElement.addEventListener('scroll', this._onScroll.bind(this), f alse);
25 25
26 this._selectionOverlay = this.contentElement.createChild('div', 'flame-chart -selection-overlay hidden'); 26 this._selectionOverlay = this.contentElement.createChild('div', 'flame-chart -selection-overlay hidden');
27 this._selectedTimeSpanLabel = this._selectionOverlay.createChild('div', 'tim e-span'); 27 this._selectedTimeSpanLabel = this._selectionOverlay.createChild('div', 'tim e-span');
28 28
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 _onScroll() { 293 _onScroll() {
294 this._scrollTop = this._vScrollElement.scrollTop; 294 this._scrollTop = this._vScrollElement.scrollTop;
295 this.scheduleUpdate(); 295 this.scheduleUpdate();
296 } 296 }
297 297
298 /** 298 /**
299 * @param {!Event} e 299 * @param {!Event} e
300 * @private 300 * @private
301 */ 301 */
302 _handleZoomPanKeys(e) { 302 _handleZoomPanKeys(e) {
303 if (!WebInspector.KeyboardShortcut.hasNoModifiers(e)) 303 if (!UI.KeyboardShortcut.hasNoModifiers(e))
304 return; 304 return;
305 var zoomMultiplier = e.shiftKey ? 0.8 : 0.3; 305 var zoomMultiplier = e.shiftKey ? 0.8 : 0.3;
306 var panMultiplier = e.shiftKey ? 320 : 80; 306 var panMultiplier = e.shiftKey ? 320 : 80;
307 if (e.code === 'KeyA') { 307 if (e.code === 'KeyA') {
308 this._handlePanGesture(-panMultiplier * this._pixelToTime); 308 this._handlePanGesture(-panMultiplier * this._pixelToTime);
309 e.consume(true); 309 e.consume(true);
310 } else if (e.code === 'KeyD') { 310 } else if (e.code === 'KeyD') {
311 this._handlePanGesture(panMultiplier * this._pixelToTime); 311 this._handlePanGesture(panMultiplier * this._pixelToTime);
312 e.consume(true); 312 e.consume(true);
313 } else if (e.code === 'KeyW') { 313 } else if (e.code === 'KeyW') {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 return {left: windowLeft, right: windowRight}; 358 return {left: windowLeft, right: windowRight};
359 } 359 }
360 360
361 /** 361 /**
362 * @param {{left: number, right: number}} bounds 362 * @param {{left: number, right: number}} bounds
363 * @private 363 * @private
364 */ 364 */
365 _requestWindowTimes(bounds) { 365 _requestWindowTimes(bounds) {
366 bounds.left = Number.constrain(bounds.left, this._minimumBoundary, this._tot alTime + this._minimumBoundary); 366 bounds.left = Number.constrain(bounds.left, this._minimumBoundary, this._tot alTime + this._minimumBoundary);
367 bounds.right = Number.constrain(bounds.right, this._minimumBoundary, this._t otalTime + this._minimumBoundary); 367 bounds.right = Number.constrain(bounds.right, this._minimumBoundary, this._t otalTime + this._minimumBoundary);
368 if (bounds.right - bounds.left < WebInspector.FlameChart.MinimalTimeWindowMs ) 368 if (bounds.right - bounds.left < UI.FlameChart.MinimalTimeWindowMs)
369 return; 369 return;
370 this._flameChartDelegate.requestWindowTimes(bounds.left, bounds.right); 370 this._flameChartDelegate.requestWindowTimes(bounds.left, bounds.right);
371 } 371 }
372 372
373 /** 373 /**
374 * @param {number} startTime 374 * @param {number} startTime
375 * @param {number} endTime 375 * @param {number} endTime
376 * @private 376 * @private
377 */ 377 */
378 _animateWindowTimes(startTime, endTime) { 378 _animateWindowTimes(startTime, endTime) {
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 this.hideRangeSelection(); 422 this.hideRangeSelection();
423 if (this._muteAnimation || this._timeWindowLeft === 0 || this._timeWindowRig ht === Infinity || 423 if (this._muteAnimation || this._timeWindowLeft === 0 || this._timeWindowRig ht === Infinity ||
424 (startTime === 0 && endTime === Infinity) || (startTime === Infinity && endTime === Infinity)) { 424 (startTime === 0 && endTime === Infinity) || (startTime === Infinity && endTime === Infinity)) {
425 // Initial setup. 425 // Initial setup.
426 this._timeWindowLeft = startTime; 426 this._timeWindowLeft = startTime;
427 this._timeWindowRight = endTime; 427 this._timeWindowRight = endTime;
428 this.scheduleUpdate(); 428 this.scheduleUpdate();
429 return; 429 return;
430 } 430 }
431 this._cancelAnimation(); 431 this._cancelAnimation();
432 this._cancelWindowTimesAnimation = WebInspector.animateFunction( 432 this._cancelWindowTimesAnimation = UI.animateFunction(
433 this.element.window(), this._animateWindowTimes.bind(this), 433 this.element.window(), this._animateWindowTimes.bind(this),
434 [{from: this._timeWindowLeft, to: startTime}, {from: this._timeWindowRig ht, to: endTime}], 5, 434 [{from: this._timeWindowLeft, to: startTime}, {from: this._timeWindowRig ht, to: endTime}], 5,
435 this._animationCompleted.bind(this)); 435 this._animationCompleted.bind(this));
436 this._pendingAnimationTimeLeft = startTime; 436 this._pendingAnimationTimeLeft = startTime;
437 this._pendingAnimationTimeRight = endTime; 437 this._pendingAnimationTimeRight = endTime;
438 } 438 }
439 }; 439 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698