[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.19-706-ge5415e9

eric.carlson at apple.com eric.carlson at apple.com
Thu Feb 4 21:26:37 UTC 2010


The following commit has been merged in the webkit-1.1 branch:
commit 455083f497e3adfb244e43f87b020ca5fd94711d
Author: eric.carlson at apple.com <eric.carlson at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Sun Jan 24 18:22:43 2010 +0000

    2010-01-24  Eric Carlson  <eric.carlson at apple.com>
    
            Reviewed by Simon Fraser.
    
            https://bugs.webkit.org/show_bug.cgi?id=34047
            <rdar://problem/7573699>
            Media element "endedPlayback" logic doesn't match spec
    
            Test: media/video-timeupdate-reverse-play.html
    
            * html/HTMLMediaElement.cpp:
            (WebCore::HTMLMediaElement::ended): The 'ended' attribute should only be true when playback
            rate is positive.
            (WebCore::HTMLMediaElement::mediaPlayerTimeChanged): Always schedule a 'timeupdate' event when
            the media engine signals a time discontinuity, scheduleTimeupdateEvent will only queue an event
            if one hasn't already been posted for the current movie time.
            (WebCore::HTMLMediaElement::endedPlayback): Update to match the spec logic.
    
    2010-01-24  Eric Carlson  <eric.carlson at apple.com>
    
            Reviewed by Simon Fraser.
    
            https://bugs.webkit.org/show_bug.cgi?id=34047
            <rdar://problem/7573699>
            Media element "endedPlayback" logic doesn't match spec
    
            * media/video-timeupdate-reverse-play-expected.txt: Added.
            * media/video-timeupdate-reverse-play.html: Added.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@53780 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 7b32abe..7b35693 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,14 @@
+2010-01-24  Eric Carlson  <eric.carlson at apple.com>
+
+        Reviewed by Simon Fraser.
+
+        https://bugs.webkit.org/show_bug.cgi?id=34047
+        <rdar://problem/7573699>
+        Media element "endedPlayback" logic doesn't match spec
+
+        * media/video-timeupdate-reverse-play-expected.txt: Added.
+        * media/video-timeupdate-reverse-play.html: Added.
+
 2010-01-23  Simon Fraser  <simon.fraser at apple.com>
 
         Reviewed by Darin Adler.
diff --git a/LayoutTests/media/video-timeupdate-reverse-play-expected.txt b/LayoutTests/media/video-timeupdate-reverse-play-expected.txt
new file mode 100644
index 0000000..1356ece
--- /dev/null
+++ b/LayoutTests/media/video-timeupdate-reverse-play-expected.txt
@@ -0,0 +1,17 @@
+Tests that a 'timeupdate' event is fired when a movie plays
+in reverse to time zero.
+
+EVENT(canplaythrough)
+EXPECTED (video.currentTime == '0') OK
+RUN(video.currentTime = 0.3)
+
+EVENT(seeked)
+EXPECTED (video.currentTime.toFixed(1) == '0.3') OK
+RUN(video.play())
+RUN(video.playbackRate = -1)
+
+EVENT(timeupdate) fired at time 0
+EXPECTED (video.ended == 'false') OK
+
+END OF TEST
+
diff --git a/LayoutTests/media/video-timeupdate-reverse-play.html b/LayoutTests/media/video-timeupdate-reverse-play.html
new file mode 100644
index 0000000..eda3127
--- /dev/null
+++ b/LayoutTests/media/video-timeupdate-reverse-play.html
@@ -0,0 +1,62 @@
+<!DOCTYPE HTML>
+
+<html>
+    <head>
+        <script src=media-file.js></script>
+        <script src=video-test.js></script>
+
+        <script>
+
+            var startedPlayback = 0;
+            var seekTime = 0.3;
+
+            function canplaythrough()
+            {
+                testExpected("video.currentTime", 0);
+                run("video.currentTime = " + seekTime);
+                consoleWrite("");
+            }
+
+            function seeked()
+            {
+                // Play backwards
+                testExpected("video.currentTime.toFixed(1)", seekTime);
+                run("video.play()");
+                run("video.playbackRate = -1");
+                startedPlayback = true;
+                consoleWrite("");
+            }
+
+            function timeupdate()
+            {
+                if (startedPlayback && video.currentTime == 0) {
+                    consoleWrite("EVENT(timeupdate) fired at time 0");
+                    testExpected("video.ended", false);
+                    consoleWrite("");
+                    endTest();
+                }
+            }
+
+            function start()
+            {
+                findMediaElement();
+
+                waitForEvent("error");
+                waitForEvent('canplaythrough', canplaythrough);
+                waitForEvent('seeked', seeked);
+                video.addEventListener("timeupdate", timeupdate);
+
+                video.src = findMediaFile("video", "content/test");
+            }
+
+        </script>
+    </head>
+    <body>
+        <video controls autobuffer></video>
+        <p>Tests that a 'timeupdate' event is fired when a movie plays<br> in reverse to time zero.</p>
+        <script>start()</script>
+        <pre id="console"></pre>
+    </body>
+</html>
+
+
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index f5a3ea1..630f61e 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,21 @@
+2010-01-24  Eric Carlson  <eric.carlson at apple.com>
+
+        Reviewed by Simon Fraser.
+
+        https://bugs.webkit.org/show_bug.cgi?id=34047
+        <rdar://problem/7573699>
+        Media element "endedPlayback" logic doesn't match spec
+
+        Test: media/video-timeupdate-reverse-play.html
+
+        * html/HTMLMediaElement.cpp:
+        (WebCore::HTMLMediaElement::ended): The 'ended' attribute should only be true when playback
+        rate is positive.
+        (WebCore::HTMLMediaElement::mediaPlayerTimeChanged): Always schedule a 'timeupdate' event when
+        the media engine signals a time discontinuity, scheduleTimeupdateEvent will only queue an event
+        if one hasn't already been posted for the current movie time.
+        (WebCore::HTMLMediaElement::endedPlayback): Update to match the spec logic.
+
 2010-01-23  Simon Fraser  <simon.fraser at apple.com>
 
         Reviewed by Darin Adler.
diff --git a/WebCore/html/HTMLMediaElement.cpp b/WebCore/html/HTMLMediaElement.cpp
index 360bfb2..d1bec80 100644
--- a/WebCore/html/HTMLMediaElement.cpp
+++ b/WebCore/html/HTMLMediaElement.cpp
@@ -1093,7 +1093,10 @@ void HTMLMediaElement::setWebkitPreservesPitch(bool preservesPitch)
 
 bool HTMLMediaElement::ended() const
 {
-    return endedPlayback();
+    // 4.8.10.8 Playing the media resource
+    // The ended attribute must return true if the media element has ended 
+    // playback and the direction of playback is forwards, and false otherwise.
+    return endedPlayback() && m_playbackRate > 0;
 }
 
 bool HTMLMediaElement::autoplay() const
@@ -1407,10 +1410,14 @@ void HTMLMediaElement::mediaPlayerTimeChanged(MediaPlayer*)
 {
     beginProcessingMediaPlayerCallback();
 
+    // Always call scheduleTimeupdateEvent when the media engine reports a time discontinuity, 
+    // it will only queue a 'timeupdate' event if we haven't already posted one at the current
+    // movie time.
+    scheduleTimeupdateEvent(false);
+
     // 4.8.10.10 step 12 & 13.  Needed if no ReadyState change is associated with the seek.
-    if (m_readyState >= HAVE_CURRENT_DATA && m_seeking) {
+    if (m_readyState >= HAVE_CURRENT_DATA && m_seeking)
         finishSeek();
-    }
     
     float now = currentTime();
     float dur = duration();
@@ -1422,7 +1429,6 @@ void HTMLMediaElement::mediaPlayerTimeChanged(MediaPlayer*)
         } else {
             if (!m_sentEndEvent) {
                 m_sentEndEvent = true;
-                scheduleTimeupdateEvent(false);
                 scheduleEvent(eventNames().endedEvent);
             }
         }
@@ -1553,11 +1559,29 @@ bool HTMLMediaElement::couldPlayIfEnoughData() const
 
 bool HTMLMediaElement::endedPlayback() const
 {
-    if (!m_player || m_readyState < HAVE_METADATA)
+    float dur = duration();
+    if (!m_player || isnan(dur))
+        return false;
+
+    // 4.8.10.8 Playing the media resource
+
+    // A media element is said to have ended playback when the element's 
+    // readyState attribute is HAVE_METADATA or greater, 
+    if (m_readyState < HAVE_METADATA)
         return false;
     
-    float dur = duration();
-    return !isnan(dur) && currentTime() >= dur && !loop();
+    // and the current playback position is the end of the media resource and the direction 
+    // of playback is forwards and the media element does not have a loop attribute specified,
+    float now = currentTime();
+    if (m_playbackRate > 0)
+        return now >= dur && !loop();
+    
+    // or the current playback position is the earliest possible position and the direction 
+    // of playback is backwards
+    if (m_playbackRate < 0)
+        return now <= 0;
+
+    return false;
 }
 
 bool HTMLMediaElement::stoppedDueToErrors() const

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list