Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(256)

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/animation/AnimationScreenshotPopover.js

Issue 2466123002: DevTools: reformat front-end code to match chromium style. (Closed)
Patch Set: all done Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
5 /** 4 /**
6 * @constructor 5 * @unrestricted
7 * @extends {WebInspector.VBox}
8 * @param {!Array.<!Image>} images
9 */ 6 */
10 WebInspector.AnimationScreenshotPopover = function(images) 7 WebInspector.AnimationScreenshotPopover = class extends WebInspector.VBox {
11 { 8 /**
12 WebInspector.VBox.call(this, true); 9 * @param {!Array.<!Image>} images
10 */
11 constructor(images) {
12 super(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 }
25
26 /**
27 * @override
28 */
29 wasShown() {
30 this._rafId = this.contentElement.window().requestAnimationFrame(this._chang eFrame.bind(this));
31 }
32
33 /**
34 * @override
35 */
36 willHide() {
37 this.contentElement.window().cancelAnimationFrame(this._rafId);
38 delete this._endDelay;
39 }
40
41 _changeFrame() {
42 this._rafId = this.contentElement.window().requestAnimationFrame(this._chang eFrame.bind(this));
43
44 if (this._endDelay) {
45 this._endDelay--;
46 return;
47 }
48 this._showFrame = !this._showFrame;
49 if (!this._showFrame)
50 return;
51
52 var numFrames = this._frames.length;
53 this._frames[this._currentFrame % numFrames].style.display = 'none';
54 this._currentFrame++;
55 this._frames[(this._currentFrame) % numFrames].style.display = 'block';
56 if (this._currentFrame % numFrames === numFrames - 1)
57 this._endDelay = 50;
58 this._progressBar.style.width = (this._currentFrame % numFrames + 1) / numFr ames * 100 + '%';
59 }
24 }; 60 };
25
26 WebInspector.AnimationScreenshotPopover.prototype = {
27 wasShown: function()
28 {
29 this._rafId = this.contentElement.window().requestAnimationFrame(this._c hangeFrame.bind(this));
30 },
31
32 willHide: function()
33 {
34 this.contentElement.window().cancelAnimationFrame(this._rafId);
35 delete this._endDelay;
36 },
37
38 _changeFrame: function()
39 {
40 this._rafId = this.contentElement.window().requestAnimationFrame(this._c hangeFrame.bind(this));
41
42 if (this._endDelay) {
43 this._endDelay--;
44 return;
45 }
46 this._showFrame = !this._showFrame;
47 if (!this._showFrame)
48 return;
49
50 var numFrames = this._frames.length;
51 this._frames[this._currentFrame % numFrames].style.display = "none";
52 this._currentFrame++;
53 this._frames[(this._currentFrame) % numFrames].style.display = "block";
54 if (this._currentFrame % numFrames === numFrames - 1)
55 this._endDelay = 50;
56 this._progressBar.style.width = (this._currentFrame % numFrames + 1) / n umFrames * 100 + "%";
57 },
58
59 __proto__: WebInspector.VBox.prototype
60 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698