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

Unified Diff: third_party/WebKit/Source/core/html/HTMLMediaElement.cpp

Issue 2477203002: Media Controls: delegate 'volumechange' and 'focusin' handling to an EventListener. (Closed)
Patch Set: add comment Created 4 years, 1 month 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/HTMLMediaElement.cpp
diff --git a/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp b/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
index d1a8bdf5736319ee04f4d0c88e9b32c2d014af0b..833fef54fe0611793710a84245bee3cf1008c16a 100644
--- a/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
@@ -1090,7 +1090,6 @@ void HTMLMediaElement::loadResource(const WebMediaPlayerSource& source,
if (fastHasAttribute(mutedAttr))
m_muted = true;
- updateVolume();
DCHECK(!m_mediaSource);
@@ -2419,7 +2418,9 @@ void HTMLMediaElement::setVolume(double vol, ExceptionState& exceptionState) {
}
m_volume = vol;
- updateVolume();
+
+ if (webMediaPlayer())
+ webMediaPlayer()->setVolume(effectiveMediaVolume());
scheduleEvent(EventTypeNames::volumechange);
}
@@ -2461,7 +2462,8 @@ void HTMLMediaElement::setMuted(bool muted) {
// This is called after the volumechange event to make sure isAutoplayingMuted
// returns the right value when webMediaPlayer receives the volume update.
- updateVolume();
+ if (webMediaPlayer())
+ webMediaPlayer()->setVolume(effectiveMediaVolume());
// If an element was a candidate for autoplay muted but not visible, it will
// have a visibility observer ready to start its playback.
@@ -2471,14 +2473,6 @@ void HTMLMediaElement::setMuted(bool muted) {
}
}
-void HTMLMediaElement::updateVolume() {
- if (webMediaPlayer())
- webMediaPlayer()->setVolume(effectiveMediaVolume());
-
- if (mediaControls())
- mediaControls()->updateVolume();
-}
-
double HTMLMediaElement::effectiveMediaVolume() const {
if (m_muted)
return 0;
@@ -3327,7 +3321,7 @@ void HTMLMediaElement::updatePlayState() {
// media engine was setup. The media engine should just stash the rate
// and muted values since it isn't already playing.
webMediaPlayer()->setRate(playbackRate());
- updateVolume();
+ webMediaPlayer()->setVolume(effectiveMediaVolume());
webMediaPlayer()->play();
m_autoplayHelper->playbackStarted();
}
@@ -3801,14 +3795,6 @@ bool HTMLMediaElement::isInteractiveContent() const {
return fastHasAttribute(controlsAttr);
}
-void HTMLMediaElement::defaultEventHandler(Event* event) {
- if (event->type() == EventTypeNames::focusin) {
- if (mediaControls())
- mediaControls()->mediaElementFocused();
- }
- HTMLElement::defaultEventHandler(event);
-}
-
DEFINE_TRACE(HTMLMediaElement) {
visitor->trace(m_playedTimeRanges);
visitor->trace(m_asyncEventQueue);

Powered by Google App Engine
This is Rietveld 408576698