Diff
Modified: branches/safari-602-branch/Source/WebCore/ChangeLog (205238 => 205239)
--- branches/safari-602-branch/Source/WebCore/ChangeLog 2016-08-31 07:29:30 UTC (rev 205238)
+++ branches/safari-602-branch/Source/WebCore/ChangeLog 2016-08-31 07:39:09 UTC (rev 205239)
@@ -1,3 +1,28 @@
+2016-08-31 Babak Shafiei <[email protected]>
+
+ Merge r204989. rdar://problem/28015116
+
+ 2016-08-25 Wenson Hsieh <[email protected]>
+
+ Dragging against the end of the inline media scrubber causes the media scrubber to hide
+ https://bugs.webkit.org/show_bug.cgi?id=161207
+
+ Reviewed by Eric Carlson.
+
+ Previously, we would re-enable behavior restrictions when firing an ended event. However, if the ended event is
+ caused by the user seeking to the end of the video, the media controls would be taken away from under the user.
+ To prevent this, we don't add the relevant behavior restrictions upon media ended if media was seeking before
+ firing the event.
+
+ Tweaked an existing WebKit API test to cover this change.
+
+ * html/HTMLMediaElement.cpp:
+ (WebCore::HTMLMediaElement::mediaPlayerTimeChanged):
+ (WebCore::HTMLMediaElement::addBehaviorRestrictionsOnEndIfNecessary):
+ * html/HTMLMediaElement.h:
+ * html/MediaElementSession.cpp:
+ (WebCore::MediaElementSession::canControlControlsManager):
+
2016-08-30 Babak Shafiei <[email protected]>
Merge r204983. rdar://problem/27952772
Modified: branches/safari-602-branch/Source/WebCore/html/HTMLMediaElement.cpp (205238 => 205239)
--- branches/safari-602-branch/Source/WebCore/html/HTMLMediaElement.cpp 2016-08-31 07:29:30 UTC (rev 205238)
+++ branches/safari-602-branch/Source/WebCore/html/HTMLMediaElement.cpp 2016-08-31 07:39:09 UTC (rev 205239)
@@ -4367,6 +4367,7 @@
beginProcessingMediaPlayerCallback();
invalidateCachedTime();
+ bool wasSeeking = seeking();
// 4.8.10.9 step 14 & 15. Needed if no ReadyState change is associated with the seek.
if (m_seeking && m_readyState >= HAVE_CURRENT_DATA && !m_player->seeking())
@@ -4404,7 +4405,8 @@
if (!m_sentEndEvent) {
m_sentEndEvent = true;
scheduleEvent(eventNames().endedEvent);
- m_mediaSession->addBehaviorRestriction(MediaElementSession::RequireUserGestureToControlControlsManager | MediaElementSession::RequirePlaybackToControlControlsManager);
+ if (!wasSeeking)
+ addBehaviorRestrictionsOnEndIfNecessary();
}
// If the media element has a current media controller, then report the controller state
// for the media element's current media controller.
@@ -4425,7 +4427,8 @@
if (!m_sentEndEvent && m_player && m_player->ended()) {
m_sentEndEvent = true;
scheduleEvent(eventNames().endedEvent);
- m_mediaSession->addBehaviorRestriction(MediaElementSession::RequireUserGestureToControlControlsManager | MediaElementSession::RequirePlaybackToControlControlsManager);
+ if (!wasSeeking)
+ addBehaviorRestrictionsOnEndIfNecessary();
m_paused = true;
setPlaying(false);
}
@@ -4438,6 +4441,14 @@
endProcessingMediaPlayerCallback();
}
+void HTMLMediaElement::addBehaviorRestrictionsOnEndIfNecessary()
+{
+ if (isFullscreen())
+ return;
+
+ m_mediaSession->addBehaviorRestriction(MediaElementSession::RequirePlaybackToControlControlsManager | MediaElementSession::RequireUserGestureToControlControlsManager);
+}
+
void HTMLMediaElement::mediaPlayerVolumeChanged(MediaPlayer*)
{
LOG(Media, "HTMLMediaElement::mediaPlayerVolumeChanged(%p)", this);
Modified: branches/safari-602-branch/Source/WebCore/html/HTMLMediaElement.h (205238 => 205239)
--- branches/safari-602-branch/Source/WebCore/html/HTMLMediaElement.h 2016-08-31 07:29:30 UTC (rev 205238)
+++ branches/safari-602-branch/Source/WebCore/html/HTMLMediaElement.h 2016-08-31 07:39:09 UTC (rev 205239)
@@ -793,6 +793,8 @@
void updateUsesLTRUserInterfaceLayoutDirectionJSProperty();
void setControllerJSProperty(const char*, JSC::JSValue);
+ void addBehaviorRestrictionsOnEndIfNecessary();
+
Timer m_pendingActionTimer;
Timer m_progressEventTimer;
Timer m_playbackProgressTimer;
Modified: branches/safari-602-branch/Source/WebCore/html/MediaElementSession.cpp (205238 => 205239)
--- branches/safari-602-branch/Source/WebCore/html/MediaElementSession.cpp 2016-08-31 07:29:30 UTC (rev 205238)
+++ branches/safari-602-branch/Source/WebCore/html/MediaElementSession.cpp 2016-08-31 07:39:09 UTC (rev 205239)
@@ -224,11 +224,6 @@
return false;
}
- if (m_element.ended()) {
- LOG(Media, "MediaElementSession::canControlControlsManager - returning FALSE: Ended");
- return false;
- }
-
if (m_element.document().activeDOMObjectsAreSuspended()) {
LOG(Media, "MediaElementSession::canControlControlsManager - returning FALSE: activeDOMObjectsAreSuspended()");
return false;
Modified: branches/safari-602-branch/Tools/ChangeLog (205238 => 205239)
--- branches/safari-602-branch/Tools/ChangeLog 2016-08-31 07:29:30 UTC (rev 205238)
+++ branches/safari-602-branch/Tools/ChangeLog 2016-08-31 07:39:09 UTC (rev 205239)
@@ -1,3 +1,21 @@
+2016-08-31 Babak Shafiei <[email protected]>
+
+ Merge r204989. rdar://problem/28015116
+
+ 2016-08-25 Wenson Hsieh <[email protected]>
+
+ Dragging against the end of the inline media scrubber causes the media scrubber to hide
+ https://bugs.webkit.org/show_bug.cgi?id=161207
+
+ Reviewed by Eric Carlson.
+
+ Tweaks an existing WebKit API test covering this behavior change. After some discussion, rather than hide media
+ controls in this case, we should actually continue showing them. This is because seeking due to user gestures
+ similar to "scrubbing" are indistinguishable from gestures that immediately seek to the end.
+
+ * TestWebKitAPI/Tests/WebKit2Cocoa/VideoControlsManager.mm:
+ (TestWebKitAPI::TEST):
+
2016-08-19 Alexey Proskuryakov <[email protected]>
Merge r204656 and r204660.
Modified: branches/safari-602-branch/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/VideoControlsManager.mm (205238 => 205239)
--- branches/safari-602-branch/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/VideoControlsManager.mm 2016-08-31 07:29:30 UTC (rev 205238)
+++ branches/safari-602-branch/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/VideoControlsManager.mm 2016-08-31 07:39:09 UTC (rev 205239)
@@ -299,7 +299,7 @@
TestWebKitAPI::Util::run(&receivedScriptMessage);
}
-TEST(VideoControlsManager, VideoControlsManagerLargeAutoplayingVideoHidesControlsAfterSeekingToEnd)
+TEST(VideoControlsManager, VideoControlsManagerLargeAutoplayingVideoAfterSeekingToEnd)
{
RetainPtr<WKWebViewConfiguration> configuration = adoptNS([[WKWebViewConfiguration alloc] init]);
configuration.get().mediaTypesRequiringUserActionForPlayback = WKAudiovisualMediaTypeNone;
@@ -315,8 +315,9 @@
}]);
[[configuration userContentController] addScriptMessageHandler:onloadHandler.get() name:@"onloadHandler"];
- // Since the video has ended, the expectation is NO.
- [handler setExpectedToHaveControlsManager:NO];
+ // We expect there to be media controls, since this is a user gestured seek to the end.
+ // This is akin to seeking to the end by scrubbing in the controls.
+ [handler setExpectedToHaveControlsManager:YES];
NSURLRequest *request = [NSURLRequest requestWithURL:[[NSBundle mainBundle] URLForResource:@"large-video-hides-controls-after-seek-to-end" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]];
[webView loadRequest:request];