Commit 5b36d323 authored by alph's avatar alph Committed by Commit bot

DevTools: Fix timeline overview popover sticking at last

Review-Url: https://codereview.chromium.org/2888683002
Cr-Commit-Position: refs/heads/master@{#472231}
parent c33a8dde
...@@ -70,7 +70,7 @@ PerfUI.TimelineOverviewPane = class extends UI.VBox { ...@@ -70,7 +70,7 @@ PerfUI.TimelineOverviewPane = class extends UI.VBox {
this._cursorPosition = event.offsetX + event.target.offsetLeft; this._cursorPosition = event.offsetX + event.target.offsetLeft;
this._cursorElement.style.left = this._cursorPosition + 'px'; this._cursorElement.style.left = this._cursorPosition + 'px';
this._cursorElement.style.visibility = 'visible'; this._cursorElement.style.visibility = 'visible';
this._buildOverviewInfo().then(content => this._overviewInfo.setContent(content)); this._overviewInfo.setContent(this._buildOverviewInfo());
} }
/** /**
...@@ -482,15 +482,20 @@ PerfUI.TimelineOverviewPane.OverviewInfo = class { ...@@ -482,15 +482,20 @@ PerfUI.TimelineOverviewPane.OverviewInfo = class {
this._glassPane.setPointerEventsBehavior(UI.GlassPane.PointerEventsBehavior.PierceContents); this._glassPane.setPointerEventsBehavior(UI.GlassPane.PointerEventsBehavior.PierceContents);
this._glassPane.setMarginBehavior(UI.GlassPane.MarginBehavior.Arrow); this._glassPane.setMarginBehavior(UI.GlassPane.MarginBehavior.Arrow);
this._glassPane.setSizeBehavior(UI.GlassPane.SizeBehavior.MeasureContent); this._glassPane.setSizeBehavior(UI.GlassPane.SizeBehavior.MeasureContent);
this._visible = false;
this._element = this._element =
UI.createShadowRootWithCoreStyles(this._glassPane.contentElement, 'perf_ui/timelineOverviewInfo.css') UI.createShadowRootWithCoreStyles(this._glassPane.contentElement, 'perf_ui/timelineOverviewInfo.css')
.createChild('div', 'overview-info'); .createChild('div', 'overview-info');
} }
/** /**
* @param {!DocumentFragment} content * @param {!Promise<!DocumentFragment>} contentPromise
*/ */
setContent(content) { async setContent(contentPromise) {
this._visible = true;
var content = await contentPromise;
if (!this._visible)
return;
this._element.removeChildren(); this._element.removeChildren();
this._element.appendChild(content); this._element.appendChild(content);
this._glassPane.setContentAnchorBox(this._anchorElement.boxInWindow()); this._glassPane.setContentAnchorBox(this._anchorElement.boxInWindow());
...@@ -499,6 +504,7 @@ PerfUI.TimelineOverviewPane.OverviewInfo = class { ...@@ -499,6 +504,7 @@ PerfUI.TimelineOverviewPane.OverviewInfo = class {
} }
hide() { hide() {
this._visible = false;
this._glassPane.hide(); this._glassPane.hide();
} }
}; };
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
display: flex; display: flex;
background: white; background: white;
box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.2), 0 2px 4px rgba(0, 0, 0, 0.2), 0 2px 6px rgba(0, 0, 0, 0.1); box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.2), 0 2px 4px rgba(0, 0, 0, 0.2), 0 2px 6px rgba(0, 0, 0, 0.1);
padding: 3px;
} }
.overview-info .frame .time { .overview-info .frame .time {
......
...@@ -990,7 +990,7 @@ Timeline.TimelineFlameChartDataProvider = class extends Common.Object { ...@@ -990,7 +990,7 @@ Timeline.TimelineFlameChartDataProvider = class extends Common.Object {
* @return {?SDK.TracingModel.Event} * @return {?SDK.TracingModel.Event}
*/ */
eventByIndex(entryIndex) { eventByIndex(entryIndex) {
return this._entryType(entryIndex) === Timeline.TimelineFlameChartDataProvider.EntryType.Event ? return entryIndex >= 0 && this._entryType(entryIndex) === Timeline.TimelineFlameChartDataProvider.EntryType.Event ?
/** @type {!SDK.TracingModel.Event} */ (this._entryData[entryIndex]) : /** @type {!SDK.TracingModel.Event} */ (this._entryData[entryIndex]) :
null; null;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment