Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011, 2012 Apple Inc. All rights reserved. | 2 * Copyright (C) 2011, 2012 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. | 3 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 198 this, | 198 this, |
| 199 WTF::bind(&MediaControls::hideAllMenus, wrapWeakPersistent(this)))), | 199 WTF::bind(&MediaControls::hideAllMenus, wrapWeakPersistent(this)))), |
| 200 m_orientationLockDelegate(nullptr), | 200 m_orientationLockDelegate(nullptr), |
| 201 m_hideMediaControlsTimer(TaskRunnerHelper::get(TaskType::UnspecedTimer, | 201 m_hideMediaControlsTimer(TaskRunnerHelper::get(TaskType::UnspecedTimer, |
| 202 &mediaElement.document()), | 202 &mediaElement.document()), |
| 203 this, | 203 this, |
| 204 &MediaControls::hideMediaControlsTimerFired), | 204 &MediaControls::hideMediaControlsTimerFired), |
| 205 m_hideTimerBehaviorFlags(IgnoreNone), | 205 m_hideTimerBehaviorFlags(IgnoreNone), |
| 206 m_isMouseOverControls(false), | 206 m_isMouseOverControls(false), |
| 207 m_isPausedForScrubbing(false), | 207 m_isPausedForScrubbing(false), |
| 208 m_hasNeverBeenPlayed(true), | |
| 208 m_resizeObserver(ResizeObserver::create( | 209 m_resizeObserver(ResizeObserver::create( |
| 209 mediaElement.document(), | 210 mediaElement.document(), |
| 210 new MediaControlsResizeObserverCallback(this))), | 211 new MediaControlsResizeObserverCallback(this))), |
| 211 m_elementSizeChangedTimer(TaskRunnerHelper::get(TaskType::UnspecedTimer, | 212 m_elementSizeChangedTimer(TaskRunnerHelper::get(TaskType::UnspecedTimer, |
| 212 &mediaElement.document()), | 213 &mediaElement.document()), |
| 213 this, | 214 this, |
| 214 &MediaControls::elementSizeChangedTimerFired), | 215 &MediaControls::elementSizeChangedTimerFired), |
| 215 m_keepShowingUntilTimerFires(false) { | 216 m_keepShowingUntilTimerFires(false) { |
| 216 m_resizeObserver->observe(m_mediaElement); | 217 m_resizeObserver->observe(m_mediaElement); |
| 217 } | 218 } |
| (...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 838 m_durationDisplay->setTextContent( | 839 m_durationDisplay->setTextContent( |
| 839 LayoutTheme::theme().formatMediaControlsTime(duration)); | 840 LayoutTheme::theme().formatMediaControlsTime(duration)); |
| 840 m_durationDisplay->setCurrentValue(duration); | 841 m_durationDisplay->setCurrentValue(duration); |
| 841 updateCurrentTimeDisplay(); | 842 updateCurrentTimeDisplay(); |
| 842 | 843 |
| 843 // Update the timeline (the UI with the seek marker). | 844 // Update the timeline (the UI with the seek marker). |
| 844 m_timeline->setDuration(duration); | 845 m_timeline->setDuration(duration); |
| 845 } | 846 } |
| 846 | 847 |
| 847 void MediaControls::onPlay() { | 848 void MediaControls::onPlay() { |
| 849 if (m_hasNeverBeenPlayed) { | |
| 850 m_timeline->recordWidthOnFirstPlay(); | |
| 851 m_hasNeverBeenPlayed = false; | |
| 852 } | |
|
mlamouri (slow - plz ping)
2017/03/30 21:43:00
Would it make sense to have this in onLoadedMetada
johnme
2017/03/31 13:47:23
Moved to a new onPlayed event as discussed.
| |
| 853 | |
| 848 updatePlayState(); | 854 updatePlayState(); |
| 849 m_timeline->setPosition(mediaElement().currentTime()); | 855 m_timeline->setPosition(mediaElement().currentTime()); |
| 850 updateCurrentTimeDisplay(); | 856 updateCurrentTimeDisplay(); |
| 851 | 857 |
| 852 startHideMediaControlsTimer(); | 858 startHideMediaControlsTimer(); |
| 853 } | 859 } |
| 854 | 860 |
| 855 void MediaControls::onPause() { | 861 void MediaControls::onPause() { |
| 856 updatePlayState(); | 862 updatePlayState(); |
| 857 m_timeline->setPosition(mediaElement().currentTime()); | 863 m_timeline->setPosition(mediaElement().currentTime()); |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1100 visitor->trace(m_overflowList); | 1106 visitor->trace(m_overflowList); |
| 1101 visitor->trace(m_castButton); | 1107 visitor->trace(m_castButton); |
| 1102 visitor->trace(m_overlayCastButton); | 1108 visitor->trace(m_overlayCastButton); |
| 1103 visitor->trace(m_mediaEventListener); | 1109 visitor->trace(m_mediaEventListener); |
| 1104 visitor->trace(m_windowEventListener); | 1110 visitor->trace(m_windowEventListener); |
| 1105 visitor->trace(m_orientationLockDelegate); | 1111 visitor->trace(m_orientationLockDelegate); |
| 1106 HTMLDivElement::trace(visitor); | 1112 HTMLDivElement::trace(visitor); |
| 1107 } | 1113 } |
| 1108 | 1114 |
| 1109 } // namespace blink | 1115 } // namespace blink |
| OLD | NEW |