| 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 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 439 _cancelAnimation: function() | 439 _cancelAnimation: function() |
| 440 { | 440 { |
| 441 if (this._cancelWindowTimesAnimation) { | 441 if (this._cancelWindowTimesAnimation) { |
| 442 this._timeWindowLeft = this._pendingAnimationTimeLeft; | 442 this._timeWindowLeft = this._pendingAnimationTimeLeft; |
| 443 this._timeWindowRight = this._pendingAnimationTimeRight; | 443 this._timeWindowRight = this._pendingAnimationTimeRight; |
| 444 this._cancelWindowTimesAnimation(); | 444 this._cancelWindowTimesAnimation(); |
| 445 delete this._cancelWindowTimesAnimation; | 445 delete this._cancelWindowTimesAnimation; |
| 446 } | 446 } |
| 447 }, | 447 }, |
| 448 | 448 |
| 449 _revealEntry: function(entryIndex) |
| 450 { |
| 451 var timelineData = this._timelineData(); |
| 452 if (!timelineData) |
| 453 return; |
| 454 var entryStartTime = timelineData.entryStartTimes[entryIndex]; |
| 455 var entryTotalTime = timelineData.entryTotalTimes[entryIndex]; |
| 456 var entryEndTime = entryStartTime + entryTotalTime; |
| 457 var minEntryTimeWindow = Math.min(entryTotalTime, this._timeWindowRight
- this._timeWindowLeft); |
| 458 |
| 459 var y = this._levelToHeight(timelineData.entryLevels[entryIndex]); |
| 460 if (y < this._vScrollElement.scrollTop) |
| 461 this._vScrollElement.scrollTop = y; |
| 462 else if (y > this._vScrollElement.scrollTop + this._offsetHeight + this.
_barHeightDelta) |
| 463 this._vScrollElement.scrollTop = y - this._offsetHeight - this._barH
eightDelta; |
| 464 |
| 465 if (this._timeWindowLeft > entryEndTime) { |
| 466 var delta = this._timeWindowLeft - entryEndTime + minEntryTimeWindow
; |
| 467 this._flameChartDelegate.requestWindowTimes(this._timeWindowLeft - d
elta, this._timeWindowRight - delta); |
| 468 } else if (this._timeWindowRight < entryStartTime) { |
| 469 var delta = entryStartTime - this._timeWindowRight + minEntryTimeWin
dow; |
| 470 this._flameChartDelegate.requestWindowTimes(this._timeWindowLeft + d
elta, this._timeWindowRight + delta); |
| 471 } |
| 472 }, |
| 473 |
| 449 /** | 474 /** |
| 450 * @param {number} startTime | 475 * @param {number} startTime |
| 451 * @param {number} endTime | 476 * @param {number} endTime |
| 452 */ | 477 */ |
| 453 setWindowTimes: function(startTime, endTime) | 478 setWindowTimes: function(startTime, endTime) |
| 454 { | 479 { |
| 455 if (this._muteAnimation || this._timeWindowLeft === 0 || this._timeWindo
wRight === Infinity || (startTime === 0 && endTime === Infinity)) { | 480 if (this._muteAnimation || this._timeWindowLeft === 0 || this._timeWindo
wRight === Infinity || (startTime === 0 && endTime === Infinity)) { |
| 456 // Initial setup. | 481 // Initial setup. |
| 457 this._timeWindowLeft = startTime; | 482 this._timeWindowLeft = startTime; |
| 458 this._timeWindowRight = endTime; | 483 this._timeWindowRight = endTime; |
| (...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1103 this._rawTimelineData = timelineData; | 1128 this._rawTimelineData = timelineData; |
| 1104 this._rawTimelineDataLength = timelineData.entryStartTimes.length; | 1129 this._rawTimelineDataLength = timelineData.entryStartTimes.length; |
| 1105 }, | 1130 }, |
| 1106 | 1131 |
| 1107 /** | 1132 /** |
| 1108 * @param {number} entryIndex | 1133 * @param {number} entryIndex |
| 1109 */ | 1134 */ |
| 1110 setSelectedEntry: function(entryIndex) | 1135 setSelectedEntry: function(entryIndex) |
| 1111 { | 1136 { |
| 1112 this._selectedEntryIndex = entryIndex; | 1137 this._selectedEntryIndex = entryIndex; |
| 1138 this._revealEntry(entryIndex); |
| 1113 this._updateElementPosition(this._selectedElement, this._selectedEntryIn
dex); | 1139 this._updateElementPosition(this._selectedElement, this._selectedEntryIn
dex); |
| 1114 }, | 1140 }, |
| 1115 | 1141 |
| 1116 _updateElementPosition: function(element, entryIndex) | 1142 _updateElementPosition: function(element, entryIndex) |
| 1117 { | 1143 { |
| 1118 if (element.parentElement) | 1144 if (element.parentElement) |
| 1119 element.remove(); | 1145 element.remove(); |
| 1120 if (entryIndex === -1) | 1146 if (entryIndex === -1) |
| 1121 return; | 1147 return; |
| 1122 var timeRange = this._dataProvider.highlightTimeRange(entryIndex); | 1148 var timeRange = this._dataProvider.highlightTimeRange(entryIndex); |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1284 this.update(); | 1310 this.update(); |
| 1285 }, | 1311 }, |
| 1286 | 1312 |
| 1287 _enabled: function() | 1313 _enabled: function() |
| 1288 { | 1314 { |
| 1289 return this._rawTimelineDataLength !== 0; | 1315 return this._rawTimelineDataLength !== 0; |
| 1290 }, | 1316 }, |
| 1291 | 1317 |
| 1292 __proto__: WebInspector.HBox.prototype | 1318 __proto__: WebInspector.HBox.prototype |
| 1293 } | 1319 } |
| OLD | NEW |