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

Unified Diff: third_party/WebKit/Source/core/html/shadow/MediaControls.cpp

Issue 2499883002: Media Controls: handle 'timeupdate', 'play' and 'pause' via an EventListener. (Closed)
Patch Set: fix repaint test Created 4 years 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/html/shadow/MediaControls.cpp
diff --git a/third_party/WebKit/Source/core/html/shadow/MediaControls.cpp b/third_party/WebKit/Source/core/html/shadow/MediaControls.cpp
index bcd0d7c4fd5a72c48714ddd2ae41fb5732adb989..5b4b0b7b707d21ec773acb1c80f361aa5d401624 100644
--- a/third_party/WebKit/Source/core/html/shadow/MediaControls.cpp
+++ b/third_party/WebKit/Source/core/html/shadow/MediaControls.cpp
@@ -419,32 +419,6 @@ bool MediaControls::shouldHideMediaControls(unsigned behaviorFlags) const {
return true;
}
-void MediaControls::playbackStarted() {
- BatchedControlUpdate batch(this);
- updatePlayState();
- m_timeline->setPosition(mediaElement().currentTime());
- updateCurrentTimeDisplay();
-
- startHideMediaControlsTimer();
-}
-
-void MediaControls::playbackProgressed() {
- m_timeline->setPosition(mediaElement().currentTime());
- updateCurrentTimeDisplay();
-
- if (isVisible() && shouldHideMediaControls())
- makeTransparent();
-}
-
-void MediaControls::playbackStopped() {
- updatePlayState();
- m_timeline->setPosition(mediaElement().currentTime());
- updateCurrentTimeDisplay();
- makeOpaque();
-
- stopHideMediaControlsTimer();
-}
-
void MediaControls::updatePlayState() {
if (m_isPausedForScrubbing)
return;
@@ -718,6 +692,38 @@ void MediaControls::onFocusIn() {
resetHideMediaControlsTimer();
}
+void MediaControls::onTimeUpdate() {
+ m_timeline->setPosition(mediaElement().currentTime());
+ updateCurrentTimeDisplay();
+
+ // 'timeupdate' might be called in a paused state. The controls should not
+ // become transparent in that case.
+ if (mediaElement().paused()) {
+ makeOpaque();
+ return;
+ }
+
+ if (isVisible() && shouldHideMediaControls())
+ makeTransparent();
+}
+
+void MediaControls::onPlay() {
+ updatePlayState();
+ m_timeline->setPosition(mediaElement().currentTime());
+ updateCurrentTimeDisplay();
+
+ startHideMediaControlsTimer();
+}
+
+void MediaControls::onPause() {
+ updatePlayState();
+ m_timeline->setPosition(mediaElement().currentTime());
+ updateCurrentTimeDisplay();
+ makeOpaque();
+
+ stopHideMediaControlsTimer();
+}
+
void MediaControls::notifyPanelWidthChanged(const LayoutUnit& newWidth) {
// Don't bother to do any work if this matches the most recent panel
// width, since we're called after layout.

Powered by Google App Engine
This is Rietveld 408576698