Chromium Code Reviews| 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 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 433 _cancelAnimation: function() | 433 _cancelAnimation: function() |
| 434 { | 434 { |
| 435 if (this._cancelWindowTimesAnimation) { | 435 if (this._cancelWindowTimesAnimation) { |
| 436 this._timeWindowLeft = this._pendingAnimationTimeLeft; | 436 this._timeWindowLeft = this._pendingAnimationTimeLeft; |
| 437 this._timeWindowRight = this._pendingAnimationTimeRight; | 437 this._timeWindowRight = this._pendingAnimationTimeRight; |
| 438 this._cancelWindowTimesAnimation(); | 438 this._cancelWindowTimesAnimation(); |
| 439 delete this._cancelWindowTimesAnimation; | 439 delete this._cancelWindowTimesAnimation; |
| 440 } | 440 } |
| 441 }, | 441 }, |
| 442 | 442 |
| 443 _revealEntry: function(entryIndex) | |
| 444 { | |
| 445 var timelineData = this._timelineData(); | |
|
yurys
2014/11/06 11:39:58
Should we check for null data like in some other p
loislo
2014/11/09 15:32:57
Done.
| |
| 446 var entryStartTime = timelineData.entryStartTimes[entryIndex]; | |
| 447 var entryTotalTime = timelineData.entryTotalTimes[entryIndex]; | |
| 448 var entryEndTime = entryStartTime + entryTotalTime; | |
| 449 var minEntryTimeWindow = Math.min(entryTotalTime, this._timeWindowRight - this._timeWindowLeft); | |
| 450 | |
| 451 var y = this._levelToHeight(timelineData.entryLevels[entryIndex]); | |
| 452 if (y < this._vScrollElement.scrollTop) | |
| 453 this._vScrollElement.scrollTop = y; | |
|
yurys
2014/11/06 11:39:58
Did you consider scrolling it so that selected bar
| |
| 454 else if (y > this._vScrollElement.scrollTop + this._offsetHeight + this. _barHeightDelta) | |
| 455 this._vScrollElement.scrollTop = y - this._offsetHeight - this._barH eightDelta; | |
| 456 | |
| 457 if (this._timeWindowLeft > entryEndTime) { | |
| 458 var delta = this._timeWindowLeft - entryEndTime + minEntryTimeWindow ; | |
|
yurys
2014/11/06 11:39:58
How about delta = this._timeWindowLeft - entrySta
loislo
2014/11/09 15:32:57
The idea is to do the minimal scrolling but show a
| |
| 459 this._flameChartDelegate.requestWindowTimes(this._timeWindowLeft - d elta, this._timeWindowRight - delta); | |
| 460 } else if (this._timeWindowRight < entryStartTime) { | |
| 461 var delta = entryStartTime - this._timeWindowRight + minEntryTimeWin dow; | |
|
yurys
2014/11/06 11:39:58
Maybe delta = entryStartTime - this._timeWindowLef
loislo
2014/11/09 15:32:57
ditto
| |
| 462 this._flameChartDelegate.requestWindowTimes(this._timeWindowLeft + d elta, this._timeWindowRight + delta); | |
| 463 } | |
| 464 }, | |
| 465 | |
| 443 /** | 466 /** |
| 444 * @param {number} startTime | 467 * @param {number} startTime |
| 445 * @param {number} endTime | 468 * @param {number} endTime |
| 446 */ | 469 */ |
| 447 setWindowTimes: function(startTime, endTime) | 470 setWindowTimes: function(startTime, endTime) |
| 448 { | 471 { |
| 449 if (this._muteAnimation || this._timeWindowLeft === 0 || this._timeWindo wRight === Infinity || (startTime === 0 && endTime === Infinity)) { | 472 if (this._muteAnimation || this._timeWindowLeft === 0 || this._timeWindo wRight === Infinity || (startTime === 0 && endTime === Infinity)) { |
| 450 // Initial setup. | 473 // Initial setup. |
| 451 this._timeWindowLeft = startTime; | 474 this._timeWindowLeft = startTime; |
| 452 this._timeWindowRight = endTime; | 475 this._timeWindowRight = endTime; |
| (...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1086 this._rawTimelineData = timelineData; | 1109 this._rawTimelineData = timelineData; |
| 1087 this._rawTimelineDataLength = timelineData.entryStartTimes.length; | 1110 this._rawTimelineDataLength = timelineData.entryStartTimes.length; |
| 1088 }, | 1111 }, |
| 1089 | 1112 |
| 1090 /** | 1113 /** |
| 1091 * @param {number} entryIndex | 1114 * @param {number} entryIndex |
| 1092 */ | 1115 */ |
| 1093 setSelectedEntry: function(entryIndex) | 1116 setSelectedEntry: function(entryIndex) |
| 1094 { | 1117 { |
| 1095 this._selectedEntryIndex = entryIndex; | 1118 this._selectedEntryIndex = entryIndex; |
| 1119 this._revealEntry(entryIndex); | |
| 1096 this._updateElementPosition(this._selectedElement, this._selectedEntryIn dex); | 1120 this._updateElementPosition(this._selectedElement, this._selectedEntryIn dex); |
| 1097 }, | 1121 }, |
| 1098 | 1122 |
| 1099 _updateElementPosition: function(element, entryIndex) | 1123 _updateElementPosition: function(element, entryIndex) |
| 1100 { | 1124 { |
| 1101 if (element.parentElement) | 1125 if (element.parentElement) |
| 1102 element.remove(); | 1126 element.remove(); |
| 1103 if (entryIndex === -1) | 1127 if (entryIndex === -1) |
| 1104 return; | 1128 return; |
| 1105 var timeRange = this._dataProvider.highlightTimeRange(entryIndex); | 1129 var timeRange = this._dataProvider.highlightTimeRange(entryIndex); |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1267 this.update(); | 1291 this.update(); |
| 1268 }, | 1292 }, |
| 1269 | 1293 |
| 1270 _enabled: function() | 1294 _enabled: function() |
| 1271 { | 1295 { |
| 1272 return this._rawTimelineDataLength !== 0; | 1296 return this._rawTimelineDataLength !== 0; |
| 1273 }, | 1297 }, |
| 1274 | 1298 |
| 1275 __proto__: WebInspector.HBox.prototype | 1299 __proto__: WebInspector.HBox.prototype |
| 1276 } | 1300 } |
| OLD | NEW |