WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch
bug-224363-20210412103357.patch (text/plain), 8.69 KB, created by
Jean-Yves Avenard [:jya]
on 2021-04-11 17:33:58 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Jean-Yves Avenard [:jya]
Created:
2021-04-11 17:33:58 PDT
Size:
8.69 KB
patch
obsolete
>Subversion Revision: 275811 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 9e81e522bc439d255bf735b3bb6a5300d697183a..0af3100758c71ac06385e225901527485b88cef8 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,29 @@ >+2021-04-09 Jean-Yves Avenard <jya@apple.com> >+ >+ When seeking past the duration, currentTime will return the unadjusted seek time. >+ https://bugs.webkit.org/show_bug.cgi?id=224363 >+ <rdar://problem/76444204> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ When seeking, per spec https://html.spec.whatwg.org/multipage/media.html#dom-media-seek some steps (from 6 to 13) >+ are to be run in parallel and can be cancelled at any time. >+ When setting the currentTime attribute, it must set the official playback position, which is an approximation >+ of the current playback position. >+ The steps running in parallel, there is no explicit requirement that they must occur after the end of the >+ current event loop. If we were to query the currentTime attribute after setting it beyond the media's duration, >+ we would get a nonsensical currentTime. >+ While technically the webkit behaviour is acceptable, it is a different behaviour from other engine's browsers. >+ As such, we perform the steps that would clamp the currentTime value to the beginning and end of the media and >+ within the seekable range immediately. >+ The actual seek is still performed asynchronously. >+ >+ Test: media/video-seek-past-end-duration.html >+ >+ * html/HTMLMediaElement.cpp: >+ (WebCore::HTMLMediaElement::seekWithTolerance): >+ (WebCore::HTMLMediaElement::seekTask): >+ > 2021-04-11 Cameron McCormack <heycam@apple.com> > > Fix initial horizontal scrollbar position when vertical scrollbar is on the left. >diff --git a/Source/WebCore/html/HTMLMediaElement.cpp b/Source/WebCore/html/HTMLMediaElement.cpp >index 1e36ea0d160d4ebdc75737cccc8791ef98f7a086..e52084e1a5c27d54cc0293552232a5e2c85acefe 100644 >--- a/Source/WebCore/html/HTMLMediaElement.cpp >+++ b/Source/WebCore/html/HTMLMediaElement.cpp >@@ -2917,6 +2917,8 @@ void HTMLMediaElement::seekInternal(const MediaTime& time) > void HTMLMediaElement::seekWithTolerance(const MediaTime& inTime, const MediaTime& negativeTolerance, const MediaTime& positiveTolerance, bool fromDOM) > { > INFO_LOG(LOGIDENTIFIER, "time = ", inTime, ", negativeTolerance = ", negativeTolerance, ", positiveTolerance = ", positiveTolerance); >+ ASSERT(negativeTolerance >= MediaTime::zeroTime()); >+ > // 4.8.10.9 Seeking > MediaTime time = inTime; > >@@ -2957,36 +2959,13 @@ void HTMLMediaElement::seekWithTolerance(const MediaTime& inTime, const MediaTim > } > m_lastSeekTime = time; > >- // 5 - If the seek was in response to a DOM method call or setting of an IDL attribute, then continue >- // the script. The remainder of these steps must be run asynchronously. >- m_pendingSeek = makeUnique<PendingSeek>(now, time, negativeTolerance, positiveTolerance); >- if (fromDOM) { >- INFO_LOG(LOGIDENTIFIER, "enqueuing seek from ", now, " to ", time); >- m_seekTaskQueue.scheduleTask(std::bind(&HTMLMediaElement::seekTask, this)); >- } else >- seekTask(); >- >- if (processingUserGestureForMedia()) >- m_mediaSession->removeBehaviorRestriction(MediaElementSession::RequireUserGestureToControlControlsManager); >-} >- >-void HTMLMediaElement::seekTask() >-{ >- INFO_LOG(LOGIDENTIFIER); >- > if (!m_player) { > clearSeeking(); > return; > } > >- ASSERT(m_pendingSeek); >- MediaTime now = m_pendingSeek->now; >- MediaTime time = m_pendingSeek->targetTime; >- MediaTime negativeTolerance = m_pendingSeek->negativeTolerance; >- MediaTime positiveTolerance = m_pendingSeek->positiveTolerance; >- m_pendingSeek = nullptr; >- >- ASSERT(negativeTolerance >= MediaTime::zeroTime()); >+ // 5 - If the seek was in response to a DOM method call or setting of an IDL attribute, then continue >+ // the script. The remainder of these steps must be run in parallel. > > // 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. >@@ -3050,6 +3029,33 @@ void HTMLMediaElement::seekTask() > m_pendingSeekType = thisSeekType; > m_seeking = true; > >+ m_pendingSeek = makeUnique<PendingSeek>(now, time, negativeTolerance, positiveTolerance); >+ if (fromDOM) { >+ INFO_LOG(LOGIDENTIFIER, "enqueuing seek from ", now, " to ", time); >+ m_seekTaskQueue.scheduleTask(std::bind(&HTMLMediaElement::seekTask, this)); >+ } else >+ seekTask(); >+ >+ if (processingUserGestureForMedia()) >+ m_mediaSession->removeBehaviorRestriction(MediaElementSession::RequireUserGestureToControlControlsManager); >+} >+ >+void HTMLMediaElement::seekTask() >+{ >+ INFO_LOG(LOGIDENTIFIER); >+ >+ if (!m_player) { >+ clearSeeking(); >+ return; >+ } >+ >+ ASSERT(m_pendingSeek); >+ >+ MediaTime time = m_pendingSeek->targetTime; >+ MediaTime negativeTolerance = m_pendingSeek->negativeTolerance; >+ MediaTime positiveTolerance = m_pendingSeek->positiveTolerance; >+ m_pendingSeek = nullptr; >+ > // 10 - Queue a task to fire a simple event named seeking at the element. > scheduleEvent(eventNames().seekingEvent); > >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index a4913351ad47a4c9ad707ee776f26bda863a16c6..40f9529642ec5f71576234fee80d89d2d9c96afb 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,14 @@ >+2021-04-09 Jean-Yves Avenard <jya@apple.com> >+ >+ When seeking past the duration, currentTime will return the unadjusted seek time. >+ https://bugs.webkit.org/show_bug.cgi?id=224363 >+ <rdar://problem/76444204> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * media/video-seek-past-end-duration-expected.txt: Added. >+ * media/video-seek-past-end-duration.html: Added. >+ > 2021-04-11 Cameron McCormack <heycam@apple.com> > > Fix initial horizontal scrollbar position when vertical scrollbar is on the left. >diff --git a/LayoutTests/media/video-seek-past-end-duration-expected.txt b/LayoutTests/media/video-seek-past-end-duration-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..67bdd84978e8d80c8ae374b0b7fd47cdad1d6b3d >--- /dev/null >+++ b/LayoutTests/media/video-seek-past-end-duration-expected.txt >@@ -0,0 +1,12 @@ >+ >+RUN(video.src = findMediaFile("video", "content/test")) >+EVENT(loadeddata) >+Test that seeking past the media element duration seeks exactly to the end >+EXPECTED (mediaElement.currentTime == 'mediaElement.duration') OK >+EXPECTED (video.paused == 'true') OK >+EXPECTED (video.ended == 'true') OK >+EVENT(seeked) >+EXPECTED (mediaElement.currentTime == 'mediaElement.duration') OK >+EXPECTED (video.ended == 'true') OK >+END OF TEST >+ >diff --git a/LayoutTests/media/video-seek-past-end-duration.html b/LayoutTests/media/video-seek-past-end-duration.html >new file mode 100644 >index 0000000000000000000000000000000000000000..e50fdbe239c0d90c479cab70cb947bce1b32bf9a >--- /dev/null >+++ b/LayoutTests/media/video-seek-past-end-duration.html >@@ -0,0 +1,40 @@ >+<!DOCTYPE html> >+<html> >+<head> >+ <title>default-actionHandlers</title> >+ <script src="video-test.js"></script> >+ <script src="media-file.js"></script> >+ <script> >+ >+ async function runTest() { >+ findMediaElement(); >+ run('video.src = findMediaFile("video", "content/test")'); >+ await waitFor(video, 'loadeddata'); >+ >+ consoleWrite('Test that seeking past the media element duration seeks exactly to the end'); >+ >+ // Seek past end. >+ video.currentTime = video.duration + 10; >+ >+ // The seek time should be clamped to the element's duration >+ // Don't use "testExpected()" so we won't log the actual duration to the >+ // results file, as the floating point result may differ with different engines. >+ reportExpected(mediaElement.currentTime == mediaElement.duration, "mediaElement.currentTime", "==", "mediaElement.duration", mediaElement.currentTime); >+ >+ testExpected("video.paused", true); >+ // FIXME: User Agent such a Firefox or Chromium based browser will only return that the video >+ // has ended once the seek operation has completed. See https://bugs.webkit.org/show_bug.cgi?id=224363 >+ testExpected("video.ended", true); >+ >+ await waitFor(video, 'seeked'); >+ reportExpected(mediaElement.currentTime == mediaElement.duration, "mediaElement.currentTime", "==", "mediaElement.duration", mediaElement.currentTime); >+ testExpected("video.ended", true); >+ >+ endTest(); >+ } >+ </script> >+</head> >+<body onload="runTest()"> >+ <video controls preload='auto'></video> >+</body> >+</html>
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
ews-feeder
:
commit-queue-
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 224363
:
425617
|
425716
| 425717