| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 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.HBox} | 7 * @extends {WebInspector.HBox} |
| 8 */ | 8 */ |
| 9 WebInspector.FilmStripView = function() | 9 WebInspector.FilmStripView = function() |
| 10 { | 10 { |
| 11 WebInspector.HBox.call(this, true); | 11 WebInspector.HBox.call(this, true); |
| 12 this.registerRequiredCSS("components_lazy/filmStripView.css"); | 12 this.registerRequiredCSS("components_lazy/filmStripView.css"); |
| 13 this.contentElement.classList.add("film-strip-view"); | 13 this.contentElement.classList.add("film-strip-view"); |
| 14 this._statusLabel = this.contentElement.createChild("div", "label"); |
| 14 this.reset(); | 15 this.reset(); |
| 15 this.setMode(WebInspector.FilmStripView.Modes.TimeBased); | 16 this.setMode(WebInspector.FilmStripView.Modes.TimeBased); |
| 16 } | 17 } |
| 17 | 18 |
| 18 WebInspector.FilmStripView.Events = { | 19 WebInspector.FilmStripView.Events = { |
| 19 FrameSelected: "FrameSelected", | 20 FrameSelected: "FrameSelected", |
| 20 FrameEnter: "FrameEnter", | 21 FrameEnter: "FrameEnter", |
| 21 FrameExit: "FrameExit", | 22 FrameExit: "FrameExit", |
| 22 } | 23 } |
| 23 | 24 |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 | 105 |
| 105 update: function() | 106 update: function() |
| 106 { | 107 { |
| 107 if (!this._model) | 108 if (!this._model) |
| 108 return; | 109 return; |
| 109 var frames = this._model.frames(); | 110 var frames = this._model.frames(); |
| 110 if (!frames.length) | 111 if (!frames.length) |
| 111 return; | 112 return; |
| 112 | 113 |
| 113 this.contentElement.removeChildren(); | 114 this.contentElement.removeChildren(); |
| 114 this._statusLabel.remove(); | |
| 115 | 115 |
| 116 if (this._mode === WebInspector.FilmStripView.Modes.FrameBased) { | 116 if (this._mode === WebInspector.FilmStripView.Modes.FrameBased) { |
| 117 Promise.all(frames.map(this.createFrameElement.bind(this))).spread(t
his.contentElement.appendChildren.bind(this.contentElement)); | 117 Promise.all(frames.map(this.createFrameElement.bind(this))).spread(t
his.contentElement.appendChildren.bind(this.contentElement)); |
| 118 return; | 118 return; |
| 119 } | 119 } |
| 120 | 120 |
| 121 var width = this.contentElement.clientWidth; | 121 var width = this.contentElement.clientWidth; |
| 122 var scale = this._spanTime / width; | 122 var scale = this._spanTime / width; |
| 123 this.createFrameElement(frames[0]).then(continueWhenFrameImageLoaded.bin
d(this)); // Calculate frame width basing on the first frame. | 123 this.createFrameElement(frames[0]).then(continueWhenFrameImageLoaded.bin
d(this)); // Calculate frame width basing on the first frame. |
| 124 | 124 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 */ | 174 */ |
| 175 _onDoubleClick: function(filmStripFrame) | 175 _onDoubleClick: function(filmStripFrame) |
| 176 { | 176 { |
| 177 WebInspector.Dialog.show(null, new WebInspector.FilmStripView.DialogDele
gate(filmStripFrame, this._zeroTime)); | 177 WebInspector.Dialog.show(null, new WebInspector.FilmStripView.DialogDele
gate(filmStripFrame, this._zeroTime)); |
| 178 }, | 178 }, |
| 179 | 179 |
| 180 reset: function() | 180 reset: function() |
| 181 { | 181 { |
| 182 this._zeroTime = 0; | 182 this._zeroTime = 0; |
| 183 this.contentElement.removeChildren(); | 183 this.contentElement.removeChildren(); |
| 184 this._statusLabel = this.contentElement.createChild("div", "label"); | 184 this.contentElement.appendChild(this._statusLabel); |
| 185 this._statusLabel.textContent = WebInspector.UIString("No frames recorde
d. Reload page to start recording."); | |
| 186 }, | 185 }, |
| 187 | 186 |
| 188 setRecording: function() | 187 /** |
| 188 * @param {string} text |
| 189 */ |
| 190 setStatusText: function(text) |
| 189 { | 191 { |
| 190 this.reset(); | 192 this._statusLabel.textContent = text; |
| 191 this._statusLabel.textContent = WebInspector.UIString("Recording frames.
.."); | |
| 192 }, | |
| 193 | |
| 194 setFetching: function() | |
| 195 { | |
| 196 this._statusLabel.textContent = WebInspector.UIString("Fetching frames..
."); | |
| 197 }, | 193 }, |
| 198 | 194 |
| 199 __proto__: WebInspector.HBox.prototype | 195 __proto__: WebInspector.HBox.prototype |
| 200 } | 196 } |
| 201 | 197 |
| 202 /** | 198 /** |
| 203 * @param {!Element} imageElement | 199 * @param {!Element} imageElement |
| 204 * @param {?string} data | 200 * @param {?string} data |
| 205 */ | 201 */ |
| 206 WebInspector.FilmStripView._setImageData = function(imageElement, data) | 202 WebInspector.FilmStripView._setImageData = function(imageElement, data) |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 | 304 |
| 309 _render: function() | 305 _render: function() |
| 310 { | 306 { |
| 311 var frame = this._frames[this._index]; | 307 var frame = this._frames[this._index]; |
| 312 frame.imageDataPromise().then(WebInspector.FilmStripView._setImageData.b
ind(null, this._imageElement)); | 308 frame.imageDataPromise().then(WebInspector.FilmStripView._setImageData.b
ind(null, this._imageElement)); |
| 313 this._timeLabel.textContent = Number.millisToString(frame.timestamp - th
is._zeroTime); | 309 this._timeLabel.textContent = Number.millisToString(frame.timestamp - th
is._zeroTime); |
| 314 }, | 310 }, |
| 315 | 311 |
| 316 __proto__: WebInspector.DialogDelegate.prototype | 312 __proto__: WebInspector.DialogDelegate.prototype |
| 317 } | 313 } |
| OLD | NEW |