| Index: third_party/WebKit/Source/devtools/front_end/animation/AnimationTimeline.js
|
| diff --git a/third_party/WebKit/Source/devtools/front_end/animation/AnimationTimeline.js b/third_party/WebKit/Source/devtools/front_end/animation/AnimationTimeline.js
|
| index ddff22f0b4864825e158e3841561e5cb0e8bcbef..771e9be07d3de843656d3ceb2383fb912a477e8f 100644
|
| --- a/third_party/WebKit/Source/devtools/front_end/animation/AnimationTimeline.js
|
| +++ b/third_party/WebKit/Source/devtools/front_end/animation/AnimationTimeline.js
|
| @@ -131,9 +131,8 @@ Animation.AnimationTimeline = class extends UI.VBox {
|
| this._updatePlaybackControls();
|
|
|
| this._previewContainer = this.contentElement.createChild('div', 'animation-timeline-buffer');
|
| - this._popoverHelper = new UI.PopoverHelper(this._previewContainer, true);
|
| - this._popoverHelper.initializeCallbacks(
|
| - this._getPopoverAnchor.bind(this), this._showPopover.bind(this), this._onHidePopover.bind(this));
|
| + this._popoverHelper = new UI.PopoverHelper(this._previewContainer, this._getPopoverRequest.bind(this));
|
| + this._popoverHelper.setDisableOnClick(true);
|
| this._popoverHelper.setTimeout(0);
|
| var emptyBufferHint = this.contentElement.createChild('div', 'animation-timeline-buffer-hint');
|
| emptyBufferHint.textContent = Common.UIString('Listening for animations...');
|
| @@ -162,49 +161,44 @@ Animation.AnimationTimeline = class extends UI.VBox {
|
| }
|
|
|
| /**
|
| - * @param {!Element} element
|
| * @param {!Event} event
|
| - * @return {!Element|!AnchorBox|undefined}
|
| - */
|
| - _getPopoverAnchor(element, event) {
|
| - if (element.isDescendant(this._previewContainer))
|
| - return element;
|
| - }
|
| -
|
| - /**
|
| - * @param {!Element|!AnchorBox} anchor
|
| - * @param {!UI.GlassPane} popover
|
| - * @return {!Promise<boolean>}
|
| - */
|
| - _showPopover(anchor, popover) {
|
| - var animGroup;
|
| - for (var group of this._previewMap.keysArray()) {
|
| - if (this._previewMap.get(group).element === anchor.parentElement)
|
| - animGroup = group;
|
| - }
|
| - console.assert(animGroup);
|
| - var screenshots = animGroup.screenshots();
|
| - if (!screenshots.length)
|
| - return Promise.resolve(false);
|
| -
|
| - var fulfill;
|
| - var promise = new Promise(x => fulfill = x);
|
| - if (!screenshots[0].complete)
|
| - screenshots[0].onload = onFirstScreenshotLoaded.bind(null, screenshots);
|
| - else
|
| - onFirstScreenshotLoaded(screenshots);
|
| - return promise;
|
| -
|
| - /**
|
| - * @param {!Array.<!Image>} screenshots
|
| - */
|
| - function onFirstScreenshotLoaded(screenshots) {
|
| - new Animation.AnimationScreenshotPopover(screenshots).show(popover.contentElement);
|
| - fulfill(true);
|
| - }
|
| - }
|
| -
|
| - _onHidePopover() {
|
| + * @return {?UI.PopoverRequest}
|
| + */
|
| + _getPopoverRequest(event) {
|
| + var element = event.target;
|
| + if (!element.isDescendant(this._previewContainer))
|
| + return null;
|
| +
|
| + return {
|
| + box: event.target.boxInWindow(),
|
| + show: popover => {
|
| + var animGroup;
|
| + for (var group of this._previewMap.keysArray()) {
|
| + if (this._previewMap.get(group).element === element.parentElement)
|
| + animGroup = group;
|
| + }
|
| + console.assert(animGroup);
|
| + var screenshots = animGroup.screenshots();
|
| + if (!screenshots.length)
|
| + return Promise.resolve(false);
|
| +
|
| + var fulfill;
|
| + var promise = new Promise(x => fulfill = x);
|
| + if (!screenshots[0].complete)
|
| + screenshots[0].onload = onFirstScreenshotLoaded.bind(null, screenshots);
|
| + else
|
| + onFirstScreenshotLoaded(screenshots);
|
| + return promise;
|
| +
|
| + /**
|
| + * @param {!Array.<!Image>} screenshots
|
| + */
|
| + function onFirstScreenshotLoaded(screenshots) {
|
| + new Animation.AnimationScreenshotPopover(screenshots).show(popover.contentElement);
|
| + fulfill(true);
|
| + }
|
| + }
|
| + };
|
| }
|
|
|
| _togglePauseAll() {
|
|
|