| OLD | NEW |
| 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2014 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.SidebarPane} | 7 * @extends {WebInspector.SidebarPane} |
| 8 */ | 8 */ |
| 9 WebInspector.AnimationsSidebarPane = function(stylesPane) | 9 WebInspector.AnimationsSidebarPane = function(stylesPane) |
| 10 { | 10 { |
| 11 WebInspector.SidebarPane.call(this, WebInspector.UIString("Animations")); | 11 WebInspector.SidebarPane.call(this, WebInspector.UIString("Animations")); |
| 12 this._stylesPane = stylesPane; | 12 this._stylesPane = stylesPane; |
| 13 | 13 |
| 14 this._emptyElement = document.createElement("div"); | 14 this._emptyElement = createElement("div"); |
| 15 this._emptyElement.className = "info"; | 15 this._emptyElement.className = "info"; |
| 16 this._emptyElement.textContent = WebInspector.UIString("No Animations"); | 16 this._emptyElement.textContent = WebInspector.UIString("No Animations"); |
| 17 | 17 |
| 18 this.bodyElement.appendChild(this._emptyElement); | 18 this.bodyElement.appendChild(this._emptyElement); |
| 19 } | 19 } |
| 20 | 20 |
| 21 WebInspector.AnimationsSidebarPane.prototype = { | 21 WebInspector.AnimationsSidebarPane.prototype = { |
| 22 /** | 22 /** |
| 23 * @param {?WebInspector.DOMNode} node | 23 * @param {?WebInspector.DOMNode} node |
| 24 */ | 24 */ |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 } | 59 } |
| 60 | 60 |
| 61 /** | 61 /** |
| 62 * @constructor | 62 * @constructor |
| 63 * @param {!WebInspector.AnimationsSidebarPane} parentPane | 63 * @param {!WebInspector.AnimationsSidebarPane} parentPane |
| 64 * @param {?WebInspector.AnimationModel.AnimationPlayer} animationPlayer | 64 * @param {?WebInspector.AnimationModel.AnimationPlayer} animationPlayer |
| 65 */ | 65 */ |
| 66 WebInspector.AnimationSection = function(parentPane, animationPlayer) | 66 WebInspector.AnimationSection = function(parentPane, animationPlayer) |
| 67 { | 67 { |
| 68 this._parentPane = parentPane; | 68 this._parentPane = parentPane; |
| 69 this.propertiesSection = document.createElement("div"); | 69 this.propertiesSection = createElement("div"); |
| 70 this._setAnimationPlayer(animationPlayer); | 70 this._setAnimationPlayer(animationPlayer); |
| 71 | 71 |
| 72 this.element = document.createElement("div"); | 72 this.element = createElement("div"); |
| 73 this.element.className = "styles-section"; | 73 this.element.className = "styles-section"; |
| 74 | 74 |
| 75 this._updateThrottler = new WebInspector.Throttler(WebInspector.AnimationSec
tion.updateTimeout); | 75 this._updateThrottler = new WebInspector.Throttler(WebInspector.AnimationSec
tion.updateTimeout); |
| 76 this.element.appendChild(this._createAnimationControls()); | 76 this.element.appendChild(this._createAnimationControls()); |
| 77 this.element.appendChild(this.propertiesSection); | 77 this.element.appendChild(this.propertiesSection); |
| 78 } | 78 } |
| 79 | 79 |
| 80 WebInspector.AnimationSection.updateTimeout = 100; | 80 WebInspector.AnimationSection.updateTimeout = 100; |
| 81 | 81 |
| 82 WebInspector.AnimationSection.prototype = { | 82 WebInspector.AnimationSection.prototype = { |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 * @param {!Event} e | 114 * @param {!Event} e |
| 115 * @this {WebInspector.AnimationSection} | 115 * @this {WebInspector.AnimationSection} |
| 116 */ | 116 */ |
| 117 function sliderInputHandler(e) | 117 function sliderInputHandler(e) |
| 118 { | 118 { |
| 119 this.player.setCurrentTime(parseFloat(e.target.value), this._setAnim
ationPlayer.bind(this)); | 119 this.player.setCurrentTime(parseFloat(e.target.value), this._setAnim
ationPlayer.bind(this)); |
| 120 } | 120 } |
| 121 | 121 |
| 122 var iterationDuration = this.player.source().duration(); | 122 var iterationDuration = this.player.source().duration(); |
| 123 var iterationCount = this.player.source().iterationCount(); | 123 var iterationCount = this.player.source().iterationCount(); |
| 124 var slider = document.createElement("input"); | 124 var slider = createElement("input"); |
| 125 slider.type = "range"; | 125 slider.type = "range"; |
| 126 slider.min = 0; | 126 slider.min = 0; |
| 127 slider.step = 0.01; | 127 slider.step = 0.01; |
| 128 | 128 |
| 129 if (!iterationCount) { | 129 if (!iterationCount) { |
| 130 // Infinite iterations | 130 // Infinite iterations |
| 131 slider.max = iterationDuration; | 131 slider.max = iterationDuration; |
| 132 slider.value = this.player.currentTime() % iterationDuration; | 132 slider.value = this.player.currentTime() % iterationDuration; |
| 133 } else { | 133 } else { |
| 134 slider.max = iterationCount * iterationDuration; | 134 slider.max = iterationCount * iterationDuration; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 this._pauseButton.state = paused; | 169 this._pauseButton.state = paused; |
| 170 this._pauseButton.title = paused ? WebInspector.UIString("Play anima
tion") : WebInspector.UIString("Pause animation"); | 170 this._pauseButton.title = paused ? WebInspector.UIString("Play anima
tion") : WebInspector.UIString("Pause animation"); |
| 171 } | 171 } |
| 172 | 172 |
| 173 this._pauseButton = new WebInspector.StatusBarButton("", "animation-paus
e"); | 173 this._pauseButton = new WebInspector.StatusBarButton("", "animation-paus
e"); |
| 174 updatePauseButton.call(this, this.player.paused()); | 174 updatePauseButton.call(this, this.player.paused()); |
| 175 this._pauseButton.addEventListener("click", pauseButtonHandler, this); | 175 this._pauseButton.addEventListener("click", pauseButtonHandler, this); |
| 176 | 176 |
| 177 this.currentTimeSlider = this._createCurrentTimeSlider(); | 177 this.currentTimeSlider = this._createCurrentTimeSlider(); |
| 178 | 178 |
| 179 var controls = document.createElement("div"); | 179 var controls = createElement("div"); |
| 180 controls.appendChild(this._pauseButton.element); | 180 controls.appendChild(this._pauseButton.element); |
| 181 controls.appendChild(this.currentTimeSlider); | 181 controls.appendChild(this.currentTimeSlider); |
| 182 | 182 |
| 183 return controls; | 183 return controls; |
| 184 }, | 184 }, |
| 185 | 185 |
| 186 /** | 186 /** |
| 187 * @param {?WebInspector.AnimationModel.AnimationPlayer} p | 187 * @param {?WebInspector.AnimationModel.AnimationPlayer} p |
| 188 */ | 188 */ |
| 189 _setAnimationPlayer: function(p) | 189 _setAnimationPlayer: function(p) |
| (...skipping 14 matching lines...) Expand all Loading... |
| 204 "duration": p.source().duration(), | 204 "duration": p.source().duration(), |
| 205 "direction": p.source().direction(), | 205 "direction": p.source().direction(), |
| 206 "fill-mode": p.source().fillMode(), | 206 "fill-mode": p.source().fillMode(), |
| 207 "time-fraction": p.source().timeFraction() | 207 "time-fraction": p.source().timeFraction() |
| 208 }; | 208 }; |
| 209 var obj = WebInspector.RemoteObject.fromLocalObject(animationObject); | 209 var obj = WebInspector.RemoteObject.fromLocalObject(animationObject); |
| 210 var section = new WebInspector.ObjectPropertiesSection(obj, WebInspector
.UIString("Animation Properties")); | 210 var section = new WebInspector.ObjectPropertiesSection(obj, WebInspector
.UIString("Animation Properties")); |
| 211 this.propertiesSection.appendChild(section.element); | 211 this.propertiesSection.appendChild(section.element); |
| 212 } | 212 } |
| 213 } | 213 } |
| OLD | NEW |