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

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

Issue 2563853003: [MediaControls] Listen to durationchange instead of letting HTML call methods of MediaControls (Closed)
Patch Set: doing the same as timeupdate 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 c7685babd45c0dc954c0a852c454b8367de70065..a9133111dd5d151aa9bfcde0de79bff7e8aab72b 100644
--- a/third_party/WebKit/Source/core/html/shadow/MediaControls.cpp
+++ b/third_party/WebKit/Source/core/html/shadow/MediaControls.cpp
@@ -705,6 +705,21 @@ void MediaControls::onTimeUpdate() {
makeTransparent();
}
+void MediaControls::onDurationChange() {
+ m_timeline->setDuration(mediaElement().duration());
+ updateCurrentTimeDisplay();
+
+ // 'durationchange' 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();
mlamouri (slow - plz ping) 2016/12/13 20:00:00 I don't think you need to do all the transparency
Zhiqiang Zhang (Slow) 2016/12/13 20:13:20 Done.
+}
+
void MediaControls::onPlay() {
updatePlayState();
m_timeline->setPosition(mediaElement().currentTime());

Powered by Google App Engine
This is Rietveld 408576698