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

Side by Side Diff: Source/core/html/HTMLMediaElement.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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/html/HTMLMediaElement.h ('k') | Source/core/html/MediaController.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 2163 matching lines...) Expand 10 before | Expand all | Expand 10 after
2174 // Some media engines make multiple "time changed" callbacks at the same tim e, but we only want one 2174 // Some media engines make multiple "time changed" callbacks at the same tim e, but we only want one
2175 // event at a given time so filter here 2175 // event at a given time so filter here
2176 double movieTime = currentTime(); 2176 double movieTime = currentTime();
2177 if (movieTime != m_lastTimeUpdateEventMovieTime) { 2177 if (movieTime != m_lastTimeUpdateEventMovieTime) {
2178 scheduleEvent(EventTypeNames::timeupdate); 2178 scheduleEvent(EventTypeNames::timeupdate);
2179 m_lastTimeUpdateEventWallTime = now; 2179 m_lastTimeUpdateEventWallTime = now;
2180 m_lastTimeUpdateEventMovieTime = movieTime; 2180 m_lastTimeUpdateEventMovieTime = movieTime;
2181 } 2181 }
2182 } 2182 }
2183 2183
2184 bool HTMLMediaElement::canPlay() const 2184 bool HTMLMediaElement::togglePlayStateWillPlay() const
2185 { 2185 {
2186 return paused() || ended() || m_readyState < HAVE_METADATA; 2186 if (m_mediaController)
2187 return m_mediaController->paused() || m_mediaController->isRestrained();
2188 return paused();
2187 } 2189 }
2188 2190
2189 void HTMLMediaElement::togglePlayState() 2191 void HTMLMediaElement::togglePlayState()
2190 { 2192 {
2191 ASSERT(controls());
2192 // The activation behavior of a media element that is exposing a user interf ace to the user 2193 // The activation behavior of a media element that is exposing a user interf ace to the user
2193 if (m_mediaController) { 2194 if (m_mediaController) {
2194 if (m_mediaController->isRestrained()) 2195 if (m_mediaController->isRestrained())
2195 m_mediaController->play(); 2196 m_mediaController->play();
2196 else if (m_mediaController->paused()) 2197 else if (m_mediaController->paused())
2197 m_mediaController->unpause(); 2198 m_mediaController->unpause();
2198 else 2199 else
2199 m_mediaController->pause(); 2200 m_mediaController->pause();
2200 } else { 2201 } else {
2201 if (paused()) 2202 if (paused())
(...skipping 1443 matching lines...) Expand 10 before | Expand all | Expand 10 after
3645 { 3646 {
3646 m_mediaSource->setWebMediaSourceAndOpen(adoptPtr(webMediaSource)); 3647 m_mediaSource->setWebMediaSourceAndOpen(adoptPtr(webMediaSource));
3647 } 3648 }
3648 3649
3649 bool HTMLMediaElement::isInteractiveContent() const 3650 bool HTMLMediaElement::isInteractiveContent() const
3650 { 3651 {
3651 return fastHasAttribute(controlsAttr); 3652 return fastHasAttribute(controlsAttr);
3652 } 3653 }
3653 3654
3654 } 3655 }
OLDNEW
« no previous file with comments | « Source/core/html/HTMLMediaElement.h ('k') | Source/core/html/MediaController.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698