REGRESSION (231817): Videos permanently blank out after switching out of a tab and...
authorjer.noble@apple.com <jer.noble@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 6 Jun 2018 04:25:48 +0000 (04:25 +0000)
committerjer.noble@apple.com <jer.noble@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 6 Jun 2018 04:25:48 +0000 (04:25 +0000)
https://bugs.webkit.org/show_bug.cgi?id=186326
<rdar://problem/40778157>

Reviewed by Eric Carlson.

Source/WebCore:

Check whether the element is visible in the viewport when the web view itself becomes visible, and if so, clear the m_elementIsHiddenUntilVisibleInViewport flag.

* html/MediaElementSession.cpp:
(WebCore::MediaElementSession::visibilityChanged):
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:

LayoutTests:

* media/video-buffering-allowed-expected.txt:
* media/video-buffering-allowed.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@232534 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/media/video-buffering-allowed-expected.txt
LayoutTests/media/video-buffering-allowed.html
Source/WebCore/ChangeLog
Source/WebCore/html/MediaElementSession.cpp

index cfa8b79..b0ecbda 100644 (file)
@@ -1,3 +1,14 @@
+2018-06-05  Jer Noble  <jer.noble@apple.com>
+
+        REGRESSION (231817): Videos permanently blank out after switching out of a tab and back in
+        https://bugs.webkit.org/show_bug.cgi?id=186326
+        <rdar://problem/40778157>
+
+        Reviewed by Eric Carlson.
+
+        * media/video-buffering-allowed-expected.txt:
+        * media/video-buffering-allowed.html:
+
 2018-06-05  Wenson Hsieh  <wenson_hsieh@apple.com>
 
         [macOS] Spelling errors in the middle of an inserted paragraph are not displayed
index 1da49de..ff3c0f3 100644 (file)
@@ -16,6 +16,12 @@ EXPECTED (internals.elementShouldBufferData(video) == 'true') OK
 * Re-insert the video element into the document.
 RUN(document.body.insertBefore(video, document.body.firstChild))
 EXPECTED (internals.elementShouldBufferData(video) == 'true') OK
+* Simulate the view becoming invisible.
+RUN(internals.setPageVisibility(false))
+EXPECTED (internals.elementShouldBufferData(video) == 'false') OK
+* Simulate the view becoming visible.
+RUN(internals.setPageVisibility(true))
+EXPECTED (internals.elementShouldBufferData(video) == 'true') OK
 * display:none the video element.
 RUN(video.style.display = "none")
 EXPECTED (internals.elementShouldBufferData(video) == 'true') OK
index 6fbbe15..a028380 100644 (file)
             run('document.body.insertBefore(video, document.body.firstChild)');
             await testExpectedEventually('internals.elementShouldBufferData(video)', true);
 
+            consoleWrite('* Simulate the view becoming invisible.');
+            run('internals.setPageVisibility(false)');
+            await testExpectedEventually('internals.elementShouldBufferData(video)', false);
+
+            consoleWrite('* Simulate the view becoming visible.');
+            run('internals.setPageVisibility(true)');
+            await testExpectedEventually('internals.elementShouldBufferData(video)', true);
+
             consoleWrite('* display:none the video element.');
             run('video.style.display = "none"');
             await testExpectedEventually('internals.elementShouldBufferData(video)', true);
index 204e21a..136d38e 100644 (file)
@@ -1,3 +1,17 @@
+2018-06-05  Jer Noble  <jer.noble@apple.com>
+
+        REGRESSION (231817): Videos permanently blank out after switching out of a tab and back in
+        https://bugs.webkit.org/show_bug.cgi?id=186326
+        <rdar://problem/40778157>
+
+        Reviewed by Eric Carlson.
+
+        Check whether the element is visible in the viewport when the web view itself becomes visible, and if so, clear the m_elementIsHiddenUntilVisibleInViewport flag.
+
+        * html/MediaElementSession.cpp:
+        (WebCore::MediaElementSession::visibilityChanged):
+        * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
+
 2018-06-05  Zalan Bujtas  <zalan@apple.com>
 
         [LFC] Move inflow, replaced width and margin computation to a dedicated function.
index 8314e1e..469145f 100644 (file)
@@ -167,6 +167,8 @@ void MediaElementSession::visibilityChanged()
 
     if (m_element.elementIsHidden() && !m_element.isFullscreen())
         m_elementIsHiddenUntilVisibleInViewport = true;
+    else if (m_element.isVisibleInViewport())
+        m_elementIsHiddenUntilVisibleInViewport = false;
 }
 
 void MediaElementSession::isVisibleInViewportChanged()