[Extra zoom mode] Block playback until fullscreen begins
authoreric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 6 Apr 2018 23:26:03 +0000 (23:26 +0000)
committereric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 6 Apr 2018 23:26:03 +0000 (23:26 +0000)
https://bugs.webkit.org/show_bug.cgi?id=184371
<rdar://problem/39250891>

Reviewed by Youenn Fablet.

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::updatePlayState): Return early when waiting to enter fullscreen.
(WebCore::HTMLMediaElement::enterFullscreen): Set m_waitingToEnterFullscreen.
(WebCore::HTMLMediaElement::exitFullscreen): Clear m_waitingToEnterFullscreen.
(WebCore::HTMLMediaElement::didBecomeFullscreenElement): Ditto.
* html/HTMLMediaElement.h:

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

Source/WebCore/ChangeLog
Source/WebCore/html/HTMLMediaElement.cpp
Source/WebCore/html/HTMLMediaElement.h

index 65d0507f85d75098318f0c6b2bb97319f63fd7ef..061b7beb7aeede2f18f9bc2aa029ae7897ef4378 100644 (file)
@@ -1,3 +1,18 @@
+2018-04-06  Eric Carlson  <eric.carlson@apple.com>
+
+        [Extra zoom mode] Block playback until fullscreen begins
+        https://bugs.webkit.org/show_bug.cgi?id=184371
+        <rdar://problem/39250891>
+
+        Reviewed by Youenn Fablet.
+
+        * html/HTMLMediaElement.cpp:
+        (WebCore::HTMLMediaElement::updatePlayState): Return early when waiting to enter fullscreen.
+        (WebCore::HTMLMediaElement::enterFullscreen): Set m_waitingToEnterFullscreen.
+        (WebCore::HTMLMediaElement::exitFullscreen): Clear m_waitingToEnterFullscreen.
+        (WebCore::HTMLMediaElement::didBecomeFullscreenElement): Ditto.
+        * html/HTMLMediaElement.h:
+
 2018-04-06  Brent Fulgham  <bfulgham@apple.com>
 
         WebCore::screenSupportsExtendedColor improperly calls NSScreen functions in the WebContent process
index 66a93fddbe6ee136fdee27d3969de7afd6a95906..8aa0f038c0270103a090d8dd47d94a8696f551d4 100644 (file)
@@ -5262,8 +5262,10 @@ void HTMLMediaElement::updatePlayState(UpdateState updateState)
 
     INFO_LOG(LOGIDENTIFIER, "shouldBePlaying = ", shouldBePlaying, ", playerPaused = ", playerPaused);
 
-    if (shouldBePlaying && playerPaused && m_mediaSession->requiresFullscreenForVideoPlayback(*this) && !isFullscreen()) {
-        enterFullscreen();
+    if (shouldBePlaying && playerPaused && m_mediaSession->requiresFullscreenForVideoPlayback(*this) && (m_waitingToEnterFullscreen || !isFullscreen())) {
+        if (!m_waitingToEnterFullscreen)
+            enterFullscreen();
+
 #if ENABLE(EXTRA_ZOOM_MODE)
         // FIXME: Investigate doing this for all builds.
         return;
@@ -5842,6 +5844,7 @@ void HTMLMediaElement::enterFullscreen(VideoFullscreenMode mode)
         return;
 
     m_temporarilyAllowingInlinePlaybackAfterFullscreen = false;
+    m_waitingToEnterFullscreen = true;
 
 #if ENABLE(FULLSCREEN_API)
     if (document().settings().fullScreenEnabled()) {
@@ -5884,6 +5887,8 @@ void HTMLMediaElement::exitFullscreen()
 {
     INFO_LOG(LOGIDENTIFIER);
 
+    m_waitingToEnterFullscreen = false;
+
 #if ENABLE(FULLSCREEN_API)
     if (document().settings().fullScreenEnabled() && document().webkitCurrentFullScreenElement() == this) {
         if (document().webkitIsFullScreen())
@@ -5977,6 +5982,7 @@ void HTMLMediaElement::willBecomeFullscreenElement()
 
 void HTMLMediaElement::didBecomeFullscreenElement()
 {
+    m_waitingToEnterFullscreen = false;
     if (hasMediaControls())
         mediaControls()->enteredFullscreen();
     updatePlayState(UpdateState::Asynchronously);
index a3245803600b3771b9ce7262b7cc8f9d3308113f..5cf4d08fef5b68ad25fcc2c4b6ee19fde316e602 100644 (file)
@@ -1074,6 +1074,7 @@ private:
 #endif
 
     bool m_isScrubbingRemotely : 1;
+    bool m_waitingToEnterFullscreen : 1;
 
 #if ENABLE(VIDEO_TRACK)
     bool m_tracksAreReady : 1;