Title: [269011] branches/safari-611.1.4-branch/Source/WebCore
Revision
269011
Author
[email protected]
Date
2020-10-26 18:13:10 -0700 (Mon, 26 Oct 2020)

Log Message

Cherry-pick r268816. rdar://problem/70702274

    A video element may fail to enter picture-in-picture from fullscreen
    https://bugs.webkit.org/show_bug.cgi?id=217999

    Reviewed by Eric Carlson.

    When a video element is entering picture-in-picture from fullscreen,
    WebKit should only fire the `webkitendfullscreenEvent` event, but should not
    request the player in the UI process to exit fullscreen(picture-in-picture).
    So the condition to decide sending the exit fullscreen request is wrong because
    HTMLMediaElement::didBecomeFullscreenElement(), which sets `m_waitingToEnterFullscreen`
    to false, might be called before dispatching the `webkitendfullscreenEvent` event.

    * html/HTMLMediaElement.cpp:
    (WebCore::HTMLMediaElement::dispatchEvent): Fix the condition.
    (WebCore::HTMLMediaElement::exitFullscreen): Set fullscreen mode to VideoFullscreenModeNone.

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

Modified Paths

Diff

Modified: branches/safari-611.1.4-branch/Source/WebCore/ChangeLog (269010 => 269011)


--- branches/safari-611.1.4-branch/Source/WebCore/ChangeLog	2020-10-27 01:13:07 UTC (rev 269010)
+++ branches/safari-611.1.4-branch/Source/WebCore/ChangeLog	2020-10-27 01:13:10 UTC (rev 269011)
@@ -1,5 +1,46 @@
 2020-10-26  Alan Coon  <[email protected]>
 
+        Cherry-pick r268816. rdar://problem/70702274
+
+    A video element may fail to enter picture-in-picture from fullscreen
+    https://bugs.webkit.org/show_bug.cgi?id=217999
+    
+    Reviewed by Eric Carlson.
+    
+    When a video element is entering picture-in-picture from fullscreen,
+    WebKit should only fire the `webkitendfullscreenEvent` event, but should not
+    request the player in the UI process to exit fullscreen(picture-in-picture).
+    So the condition to decide sending the exit fullscreen request is wrong because
+    HTMLMediaElement::didBecomeFullscreenElement(), which sets `m_waitingToEnterFullscreen`
+    to false, might be called before dispatching the `webkitendfullscreenEvent` event.
+    
+    * html/HTMLMediaElement.cpp:
+    (WebCore::HTMLMediaElement::dispatchEvent): Fix the condition.
+    (WebCore::HTMLMediaElement::exitFullscreen): Set fullscreen mode to VideoFullscreenModeNone.
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268816 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2020-10-21  Peng Liu  <[email protected]>
+
+            A video element may fail to enter picture-in-picture from fullscreen
+            https://bugs.webkit.org/show_bug.cgi?id=217999
+
+            Reviewed by Eric Carlson.
+
+            When a video element is entering picture-in-picture from fullscreen,
+            WebKit should only fire the `webkitendfullscreenEvent` event, but should not
+            request the player in the UI process to exit fullscreen(picture-in-picture).
+            So the condition to decide sending the exit fullscreen request is wrong because
+            HTMLMediaElement::didBecomeFullscreenElement(), which sets `m_waitingToEnterFullscreen`
+            to false, might be called before dispatching the `webkitendfullscreenEvent` event.
+
+            * html/HTMLMediaElement.cpp:
+            (WebCore::HTMLMediaElement::dispatchEvent): Fix the condition.
+            (WebCore::HTMLMediaElement::exitFullscreen): Set fullscreen mode to VideoFullscreenModeNone.
+
+2020-10-26  Alan Coon  <[email protected]>
+
         Cherry-pick r268800. rdar://problem/70702272
 
     REGRESSION(r266295): Range allows start and end containers to belong to different trees

Modified: branches/safari-611.1.4-branch/Source/WebCore/html/HTMLMediaElement.cpp (269010 => 269011)


--- branches/safari-611.1.4-branch/Source/WebCore/html/HTMLMediaElement.cpp	2020-10-27 01:13:07 UTC (rev 269010)
+++ branches/safari-611.1.4-branch/Source/WebCore/html/HTMLMediaElement.cpp	2020-10-27 01:13:10 UTC (rev 269011)
@@ -5740,10 +5740,8 @@
     // We need to fire the end fullscreen event to notify the page
     // to change the position/size back *before* exiting fullscreen.
     // Otherwise, the exit fullscreen animation will be incorrect.
-    if (!m_videoFullscreenStandby && !m_waitingToEnterFullscreen && event.type() == eventNames().webkitendfullscreenEvent) {
-        setFullscreenMode(VideoFullscreenModeNone);
+    if (!m_videoFullscreenStandby && m_videoFullscreenMode == VideoFullscreenModeNone && event.type() == eventNames().webkitendfullscreenEvent)
         document().page()->chrome().client().exitVideoFullscreenForVideoElement(downcast<HTMLVideoElement>(*this));
-    }
 }
 
 bool HTMLMediaElement::addEventListener(const AtomString& eventType, Ref<EventListener>&& listener, const AddEventListenerOptions& options)
@@ -6002,6 +6000,7 @@
         }
 
         if (oldVideoFullscreenMode == VideoFullscreenModeStandard) {
+            setFullscreenMode(VideoFullscreenModeNone);
             // The exit fullscreen request will be sent in dispatchEvent().
             scheduleEvent(eventNames().webkitendfullscreenEvent);
             return;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to