| 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 | 49 |
| 50 this._overviewGrid.setResizeEnabled(false); | 50 this._overviewGrid.setResizeEnabled(false); |
| 51 this._overviewGrid.addEventListener(PerfUI.OverviewGrid.Events.WindowChanged
, this._onWindowChanged, this); | 51 this._overviewGrid.addEventListener(PerfUI.OverviewGrid.Events.WindowChanged
, this._onWindowChanged, this); |
| 52 this._overviewGrid.setClickHandler(this._onClick.bind(this)); | 52 this._overviewGrid.setClickHandler(this._onClick.bind(this)); |
| 53 this._overviewControls = []; | 53 this._overviewControls = []; |
| 54 this._markers = new Map(); | 54 this._markers = new Map(); |
| 55 | 55 |
| 56 this._popoverHelper = new UI.PopoverHelper(this._cursorArea); | 56 this._popoverHelper = new UI.PopoverHelper(this._cursorArea); |
| 57 this._popoverHelper.initializeCallbacks( | 57 this._popoverHelper.initializeCallbacks( |
| 58 this._getPopoverAnchor.bind(this), this._showPopover.bind(this), this._o
nHidePopover.bind(this)); | 58 this._getPopoverAnchor.bind(this), this._showPopover.bind(this), this._o
nHidePopover.bind(this)); |
| 59 this._popoverHelper.setHasPadding(true); |
| 59 this._popoverHelper.setTimeout(0); | 60 this._popoverHelper.setTimeout(0); |
| 60 | 61 |
| 61 this._updateThrottler = new Common.Throttler(100); | 62 this._updateThrottler = new Common.Throttler(100); |
| 62 | 63 |
| 63 this._cursorEnabled = false; | 64 this._cursorEnabled = false; |
| 64 this._cursorPosition = 0; | 65 this._cursorPosition = 0; |
| 65 this._lastWidth = 0; | 66 this._lastWidth = 0; |
| 66 } | 67 } |
| 67 | 68 |
| 68 /** | 69 /** |
| 69 * @param {!Element} element | 70 * @param {!Element} element |
| 70 * @param {!Event} event | 71 * @param {!Event} event |
| 71 * @return {!Element|!AnchorBox|undefined} | 72 * @return {!Element|!AnchorBox|undefined} |
| 72 */ | 73 */ |
| 73 _getPopoverAnchor(element, event) { | 74 _getPopoverAnchor(element, event) { |
| 74 return this._cursorArea; | 75 return this._cursorArea; |
| 75 } | 76 } |
| 76 | 77 |
| 77 /** | 78 /** |
| 78 * @param {!Element} anchor | 79 * @param {!Element} anchor |
| 79 * @param {!UI.Popover} popover | 80 * @param {!UI.GlassPane} popover |
| 81 * @return {!Promise<boolean>} |
| 80 */ | 82 */ |
| 81 _showPopover(anchor, popover) { | 83 _showPopover(anchor, popover) { |
| 82 this._buildPopoverContents().then(maybeShowPopover.bind(this)); | 84 return this._buildPopoverContents().then(maybeShowPopover.bind(this)); |
| 85 |
| 83 /** | 86 /** |
| 84 * @this {PerfUI.TimelineOverviewPane} | 87 * @this {PerfUI.TimelineOverviewPane} |
| 85 * @param {!DocumentFragment} fragment | 88 * @param {!DocumentFragment} fragment |
| 89 * @return {boolean} |
| 86 */ | 90 */ |
| 87 function maybeShowPopover(fragment) { | 91 function maybeShowPopover(fragment) { |
| 88 if (!fragment.firstChild) | 92 if (!fragment.firstChild) |
| 89 return; | 93 return false; |
| 90 var content = new PerfUI.TimelineOverviewPane.PopoverContents(); | 94 var content = new PerfUI.TimelineOverviewPane.PopoverContents(); |
| 91 this._popoverContents = content.contentElement.createChild('div'); | 95 this._popoverContents = content.contentElement.createChild('div'); |
| 92 this._popoverContents.appendChild(fragment); | 96 this._popoverContents.appendChild(fragment); |
| 93 this._popover = popover; | 97 this._popover = popover; |
| 94 popover.showView(content, this._cursorElement); | 98 content.show(popover.contentElement); |
| 99 return true; |
| 95 } | 100 } |
| 96 } | 101 } |
| 97 | 102 |
| 98 _onHidePopover() { | 103 _onHidePopover() { |
| 99 this._popover = null; | 104 this._popover = null; |
| 100 this._popoverContents = null; | 105 this._popoverContents = null; |
| 101 } | 106 } |
| 102 | 107 |
| 103 /** | 108 /** |
| 104 * @param {!Event} event | 109 * @param {!Event} event |
| (...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 539 */ | 544 */ |
| 540 onClick(event) { | 545 onClick(event) { |
| 541 return false; | 546 return false; |
| 542 } | 547 } |
| 543 | 548 |
| 544 resetCanvas() { | 549 resetCanvas() { |
| 545 this._canvas.width = this.element.clientWidth * window.devicePixelRatio; | 550 this._canvas.width = this.element.clientWidth * window.devicePixelRatio; |
| 546 this._canvas.height = this.element.clientHeight * window.devicePixelRatio; | 551 this._canvas.height = this.element.clientHeight * window.devicePixelRatio; |
| 547 } | 552 } |
| 548 }; | 553 }; |
| OLD | NEW |