Chromium Code Reviews| Index: Source/core/html/HTMLMediaElement.cpp |
| diff --git a/Source/core/html/HTMLMediaElement.cpp b/Source/core/html/HTMLMediaElement.cpp |
| index d140bf8db7e8fa433da5a8bb7cc0d143ee1e05e8..040f10930a4d371adb86bf12ad55215c6ab362fb 100644 |
| --- a/Source/core/html/HTMLMediaElement.cpp |
| +++ b/Source/core/html/HTMLMediaElement.cpp |
| @@ -2222,6 +2222,25 @@ bool HTMLMediaElement::canPlay() const |
| return paused() || ended() || m_readyState < HAVE_METADATA; |
| } |
| +void HTMLMediaElement::togglePlayState() |
| +{ |
| + ASSERT(controls()); |
| + // The activation behavior of a media element that is exposing a user interface to the user |
| + if (m_mediaController) { |
| + if (m_mediaController->isRestrained()) |
| + m_mediaController->play(); |
| + else if (m_mediaController->paused()) |
| + m_mediaController->unpause(); |
| + else |
| + m_mediaController->pause(); |
| + } else { |
| + if (paused()) |
| + play(); |
| + else |
| + pause(); |
| + } |
| +} |
| + |
| void HTMLMediaElement::mediaPlayerDidAddTextTrack(WebInbandTextTrack* webTrack) |
| { |
| if (!RuntimeEnabledFeatures::videoTrackEnabled()) |
| @@ -3423,6 +3442,10 @@ void HTMLMediaElement::markCaptionAndSubtitleTracksAsUnconfigured() |
| configureTextTracks(); |
| } |
| +bool HTMLMediaElement::willRespondToMouseClickEvents() |
| +{ |
| + return controls(); |
| +} |
| void* HTMLMediaElement::preDispatchEventHandler(Event* event) |
| { |
| @@ -3432,6 +3455,16 @@ void* HTMLMediaElement::preDispatchEventHandler(Event* event) |
| return 0; |
| } |
| +void HTMLMediaElement::defaultEventHandler(Event* event) |
| +{ |
| + if (event->type() == EventTypeNames::click && controls()) { |
|
acolwell GONE FROM CHROMIUM
2014/03/21 23:30:12
nit: Should we use willRespondToMouseClickEvents()
philipj_slow
2014/03/23 03:42:49
Done.
|
| + togglePlayState(); |
| + event->setDefaultHandled(); |
| + return; |
| + } |
| + HTMLElement::defaultEventHandler(event); |
| +} |
| + |
| void HTMLMediaElement::createMediaPlayer() |
| { |
| #if ENABLE(WEB_AUDIO) |