diff options
author | Ben Murdoch <benm@google.com> | 2010-08-13 05:20:16 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2010-08-13 05:20:16 -0700 |
commit | f4958a7d95cd5fbc1c74905e229b02c95cd5ee78 (patch) | |
tree | 14a0f1b07a19948c2ed93d0d8547caa7fe10aa0e /WebCore/html/HTMLMediaElement.cpp | |
parent | d074a7997da8ce379434eb6e208b97cde8a0841c (diff) | |
parent | f964bc1fd59a545a80a0cc2529ad8830be514871 (diff) | |
download | external_webkit-f4958a7d95cd5fbc1c74905e229b02c95cd5ee78.zip external_webkit-f4958a7d95cd5fbc1c74905e229b02c95cd5ee78.tar.gz external_webkit-f4958a7d95cd5fbc1c74905e229b02c95cd5ee78.tar.bz2 |
Merge changes I60a96064,I6929172f,Idefd9bec,I8cf448f2,I8791737a,I992c56b0,Ibb4b089d,I779a8ec0,Ife412e30,I2da1ae98,Ibcf41849
* changes:
Merge WebKit at r65072 : Update WebKit revision number.
Merge WebKit at r65072 : Update test_expectations.
Merge WebKit at r65072 : Complete cherry-pick of WebKit change 43848 to add EmptyDeviceMotionClient
Merge WebKit at r65072 : Implement DeviceMotionClientAndroid
Merge WebKit at r65072: JSC build fix in InspectorController.h
Merge WebKit at r65072: Fix V8 code generator.
Merge WebKit at r65072 : Build fix for JSC, update ambiguous usage of JSLock.
Merge WebKit at r65072: String class has moved to the WTF namespace.
Merge Webkit at r65072 : Fix conflicts.
Merge Webkit at r65072 : Fix Makefiles.
Merge WebKit at r65072 : Initial merge by git.
Diffstat (limited to 'WebCore/html/HTMLMediaElement.cpp')
-rw-r--r-- | WebCore/html/HTMLMediaElement.cpp | 58 |
1 files changed, 24 insertions, 34 deletions
diff --git a/WebCore/html/HTMLMediaElement.cpp b/WebCore/html/HTMLMediaElement.cpp index ad465bb..94c0dd2 100644 --- a/WebCore/html/HTMLMediaElement.cpp +++ b/WebCore/html/HTMLMediaElement.cpp @@ -108,8 +108,9 @@ HTMLMediaElement::HTMLMediaElement(const QualifiedName& tagName, Document* doc) #endif , m_restrictions(NoRestrictions) , m_preload(MediaPlayer::Auto) - , m_playing(false) + , m_displayMode(Unknown) , m_processingMediaPlayerCallback(0) + , m_playing(false) , m_isWaitingUntilMediaCanStart(false) , m_processingLoad(false) , m_delayingTheLoadEvent(false) @@ -494,6 +495,7 @@ void HTMLMediaElement::prepareForLoad() m_sentStalledEvent = false; m_haveFiredLoadedData = false; m_completelyLoaded = false; + m_displayMode = Unknown; // 1 - Abort any already-running instance of the resource selection algorithm for this element. m_currentSourceNode = 0; @@ -533,7 +535,6 @@ void HTMLMediaElement::prepareForLoad() m_playedTimeRanges = TimeRanges::create(); m_lastSeekTime = 0; m_closedCaptionsVisible = false; - } void HTMLMediaElement::loadInternal() @@ -671,11 +672,9 @@ void HTMLMediaElement::loadResource(const KURL& initialURL, ContentType& content #endif m_player->load(m_currentSrc, contentType); - if (isVideo() && m_player->canLoadPoster()) { - KURL posterURL = getNonEmptyURLAttribute(posterAttr); - if (!posterURL.isEmpty()) - m_player->setPoster(posterURL); - } + // If there is no poster to display, allow the media engine to render video frames as soon as + // they are available. + updateDisplayState(); if (renderer()) renderer()->updateFromElement(); @@ -746,7 +745,7 @@ void HTMLMediaElement::noneSupported() // 9 -Abort these steps. Until the load() method is invoked, the element won't attempt to load another resource. - updatePosterImage(); + updateDisplayState(); if (renderer()) renderer()->updateFromElement(); @@ -835,7 +834,7 @@ void HTMLMediaElement::setNetworkState(MediaPlayer::NetworkState state) else if (state == MediaPlayer::FormatError && m_loadState == LoadingFromSrcAttr) noneSupported(); - updatePosterImage(); + updateDisplayState(); return; } @@ -917,17 +916,13 @@ void HTMLMediaElement::setReadyState(MediaPlayer::ReadyState state) if (m_readyState >= HAVE_METADATA && oldState < HAVE_METADATA) { scheduleEvent(eventNames().durationchangeEvent); scheduleEvent(eventNames().loadedmetadataEvent); - -#if !ENABLE(PLUGIN_PROXY_FOR_VIDEO) - if (renderer() && renderer()->isVideo()) { - toRenderVideo(renderer())->videoSizeChanged(); - } -#endif + if (renderer()) + renderer()->updateFromElement(); m_delayingTheLoadEvent = false; m_player->seek(0); } - bool shouldUpdatePosterImage = false; + bool shouldUpdateDisplayState = false; // 4.8.10.7 says loadeddata is sent only when the new state *is* HAVE_CURRENT_DATA: "If the // previous ready state was HAVE_METADATA and the new ready state is HAVE_CURRENT_DATA", @@ -936,7 +931,7 @@ void HTMLMediaElement::setReadyState(MediaPlayer::ReadyState state) // We go with the later because it seems useful to count on getting this event if (m_readyState >= HAVE_CURRENT_DATA && oldState < HAVE_CURRENT_DATA && !m_haveFiredLoadedData) { m_haveFiredLoadedData = true; - shouldUpdatePosterImage = true; + shouldUpdateDisplayState = true; scheduleEvent(eventNames().loadeddataEvent); } @@ -945,7 +940,7 @@ void HTMLMediaElement::setReadyState(MediaPlayer::ReadyState state) scheduleEvent(eventNames().canplayEvent); if (isPotentiallyPlaying) scheduleEvent(eventNames().playingEvent); - shouldUpdatePosterImage = true; + shouldUpdateDisplayState = true; } if (m_readyState == HAVE_ENOUGH_DATA && oldState < HAVE_ENOUGH_DATA) { @@ -963,11 +958,11 @@ void HTMLMediaElement::setReadyState(MediaPlayer::ReadyState state) scheduleEvent(eventNames().playingEvent); } - shouldUpdatePosterImage = true; + shouldUpdateDisplayState = true; } - if (shouldUpdatePosterImage) - updatePosterImage(); + if (shouldUpdateDisplayState) + updateDisplayState(); updatePlayState(); } @@ -1071,7 +1066,6 @@ void HTMLMediaElement::seek(float time, ExceptionCode& ec) m_player->seek(time); // 10-15 are handled, if necessary, when the engine signals a readystate change. - } void HTMLMediaElement::finishSeek() @@ -1081,6 +1075,8 @@ void HTMLMediaElement::finishSeek() // 4.8.10.10 Seeking step 13 scheduleEvent(eventNames().seekedEvent); + + setDisplayMode(Video); } HTMLMediaElement::ReadyState HTMLMediaElement::readyState() const @@ -1585,13 +1581,8 @@ void HTMLMediaElement::mediaPlayerDurationChanged(MediaPlayer*) { beginProcessingMediaPlayerCallback(); scheduleEvent(eventNames().durationchangeEvent); -#if !ENABLE(PLUGIN_PROXY_FOR_VIDEO) - if (renderer()) { + if (renderer()) renderer()->updateFromElement(); - if (renderer()->isVideo()) - toRenderVideo(renderer())->videoSizeChanged(); - } -#endif endProcessingMediaPlayerCallback(); } @@ -1619,20 +1610,17 @@ void HTMLMediaElement::mediaPlayerSawUnsupportedTracks(MediaPlayer*) void HTMLMediaElement::mediaPlayerRepaint(MediaPlayer*) { beginProcessingMediaPlayerCallback(); + updateDisplayState(); if (renderer()) renderer()->repaint(); - - updatePosterImage(); endProcessingMediaPlayerCallback(); } void HTMLMediaElement::mediaPlayerSizeChanged(MediaPlayer*) { beginProcessingMediaPlayerCallback(); -#if !ENABLE(PLUGIN_PROXY_FOR_VIDEO) - if (renderer() && renderer()->isVideo()) - toRenderVideo(renderer())->videoSizeChanged(); -#endif + if (renderer()) + renderer()->updateFromElement(); endProcessingMediaPlayerCallback(); } @@ -1783,6 +1771,8 @@ void HTMLMediaElement::updatePlayState() bool shouldBePlaying = potentiallyPlaying(); bool playerPaused = m_player->paused(); if (shouldBePlaying && playerPaused) { + setDisplayMode(Video); + // Set rate before calling play in case the rate was set before the media engine wasn't setup. // The media engine should just stash the rate since it isn't already playing. m_player->setRate(m_playbackRate); |