Title: [212528] branches/safari-603-branch

Diff

Modified: branches/safari-603-branch/LayoutTests/ChangeLog (212527 => 212528)


--- branches/safari-603-branch/LayoutTests/ChangeLog	2017-02-17 05:28:07 UTC (rev 212527)
+++ branches/safari-603-branch/LayoutTests/ChangeLog	2017-02-17 05:28:11 UTC (rev 212528)
@@ -1,5 +1,23 @@
 2017-02-16  Matthew Hanson  <matthew_han...@apple.com>
 
+        Merge r212314. rdar://problem/27685077
+
+    2017-02-14  Jeremy Jones  <jere...@apple.com>
+
+            When playing inline after fullscreen, set a flag instead of adding attribute plays inline, and use in requiresFullscreenForVideoPlayback.
+            https://bugs.webkit.org/show_bug.cgi?id=167815
+            rdar://problem/27685077
+
+            Reviewed by Jer Noble.
+
+            Add a new test that tests inline after fullscreen behavior of looping video.
+
+            * media/media-fullscreen-loop-inline-expected.txt: Added.
+            * media/media-fullscreen-loop-inline.html: Added.
+            * platform/mac-wk2/TestExpectations: Skipped on webkit2.
+
+2017-02-16  Matthew Hanson  <matthew_han...@apple.com>
+
         Merge r212301. rdar://problem/30494674
 
     2017-02-13  Filip Pizlo  <fpi...@apple.com>

Added: branches/safari-603-branch/LayoutTests/media/media-fullscreen-loop-inline-expected.txt (0 => 212528)


--- branches/safari-603-branch/LayoutTests/media/media-fullscreen-loop-inline-expected.txt	                        (rev 0)
+++ branches/safari-603-branch/LayoutTests/media/media-fullscreen-loop-inline-expected.txt	2017-02-17 05:28:11 UTC (rev 212528)
@@ -0,0 +1,20 @@
+
+RUN(internals.settings.setAllowsInlineMediaPlayback(false))
+RUN(internals.settings.setAllowsInlineMediaPlaybackAfterFullscreen(true))
+RUN(internals.settings.setFullScreenEnabled(false))
+RUN(internals.setMediaElementRestrictions(video, "NoRestrictions"))
+RUN(video.loop = true)
+RUN(video.src = "" "content/test"))
+RUN(video.play())
+EVENT(webkitbeginfullscreen)
+RUN(video.currentTime = 5)
+RUN(video.webkitExitFullscreen())
+EVENT(webkitendfullscreen)
+EXPECTED (video.paused == 'false') OK
+RUN(video._ontimeupdate_ = timeupdate)
+RUN(video._ontimeupdate_ = null)
+Looped
+EXPECTED (video.playsInline == 'false') OK
+EXPECTED (video.paused == 'false') OK
+END OF TEST
+

Added: branches/safari-603-branch/LayoutTests/media/media-fullscreen-loop-inline.html (0 => 212528)


--- branches/safari-603-branch/LayoutTests/media/media-fullscreen-loop-inline.html	                        (rev 0)
+++ branches/safari-603-branch/LayoutTests/media/media-fullscreen-loop-inline.html	2017-02-17 05:28:11 UTC (rev 212528)
@@ -0,0 +1,57 @@
+<!DOCTYPE html><!-- webkit-test-runner [ enableModernMediaControls=false ] -->
+<html>
+<head>
+    <title>media-fullscreen-return-to-inline</title>
+
+    <script src=""
+    <script src=""
+
+    <script>
+    function go()
+    {
+        findMediaElement();
+        run('internals.settings.setAllowsInlineMediaPlayback(false)');
+        run('internals.settings.setAllowsInlineMediaPlaybackAfterFullscreen(true)');
+        run('internals.settings.setFullScreenEnabled(false)');
+        run('internals.setMediaElementRestrictions(video, "NoRestrictions")');
+        run('video.loop = true');
+        run('video.src = "" "content/test")');
+        waitForEventOnce('webkitbeginfullscreen', beginfullscreen);
+        run('video.play()');
+    }
+
+    function beginfullscreen()
+    {
+        run('video.currentTime = 5');
+        run('video.webkitExitFullscreen()');
+        waitForEventOnce('webkitendfullscreen', endfullscreen);
+    }
+
+    function endfullscreen()
+    {
+        testExpected('video.paused', false);
+        run('video._ontimeupdate_ = timeupdate');
+        waitForEventAndFail('webkitbeginfullscreen');
+    }
+
+    function timeupdate()
+    {
+        if (video.currentTime == 0) {
+            run('video._ontimeupdate_ = null');
+            consoleWrite("Looped");
+            testExpected('video.playsInline', false);
+            setTimeout(function loopCompleted() {
+               testExpected('video.paused', false);
+               endTest();
+            }, 0);
+        }
+    }
+
+    </script>
+
+</head>
+
+<body _onload_="go()">
+    <video controls></video>
+</body>
+</html>

Modified: branches/safari-603-branch/LayoutTests/platform/mac-wk2/TestExpectations (212527 => 212528)


--- branches/safari-603-branch/LayoutTests/platform/mac-wk2/TestExpectations	2017-02-17 05:28:07 UTC (rev 212527)
+++ branches/safari-603-branch/LayoutTests/platform/mac-wk2/TestExpectations	2017-02-17 05:28:11 UTC (rev 212528)
@@ -319,6 +319,9 @@
 
 webkit.org/b/156077 inspector/heap/getRemoteObject.html [ Pass Failure ]
 
+# Video fullscreen is not implemented for mac wk2 in webkittestrunner
+media/media-fullscreen-loop-inline.html [ Skip ]
+
 ### END OF (1) Classified failures with bug reports
 ########################################
 

Modified: branches/safari-603-branch/Source/WebCore/ChangeLog (212527 => 212528)


--- branches/safari-603-branch/Source/WebCore/ChangeLog	2017-02-17 05:28:07 UTC (rev 212527)
+++ branches/safari-603-branch/Source/WebCore/ChangeLog	2017-02-17 05:28:11 UTC (rev 212528)
@@ -1,5 +1,31 @@
 2017-02-16  Matthew Hanson  <matthew_han...@apple.com>
 
+        Merge r212314. rdar://problem/27685077
+
+    2017-02-14  Jeremy Jones  <jere...@apple.com>
+
+            When playing inline after fullscreen, set a flag instead of adding attribute plays inline, and use in requiresFullscreenForVideoPlayback.
+            https://bugs.webkit.org/show_bug.cgi?id=167815
+            rdar://problem/27685077
+
+            Reviewed by Jer Noble.
+
+            Test: media/media-fullscreen-loop-inline.html
+
+            When video is allowed to play inline after fullscreen. Looped video causes play state to update, which can send video back to fullscreen when
+            allowsInline is false. This change will set a new flag when allowsInlineMediaPlaybackAfterFullscreen allows inline playback that can be tested
+            in requiresFullscreenForVideoPlayback to prevent sending video back into fullscreen when video loops.
+
+            * html/HTMLMediaElement.cpp:
+            (WebCore::HTMLMediaElement::enterFullscreen):
+            (WebCore::HTMLMediaElement::exitFullscreen):
+            * html/HTMLMediaElement.h:
+            (WebCore::HTMLMediaElement::isTemporarilyAllowingInlinePlaybackAfterFullscreen): Added.
+            * html/MediaElementSession.cpp:
+            (WebCore::MediaElementSession::requiresFullscreenForVideoPlayback):
+
+2017-02-16  Matthew Hanson  <matthew_han...@apple.com>
+
         Merge r212301. rdar://problem/30494674
 
     2017-02-13  Filip Pizlo  <fpi...@apple.com>

Modified: branches/safari-603-branch/Source/WebCore/html/HTMLMediaElement.cpp (212527 => 212528)


--- branches/safari-603-branch/Source/WebCore/html/HTMLMediaElement.cpp	2017-02-17 05:28:07 UTC (rev 212527)
+++ branches/safari-603-branch/Source/WebCore/html/HTMLMediaElement.cpp	2017-02-17 05:28:11 UTC (rev 212528)
@@ -5418,6 +5418,8 @@
     if (m_videoFullscreenMode == mode)
         return;
 
+    m_temporarilyAllowingInlinePlaybackAfterFullscreen = false;
+
 #if ENABLE(FULLSCREEN_API)
     if (document().settings()->fullScreenEnabled()) {
         if (mode == VideoFullscreenModeStandard) {
@@ -5481,9 +5483,9 @@
         if (!document().settings() || !document().settings()->allowsInlineMediaPlaybackAfterFullscreen() || isVideoTooSmallForInlinePlayback())
             pauseInternal();
         else {
-            // Allow inline playback, but set 'playsinline' so pausing and starting again (e.g. when scrubbing) won't go back to fullscreen.
+            // Allow inline playback, but set a flag so pausing and starting again (e.g. when scrubbing or looping) won't go back to fullscreen.
             // Also set the controls attribute so the user will be able to control playback.
-            setBooleanAttribute(HTMLNames::playsinlineAttr, true);
+            m_temporarilyAllowingInlinePlaybackAfterFullscreen = true;
             setControls(true);
         }
     }

Modified: branches/safari-603-branch/Source/WebCore/html/HTMLMediaElement.h (212527 => 212528)


--- branches/safari-603-branch/Source/WebCore/html/HTMLMediaElement.h	2017-02-17 05:28:07 UTC (rev 212527)
+++ branches/safari-603-branch/Source/WebCore/html/HTMLMediaElement.h	2017-02-17 05:28:11 UTC (rev 212528)
@@ -485,6 +485,8 @@
 
     double playbackStartedTime() const { return m_playbackStartedTime; }
 
+    bool isTemporarilyAllowingInlinePlaybackAfterFullscreen() const {return m_temporarilyAllowingInlinePlaybackAfterFullscreen; }
+
 protected:
     HTMLMediaElement(const QualifiedName&, Document&, bool createdByParser);
     virtual ~HTMLMediaElement();
@@ -883,6 +885,8 @@
     bool m_preparedForInline;
     std::function<void()> m_preparedForInlineCompletionHandler;
 
+    bool m_temporarilyAllowingInlinePlaybackAfterFullscreen { false };
+
 #if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
     RetainPtr<PlatformLayer> m_videoFullscreenLayer;
     FloatRect m_videoFullscreenFrame;

Modified: branches/safari-603-branch/Source/WebCore/html/MediaElementSession.cpp (212527 => 212528)


--- branches/safari-603-branch/Source/WebCore/html/MediaElementSession.cpp	2017-02-17 05:28:07 UTC (rev 212527)
+++ branches/safari-603-branch/Source/WebCore/html/MediaElementSession.cpp	2017-02-17 05:28:11 UTC (rev 212528)
@@ -545,6 +545,9 @@
     if (!settings || !settings->allowsInlineMediaPlayback())
         return true;
 
+    if (element.isTemporarilyAllowingInlinePlaybackAfterFullscreen())
+        return false;
+
     if (!settings->inlineMediaPlaybackRequiresPlaysInlineAttribute())
         return false;
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to