Title: [201006] branches/safari-602.1.32-branch

Diff

Modified: branches/safari-602.1.32-branch/LayoutTests/ChangeLog (201005 => 201006)


--- branches/safari-602.1.32-branch/LayoutTests/ChangeLog	2016-05-17 08:47:03 UTC (rev 201005)
+++ branches/safari-602.1.32-branch/LayoutTests/ChangeLog	2016-05-17 08:47:06 UTC (rev 201006)
@@ -1,5 +1,19 @@
 2016-05-17  Babak Shafiei  <[email protected]>
 
+        Merge r200688. rdar://problem/26013966
+
+    2016-05-11  Jer Noble  <[email protected]>
+
+            Videos allowed to play through the Main Content restriction should not pause when scrolled off-screen.
+            https://bugs.webkit.org/show_bug.cgi?id=157555
+
+            Reviewed by Eric Carlson.
+
+            * media/video-main-content-allow-then-scroll-expected.txt: Added.
+            * media/video-main-content-allow-then-scroll.html: Added.
+
+2016-05-17  Babak Shafiei  <[email protected]>
+
         Merge r200803. rdar://problem/17779042
 
     2016-05-12  Myles C. Maxfield  <[email protected]>

Added: branches/safari-602.1.32-branch/LayoutTests/media/video-main-content-allow-then-scroll-expected.txt (0 => 201006)


--- branches/safari-602.1.32-branch/LayoutTests/media/video-main-content-allow-then-scroll-expected.txt	                        (rev 0)
+++ branches/safari-602.1.32-branch/LayoutTests/media/video-main-content-allow-then-scroll-expected.txt	2016-05-17 08:47:06 UTC (rev 201006)
@@ -0,0 +1,8 @@
+RUN(internals.setMediaElementRestrictions(video, "RequireUserGestureForVideoRateChange,OverrideUserGestureRequirementForMainContent"))
+EVENT(canplaythrough)
+EVENT(playing)
+RUN(document.body.scrollTop = document.body.clientHeight)
+EXPECTED (video.paused == 'false') OK
+END OF TEST
+
+

Added: branches/safari-602.1.32-branch/LayoutTests/media/video-main-content-allow-then-scroll.html (0 => 201006)


--- branches/safari-602.1.32-branch/LayoutTests/media/video-main-content-allow-then-scroll.html	                        (rev 0)
+++ branches/safari-602.1.32-branch/LayoutTests/media/video-main-content-allow-then-scroll.html	2016-05-17 08:47:06 UTC (rev 201006)
@@ -0,0 +1,47 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <title>video-main-content-allow</title>
+    <script src=""
+    <script src=""
+    <script>
+    function go() {
+        video = document.createElement('video');
+        run('internals.setMediaElementRestrictions(video, "RequireUserGestureForVideoRateChange,OverrideUserGestureRequirementForMainContent")');
+        document.body.appendChild(video);
+        var spacer = document.body.appendChild(document.createElement('div'));
+        spacer.id = 'spacer';
+
+        video.src = "" 'content/test');
+        waitForEvent('canplaythrough', canPlayThrough);
+    }
+
+    function canPlayThrough() {
+        video.play();
+        waitForEvent('playing', playing);
+    }
+
+    function playing() {
+        run('document.body.scrollTop = document.body.clientHeight');
+        waitForEventAndFail('pause');
+        setTimeout(afterPlaying, 100);
+    }
+
+    function afterPlaying() {
+        testExpected('video.paused', false);
+        endTest();
+    }
+    </script>
+    <style>
+    html, body, #spacer {
+        height: 100%;
+    }
+    video {
+        width: 600px;
+        height: 400px;
+    }
+    </style>
+</head>
+<body _onload_="go()">
+</body>
+</html>
\ No newline at end of file

Modified: branches/safari-602.1.32-branch/Source/WebCore/ChangeLog (201005 => 201006)


--- branches/safari-602.1.32-branch/Source/WebCore/ChangeLog	2016-05-17 08:47:03 UTC (rev 201005)
+++ branches/safari-602.1.32-branch/Source/WebCore/ChangeLog	2016-05-17 08:47:06 UTC (rev 201006)
@@ -1,5 +1,21 @@
 2016-05-17  Babak Shafiei  <[email protected]>
 
+        Merge r200688. rdar://problem/26013966
+
+    2016-05-11  Jer Noble  <[email protected]>
+
+            Videos allowed to play through the Main Content restriction should not pause when scrolled off-screen.
+            https://bugs.webkit.org/show_bug.cgi?id=157555
+
+            Reviewed by Eric Carlson.
+
+            Test: media/video-main-content-allow-then-scroll.html
+
+            * html/MediaElementSession.cpp:
+            (WebCore::isMainContent):
+
+2016-05-17  Babak Shafiei  <[email protected]>
+
         Merge r200803. rdar://problem/17779042
 
     2016-05-12  Myles C. Maxfield  <[email protected]>

Modified: branches/safari-602.1.32-branch/Source/WebCore/html/MediaElementSession.cpp (201005 => 201006)


--- branches/safari-602.1.32-branch/Source/WebCore/html/MediaElementSession.cpp	2016-05-17 08:47:03 UTC (rev 201005)
+++ branches/safari-602.1.32-branch/Source/WebCore/html/MediaElementSession.cpp	2016-05-17 08:47:06 UTC (rev 201006)
@@ -509,9 +509,13 @@
         return false;
 
     // Elements which are hidden by style, or have been scrolled out of view, cannot be main content.
+    // But elements which have audio & video and are already playing should not stop playing because
+    // they are scrolled off the page.
     if (renderer->style().visibility() != VISIBLE
-        || renderer->visibleInViewportState() != RenderElement::VisibleInViewport)
+        || (renderer->visibleInViewportState() != RenderElement::VisibleInViewport && !element.isPlaying())
+        ) {
         return false;
+    }
 
     // Main content elements must be in the main frame.
     Document& document = element.document();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to