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 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 208 */ | 208 */ |
| 209 maxStackDepth: function() { }, | 209 maxStackDepth: function() { }, |
| 210 | 210 |
| 211 /** | 211 /** |
| 212 * @return {?WebInspector.FlameChart.TimelineData} | 212 * @return {?WebInspector.FlameChart.TimelineData} |
| 213 */ | 213 */ |
| 214 timelineData: function() { }, | 214 timelineData: function() { }, |
| 215 | 215 |
| 216 /** | 216 /** |
| 217 * @param {number} entryIndex | 217 * @param {number} entryIndex |
| 218 * @return {?Array.<!{title: string, value: (string|!Element)}>} | 218 * @return {?Promise<!Element>} |
| 219 */ | 219 */ |
| 220 prepareHighlightedEntryInfo: function(entryIndex) { }, | 220 prepareHighlightedEntryInfo: function(entryIndex) { }, |
| 221 | 221 |
| 222 /** | 222 /** |
| 223 * @param {number} entryIndex | 223 * @param {number} entryIndex |
| 224 * @return {boolean} | 224 * @return {boolean} |
| 225 */ | 225 */ |
| 226 canJumpToEntry: function(entryIndex) { }, | 226 canJumpToEntry: function(entryIndex) { }, |
| 227 | 227 |
| 228 /** | 228 /** |
| (...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 806 this._lastMouseOffsetX = -1; | 806 this._lastMouseOffsetX = -1; |
| 807 this._lastMouseOffsetY = -1; | 807 this._lastMouseOffsetY = -1; |
| 808 this.hideHighlight(); | 808 this.hideHighlight(); |
| 809 }, | 809 }, |
| 810 | 810 |
| 811 /** | 811 /** |
| 812 * @param {number} entryIndex | 812 * @param {number} entryIndex |
| 813 */ | 813 */ |
| 814 _updatePopover: function(entryIndex) | 814 _updatePopover: function(entryIndex) |
| 815 { | 815 { |
| 816 if (entryIndex !== this._highlightedEntryIndex) { | 816 if (entryIndex === this._highlightedEntryIndex) { |
| 817 this._entryInfo.removeChildren(); | 817 this._updatePopoverOffset(); |
| 818 var entryInfo = this._dataProvider.prepareHighlightedEntryInfo(entry Index); | 818 return; |
| 819 if (entryInfo) | |
| 820 this._entryInfo.appendChild(this._buildEntryInfo(entryInfo)); | |
| 821 } | 819 } |
| 820 this._entryInfo.removeChildren(); | |
| 821 var popoverElementPromise = this._dataProvider.prepareHighlightedEntryIn fo(entryIndex); | |
| 822 if (popoverElementPromise) | |
| 823 popoverElementPromise.then(element => this._entryInfo.appendChild(el ement)).then(() => this._updatePopoverOffset); | |
|
alph
2016/09/08 00:16:05
missing a call at the end.
| |
| 824 }, | |
| 825 | |
| 826 _updatePopoverOffset: function() | |
| 827 { | |
| 822 var mouseX = this._lastMouseOffsetX; | 828 var mouseX = this._lastMouseOffsetX; |
| 823 var mouseY = this._lastMouseOffsetY; | 829 var mouseY = this._lastMouseOffsetY; |
| 824 var parentWidth = this._entryInfo.parentElement.clientWidth; | 830 var parentWidth = this._entryInfo.parentElement.clientWidth; |
| 825 var parentHeight = this._entryInfo.parentElement.clientHeight; | 831 var parentHeight = this._entryInfo.parentElement.clientHeight; |
| 826 var infoWidth = this._entryInfo.clientWidth; | 832 var infoWidth = this._entryInfo.clientWidth; |
| 827 var infoHeight = this._entryInfo.clientHeight; | 833 var infoHeight = this._entryInfo.clientHeight; |
| 828 var /** @const */ offsetX = 10; | 834 var /** @const */ offsetX = 10; |
| 829 var /** @const */ offsetY = 6; | 835 var /** @const */ offsetY = 6; |
| 830 var x; | 836 var x; |
| 831 var y; | 837 var y; |
| (...skipping 1003 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1835 /** | 1841 /** |
| 1836 * @param {number} level | 1842 * @param {number} level |
| 1837 * @return {number} | 1843 * @return {number} |
| 1838 */ | 1844 */ |
| 1839 _levelToHeight: function(level) | 1845 _levelToHeight: function(level) |
| 1840 { | 1846 { |
| 1841 return this._visibleLevelOffsets[level]; | 1847 return this._visibleLevelOffsets[level]; |
| 1842 }, | 1848 }, |
| 1843 | 1849 |
| 1844 /** | 1850 /** |
| 1845 * @param {!Array<!{title: string, value: (string|!Element)}>} entryInfo | |
| 1846 * @return {!Element} | |
| 1847 */ | |
| 1848 _buildEntryInfo: function(entryInfo) | |
| 1849 { | |
| 1850 var infoTable = createElementWithClass("table", "info-table"); | |
| 1851 for (var entry of entryInfo) { | |
| 1852 var row = infoTable.createChild("tr"); | |
| 1853 row.createChild("td", "title").textContent = entry.title; | |
| 1854 if (typeof entry.value === "string") | |
| 1855 row.createChild("td").textContent = entry.value; | |
| 1856 else | |
| 1857 row.createChild("td").appendChild(entry.value); | |
| 1858 } | |
| 1859 return infoTable; | |
| 1860 }, | |
| 1861 | |
| 1862 /** | |
| 1863 * @param {!CanvasRenderingContext2D} context | 1851 * @param {!CanvasRenderingContext2D} context |
| 1864 * @param {string} text | 1852 * @param {string} text |
| 1865 * @param {number} maxWidth | 1853 * @param {number} maxWidth |
| 1866 * @return {string} | 1854 * @return {string} |
| 1867 */ | 1855 */ |
| 1868 _prepareText: function(context, text, maxWidth) | 1856 _prepareText: function(context, text, maxWidth) |
| 1869 { | 1857 { |
| 1870 var /** @const */ maxLength = 200; | 1858 var /** @const */ maxLength = 200; |
| 1871 if (maxWidth <= 10) | 1859 if (maxWidth <= 10) |
| 1872 return ""; | 1860 return ""; |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2020 this.update(); | 2008 this.update(); |
| 2021 }, | 2009 }, |
| 2022 | 2010 |
| 2023 _enabled: function() | 2011 _enabled: function() |
| 2024 { | 2012 { |
| 2025 return this._rawTimelineDataLength !== 0; | 2013 return this._rawTimelineDataLength !== 0; |
| 2026 }, | 2014 }, |
| 2027 | 2015 |
| 2028 __proto__: WebInspector.HBox.prototype | 2016 __proto__: WebInspector.HBox.prototype |
| 2029 } | 2017 } |
| OLD | NEW |