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 * @unrestricted | 5 * @unrestricted |
6 */ | 6 */ |
7 Components.FilmStripView = class extends UI.HBox { | 7 Components.FilmStripView = class extends UI.HBox { |
8 constructor() { | 8 constructor() { |
9 super(true); | 9 super(true); |
10 this.registerRequiredCSS('components_lazy/filmStripView.css'); | 10 this.registerRequiredCSS('components_lazy/filmStripView.css'); |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 this.contentElement.tabIndex = 0; | 217 this.contentElement.tabIndex = 0; |
218 | 218 |
219 this._frames = filmStripFrame.model().frames(); | 219 this._frames = filmStripFrame.model().frames(); |
220 this._index = filmStripFrame.index; | 220 this._index = filmStripFrame.index; |
221 this._zeroTime = zeroTime || filmStripFrame.model().zeroTime(); | 221 this._zeroTime = zeroTime || filmStripFrame.model().zeroTime(); |
222 | 222 |
223 this._imageElement = this.contentElement.createChild('img'); | 223 this._imageElement = this.contentElement.createChild('img'); |
224 var footerElement = this.contentElement.createChild('div', 'filmstrip-dialog
-footer'); | 224 var footerElement = this.contentElement.createChild('div', 'filmstrip-dialog
-footer'); |
225 footerElement.createChild('div', 'flex-auto'); | 225 footerElement.createChild('div', 'flex-auto'); |
226 var prevButton = | 226 var prevButton = |
227 createTextButton('\u25C0', this._onPrevFrame.bind(this), undefined, Comm
on.UIString('Previous frame')); | 227 UI.createTextButton('\u25C0', this._onPrevFrame.bind(this), undefined, C
ommon.UIString('Previous frame')); |
228 footerElement.appendChild(prevButton); | 228 footerElement.appendChild(prevButton); |
229 this._timeLabel = footerElement.createChild('div', 'filmstrip-dialog-label')
; | 229 this._timeLabel = footerElement.createChild('div', 'filmstrip-dialog-label')
; |
230 var nextButton = createTextButton('\u25B6', this._onNextFrame.bind(this), un
defined, Common.UIString('Next frame')); | 230 var nextButton = |
| 231 UI.createTextButton('\u25B6', this._onNextFrame.bind(this), undefined, C
ommon.UIString('Next frame')); |
231 footerElement.appendChild(nextButton); | 232 footerElement.appendChild(nextButton); |
232 footerElement.createChild('div', 'flex-auto'); | 233 footerElement.createChild('div', 'flex-auto'); |
233 | 234 |
234 this.contentElement.addEventListener('keydown', this._keyDown.bind(this), fa
lse); | 235 this.contentElement.addEventListener('keydown', this._keyDown.bind(this), fa
lse); |
235 this.setDefaultFocusedElement(this.contentElement); | 236 this.setDefaultFocusedElement(this.contentElement); |
236 this._render(); | 237 this._render(); |
237 } | 238 } |
238 | 239 |
239 _resize() { | 240 _resize() { |
240 if (!this._dialog) { | 241 if (!this._dialog) { |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 * @return {!Promise<undefined>} | 302 * @return {!Promise<undefined>} |
302 */ | 303 */ |
303 _render() { | 304 _render() { |
304 var frame = this._frames[this._index]; | 305 var frame = this._frames[this._index]; |
305 this._timeLabel.textContent = Number.millisToString(frame.timestamp - this._
zeroTime); | 306 this._timeLabel.textContent = Number.millisToString(frame.timestamp - this._
zeroTime); |
306 return frame.imageDataPromise() | 307 return frame.imageDataPromise() |
307 .then(Components.FilmStripView._setImageData.bind(null, this._imageEleme
nt)) | 308 .then(Components.FilmStripView._setImageData.bind(null, this._imageEleme
nt)) |
308 .then(this._resize.bind(this)); | 309 .then(this._resize.bind(this)); |
309 } | 310 } |
310 }; | 311 }; |
OLD | NEW |