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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 | 63 |
64 /** | 64 /** |
65 * @param {!Event} event | 65 * @param {!Event} event |
66 */ | 66 */ |
67 _onMouseMove(event) { | 67 _onMouseMove(event) { |
68 if (!this._cursorEnabled) | 68 if (!this._cursorEnabled) |
69 return; | 69 return; |
70 this._cursorPosition = event.offsetX + event.target.offsetLeft; | 70 this._cursorPosition = event.offsetX + event.target.offsetLeft; |
71 this._cursorElement.style.left = this._cursorPosition + 'px'; | 71 this._cursorElement.style.left = this._cursorPosition + 'px'; |
72 this._cursorElement.style.visibility = 'visible'; | 72 this._cursorElement.style.visibility = 'visible'; |
73 this._buildOverviewInfo().then(content => this._overviewInfo.setContent(cont
ent)); | 73 this._overviewInfo.setContent(this._buildOverviewInfo()); |
74 } | 74 } |
75 | 75 |
76 /** | 76 /** |
77 * @return {!Promise<!DocumentFragment>} | 77 * @return {!Promise<!DocumentFragment>} |
78 */ | 78 */ |
79 async _buildOverviewInfo() { | 79 async _buildOverviewInfo() { |
80 var document = this.element.ownerDocument; | 80 var document = this.element.ownerDocument; |
81 var x = this._cursorPosition; | 81 var x = this._cursorPosition; |
82 var elements = await Promise.all(this._overviewControls.map(control => contr
ol.overviewInfoPromise(x))); | 82 var elements = await Promise.all(this._overviewControls.map(control => contr
ol.overviewInfoPromise(x))); |
83 var fragment = document.createDocumentFragment(); | 83 var fragment = document.createDocumentFragment(); |
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 PerfUI.TimelineOverviewPane.OverviewInfo = class { | 475 PerfUI.TimelineOverviewPane.OverviewInfo = class { |
476 /** | 476 /** |
477 * @param {!Element} anchor | 477 * @param {!Element} anchor |
478 */ | 478 */ |
479 constructor(anchor) { | 479 constructor(anchor) { |
480 this._anchorElement = anchor; | 480 this._anchorElement = anchor; |
481 this._glassPane = new UI.GlassPane(); | 481 this._glassPane = new UI.GlassPane(); |
482 this._glassPane.setPointerEventsBehavior(UI.GlassPane.PointerEventsBehavior.
PierceContents); | 482 this._glassPane.setPointerEventsBehavior(UI.GlassPane.PointerEventsBehavior.
PierceContents); |
483 this._glassPane.setMarginBehavior(UI.GlassPane.MarginBehavior.Arrow); | 483 this._glassPane.setMarginBehavior(UI.GlassPane.MarginBehavior.Arrow); |
484 this._glassPane.setSizeBehavior(UI.GlassPane.SizeBehavior.MeasureContent); | 484 this._glassPane.setSizeBehavior(UI.GlassPane.SizeBehavior.MeasureContent); |
| 485 this._visible = false; |
485 this._element = | 486 this._element = |
486 UI.createShadowRootWithCoreStyles(this._glassPane.contentElement, 'perf_
ui/timelineOverviewInfo.css') | 487 UI.createShadowRootWithCoreStyles(this._glassPane.contentElement, 'perf_
ui/timelineOverviewInfo.css') |
487 .createChild('div', 'overview-info'); | 488 .createChild('div', 'overview-info'); |
488 } | 489 } |
489 | 490 |
490 /** | 491 /** |
491 * @param {!DocumentFragment} content | 492 * @param {!Promise<!DocumentFragment>} contentPromise |
492 */ | 493 */ |
493 setContent(content) { | 494 async setContent(contentPromise) { |
| 495 this._visible = true; |
| 496 var content = await contentPromise; |
| 497 if (!this._visible) |
| 498 return; |
494 this._element.removeChildren(); | 499 this._element.removeChildren(); |
495 this._element.appendChild(content); | 500 this._element.appendChild(content); |
496 this._glassPane.setContentAnchorBox(this._anchorElement.boxInWindow()); | 501 this._glassPane.setContentAnchorBox(this._anchorElement.boxInWindow()); |
497 if (!this._glassPane.isShowing()) | 502 if (!this._glassPane.isShowing()) |
498 this._glassPane.show(/** @type {!Document} */ (this._anchorElement.ownerDo
cument)); | 503 this._glassPane.show(/** @type {!Document} */ (this._anchorElement.ownerDo
cument)); |
499 } | 504 } |
500 | 505 |
501 hide() { | 506 hide() { |
| 507 this._visible = false; |
502 this._glassPane.hide(); | 508 this._glassPane.hide(); |
503 } | 509 } |
504 }; | 510 }; |
OLD | NEW |