Title: [219509] trunk
Revision
219509
Author
jer.no...@apple.com
Date
2017-07-14 10:33:28 -0700 (Fri, 14 Jul 2017)

Log Message

Adding the 'autoplay' attribute to a media element during a user gesture should remove user gesture restrictions.
https://bugs.webkit.org/show_bug.cgi?id=174373

Reviewed by Eric Carlson.

Source/WebCore:

Test: media/video-add-autoplay-user-gesture.html

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::parseAttribute):

LayoutTests:

* media/video-add-autoplay-user-gesture-expected.txt: Added.
* media/video-add-autoplay-user-gesture.html: Added.
* media/platform/ios/TestExpectations: Skipped; requires EventSender.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (219508 => 219509)


--- trunk/LayoutTests/ChangeLog	2017-07-14 17:31:14 UTC (rev 219508)
+++ trunk/LayoutTests/ChangeLog	2017-07-14 17:33:28 UTC (rev 219509)
@@ -1,3 +1,14 @@
+2017-07-14  Jer Noble  <jer.no...@apple.com>
+
+        Adding the 'autoplay' attribute to a media element during a user gesture should remove user gesture restrictions.
+        https://bugs.webkit.org/show_bug.cgi?id=174373
+
+        Reviewed by Eric Carlson.
+
+        * media/video-add-autoplay-user-gesture-expected.txt: Added.
+        * media/video-add-autoplay-user-gesture.html: Added.
+        * media/platform/ios/TestExpectations: Skipped; requires EventSender.
+
 2017-07-14  Matt Lewis  <jlew...@apple.com>
 
         Unreviewed, rolling out r219500.

Added: trunk/LayoutTests/media/video-add-autoplay-user-gesture-expected.txt (0 => 219509)


--- trunk/LayoutTests/media/video-add-autoplay-user-gesture-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/media/video-add-autoplay-user-gesture-expected.txt	2017-07-14 17:33:28 UTC (rev 219509)
@@ -0,0 +1,8 @@
+RUN(window.internals.settings.setVideoPlaybackRequiresUserGesture(true);)
+RUN(video = document.createElement("video"))
+RUN(video.src = "" "content/test"))
+RUN(video.setAttribute("autoplay", ""))
+RUN(document.body.appendChild(video))
+EVENT(playing)
+END OF TEST
+

Added: trunk/LayoutTests/media/video-add-autoplay-user-gesture.html (0 => 219509)


--- trunk/LayoutTests/media/video-add-autoplay-user-gesture.html	                        (rev 0)
+++ trunk/LayoutTests/media/video-add-autoplay-user-gesture.html	2017-07-14 17:33:28 UTC (rev 219509)
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <title>video-add-autoplay-user-gesture</title>
+    <script src=""
+    <script src=""
+    <script>
+    function runTest() {
+        run('window.internals.settings.setVideoPlaybackRequiresUserGesture(true);');
+        run('video = document.createElement("video")');
+        run('video.src = "" "content/test")');
+        runWithKeyDown(() => {
+            run('video.setAttribute("autoplay", "")');
+            run('document.body.appendChild(video)');
+            waitForEventAndEnd('playing');
+            failTestIn(1000);
+        });
+    }
+    </script>
+</head>
+<body _onload_="runTest()">
+</body>
+</html>
\ No newline at end of file

Modified: trunk/LayoutTests/platform/ios/TestExpectations (219508 => 219509)


--- trunk/LayoutTests/platform/ios/TestExpectations	2017-07-14 17:31:14 UTC (rev 219508)
+++ trunk/LayoutTests/platform/ios/TestExpectations	2017-07-14 17:33:28 UTC (rev 219509)
@@ -2563,6 +2563,7 @@
 media/media-controls-accessibility.html [ Timeout ]
 media/media-fullscreen-return-to-inline.html
 media/no-autoplay-with-user-gesture-requirement.html
+media/video-add-autoplay-user-gesture.html
 media/video-controls-drag.html
 media/video-controls-fullscreen-volume.html
 media/video-controls-no-display-with-text-track.html

Modified: trunk/Source/WebCore/ChangeLog (219508 => 219509)


--- trunk/Source/WebCore/ChangeLog	2017-07-14 17:31:14 UTC (rev 219508)
+++ trunk/Source/WebCore/ChangeLog	2017-07-14 17:33:28 UTC (rev 219509)
@@ -1,3 +1,15 @@
+2017-07-14  Jer Noble  <jer.no...@apple.com>
+
+        Adding the 'autoplay' attribute to a media element during a user gesture should remove user gesture restrictions.
+        https://bugs.webkit.org/show_bug.cgi?id=174373
+
+        Reviewed by Eric Carlson.
+
+        Test: media/video-add-autoplay-user-gesture.html
+
+        * html/HTMLMediaElement.cpp:
+        (WebCore::HTMLMediaElement::parseAttribute):
+
 2017-07-14  Matt Lewis  <jlew...@apple.com>
 
         Unreviewed, rolling out r219500.

Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (219508 => 219509)


--- trunk/Source/WebCore/html/HTMLMediaElement.cpp	2017-07-14 17:31:14 UTC (rev 219508)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp	2017-07-14 17:33:28 UTC (rev 219509)
@@ -790,6 +790,10 @@
 
     } else if (name == mediagroupAttr)
         setMediaGroup(value);
+    else if (name == autoplayAttr) {
+        if (processingUserGestureForMedia())
+            removeBehaviorsRestrictionsAfterFirstUserGesture();
+    }
     else
         HTMLElement::parseAttribute(name, value);
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to