| 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 /** | 5 /** |
| 6 * @constructor | 6 * @constructor |
| 7 * @extends {WebInspector.VBox} | 7 * @extends {WebInspector.VBox} |
| 8 * @param {!Array.<!Image>} images | 8 * @param {!Array.<!Image>} images |
| 9 */ | 9 */ |
| 10 WebInspector.AnimationScreenshotPopover = function(images) | 10 WebInspector.AnimationScreenshotPopover = function(images) |
| 11 { | 11 { |
| 12 WebInspector.VBox.call(this, true); | 12 WebInspector.VBox.call(this, true); |
| 13 console.assert(images.length); | 13 console.assert(images.length); |
| 14 this.registerRequiredCSS("animation/animationScreenshotPopover.css"); | 14 this.registerRequiredCSS("animation/animationScreenshotPopover.css"); |
| 15 this.contentElement.classList.add("animation-screenshot-popover"); | 15 this.contentElement.classList.add("animation-screenshot-popover"); |
| 16 this._frames = images; | 16 this._frames = images; |
| 17 for (var image of images) { | 17 for (var image of images) { |
| 18 this.contentElement.appendChild(image); | 18 this.contentElement.appendChild(image); |
| 19 image.style.display = "none"; | 19 image.style.display = "none"; |
| 20 } | 20 } |
| 21 this._currentFrame = 0; | 21 this._currentFrame = 0; |
| 22 this._frames[0].style.display = "block"; | 22 this._frames[0].style.display = "block"; |
| 23 this._progressBar = this.contentElement.createChild("div", "animation-progre
ss"); | 23 this._progressBar = this.contentElement.createChild("div", "animation-progre
ss"); |
| 24 } | 24 }; |
| 25 | 25 |
| 26 WebInspector.AnimationScreenshotPopover.prototype = { | 26 WebInspector.AnimationScreenshotPopover.prototype = { |
| 27 wasShown: function() | 27 wasShown: function() |
| 28 { | 28 { |
| 29 this._rafId = this.contentElement.window().requestAnimationFrame(this._c
hangeFrame.bind(this)); | 29 this._rafId = this.contentElement.window().requestAnimationFrame(this._c
hangeFrame.bind(this)); |
| 30 }, | 30 }, |
| 31 | 31 |
| 32 willHide: function() | 32 willHide: function() |
| 33 { | 33 { |
| 34 this.contentElement.window().cancelAnimationFrame(this._rafId); | 34 this.contentElement.window().cancelAnimationFrame(this._rafId); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 50 var numFrames = this._frames.length; | 50 var numFrames = this._frames.length; |
| 51 this._frames[this._currentFrame % numFrames].style.display = "none"; | 51 this._frames[this._currentFrame % numFrames].style.display = "none"; |
| 52 this._currentFrame++; | 52 this._currentFrame++; |
| 53 this._frames[(this._currentFrame) % numFrames].style.display = "block"; | 53 this._frames[(this._currentFrame) % numFrames].style.display = "block"; |
| 54 if (this._currentFrame % numFrames === numFrames - 1) | 54 if (this._currentFrame % numFrames === numFrames - 1) |
| 55 this._endDelay = 50; | 55 this._endDelay = 50; |
| 56 this._progressBar.style.width = (this._currentFrame % numFrames + 1) / n
umFrames * 100 + "%"; | 56 this._progressBar.style.width = (this._currentFrame % numFrames + 1) / n
umFrames * 100 + "%"; |
| 57 }, | 57 }, |
| 58 | 58 |
| 59 __proto__: WebInspector.VBox.prototype | 59 __proto__: WebInspector.VBox.prototype |
| 60 } | 60 }; |
| OLD | NEW |