OLD | NEW |
1 /** | 1 /** |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 WebInspector.FlameChart = function(dataProvider, flameChartDelegate, isTopDown) | 51 WebInspector.FlameChart = function(dataProvider, flameChartDelegate, isTopDown) |
52 { | 52 { |
53 WebInspector.HBox.call(this); | 53 WebInspector.HBox.call(this); |
54 this.element.classList.add("flame-chart-main-pane"); | 54 this.element.classList.add("flame-chart-main-pane"); |
55 this._flameChartDelegate = flameChartDelegate; | 55 this._flameChartDelegate = flameChartDelegate; |
56 this._isTopDown = isTopDown; | 56 this._isTopDown = isTopDown; |
57 | 57 |
58 this._calculator = new WebInspector.FlameChart.Calculator(); | 58 this._calculator = new WebInspector.FlameChart.Calculator(); |
59 | 59 |
60 this._canvas = this.element.createChild("canvas"); | 60 this._canvas = this.element.createChild("canvas"); |
61 this._canvas.addEventListener("mousemove", this._onMouseMove.bind(this)); | 61 this._canvas.addEventListener("mousemove", this._onMouseMove.bind(this), fal
se); |
62 this._canvas.addEventListener("mousewheel", this._onMouseWheel.bind(this), f
alse); | 62 this._canvas.addEventListener("mousewheel", this._onMouseWheel.bind(this), f
alse); |
63 this._canvas.addEventListener("click", this._onClick.bind(this), false); | 63 this._canvas.addEventListener("click", this._onClick.bind(this), false); |
64 WebInspector.installDragHandle(this._canvas, this._startCanvasDragging.bind(
this), this._canvasDragging.bind(this), this._endCanvasDragging.bind(this), "mov
e", null); | 64 WebInspector.installDragHandle(this._canvas, this._startCanvasDragging.bind(
this), this._canvasDragging.bind(this), this._endCanvasDragging.bind(this), "mov
e", null); |
65 | 65 |
66 this._vScrollElement = this.element.createChild("div", "flame-chart-v-scroll
"); | 66 this._vScrollElement = this.element.createChild("div", "flame-chart-v-scroll
"); |
67 this._vScrollContent = this._vScrollElement.createChild("div"); | 67 this._vScrollContent = this._vScrollElement.createChild("div"); |
68 this._vScrollElement.addEventListener("scroll", this._scheduleUpdate.bind(th
is), false); | 68 this._vScrollElement.addEventListener("scroll", this._scheduleUpdate.bind(th
is), false); |
69 | 69 |
70 this._entryInfo = this.element.createChild("div", "profile-entry-info"); | 70 this._entryInfo = this.element.createChild("div", "profile-entry-info"); |
71 this._highlightElement = this.element.createChild("div", "flame-chart-highli
ght-element"); | 71 this._highlightElement = this.element.createChild("div", "flame-chart-highli
ght-element"); |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 entryTitle: function(entryIndex) { }, | 158 entryTitle: function(entryIndex) { }, |
159 | 159 |
160 /** | 160 /** |
161 * @param {number} entryIndex | 161 * @param {number} entryIndex |
162 * @return {?string} | 162 * @return {?string} |
163 */ | 163 */ |
164 entryFont: function(entryIndex) { }, | 164 entryFont: function(entryIndex) { }, |
165 | 165 |
166 /** | 166 /** |
167 * @param {number} entryIndex | 167 * @param {number} entryIndex |
168 * @return {!string} | 168 * @return {string} |
169 */ | 169 */ |
170 entryColor: function(entryIndex) { }, | 170 entryColor: function(entryIndex) { }, |
171 | 171 |
172 /** | 172 /** |
173 * @param {number} entryIndex | 173 * @param {number} entryIndex |
174 * @param {!CanvasRenderingContext2D} context | 174 * @param {!CanvasRenderingContext2D} context |
175 * @param {?string} text | 175 * @param {?string} text |
176 * @param {number} barX | 176 * @param {number} barX |
177 * @param {number} barY | 177 * @param {number} barY |
178 * @param {number} barWidth | 178 * @param {number} barWidth |
179 * @param {number} barHeight | 179 * @param {number} barHeight |
180 * @param {function(number):number} timeToPosition | 180 * @param {function(number):number} timeToPosition |
181 * @return {boolean} | 181 * @return {boolean} |
182 */ | 182 */ |
183 decorateEntry: function(entryIndex, context, text, barX, barY, barWidth, bar
Height, timeToPosition) { }, | 183 decorateEntry: function(entryIndex, context, text, barX, barY, barWidth, bar
Height, timeToPosition) { }, |
184 | 184 |
185 /** | 185 /** |
186 * @param {number} entryIndex | 186 * @param {number} entryIndex |
187 * @return {boolean} | 187 * @return {boolean} |
188 */ | 188 */ |
189 forceDecoration: function(entryIndex) { }, | 189 forceDecoration: function(entryIndex) { }, |
190 | 190 |
191 /** | 191 /** |
192 * @param {number} entryIndex | 192 * @param {number} entryIndex |
193 * @return {!string} | 193 * @return {string} |
194 */ | 194 */ |
195 textColor: function(entryIndex) { }, | 195 textColor: function(entryIndex) { }, |
196 | 196 |
197 /** | 197 /** |
198 * @return {number} | 198 * @return {number} |
199 */ | 199 */ |
200 textBaseline: function() { }, | 200 textBaseline: function() { }, |
201 | 201 |
202 /** | 202 /** |
203 * @return {number} | 203 * @return {number} |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 this._flameChartDelegate.requestWindowTimes(windowLeft, windowRight); | 442 this._flameChartDelegate.requestWindowTimes(windowLeft, windowRight); |
443 this._maxDragOffset = Math.max(this._maxDragOffset, Math.abs(pixelShift)
); | 443 this._maxDragOffset = Math.max(this._maxDragOffset, Math.abs(pixelShift)
); |
444 }, | 444 }, |
445 | 445 |
446 _endCanvasDragging: function() | 446 _endCanvasDragging: function() |
447 { | 447 { |
448 this._isDragging = false; | 448 this._isDragging = false; |
449 }, | 449 }, |
450 | 450 |
451 /** | 451 /** |
452 * @param {?MouseEvent} event | 452 * @param {?Event} event |
453 */ | 453 */ |
454 _onMouseMove: function(event) | 454 _onMouseMove: function(event) |
455 { | 455 { |
456 if (this._isDragging) | 456 if (this._isDragging) |
457 return; | 457 return; |
458 var entryIndex = this._coordinatesToEntryIndex(event.offsetX, event.offs
etY); | 458 var entryIndex = this._coordinatesToEntryIndex(event.offsetX, event.offs
etY); |
459 | 459 |
460 if (this._highlightedEntryIndex === entryIndex) | 460 if (this._highlightedEntryIndex === entryIndex) |
461 return; | 461 return; |
462 | 462 |
(...skipping 24 matching lines...) Expand all Loading... |
487 // we skip the click. Otherwise we jump to the sources. | 487 // we skip the click. Otherwise we jump to the sources. |
488 const clickThreshold = 5; | 488 const clickThreshold = 5; |
489 if (this._maxDragOffset > clickThreshold) | 489 if (this._maxDragOffset > clickThreshold) |
490 return; | 490 return; |
491 if (this._highlightedEntryIndex === -1) | 491 if (this._highlightedEntryIndex === -1) |
492 return; | 492 return; |
493 this.dispatchEventToListeners(WebInspector.FlameChart.Events.EntrySelect
ed, this._highlightedEntryIndex); | 493 this.dispatchEventToListeners(WebInspector.FlameChart.Events.EntrySelect
ed, this._highlightedEntryIndex); |
494 }, | 494 }, |
495 | 495 |
496 /** | 496 /** |
497 * @param {?MouseEvent} e | 497 * @param {?Event} e |
498 */ | 498 */ |
499 _onMouseWheel: function(e) | 499 _onMouseWheel: function(e) |
500 { | 500 { |
501 var scrollIsThere = this._totalHeight > this._offsetHeight; | 501 var scrollIsThere = this._totalHeight > this._offsetHeight; |
502 var windowLeft = this._timeWindowLeft ? this._timeWindowLeft : this._dat
aProvider.minimumBoundary(); | 502 var windowLeft = this._timeWindowLeft ? this._timeWindowLeft : this._dat
aProvider.minimumBoundary(); |
503 var windowRight = this._timeWindowRight !== Infinity ? this._timeWindowR
ight : this._dataProvider.minimumBoundary() + this._dataProvider.totalTime(); | 503 var windowRight = this._timeWindowRight !== Infinity ? this._timeWindowR
ight : this._dataProvider.minimumBoundary() + this._dataProvider.totalTime(); |
504 | 504 |
505 var panHorizontally = Math.abs(e.wheelDeltaX) > Math.abs(e.wheelDeltaY)
&& !e.shiftKey; | 505 var panHorizontally = Math.abs(e.wheelDeltaX) > Math.abs(e.wheelDeltaY)
&& !e.shiftKey; |
506 var panVertically = scrollIsThere && ((e.wheelDeltaY && !e.shiftKey) ||
(Math.abs(e.wheelDeltaX) === 120 && !e.shiftKey)); | 506 var panVertically = scrollIsThere && ((e.wheelDeltaY && !e.shiftKey) ||
(Math.abs(e.wheelDeltaX) === 120 && !e.shiftKey)); |
507 if (panVertically) { | 507 if (panVertically) { |
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
958 reset: function() | 958 reset: function() |
959 { | 959 { |
960 this._highlightedEntryIndex = -1; | 960 this._highlightedEntryIndex = -1; |
961 this._selectedEntryIndex = -1; | 961 this._selectedEntryIndex = -1; |
962 this._textWidth = {}; | 962 this._textWidth = {}; |
963 this.update(); | 963 this.update(); |
964 }, | 964 }, |
965 | 965 |
966 __proto__: WebInspector.HBox.prototype | 966 __proto__: WebInspector.HBox.prototype |
967 } | 967 } |
OLD | NEW |