From: eric.carlson@apple.com Date: Wed, 13 Apr 2016 22:09:43 +0000 (+0000) Subject: [iOS] remote command should be considered user events X-Git-Url: http://git.webkit.org/?p=WebKit-https.git;a=commitdiff_plain;h=3ca9be81ee2f01ae061045d2b07fb0083b2c14e6 [iOS] remote command should be considered user events https://bugs.webkit.org/show_bug.cgi?id=156546 Reviewed by Jer Noble. Source/WebCore: Test: media/remote-control-command-is-user-gesture.html * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::didReceiveRemoteControlCommand): Increment/decrement m_processingRemoteControlCommand around calling remote command method. (WebCore::HTMLMediaElement::processingUserGesture): Return true if called while handling a remote control command. * html/HTMLMediaElement.h: LayoutTests: * media/remote-control-command-is-user-gesture-expected.txt: Added. * media/remote-control-command-is-user-gesture.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@199515 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog index 5f56d45..79301b6 100644 --- a/LayoutTests/ChangeLog +++ b/LayoutTests/ChangeLog @@ -1,3 +1,14 @@ +2016-04-13 Eric Carlson + + [iOS] remote command should be considered user events + https://bugs.webkit.org/show_bug.cgi?id=156546 + + + Reviewed by Jer Noble. + + * media/remote-control-command-is-user-gesture-expected.txt: Added. + * media/remote-control-command-is-user-gesture.html: Added. + 2016-04-13 Commit Queue Unreviewed, rolling out r199502 and r199511. diff --git a/LayoutTests/media/remote-control-command-is-user-gesture-expected.txt b/LayoutTests/media/remote-control-command-is-user-gesture-expected.txt new file mode 100644 index 0000000..16be059 --- /dev/null +++ b/LayoutTests/media/remote-control-command-is-user-gesture-expected.txt @@ -0,0 +1,17 @@ +Test that a remote control command is treated as a user gesture. + + +RUN(internals.setMediaElementRestrictions(video, "RequireUserGestureForVideoRateChange")) +* set video.src +EVENT(loadedmetadata) + +* video.play() should fail +RUN(video.play()) +EXPECTED (video.paused == 'true') OK + +* Send a play command, it should succeed. +RUN(internals.postRemoteControlCommand('play')) + +EVENT(timeupdate) +END OF TEST + diff --git a/LayoutTests/media/remote-control-command-is-user-gesture.html b/LayoutTests/media/remote-control-command-is-user-gesture.html new file mode 100644 index 0000000..d401b34 --- /dev/null +++ b/LayoutTests/media/remote-control-command-is-user-gesture.html @@ -0,0 +1,43 @@ + + + + + + + + +

Test that a remote control command is treated as a user gesture.

+ + + diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog index dc208ea..c1dfc21 100644 --- a/Source/WebCore/ChangeLog +++ b/Source/WebCore/ChangeLog @@ -1,3 +1,20 @@ +2016-04-13 Eric Carlson + + [iOS] remote command should be considered user events + https://bugs.webkit.org/show_bug.cgi?id=156546 + + + Reviewed by Jer Noble. + + Test: media/remote-control-command-is-user-gesture.html + + * html/HTMLMediaElement.cpp: + (WebCore::HTMLMediaElement::didReceiveRemoteControlCommand): Increment/decrement + m_processingRemoteControlCommand around calling remote command method. + (WebCore::HTMLMediaElement::processingUserGesture): Return true if called while handling + a remote control command. + * html/HTMLMediaElement.h: + 2016-04-13 Antonio Gomes Non-resizable text field looks resizable diff --git a/Source/WebCore/html/HTMLMediaElement.cpp b/Source/WebCore/html/HTMLMediaElement.cpp index b446242..8b37070 100644 --- a/Source/WebCore/html/HTMLMediaElement.cpp +++ b/Source/WebCore/html/HTMLMediaElement.cpp @@ -85,6 +85,7 @@ #include "ShadowRoot.h" #include "TimeRanges.h" #include "UserContentController.h" +#include "UserGestureIndicator.h" #include #include #include @@ -6640,6 +6641,7 @@ void HTMLMediaElement::didReceiveRemoteControlCommand(PlatformMediaSession::Remo { LOG(Media, "HTMLMediaElement::didReceiveRemoteControlCommand(%p) - %i", this, static_cast(command)); + UserGestureIndicator remoteControlUserGesture(DefinitelyProcessingUserGesture, &document()); switch (command) { case PlatformMediaSession::PlayCommand: play();