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

Unified Diff: Source/core/html/shadow/MediaControlElements.cpp

Issue 214793005: Use HTMLMediaElement::togglePlayState() where appropriate (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: documentation Created 6 years, 9 months 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
« no previous file with comments | « Source/core/html/MediaDocument.cpp ('k') | Source/core/html/shadow/MediaControls.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/shadow/MediaControlElements.cpp
diff --git a/Source/core/html/shadow/MediaControlElements.cpp b/Source/core/html/shadow/MediaControlElements.cpp
index d1b48a03404ca4a9fe531128ad5ad3d198a7f253..d2b40f849c5da799538c7da02b3212c6068dadb9 100644
--- a/Source/core/html/shadow/MediaControlElements.cpp
+++ b/Source/core/html/shadow/MediaControlElements.cpp
@@ -237,10 +237,7 @@ PassRefPtr<MediaControlPlayButtonElement> MediaControlPlayButtonElement::create(
void MediaControlPlayButtonElement::defaultEventHandler(Event* event)
{
if (event->type() == EventTypeNames::click) {
- if (mediaControllerInterface().canPlay())
- mediaControllerInterface().play();
- else
- mediaControllerInterface().pause();
+ mediaElement().togglePlayState();
updateDisplayType();
event->setDefaultHandled();
}
@@ -249,7 +246,7 @@ void MediaControlPlayButtonElement::defaultEventHandler(Event* event)
void MediaControlPlayButtonElement::updateDisplayType()
{
- setDisplayType(mediaControllerInterface().canPlay() ? MediaPlayButton : MediaPauseButton);
+ setDisplayType(mediaElement().togglePlayStateWillPlay() ? MediaPlayButton : MediaPauseButton);
}
const AtomicString& MediaControlPlayButtonElement::shadowPseudoId() const
@@ -275,8 +272,8 @@ PassRefPtr<MediaControlOverlayPlayButtonElement> MediaControlOverlayPlayButtonEl
void MediaControlOverlayPlayButtonElement::defaultEventHandler(Event* event)
{
- if (event->type() == EventTypeNames::click && mediaControllerInterface().canPlay()) {
- mediaControllerInterface().play();
+ if (event->type() == EventTypeNames::click && mediaElement().togglePlayStateWillPlay()) {
+ mediaElement().togglePlayState();
updateDisplayType();
event->setDefaultHandled();
}
@@ -285,7 +282,7 @@ void MediaControlOverlayPlayButtonElement::defaultEventHandler(Event* event)
void MediaControlOverlayPlayButtonElement::updateDisplayType()
{
- if (mediaControllerInterface().canPlay()) {
+ if (mediaElement().togglePlayStateWillPlay()) {
show();
} else
hide();
« no previous file with comments | « Source/core/html/MediaDocument.cpp ('k') | Source/core/html/shadow/MediaControls.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698