2011-02-01 Adam Barth <abarth@webkit.org>
[WebKit.git] / Source / WebCore / html / HTMLMediaElement.cpp
index 3a63a3353302fd28e2732e82f120437508d29acf..9f11aa5e488b9c0183f8fccf982ee4509db61539 100644 (file)
@@ -48,6 +48,7 @@
 #include "HTMLSourceElement.h"
 #include "HTMLVideoElement.h"
 #include "Logging.h"
+#include "MediaControls.h"
 #include "MediaDocument.h"
 #include "MediaError.h"
 #include "MediaList.h"
@@ -540,6 +541,7 @@ void HTMLMediaElement::prepareForLoad()
         refreshCachedTime();
         m_paused = true;
         m_seeking = false;
+        invalidateCachedTime();
         scheduleEvent(eventNames().emptiedEvent);
     }
 
@@ -991,6 +993,7 @@ void HTMLMediaElement::setReadyState(MediaPlayer::ReadyState state)
 
         if (m_autoplaying && m_paused && autoplay()) {
             m_paused = false;
+            invalidateCachedTime();
             scheduleEvent(eventNames().playEvent);
             scheduleEvent(eventNames().playingEvent);
         }
@@ -1300,6 +1303,7 @@ void HTMLMediaElement::setPlaybackRate(float rate)
 
     if (m_playbackRate != rate) {
         m_playbackRate = rate;
+        invalidateCachedTime();
         scheduleEvent(eventNames().ratechangeEvent);
     }
     if (m_player && potentiallyPlaying() && m_player->rate() != rate)
@@ -1404,6 +1408,7 @@ void HTMLMediaElement::playInternal()
     
     if (m_paused) {
         m_paused = false;
+        invalidateCachedTime();
         scheduleEvent(eventNames().playEvent);
 
         if (m_readyState <= HAVE_CURRENT_DATA)
@@ -1891,6 +1896,7 @@ void HTMLMediaElement::mediaPlayerRateChanged(MediaPlayer*)
     // Stash the rate in case the one we tried to set isn't what the engine is
     // using (eg. it can't handle the rate we set)
     m_playbackRate = m_player->rate();
+    invalidateCachedTime();
     endProcessingMediaPlayerCallback();
 }
 
@@ -2282,7 +2288,7 @@ void HTMLMediaElement::defaultEventHandler(Event* event)
         widget->handleEvent(event);
 #else
     if (renderer() && renderer()->isMedia())
-        toRenderMedia(renderer())->forwardEvent(event);
+        toRenderMedia(renderer())->controls()->forwardEvent(event);
     if (event->defaultHandled())
         return;
     HTMLElement::defaultEventHandler(event);
@@ -2386,7 +2392,7 @@ void HTMLMediaElement::createMediaPlayerProxy()
         m_needWidgetUpdate = false;
 }
 
-void HTMLMediaElement::updateWidget(bool)
+void HTMLMediaElement::updateWidget(PluginCreationOption)
 {
     mediaElement->setNeedWidgetUpdate(false);