OLD | NEW |
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 /** | 4 /** |
5 * @implements {SDK.SDKModelObserver<!Animation.AnimationModel>} | 5 * @implements {SDK.SDKModelObserver<!Animation.AnimationModel>} |
6 * @unrestricted | 6 * @unrestricted |
7 */ | 7 */ |
8 Animation.AnimationTimeline = class extends UI.VBox { | 8 Animation.AnimationTimeline = class extends UI.VBox { |
9 constructor() { | 9 constructor() { |
10 super(true); | 10 super(true); |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 * @param {!Event} event | 166 * @param {!Event} event |
167 * @return {!Element|!AnchorBox|undefined} | 167 * @return {!Element|!AnchorBox|undefined} |
168 */ | 168 */ |
169 _getPopoverAnchor(element, event) { | 169 _getPopoverAnchor(element, event) { |
170 if (element.isDescendant(this._previewContainer)) | 170 if (element.isDescendant(this._previewContainer)) |
171 return element; | 171 return element; |
172 } | 172 } |
173 | 173 |
174 /** | 174 /** |
175 * @param {!Element} anchor | 175 * @param {!Element} anchor |
176 * @param {!UI.Popover} popover | 176 * @param {!UI.GlassPane} popover |
| 177 * @return {!Promise<boolean>} |
177 */ | 178 */ |
178 _showPopover(anchor, popover) { | 179 _showPopover(anchor, popover) { |
179 var animGroup; | 180 var animGroup; |
180 for (var group of this._previewMap.keysArray()) { | 181 for (var group of this._previewMap.keysArray()) { |
181 if (this._previewMap.get(group).element === anchor.parentElement) | 182 if (this._previewMap.get(group).element === anchor.parentElement) |
182 animGroup = group; | 183 animGroup = group; |
183 } | 184 } |
184 console.assert(animGroup); | 185 console.assert(animGroup); |
185 var screenshots = animGroup.screenshots(); | 186 var screenshots = animGroup.screenshots(); |
186 if (!screenshots.length) | 187 if (!screenshots.length) |
187 return; | 188 return Promise.resolve(false); |
188 | 189 |
| 190 var fulfill; |
| 191 var promise = new Promise(x => fulfill = x); |
189 if (!screenshots[0].complete) | 192 if (!screenshots[0].complete) |
190 screenshots[0].onload = onFirstScreenshotLoaded.bind(null, screenshots); | 193 screenshots[0].onload = onFirstScreenshotLoaded.bind(null, screenshots); |
191 else | 194 else |
192 onFirstScreenshotLoaded(screenshots); | 195 onFirstScreenshotLoaded(screenshots); |
| 196 return promise; |
193 | 197 |
194 /** | 198 /** |
195 * @param {!Array.<!Image>} screenshots | 199 * @param {!Array.<!Image>} screenshots |
196 */ | 200 */ |
197 function onFirstScreenshotLoaded(screenshots) { | 201 function onFirstScreenshotLoaded(screenshots) { |
198 var content = new Animation.AnimationScreenshotPopover(screenshots); | 202 new Animation.AnimationScreenshotPopover(screenshots).show(popover.content
Element); |
199 popover.setNoPadding(true); | 203 fulfill(true); |
200 popover.showView(content, anchor); | |
201 } | 204 } |
202 } | 205 } |
203 | 206 |
204 _onHidePopover() { | 207 _onHidePopover() { |
205 } | 208 } |
206 | 209 |
207 _togglePauseAll() { | 210 _togglePauseAll() { |
208 this._allPaused = !this._allPaused; | 211 this._allPaused = !this._allPaused; |
209 this._pauseButton.setToggled(this._allPaused); | 212 this._pauseButton.setToggled(this._allPaused); |
210 this._setPlaybackRate(this._playbackRate); | 213 this._setPlaybackRate(this._playbackRate); |
(...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
730 static parse(text) { | 733 static parse(text) { |
731 var match = text.match(/^steps\((\d+), (start|middle)\)$/); | 734 var match = text.match(/^steps\((\d+), (start|middle)\)$/); |
732 if (match) | 735 if (match) |
733 return new Animation.AnimationTimeline.StepTimingFunction(parseInt(match[1
], 10), match[2]); | 736 return new Animation.AnimationTimeline.StepTimingFunction(parseInt(match[1
], 10), match[2]); |
734 match = text.match(/^steps\((\d+)\)$/); | 737 match = text.match(/^steps\((\d+)\)$/); |
735 if (match) | 738 if (match) |
736 return new Animation.AnimationTimeline.StepTimingFunction(parseInt(match[1
], 10), 'end'); | 739 return new Animation.AnimationTimeline.StepTimingFunction(parseInt(match[1
], 10), 'end'); |
737 return null; | 740 return null; |
738 } | 741 } |
739 }; | 742 }; |
OLD | NEW |