[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

eric.carlson at apple.com eric.carlson at apple.com
Wed Dec 22 11:10:42 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 3f2c676677a2c79a3a5613c1d7402d5eed62b390
Author: eric.carlson at apple.com <eric.carlson at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Jul 14 14:37:56 2010 +0000

    2010-07-14  Eric Carlson  <eric.carlson at apple.com>
    
            Reviewed by Darin Adler.
    
            Update media element's seeking logic
            https://bugs.webkit.org/show_bug.cgi?id=42178
            <rdar://problem/8185817>
    
            * html/HTMLMediaElement.cpp:
            (WebCore::HTMLMediaElement::seek): When asked to seek to an unbuffered time, seek to the
            nearest time instead of generating an exception. Re-order the logic to match spec text.
    
            * html/TimeRanges.cpp:
            (TimeRanges::nearest): New, return the value closest to the specified time.
            * html/TimeRanges.h:
    
    2010-07-14  Eric Carlson  <eric.carlson at apple.com>
    
            Reviewed by Darin Adler.
    
            Update media element's seeking logic.
            https://bugs.webkit.org/show_bug.cgi?id=42178
            <rdar://problem/8185817>
    
            * http/tests/media/video-seekable-stall-expected.txt:
            * http/tests/media/video-seekable-stall.html: Seeking to an unbuffered time no longer
            generates an exception.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@63319 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index bcfc824..c20bbe3 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,15 @@
+2010-07-14  Eric Carlson  <eric.carlson at apple.com>
+
+        Reviewed by Darin Adler.
+
+        Update media element's seeking logic.
+        https://bugs.webkit.org/show_bug.cgi?id=42178
+        <rdar://problem/8185817>
+
+        * http/tests/media/video-seekable-stall-expected.txt:
+        * http/tests/media/video-seekable-stall.html: Seeking to an unbuffered time no longer
+        generates an exception.
+
 2010-07-14  Sheriff Bot  <webkit.review.bot at gmail.com>
 
         Unreviewed, rolling out r63305.
diff --git a/LayoutTests/http/tests/media/video-seekable-stall-expected.txt b/LayoutTests/http/tests/media/video-seekable-stall-expected.txt
index c130f0e..ba81728 100644
--- a/LayoutTests/http/tests/media/video-seekable-stall-expected.txt
+++ b/LayoutTests/http/tests/media/video-seekable-stall-expected.txt
@@ -6,6 +6,5 @@ TEST(video.seekable.length == 1) OK
 TEST(video.seekable.start(0) == 0) OK
 TEST(video.seekable.end(0) > 0) OK
 TEST(video.seekable.end(0) < video.duration - 1) OK
-TEST(video.currentTime = video.duration - 1) THROWS(DOMException.INDEX_SIZE_ERR) OK
 END OF TEST
 
diff --git a/LayoutTests/http/tests/media/video-seekable-stall.html b/LayoutTests/http/tests/media/video-seekable-stall.html
index 08830b3..fac6d0a 100644
--- a/LayoutTests/http/tests/media/video-seekable-stall.html
+++ b/LayoutTests/http/tests/media/video-seekable-stall.html
@@ -8,7 +8,6 @@ waitForEvent('canplay', function () {
     test("video.seekable.start(0) == 0");
     test("video.seekable.end(0) > 0");
     test("video.seekable.end(0) < video.duration - 1");
-    testException("video.currentTime = video.duration - 1", "DOMException.INDEX_SIZE_ERR");
     endTest();
 } );
 video.src = "http://127.0.0.1:8000/media/video-load-and-stall.cgi?name=../../../media/content/test.mp4&stallAt=100000";
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 9a63225..a970d22 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,19 @@
+2010-07-14  Eric Carlson  <eric.carlson at apple.com>
+
+        Reviewed by Darin Adler.
+
+        Update media element's seeking logic
+        https://bugs.webkit.org/show_bug.cgi?id=42178
+        <rdar://problem/8185817>
+
+        * html/HTMLMediaElement.cpp:
+        (WebCore::HTMLMediaElement::seek): When asked to seek to an unbuffered time, seek to the 
+        nearest time instead of generating an exception. Re-order the logic to match spec text.
+
+        * html/TimeRanges.cpp:
+        (TimeRanges::nearest): New, return the value closest to the specified time.
+        * html/TimeRanges.h:
+
 2010-07-14  Hans Wennborg  <hans at chromium.org>
 
         Reviewed by Steve Block.
diff --git a/WebCore/html/HTMLMediaElement.cpp b/WebCore/html/HTMLMediaElement.cpp
index 77beabf..5c823f8 100644
--- a/WebCore/html/HTMLMediaElement.cpp
+++ b/WebCore/html/HTMLMediaElement.cpp
@@ -1015,49 +1015,55 @@ bool HTMLMediaElement::supportsSave() const
     
 void HTMLMediaElement::seek(float time, ExceptionCode& ec)
 {
-    // 4.8.10.10. Seeking
-    // 1
+    // 4.8.9.9 Seeking
+
+    // 1 - If the media element's readyState is HAVE_NOTHING, then raise an INVALID_STATE_ERR exception.
     if (m_readyState == HAVE_NOTHING || !m_player) {
         ec = INVALID_STATE_ERR;
         return;
     }
 
-    // 2
+    // Get the current time before setting m_seeking, m_lastSeekTime is returned once it is set.
+    float now = currentTime();
+
+    // 3 - Set the seeking IDL attribute to true.
+    // The flag will be cleared when the engine tells is the time has actually changed
+    m_seeking = true;
+
+    // 4 - Queue a task to fire a simple event named timeupdate at the element.
+    scheduleTimeupdateEvent(false);
+
+    // 6 - If the new playback position is later than the end of the media resource, then let it be the end 
+    // of the media resource instead.
     time = min(time, duration());
 
-    // 3
-    time = max(time, 0.0f);
+    // 7 - If the new playback position is less than the earliest possible position, let it be that position instead.
+    float earliestTime = m_player->startTime();
+    time = max(time, earliestTime);
 
-    // 4
+    // 8 - If the (possibly now changed) new playback position is not in one of the ranges given in the 
+    // seekable attribute, then let it be the position in one of the ranges given in the seekable attribute 
+    // that is the nearest to the new playback position. ... If there are no ranges given in the seekable
+    // attribute then set the seeking IDL attribute to false and abort these steps.
     RefPtr<TimeRanges> seekableRanges = seekable();
-    if (!seekableRanges->contain(time)) {
-        ec = INDEX_SIZE_ERR;
+    if (!seekableRanges->length() || time == now) {
+        m_seeking = false;
         return;
     }
-    
-    // avoid generating events when the time won't actually change
-    float now = currentTime();
-    if (time == now)
-        return;
+    time = seekableRanges->nearest(time);
 
-    // 5
     if (m_playing) {
         if (m_lastSeekTime < now)
             addPlayedRange(m_lastSeekTime, now);
     }
     m_lastSeekTime = time;
+    m_sentEndEvent = false;
 
-    // 6 - set the seeking flag, it will be cleared when the engine tells is the time has actually changed
-    m_seeking = true;
-
-    // 7
-    scheduleTimeupdateEvent(false);
+    // 9 - Set the current playback position to the given new playback position
+    m_player->seek(time);
 
-    // 8 - this is covered, if necessary, when the engine signals a readystate change
+    // 10-15 are handled, if necessary, when the engine signals a readystate change.
 
-    // 10
-    m_player->seek(time);
-    m_sentEndEvent = false;
 }
 
 void HTMLMediaElement::finishSeek()
diff --git a/WebCore/html/TimeRanges.cpp b/WebCore/html/TimeRanges.cpp
index e5b070d..3ae4618 100644
--- a/WebCore/html/TimeRanges.cpp
+++ b/WebCore/html/TimeRanges.cpp
@@ -115,3 +115,21 @@ bool TimeRanges::contain(float time) const
     }
     return false;
 }
+
+float TimeRanges::nearest(float time) const
+{ 
+    ExceptionCode unused;
+    float closest = 0;
+    unsigned count = length();
+    for (unsigned ndx = 0; ndx < count; ndx++) {
+        float startTime = start(ndx, unused);
+        float endTime = end(ndx, unused);
+        if (time >= startTime && time <= endTime)
+            return time;
+        if (fabs(startTime - time) < closest)
+            closest = fabs(startTime - time);
+        else if (fabs(endTime - time) < closest)
+            closest = fabs(endTime - time);
+    }
+    return closest;
+}
diff --git a/WebCore/html/TimeRanges.h b/WebCore/html/TimeRanges.h
index 6be8c4e..2d7af25 100644
--- a/WebCore/html/TimeRanges.h
+++ b/WebCore/html/TimeRanges.h
@@ -55,6 +55,8 @@ public:
     void add(float start, float end);
     
     bool contain(float time) const;
+    
+    float nearest(float time) const;
 
 private:
     TimeRanges() { }

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list