Title: [103249] trunk
Revision
103249
Author
jer.no...@apple.com
Date
2011-12-19 11:15:47 -0800 (Mon, 19 Dec 2011)

Log Message

MediaController: cannot scrub while playing.
https://bugs.webkit.org/show_bug.cgi?id=74870
rdar://problem/10602037

Reviewed by Eric Carlson.

Source/WebCore:

Updated media/media-controller-playback.html test.

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::setController): Change order of operations; set the controllers media
    element before passing controller to the controls.
* html/MediaController.cpp:
(MediaController::updatePlaybackState): Stop the playback clock when WAITING or ENDED.
(MediaController::beginScrubbing): Stop the playback clock.
(MediaController::endScrubbing): Restart (if necessary) the playback clock.
(MediaController::canPlay): Return true if paused.
* platform/mac/PlatformClockCA.cpp:
(PlatformClockCA::setCurrentTime): Stop the CAClock before changing the current time.

LayoutTests:

* media/media-controller-playback.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (103248 => 103249)


--- trunk/LayoutTests/ChangeLog	2011-12-19 18:37:37 UTC (rev 103248)
+++ trunk/LayoutTests/ChangeLog	2011-12-19 19:15:47 UTC (rev 103249)
@@ -1,3 +1,13 @@
+2011-12-19  Jer Noble  <jer.no...@apple.com>
+
+        MediaController: cannot scrub while playing.
+        https://bugs.webkit.org/show_bug.cgi?id=74870
+        rdar://problem/10602037
+
+        Reviewed by Eric Carlson.
+
+        * media/media-controller-playback.html:
+
 2011-12-19  Adrienne Walker  <e...@google.com>
 
         [chromium] Mark more worker tests as being flaky crashers

Modified: trunk/LayoutTests/media/media-controller-playback.html (103248 => 103249)


--- trunk/LayoutTests/media/media-controller-playback.html	2011-12-19 18:37:37 UTC (rev 103248)
+++ trunk/LayoutTests/media/media-controller-playback.html	2011-12-19 19:15:47 UTC (rev 103249)
@@ -22,9 +22,6 @@
         function canplaythrough() {
             consoleWrite("EVENT(canplaythrough)");
             controller.removeEventListener('canplaythrough', canplaythrough, true);
-            run('controller.currentTime = 5');
-            testExpected('video.currentTime', 5);
-            testExpected('video2.currentTime', 5);
             run('video.play()');
             run('video2.play()');
             controller.addEventListener('playing', playing, true);
@@ -36,6 +33,9 @@
             controller.removeEventListener('playing', playing, true);
             testExpected('controller.paused', false);
             controller.addEventListener('ended', ended, true);
+            run('controller.currentTime = 5');
+            testExpected('video.currentTime', 5);
+            testExpected('video2.currentTime', 5);
         }
 
         function ended() { 

Modified: trunk/Source/WebCore/ChangeLog (103248 => 103249)


--- trunk/Source/WebCore/ChangeLog	2011-12-19 18:37:37 UTC (rev 103248)
+++ trunk/Source/WebCore/ChangeLog	2011-12-19 19:15:47 UTC (rev 103249)
@@ -1,3 +1,24 @@
+2011-12-19  Jer Noble  <jer.no...@apple.com>
+
+        MediaController: cannot scrub while playing.
+        https://bugs.webkit.org/show_bug.cgi?id=74870
+        rdar://problem/10602037
+
+        Reviewed by Eric Carlson.
+
+        Updated media/media-controller-playback.html test.
+
+        * html/HTMLMediaElement.cpp:
+        (WebCore::HTMLMediaElement::setController): Change order of operations; set the controllers media
+            element before passing controller to the controls.
+        * html/MediaController.cpp:
+        (MediaController::updatePlaybackState): Stop the playback clock when WAITING or ENDED.
+        (MediaController::beginScrubbing): Stop the playback clock.
+        (MediaController::endScrubbing): Restart (if necessary) the playback clock.
+        (MediaController::canPlay): Return true if paused.
+        * platform/mac/PlatformClockCA.cpp:
+        (PlatformClockCA::setCurrentTime): Stop the CAClock before changing the current time.
+
 2011-12-19  Adam Barth  <aba...@webkit.org>
 
         We don't pass all of the html5lib unsafe-text.dat tests

Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (103248 => 103249)


--- trunk/Source/WebCore/html/HTMLMediaElement.cpp	2011-12-19 18:37:37 UTC (rev 103248)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp	2011-12-19 19:15:47 UTC (rev 103249)
@@ -3626,11 +3626,11 @@
 
     m_mediaController = controller;
 
+    if (m_mediaController)
+        m_mediaController->addMediaElement(this);
+
     if (hasMediaControls())
         mediaControls()->setMediaController(m_mediaController ? m_mediaController.get() : static_cast<MediaControllerInterface*>(this));
-
-    if (m_mediaController)
-        m_mediaController->addMediaElement(this);
 }
 
 void HTMLMediaElement::updateMediaController()

Modified: trunk/Source/WebCore/html/MediaController.cpp (103248 => 103249)


--- trunk/Source/WebCore/html/MediaController.cpp	2011-12-19 18:37:37 UTC (rev 103248)
+++ trunk/Source/WebCore/html/MediaController.cpp	2011-12-19 19:15:47 UTC (rev 103249)
@@ -373,7 +373,6 @@
         if (!m_paused && hasEnded()) {
             // changes the MediaController object to a paused media controller
             m_paused = true;
-            m_clock->stop();
 
             // and then fires a simple event named pause at the MediaController object.
             scheduleEvent(eventNames().pauseEvent);
@@ -387,9 +386,11 @@
     switch (newPlaybackState) {
     case WAITING:
         eventName = eventNames().waitingEvent;
+        m_clock->stop();
         break;
     case ENDED:
         eventName = eventNames().endedEvent;
+        m_clock->stop();
         break;
     case PLAYING:
         eventName = eventNames().playingEvent;
@@ -538,16 +539,23 @@
 {
     for (size_t index = 0; index < m_mediaElements.size(); ++index)
         m_mediaElements[index]->beginScrubbing();
+    if (m_playbackState == PLAYING)
+        m_clock->stop();
 }
 
 void MediaController::endScrubbing()
 {
     for (size_t index = 0; index < m_mediaElements.size(); ++index)
         m_mediaElements[index]->endScrubbing();
+    if (m_playbackState == PLAYING)
+        m_clock->start();
 }
 
 bool MediaController::canPlay() const
 {
+    if (m_paused)
+        return true;
+
     for (size_t index = 0; index < m_mediaElements.size(); ++index) {
         if (!m_mediaElements[index]->canPlay())
             return false;

Modified: trunk/Source/WebCore/platform/mac/PlatformClockCA.cpp (103248 => 103249)


--- trunk/Source/WebCore/platform/mac/PlatformClockCA.cpp	2011-12-19 18:37:37 UTC (rev 103248)
+++ trunk/Source/WebCore/platform/mac/PlatformClockCA.cpp	2011-12-19 19:15:47 UTC (rev 103249)
@@ -63,10 +63,14 @@
 
 void PlatformClockCA::setCurrentTime(float time)
 {
+    if (m_running)
+        CAClockStop(m_clock);
     CAClockTime caTime;
     caTime.format = kCAClockTimeFormat_Seconds;
     caTime.time.seconds = time;
     CAClockSetCurrentTime(m_clock, &caTime);
+    if (m_running)
+        CAClockStart(m_clock);
 }
 
 float PlatformClockCA::currentTime() const
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to