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 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 * @return {number} | 256 * @return {number} |
257 */ | 257 */ |
258 textBaseline: function() { }, | 258 textBaseline: function() { }, |
259 | 259 |
260 /** | 260 /** |
261 * @return {number} | 261 * @return {number} |
262 */ | 262 */ |
263 textPadding: function() { }, | 263 textPadding: function() { }, |
264 | 264 |
265 /** | 265 /** |
266 * @return {?{startTime: number, endTime: number}} | |
267 */ | |
268 highlightTimeRange: function(entryIndex) { }, | |
269 | |
270 /** | |
271 * @return {number} | 266 * @return {number} |
272 */ | 267 */ |
273 paddingLeft: function() { }, | 268 paddingLeft: function() { }, |
274 } | 269 } |
275 | 270 |
276 /** | 271 /** |
277 * @interface | 272 * @interface |
278 */ | 273 */ |
279 WebInspector.FlameChartMarker = function() | 274 WebInspector.FlameChartMarker = function() |
280 { | 275 { |
(...skipping 1193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1474 this._revealEntry(entryIndex); | 1469 this._revealEntry(entryIndex); |
1475 this._updateElementPosition(this._selectedElement, this._selectedEntryIn
dex); | 1470 this._updateElementPosition(this._selectedElement, this._selectedEntryIn
dex); |
1476 }, | 1471 }, |
1477 | 1472 |
1478 /** | 1473 /** |
1479 * @param {!Element} element | 1474 * @param {!Element} element |
1480 * @param {number} entryIndex | 1475 * @param {number} entryIndex |
1481 */ | 1476 */ |
1482 _updateElementPosition: function(element, entryIndex) | 1477 _updateElementPosition: function(element, entryIndex) |
1483 { | 1478 { |
1484 /** @const */ var elementMinWidth = 2; | 1479 const elementMinWidthPx = 2; |
1485 if (element.parentElement) | 1480 if (element.parentElement) |
1486 element.remove(); | 1481 element.remove(); |
1487 if (entryIndex === -1) | 1482 if (entryIndex === -1) |
1488 return; | 1483 return; |
1489 var timeRange = this._dataProvider.highlightTimeRange(entryIndex); | |
1490 if (!timeRange) | |
1491 return; | |
1492 var timelineData = this._timelineData(); | 1484 var timelineData = this._timelineData(); |
1493 var barX = this._timeToPositionClipped(timeRange.startTime); | 1485 var startTime = timelineData.entryStartTimes[entryIndex]; |
1494 var barRight = this._timeToPositionClipped(timeRange.endTime); | 1486 var endTime = startTime + (timelineData.entryTotalTimes[entryIndex] || 0
); |
| 1487 var barX = this._timeToPositionClipped(startTime); |
| 1488 var barRight = this._timeToPositionClipped(endTime); |
1495 if (barRight === 0 || barX === this._offsetWidth) | 1489 if (barRight === 0 || barX === this._offsetWidth) |
1496 return; | 1490 return; |
1497 var barWidth = barRight - barX; | 1491 var barWidth = barRight - barX; |
1498 var barCenter = barX + barWidth / 2; | 1492 var barCenter = barX + barWidth / 2; |
1499 barWidth = Math.max(barWidth, elementMinWidth); | 1493 barWidth = Math.max(barWidth, elementMinWidthPx); |
1500 barX = barCenter - barWidth / 2; | 1494 barX = barCenter - barWidth / 2; |
1501 var barY = this._levelToHeight(timelineData.entryLevels[entryIndex]) - t
his.scrollOffset(); | 1495 var barY = this._levelToHeight(timelineData.entryLevels[entryIndex]) - t
his.scrollOffset(); |
1502 var style = element.style; | 1496 var style = element.style; |
1503 style.left = barX + "px"; | 1497 style.left = barX + "px"; |
1504 style.top = barY + "px"; | 1498 style.top = barY + "px"; |
1505 style.width = barWidth + "px"; | 1499 style.width = barWidth + "px"; |
1506 style.height = this._barHeight - 1 + "px"; | 1500 style.height = this._barHeight - 1 + "px"; |
1507 this.viewportElement.appendChild(element); | 1501 this.viewportElement.appendChild(element); |
1508 }, | 1502 }, |
1509 | 1503 |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1662 this.update(); | 1656 this.update(); |
1663 }, | 1657 }, |
1664 | 1658 |
1665 _enabled: function() | 1659 _enabled: function() |
1666 { | 1660 { |
1667 return this._rawTimelineDataLength !== 0; | 1661 return this._rawTimelineDataLength !== 0; |
1668 }, | 1662 }, |
1669 | 1663 |
1670 __proto__: WebInspector.ChartViewport.prototype | 1664 __proto__: WebInspector.ChartViewport.prototype |
1671 } | 1665 } |
OLD | NEW |