| 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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), fal
se); | 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(thi
s), 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"); |
| 72 this._selectedElement = this.element.createChild("div", "flame-chart-selecte
d-element"); | 72 this._selectedElement = this.element.createChild("div", "flame-chart-selecte
d-element"); |
| 73 | 73 |
| 74 this._dataProvider = dataProvider; | 74 this._dataProvider = dataProvider; |
| 75 | 75 |
| 76 this._windowLeft = 0.0; | 76 this._windowLeft = 0.0; |
| 77 this._windowRight = 1.0; | 77 this._windowRight = 1.0; |
| 78 this._windowWidth = 1.0; | 78 this._windowWidth = 1.0; |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 392 }, | 392 }, |
| 393 | 393 |
| 394 /** | 394 /** |
| 395 * @param {number} startTime | 395 * @param {number} startTime |
| 396 * @param {number} endTime | 396 * @param {number} endTime |
| 397 */ | 397 */ |
| 398 setWindowTimes: function(startTime, endTime) | 398 setWindowTimes: function(startTime, endTime) |
| 399 { | 399 { |
| 400 this._timeWindowLeft = startTime; | 400 this._timeWindowLeft = startTime; |
| 401 this._timeWindowRight = endTime; | 401 this._timeWindowRight = endTime; |
| 402 this._scheduleUpdate(); | 402 this.scheduleUpdate(); |
| 403 }, | 403 }, |
| 404 | 404 |
| 405 /** | 405 /** |
| 406 * @param {!MouseEvent} event | 406 * @param {!MouseEvent} event |
| 407 */ | 407 */ |
| 408 _startCanvasDragging: function(event) | 408 _startCanvasDragging: function(event) |
| 409 { | 409 { |
| 410 if (!this._timelineData() || this._timeWindowRight === Infinity) | 410 if (!this._timelineData() || this._timeWindowRight === Infinity) |
| 411 return false; | 411 return false; |
| 412 this._isDragging = true; | 412 this._isDragging = true; |
| (...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 919 | 919 |
| 920 this._totalHeight = this._levelToHeight(this._dataProvider.maxStackDepth
() + 1); | 920 this._totalHeight = this._levelToHeight(this._dataProvider.maxStackDepth
() + 1); |
| 921 this._vScrollContent.style.height = this._totalHeight + "px"; | 921 this._vScrollContent.style.height = this._totalHeight + "px"; |
| 922 this._scrollTop = this._vScrollElement.scrollTop; | 922 this._scrollTop = this._vScrollElement.scrollTop; |
| 923 this._updateScrollBar(); | 923 this._updateScrollBar(); |
| 924 }, | 924 }, |
| 925 | 925 |
| 926 onResize: function() | 926 onResize: function() |
| 927 { | 927 { |
| 928 this._updateScrollBar(); | 928 this._updateScrollBar(); |
| 929 this._scheduleUpdate(); | 929 this.scheduleUpdate(); |
| 930 }, | 930 }, |
| 931 | 931 |
| 932 _updateScrollBar: function() | 932 _updateScrollBar: function() |
| 933 { | 933 { |
| 934 var showScroll = this._totalHeight > this._offsetHeight; | 934 var showScroll = this._totalHeight > this._offsetHeight; |
| 935 this._vScrollElement.classList.toggle("hidden", !showScroll); | 935 this._vScrollElement.classList.toggle("hidden", !showScroll); |
| 936 this._offsetWidth = this.element.offsetWidth - (WebInspector.isMac() ? 0
: this._vScrollElement.offsetWidth); | 936 this._offsetWidth = this.element.offsetWidth - (WebInspector.isMac() ? 0
: this._vScrollElement.offsetWidth); |
| 937 this._offsetHeight = this.element.offsetHeight; | 937 this._offsetHeight = this.element.offsetHeight; |
| 938 }, | 938 }, |
| 939 | 939 |
| 940 _scheduleUpdate: function() | 940 scheduleUpdate: function() |
| 941 { | 941 { |
| 942 if (this._updateTimerId) | 942 if (this._updateTimerId) |
| 943 return; | 943 return; |
| 944 this._updateTimerId = requestAnimationFrame(this.update.bind(this)); | 944 this._updateTimerId = requestAnimationFrame(this.update.bind(this)); |
| 945 }, | 945 }, |
| 946 | 946 |
| 947 update: function() | 947 update: function() |
| 948 { | 948 { |
| 949 this._updateTimerId = 0; | 949 this._updateTimerId = 0; |
| 950 if (!this._timelineData()) | 950 if (!this._timelineData()) |
| 951 return; | 951 return; |
| 952 this._resetCanvas(); | 952 this._resetCanvas(); |
| 953 this._updateBoundaries(); | 953 this._updateBoundaries(); |
| 954 this._calculator._updateBoundaries(this); | 954 this._calculator._updateBoundaries(this); |
| 955 this._draw(this._offsetWidth, this._offsetHeight); | 955 this._draw(this._offsetWidth, this._offsetHeight); |
| 956 }, | 956 }, |
| 957 | 957 |
| 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 |