Title: [200688] trunk
- Revision
- 200688
- Author
- jer.no...@apple.com
- Date
- 2016-05-11 09:20:20 -0700 (Wed, 11 May 2016)
Log Message
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.
Source/WebCore:
Test: media/video-main-content-allow-then-scroll.html
* html/MediaElementSession.cpp:
(WebCore::isMainContent):
LayoutTests:
* media/video-main-content-allow-then-scroll-expected.txt: Added.
* media/video-main-content-allow-then-scroll.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (200687 => 200688)
--- trunk/LayoutTests/ChangeLog 2016-05-11 16:18:41 UTC (rev 200687)
+++ trunk/LayoutTests/ChangeLog 2016-05-11 16:20:20 UTC (rev 200688)
@@ -1,3 +1,13 @@
+2016-05-11 Jer Noble <jer.no...@apple.com>
+
+ 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-11 Pranjal Jumde <pju...@apple.com>
Sites served over insecure connections should not be allowed to use geolocation.
Added: trunk/LayoutTests/media/video-main-content-allow-then-scroll-expected.txt (0 => 200688)
--- trunk/LayoutTests/media/video-main-content-allow-then-scroll-expected.txt (rev 0)
+++ trunk/LayoutTests/media/video-main-content-allow-then-scroll-expected.txt 2016-05-11 16:20:20 UTC (rev 200688)
@@ -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: trunk/LayoutTests/media/video-main-content-allow-then-scroll.html (0 => 200688)
--- trunk/LayoutTests/media/video-main-content-allow-then-scroll.html (rev 0)
+++ trunk/LayoutTests/media/video-main-content-allow-then-scroll.html 2016-05-11 16:20:20 UTC (rev 200688)
@@ -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: trunk/Source/WebCore/ChangeLog (200687 => 200688)
--- trunk/Source/WebCore/ChangeLog 2016-05-11 16:18:41 UTC (rev 200687)
+++ trunk/Source/WebCore/ChangeLog 2016-05-11 16:20:20 UTC (rev 200688)
@@ -1,3 +1,15 @@
+2016-05-11 Jer Noble <jer.no...@apple.com>
+
+ 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-11 Fujii Hironori <hironori.fu...@sony.com>
[curl] curl_easy_setopt(CURLOPT_CONNECT_ONLY) should take a long parameter
Modified: trunk/Source/WebCore/html/MediaElementSession.cpp (200687 => 200688)
--- trunk/Source/WebCore/html/MediaElementSession.cpp 2016-05-11 16:18:41 UTC (rev 200687)
+++ trunk/Source/WebCore/html/MediaElementSession.cpp 2016-05-11 16:20:20 UTC (rev 200688)
@@ -511,9 +511,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
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes