Title: [266728] trunk/Source
Revision
266728
Author
[email protected]
Date
2020-09-08 10:38:25 -0700 (Tue, 08 Sep 2020)

Log Message

Clean up functions and state variables related to the picture-in-picture implementation
https://bugs.webkit.org/show_bug.cgi?id=215972

Reviewed by Jer Noble.

Source/WebCore:

This patch cleans up variables and functions related to changing video presentation mode
in HTMLVideoElement and HTMLMediaElement. It cleans up some event-related code as well.

This patch also simplifies the process of entering the picture-in-picture mode.
The XPC message VideoFullscreenManagerProxy::DidEnterFullscreen from the UI process
will provide the picture-in-picture window size if the video is entering picture-in-picture,
so that we can get rid of the intermediate state (waiting for the initial picture-in-picture
window frame).

With this patch, all presentation mode change requests need to go through the HTMLVideoElement.
Normally, video presentation mode change requests come from the web process where a page
calls the fullscreen/picture-in-picture API or a user interacts with the modern media controls.
However, through gestures, the UI process may request to change the presentation mode
(e.g., from fullscreen to picture-in-picture). The web process side will be like a dry run
because the tasks in the UI process are mostly completed before the web process receives
the request. The motivation to do that is to guarantee correct events are fired.
All scenarios sharing the same code path also help us avoid regressions because we don't
have a good way to create regression tests for the scenarios where presentation mode change
requests come from the UI process.

Covered by existing tests.

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::dispatchEvent):
(WebCore::HTMLMediaElement::enterFullscreen):
(WebCore::HTMLMediaElement::exitFullscreen):
(WebCore::HTMLMediaElement::setVideoFullscreenStandby):
(WebCore::HTMLMediaElement::willBecomeFullscreenElement):
Simplify the implementation.
(WebCore::HTMLMediaElement::willStopBeingFullscreenElement):
(WebCore::HTMLMediaElement::isVideoLayerInline):
(WebCore::HTMLMediaElement::setVideoFullscreenFrame):
(WebCore::HTMLMediaElement::setFullscreenMode):
Delete function HTMLVideoElement::fullscreenModeChanged() and move its code
to this function.
(WebCore::HTMLMediaElement::fullscreenModeChanged): Deleted.

* html/HTMLMediaElement.h:
(WebCore::HTMLMediaElement::fullscreenMode const):
Replace fullscreenModeChanged() with a private function setFullscreenMode().
Change "void setVideoFullscreenFrame(FloatRect)" to "void setVideoFullscreenFrame(const FloatRect&)".

* html/HTMLVideoElement.cpp:
(WebCore::HTMLVideoElement::webkitDisplayingFullscreen):
(WebCore::HTMLVideoElement::toPresentationMode):
(WebCore::HTMLVideoElement::webkitSetPresentationMode):
(WebCore::HTMLVideoElement::setPresentationMode):
(WebCore::HTMLVideoElement::didEnterFullscreenOrPictureInPicture):
(WebCore::HTMLVideoElement::didExitFullscreenOrPictureInPicture):
(WebCore::HTMLVideoElement::didBecomeFullscreenElement):
(WebCore::HTMLVideoElement::setVideoFullscreenFrame):
(WebCore::toPresentationMode): Deleted.
(WebCore::HTMLVideoElement::setFullscreenMode): Deleted.
(WebCore::HTMLVideoElement::fullscreenModeChanged): Deleted.
(WebCore::HTMLVideoElement::didStopBeingFullscreenElement): Deleted.
* html/HTMLVideoElement.h:
Only HTMLVIdeoElement::setPresentationMode() can be used by other modules (PlaybackSessionManager
or VideoFullscreenManager) to change the video presentation mode.
This patch defines different callbacks regarding the fullscreen mode change transition
for FullscreenManager and VideoFullscreenManager.
- didBecomeFullscreenElement for FullscreenManager.
- didEnterFullscreenOrPictureInPicture and didExitFullscreenOrPictureInPicture for
VideoFullscreenManager.
This patch removes m_isWaitingForPictureInPictureWindowFrame and renames m_isChangingPresentationMode
to m_isChangingVideoFullscreenMode.

* platform/cocoa/PlaybackSessionModelMediaElement.mm:
(WebCore::PlaybackSessionModelMediaElement::togglePictureInPicture):

* platform/cocoa/VideoFullscreenChangeObserver.h:

* platform/cocoa/VideoFullscreenModelVideoElement.mm:
(WebCore::VideoFullscreenModelVideoElement::requestFullscreenMode):
(WebCore::VideoFullscreenModelVideoElement::fullscreenModeChanged):
(WebCore::VideoFullscreenModelVideoElement::setHasVideo):
(WebCore::VideoFullscreenModelVideoElement::setVideoDimensions):
(WebCore::VideoFullscreenModelVideoElement::willEnterPictureInPicture):
(WebCore::VideoFullscreenModelVideoElement::didEnterPictureInPicture):
(WebCore::VideoFullscreenModelVideoElement::failedToEnterPictureInPicture):
(WebCore::VideoFullscreenModelVideoElement::willExitPictureInPicture):
(WebCore::VideoFullscreenModelVideoElement::didExitPictureInPicture):
Iterate a copy of the HashSet of VideoFullscreenModelClient pointers because a callback may
remove the client itself during the iteration.

* platform/ios/VideoFullscreenInterfaceAVKit.h:
* platform/ios/VideoFullscreenInterfaceAVKit.mm:
(-[WebAVPlayerLayer calculateTargetVideoFrame]):
(-[WebAVPlayerLayer layoutSublayers]):
(WebAVPlayerLayerView_startRoutingVideoToPictureInPicturePlayerLayerView):
(VideoFullscreenInterfaceAVKit::cleanupFullscreen):
(VideoFullscreenInterfaceAVKit::didStartPictureInPicture):
(VideoFullscreenInterfaceAVKit::failedToStartPictureInPicture):
(VideoFullscreenInterfaceAVKit::doSetup):
(VideoFullscreenInterfaceAVKit::doEnterFullscreen):
(VideoFullscreenInterfaceAVKit::willEnterStandbyFromPictureInPicture): Deleted.
(VideoFullscreenInterfaceAVKit::setWillEnterStandbyFromPictureInPicture): Deleted.
Add a property isPictureInPicture to WebAVPlayerLayer, which will set to YES if
a layer is created for picture-in-picture.
This property is used in -[WebAVPlayerLayer layoutSublayers] to skip
the unnecessary calculation of "targetVideoFrame" because the PiP window will
always have the same aspect ratio as the video content, so we can set
"targetVideoFrame" to be the bounds of the layer. Moreover, the calculation may
lead to rounding errors for some numbers and the errors may trigger unnecessary
picture-in-picture window resize events.

* platform/ios/WebVideoFullscreenControllerAVKit.mm:
This file has been moved to WebCore so we don't need to include WebCore headers
in a way like "#include <WebCore/XXX.h>".

* platform/mac/VideoFullscreenInterfaceMac.mm:
(-[WebVideoFullscreenInterfaceMacObjC enterPIP]):
(-[WebVideoFullscreenInterfaceMacObjC boundsDidChangeForVideoViewContainer:]):
(WebCore::VideoFullscreenInterfaceMac::enterFullscreen):
Add PIPState::EnteringPIP. Notify the observer that the video has entered
picture-in-picture after the PiP window size is finalized.

Source/WebKit:

This patch adds an optional FloatSize parameter to the VideoFullscreenManager::DidEnterFullscreen message.
Also, it enables the picture-in-picture and fullscreen events when a video element enters picture-in-picture
from the fullscreen mode.

* UIProcess/Cocoa/VideoFullscreenManagerProxy.h:
* UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
(WebKit::VideoFullscreenModelContext::didEnterFullscreen):
(WebKit::VideoFullscreenModelContext::prepareToExitFullscreen):
(WebKit::VideoFullscreenModelContext::willEnterPictureInPicture):
(WebKit::VideoFullscreenModelContext::didEnterPictureInPicture):
(WebKit::VideoFullscreenModelContext::failedToEnterPictureInPicture):
(WebKit::VideoFullscreenModelContext::willExitPictureInPicture):
(WebKit::VideoFullscreenModelContext::didExitPictureInPicture):
(WebKit::VideoFullscreenManagerProxy::ensureClientForContext):
(WebKit::VideoFullscreenManagerProxy::setupFullscreenWithID):
(WebKit::VideoFullscreenManagerProxy::enterFullscreen):
(WebKit::VideoFullscreenManagerProxy::didEnterFullscreen):
Use ensureClientForContext() instead of addClientForContext() in setupFullscreenWithID()
to avoid leaking VideoFullscreenInterfaceAVKit instances.
Iterate a copy of the HashSet of VideoFullscreenModelClient pointers because a callback may
remove the client itself during the iteration.

* UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm:
(-[WKFullScreenWindowController prepareToExitPictureInPicture]):
* UIProcess/mac/WKFullScreenWindowController.h:
* UIProcess/mac/WKFullScreenWindowController.mm:
(-[WKFullScreenWindowController didExitPictureInPicture]):
Fix leaking of VideoFullscreenInterfaceMac.

* WebProcess/cocoa/VideoFullscreenManager.h:
* WebProcess/cocoa/VideoFullscreenManager.messages.in:
* WebProcess/cocoa/VideoFullscreenManager.mm:
(WebKit::VideoFullscreenManager::fullscreenModeChanged):
We need to change the fullscreen mode in the VideoFullscreenInterfaceContext instance as well.
(WebKit::VideoFullscreenManager::didEnterFullscreen):
(WebKit::VideoFullscreenManager::didCleanupFullscreen):
Call didExitFullscreenOrPictureInPicture() instead of didStopBeingFullscreenElement(), which
is for the FullscreenManager.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (266727 => 266728)


--- trunk/Source/WebCore/ChangeLog	2020-09-08 16:46:23 UTC (rev 266727)
+++ trunk/Source/WebCore/ChangeLog	2020-09-08 17:38:25 UTC (rev 266728)
@@ -1,3 +1,126 @@
+2020-09-08  Peng Liu  <[email protected]>
+
+        Clean up functions and state variables related to the picture-in-picture implementation
+        https://bugs.webkit.org/show_bug.cgi?id=215972
+
+        Reviewed by Jer Noble.
+
+        This patch cleans up variables and functions related to changing video presentation mode
+        in HTMLVideoElement and HTMLMediaElement. It cleans up some event-related code as well.
+
+        This patch also simplifies the process of entering the picture-in-picture mode.
+        The XPC message VideoFullscreenManagerProxy::DidEnterFullscreen from the UI process
+        will provide the picture-in-picture window size if the video is entering picture-in-picture,
+        so that we can get rid of the intermediate state (waiting for the initial picture-in-picture
+        window frame).
+
+        With this patch, all presentation mode change requests need to go through the HTMLVideoElement.
+        Normally, video presentation mode change requests come from the web process where a page
+        calls the fullscreen/picture-in-picture API or a user interacts with the modern media controls.
+        However, through gestures, the UI process may request to change the presentation mode
+        (e.g., from fullscreen to picture-in-picture). The web process side will be like a dry run
+        because the tasks in the UI process are mostly completed before the web process receives
+        the request. The motivation to do that is to guarantee correct events are fired.
+        All scenarios sharing the same code path also help us avoid regressions because we don't
+        have a good way to create regression tests for the scenarios where presentation mode change
+        requests come from the UI process.
+
+        Covered by existing tests.
+
+        * html/HTMLMediaElement.cpp:
+        (WebCore::HTMLMediaElement::dispatchEvent):
+        (WebCore::HTMLMediaElement::enterFullscreen):
+        (WebCore::HTMLMediaElement::exitFullscreen):
+        (WebCore::HTMLMediaElement::setVideoFullscreenStandby):
+        (WebCore::HTMLMediaElement::willBecomeFullscreenElement):
+        Simplify the implementation.
+        (WebCore::HTMLMediaElement::willStopBeingFullscreenElement):
+        (WebCore::HTMLMediaElement::isVideoLayerInline):
+        (WebCore::HTMLMediaElement::setVideoFullscreenFrame):
+        (WebCore::HTMLMediaElement::setFullscreenMode):
+        Delete function HTMLVideoElement::fullscreenModeChanged() and move its code
+        to this function.
+        (WebCore::HTMLMediaElement::fullscreenModeChanged): Deleted.
+
+        * html/HTMLMediaElement.h:
+        (WebCore::HTMLMediaElement::fullscreenMode const):
+        Replace fullscreenModeChanged() with a private function setFullscreenMode().
+        Change "void setVideoFullscreenFrame(FloatRect)" to "void setVideoFullscreenFrame(const FloatRect&)".
+
+        * html/HTMLVideoElement.cpp:
+        (WebCore::HTMLVideoElement::webkitDisplayingFullscreen):
+        (WebCore::HTMLVideoElement::toPresentationMode):
+        (WebCore::HTMLVideoElement::webkitSetPresentationMode):
+        (WebCore::HTMLVideoElement::setPresentationMode):
+        (WebCore::HTMLVideoElement::didEnterFullscreenOrPictureInPicture):
+        (WebCore::HTMLVideoElement::didExitFullscreenOrPictureInPicture):
+        (WebCore::HTMLVideoElement::didBecomeFullscreenElement):
+        (WebCore::HTMLVideoElement::setVideoFullscreenFrame):
+        (WebCore::toPresentationMode): Deleted.
+        (WebCore::HTMLVideoElement::setFullscreenMode): Deleted.
+        (WebCore::HTMLVideoElement::fullscreenModeChanged): Deleted.
+        (WebCore::HTMLVideoElement::didStopBeingFullscreenElement): Deleted.
+        * html/HTMLVideoElement.h:
+        Only HTMLVIdeoElement::setPresentationMode() can be used by other modules (PlaybackSessionManager
+        or VideoFullscreenManager) to change the video presentation mode.
+        This patch defines different callbacks regarding the fullscreen mode change transition
+        for FullscreenManager and VideoFullscreenManager.
+        - didBecomeFullscreenElement for FullscreenManager.
+        - didEnterFullscreenOrPictureInPicture and didExitFullscreenOrPictureInPicture for
+        VideoFullscreenManager.
+        This patch removes m_isWaitingForPictureInPictureWindowFrame and renames m_isChangingPresentationMode
+        to m_isChangingVideoFullscreenMode.
+
+        * platform/cocoa/PlaybackSessionModelMediaElement.mm:
+        (WebCore::PlaybackSessionModelMediaElement::togglePictureInPicture):
+
+        * platform/cocoa/VideoFullscreenChangeObserver.h:
+
+        * platform/cocoa/VideoFullscreenModelVideoElement.mm:
+        (WebCore::VideoFullscreenModelVideoElement::requestFullscreenMode):
+        (WebCore::VideoFullscreenModelVideoElement::fullscreenModeChanged):
+        (WebCore::VideoFullscreenModelVideoElement::setHasVideo):
+        (WebCore::VideoFullscreenModelVideoElement::setVideoDimensions):
+        (WebCore::VideoFullscreenModelVideoElement::willEnterPictureInPicture):
+        (WebCore::VideoFullscreenModelVideoElement::didEnterPictureInPicture):
+        (WebCore::VideoFullscreenModelVideoElement::failedToEnterPictureInPicture):
+        (WebCore::VideoFullscreenModelVideoElement::willExitPictureInPicture):
+        (WebCore::VideoFullscreenModelVideoElement::didExitPictureInPicture):
+        Iterate a copy of the HashSet of VideoFullscreenModelClient pointers because a callback may
+        remove the client itself during the iteration.
+
+        * platform/ios/VideoFullscreenInterfaceAVKit.h:
+        * platform/ios/VideoFullscreenInterfaceAVKit.mm:
+        (-[WebAVPlayerLayer calculateTargetVideoFrame]):
+        (-[WebAVPlayerLayer layoutSublayers]):
+        (WebAVPlayerLayerView_startRoutingVideoToPictureInPicturePlayerLayerView):
+        (VideoFullscreenInterfaceAVKit::cleanupFullscreen):
+        (VideoFullscreenInterfaceAVKit::didStartPictureInPicture):
+        (VideoFullscreenInterfaceAVKit::failedToStartPictureInPicture):
+        (VideoFullscreenInterfaceAVKit::doSetup):
+        (VideoFullscreenInterfaceAVKit::doEnterFullscreen):
+        (VideoFullscreenInterfaceAVKit::willEnterStandbyFromPictureInPicture): Deleted.
+        (VideoFullscreenInterfaceAVKit::setWillEnterStandbyFromPictureInPicture): Deleted.
+        Add a property isPictureInPicture to WebAVPlayerLayer, which will set to YES if
+        a layer is created for picture-in-picture.
+        This property is used in -[WebAVPlayerLayer layoutSublayers] to skip
+        the unnecessary calculation of "targetVideoFrame" because the PiP window will
+        always have the same aspect ratio as the video content, so we can set
+        "targetVideoFrame" to be the bounds of the layer. Moreover, the calculation may
+        lead to rounding errors for some numbers and the errors may trigger unnecessary
+        picture-in-picture window resize events.
+
+        * platform/ios/WebVideoFullscreenControllerAVKit.mm:
+        This file has been moved to WebCore so we don't need to include WebCore headers
+        in a way like "#include <WebCore/XXX.h>".
+
+        * platform/mac/VideoFullscreenInterfaceMac.mm:
+        (-[WebVideoFullscreenInterfaceMacObjC enterPIP]):
+        (-[WebVideoFullscreenInterfaceMacObjC boundsDidChangeForVideoViewContainer:]):
+        (WebCore::VideoFullscreenInterfaceMac::enterFullscreen):
+        Add PIPState::EnteringPIP. Notify the observer that the video has entered
+        picture-in-picture after the PiP window size is finalized.
+
 2020-09-08  Zalan Bujtas  <[email protected]>
 
         [LFC][IFC] Remove redundant FormattingContext::Quirks::lineDescentNeedsCollapsing

Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (266727 => 266728)


--- trunk/Source/WebCore/html/HTMLMediaElement.cpp	2020-09-08 16:46:23 UTC (rev 266727)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp	2020-09-08 17:38:25 UTC (rev 266728)
@@ -5779,8 +5779,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 && event.type() == eventNames().webkitendfullscreenEvent) {
-        fullscreenModeChanged(VideoFullscreenModeNone);
+    if (!m_videoFullscreenStandby && !m_waitingToEnterFullscreen && event.type() == eventNames().webkitendfullscreenEvent) {
+        setFullscreenMode(VideoFullscreenModeNone);
         document().page()->chrome().client().exitVideoFullscreenForVideoElement(downcast<HTMLVideoElement>(*this));
     }
 }
@@ -5973,11 +5973,18 @@
 
                 m_temporarilyAllowingInlinePlaybackAfterFullscreen = false;
                 m_waitingToEnterFullscreen = true;
-                fullscreenModeChanged(mode);
+                auto oldMode = m_videoFullscreenMode;
+                setFullscreenMode(mode);
                 configureMediaControls();
 
                 document().page()->chrome().client().enterVideoFullscreenForVideoElement(asVideo, m_videoFullscreenMode, m_videoFullscreenStandby);
-                scheduleEvent(eventNames().webkitbeginfullscreenEvent);
+                if (m_videoFullscreenStandby)
+                    return;
+
+                if (mode == VideoFullscreenModeStandard)
+                    scheduleEvent(eventNames().webkitbeginfullscreenEvent);
+                else if (oldMode == VideoFullscreenModeStandard)
+                    scheduleEvent(eventNames().webkitendfullscreenEvent);
             }
         }
     });
@@ -6024,15 +6031,23 @@
     }
 
     if (document().activeDOMObjectsAreSuspended() || document().activeDOMObjectsAreStopped()) {
-        fullscreenModeChanged(VideoFullscreenModeNone);
+        setFullscreenMode(VideoFullscreenModeNone);
         document().page()->chrome().client().exitVideoFullscreenToModeWithoutAnimation(downcast<HTMLVideoElement>(*this), VideoFullscreenModeNone);
     } else if (document().page()->chrome().client().supportsVideoFullscreen(oldVideoFullscreenMode)) {
         if (m_videoFullscreenStandby) {
-            fullscreenModeChanged(VideoFullscreenModeNone);
+            setFullscreenMode(VideoFullscreenModeNone);
             document().page()->chrome().client().enterVideoFullscreenForVideoElement(downcast<HTMLVideoElement>(*this), m_videoFullscreenMode, m_videoFullscreenStandby);
+            return;
         }
 
-        scheduleEvent(eventNames().webkitendfullscreenEvent);
+        if (oldVideoFullscreenMode == VideoFullscreenModeStandard) {
+            // The exit fullscreen request will be sent in dispatchEvent().
+            scheduleEvent(eventNames().webkitendfullscreenEvent);
+            return;
+        }
+
+        setFullscreenMode(VideoFullscreenModeNone);
+        document().page()->chrome().client().exitVideoFullscreenForVideoElement(downcast<HTMLVideoElement>(*this));
     }
 }
 
@@ -6066,7 +6081,7 @@
         return;
 
     if (m_videoFullscreenStandby)
-        document().page()->chrome().client().enterVideoFullscreenForVideoElement(downcast<HTMLVideoElement>(*this), m_videoFullscreenMode, m_videoFullscreenStandby);
+        document().page()->chrome().client().enterVideoFullscreenForVideoElement(downcast<HTMLVideoElement>(*this), VideoFullscreenModeNone, m_videoFullscreenStandby);
     else
         document().page()->chrome().client().exitVideoFullscreenForVideoElement(downcast<HTMLVideoElement>(*this));
 }
@@ -6077,20 +6092,12 @@
     HTMLMediaElementEnums::VideoFullscreenMode oldVideoFullscreenMode = m_videoFullscreenMode;
 #endif
 
-    fullscreenModeChanged(VideoFullscreenModeStandard);
+    if (m_videoFullscreenMode != VideoFullscreenModeStandard)
+        setFullscreenMode(VideoFullscreenModeStandard);
 
 #if PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)
-    switch (oldVideoFullscreenMode) {
-    case VideoFullscreenModeNone:
-    case VideoFullscreenModeStandard:
-        // Don't need to do anything if we are not in any special fullscreen mode or it's already
-        // in standard fullscreen mode.
-        break;
-    case VideoFullscreenModePictureInPicture:
-        if (is<HTMLVideoElement>(*this))
-            downcast<HTMLVideoElement>(this)->exitToFullscreenModeWithoutAnimationIfPossible(oldVideoFullscreenMode, VideoFullscreenModeStandard);
-        break;
-    }
+    if (oldVideoFullscreenMode == VideoFullscreenModePictureInPicture && is<HTMLVideoElement>(*this))
+        downcast<HTMLVideoElement>(*this).exitToFullscreenModeWithoutAnimationIfPossible(oldVideoFullscreenMode, VideoFullscreenModeStandard);
 #endif
 
     Element::willBecomeFullscreenElement();
@@ -6106,7 +6113,7 @@
 void HTMLMediaElement::willStopBeingFullscreenElement()
 {
     if (fullscreenMode() == VideoFullscreenModeStandard)
-        fullscreenModeChanged(VideoFullscreenModeNone);
+        setFullscreenMode(VideoFullscreenModeNone);
 }
 
 PlatformLayer* HTMLMediaElement::platformLayer() const
@@ -6146,7 +6153,7 @@
 bool HTMLMediaElement::isVideoLayerInline()
 {
     return !m_videoFullscreenLayer;
-};
+}
 
 RetainPtr<PlatformLayer> HTMLMediaElement::createVideoFullscreenLayer()
 {
@@ -6169,7 +6176,7 @@
     updateTextTrackDisplay();
 }
 
-void HTMLMediaElement::setVideoFullscreenFrame(FloatRect frame)
+void HTMLMediaElement::setVideoFullscreenFrame(const FloatRect& frame)
 {
     m_videoFullscreenFrame = frame;
     if (m_player)
@@ -7915,11 +7922,20 @@
     return m_videoFullscreenMode == VideoFullscreenModePictureInPicture;
 }
 
-void HTMLMediaElement::fullscreenModeChanged(VideoFullscreenMode mode)
+void HTMLMediaElement::setFullscreenMode(VideoFullscreenMode mode)
 {
-    if (m_videoFullscreenMode == mode)
-        return;
+    INFO_LOG(LOGIDENTIFIER, "changed from ", fullscreenMode(), ", to ", mode);
+#if ENABLE(VIDEO_PRESENTATION_MODE)
+    scheduleEvent(eventNames().webkitpresentationmodechangedEvent);
+#endif
 
+    setPreparedToReturnVideoLayerToInline(mode != HTMLMediaElementEnums::VideoFullscreenModePictureInPicture);
+
+#if ENABLE(VIDEO_PRESENTATION_MODE)
+    if (player())
+        player()->setVideoFullscreenMode(mode);
+#endif
+
     m_videoFullscreenMode = mode;
     visibilityStateChanged();
     schedulePlaybackControlsManagerUpdate();

Modified: trunk/Source/WebCore/html/HTMLMediaElement.h (266727 => 266728)


--- trunk/Source/WebCore/html/HTMLMediaElement.h	2020-09-08 16:46:23 UTC (rev 266727)
+++ trunk/Source/WebCore/html/HTMLMediaElement.h	2020-09-08 17:38:25 UTC (rev 266728)
@@ -178,7 +178,7 @@
 #ifdef __OBJC__
     PlatformLayer* videoFullscreenLayer() const { return m_videoFullscreenLayer.get(); }
 #endif
-    virtual void setVideoFullscreenFrame(FloatRect);
+    virtual void setVideoFullscreenFrame(const FloatRect&);
     void setVideoFullscreenGravity(MediaPlayer::VideoGravity);
     MediaPlayer::VideoGravity videoFullscreenGravity() const { return m_videoFullscreenGravity; }
 #endif
@@ -430,7 +430,6 @@
 
     using MediaPlayerEnums::VideoFullscreenMode;
     VideoFullscreenMode fullscreenMode() const { return m_videoFullscreenMode; }
-    virtual void fullscreenModeChanged(VideoFullscreenMode);
 
     void enterFullscreen(VideoFullscreenMode);
     WEBCORE_EXPORT void enterFullscreen() override;
@@ -625,6 +624,8 @@
     void didRecalcStyle(Style::Change) override;
     bool isInteractiveContent() const override;
 
+    void setFullscreenMode(VideoFullscreenMode);
+
     void willBecomeFullscreenElement() override;
     void willStopBeingFullscreenElement() override;
 

Modified: trunk/Source/WebCore/html/HTMLVideoElement.cpp (266727 => 266728)


--- trunk/Source/WebCore/html/HTMLVideoElement.cpp	2020-09-08 16:46:23 UTC (rev 266727)
+++ trunk/Source/WebCore/html/HTMLVideoElement.cpp	2020-09-08 17:38:25 UTC (rev 266728)
@@ -353,11 +353,11 @@
 bool HTMLVideoElement::webkitDisplayingFullscreen()
 {
     if (document().quirks().needsAkamaiMediaPlayerQuirk(*this))
-        return isFullscreen() || m_isChangingPresentationMode;
+        return isFullscreen() || m_isChangingVideoFullscreenMode;
 
     // This function starts to return true after the video element has entered
     // fullscreen/picture-in-picture until it has exited fullscreen/picture-in-picture
-    return (isFullscreen() && !waitingToEnterFullscreen()) || (!isFullscreen() && m_isChangingPresentationMode);
+    return (isFullscreen() && !waitingToEnterFullscreen()) || (!isFullscreen() && m_isChangingVideoFullscreenMode);
 }
 
 void HTMLVideoElement::ancestorWillEnterFullscreen()
@@ -451,7 +451,7 @@
     return HTMLMediaElementEnums::VideoFullscreenModeNone;
 }
 
-static inline HTMLVideoElement::VideoPresentationMode toPresentationMode(HTMLMediaElementEnums::VideoFullscreenMode mode)
+HTMLVideoElement::VideoPresentationMode HTMLVideoElement::toPresentationMode(HTMLMediaElementEnums::VideoFullscreenMode mode)
 {
     if (mode == HTMLMediaElementEnums::VideoFullscreenModeStandard)
         return HTMLVideoElement::VideoPresentationMode::Fullscreen;
@@ -469,22 +469,23 @@
 void HTMLVideoElement::webkitSetPresentationMode(VideoPresentationMode mode)
 {
     INFO_LOG(LOGIDENTIFIER, ", mode = ",  mode);
-    setFullscreenMode(toFullscreenMode(mode));
+    setPresentationMode(mode);
 }
 
-void HTMLVideoElement::setFullscreenMode(HTMLMediaElementEnums::VideoFullscreenMode mode)
+void HTMLVideoElement::setPresentationMode(VideoPresentationMode mode)
 {
-    INFO_LOG(LOGIDENTIFIER, ", mode = ", mode);
-
-    if (m_isChangingPresentationMode)
+    if (m_isChangingVideoFullscreenMode || toPresentationMode(fullscreenMode()) == mode)
         return;
 
-    if (mode == VideoFullscreenModeNone) {
+    auto videoFullscreenMode = toFullscreenMode(mode);
+    INFO_LOG(LOGIDENTIFIER, ", videoFullscreenMode = ", videoFullscreenMode);
+
+    if (videoFullscreenMode == VideoFullscreenModeNone) {
         if (isFullscreen()) {
             if (toPresentationMode(fullscreenMode()) == VideoPresentationMode::PictureInPicture)
-                m_isEnteringOrExitingPictureInPicture = true;
+                m_isExitingPictureInPicture = true;
 
-            m_isChangingPresentationMode = true;
+            m_isChangingVideoFullscreenMode = true;
             exitFullscreen();
         }
 
@@ -491,16 +492,16 @@
         return;
     }
 
-    if (!mediaSession().fullscreenPermitted() || !supportsFullscreen(mode))
+    if (!mediaSession().fullscreenPermitted() || !supportsFullscreen(videoFullscreenMode))
         return;
 
-    if (mode == VideoFullscreenModePictureInPicture)
-        m_isEnteringOrExitingPictureInPicture = true;
+    if (videoFullscreenMode == VideoFullscreenModePictureInPicture)
+        m_isEnteringPictureInPicture = true;
+    else if (fullscreenMode() == VideoFullscreenModePictureInPicture)
+        m_isExitingPictureInPicture = true;
 
-    if (mode != fullscreenMode()) {
-        m_isChangingPresentationMode = true;
-        enterFullscreen(mode);
-    }
+    m_isChangingVideoFullscreenMode = true;
+    enterFullscreen(videoFullscreenMode);
 }
 
 auto HTMLVideoElement::webkitPresentationMode() const -> VideoPresentationMode
@@ -508,34 +509,32 @@
     return toPresentationMode(fullscreenMode());
 }
 
-void HTMLVideoElement::fullscreenModeChanged(VideoFullscreenMode mode)
+void HTMLVideoElement::didEnterFullscreenOrPictureInPicture(const FloatSize& size)
 {
-    if (mode != fullscreenMode()) {
-        INFO_LOG(LOGIDENTIFIER, "changed from ", fullscreenMode(), ", to ", mode);
-        scheduleEvent(eventNames().webkitpresentationmodechangedEvent);
-        setPreparedToReturnVideoLayerToInline(mode != HTMLMediaElementEnums::VideoFullscreenModePictureInPicture);
+    m_isChangingVideoFullscreenMode = false;
+    if (m_isEnteringPictureInPicture || m_isExitingPictureInPicture) {
+#if ENABLE(PICTURE_IN_PICTURE_API)
+        if (m_pictureInPictureObserver) {
+            if (m_isEnteringPictureInPicture)
+                m_pictureInPictureObserver->didEnterPictureInPicture(flooredIntSize(size));
+            else
+                m_pictureInPictureObserver->didExitPictureInPicture();
+        }
+#else
+        UNUSED_PARAM(size);
+#endif
+        m_isEnteringPictureInPicture = false;
+        m_isExitingPictureInPicture = false;
     }
 
-    if (player())
-        player()->setVideoFullscreenMode(mode);
-
-    HTMLMediaElement::fullscreenModeChanged(mode);
-}
-
-void HTMLVideoElement::didBecomeFullscreenElement()
-{
-    m_isChangingPresentationMode = false;
-    if (m_isEnteringOrExitingPictureInPicture)
-        m_isWaitingForPictureInPictureWindowFrame = true;
-
     HTMLMediaElement::didBecomeFullscreenElement();
 }
 
-void HTMLVideoElement::didStopBeingFullscreenElement()
+void HTMLVideoElement::didExitFullscreenOrPictureInPicture()
 {
-    m_isChangingPresentationMode = false;
-    if (m_isEnteringOrExitingPictureInPicture) {
-        m_isEnteringOrExitingPictureInPicture = false;
+    m_isChangingVideoFullscreenMode = false;
+    if (m_isExitingPictureInPicture) {
+        m_isExitingPictureInPicture = false;
 #if ENABLE(PICTURE_IN_PICTURE_API)
         if (m_pictureInPictureObserver)
             m_pictureInPictureObserver->didExitPictureInPicture();
@@ -543,25 +542,23 @@
     }
 }
 
-void HTMLVideoElement::setVideoFullscreenFrame(FloatRect frame)
+#if ENABLE(FULLSCREEN_API) && ENABLE(VIDEO_USES_ELEMENT_FULLSCREEN)
+void HTMLVideoElement::didBecomeFullscreenElement()
 {
+    m_isChangingVideoFullscreenMode = false;
+    HTMLMediaElement::didBecomeFullscreenElement();
+}
+#endif
+
+void HTMLVideoElement::setVideoFullscreenFrame(const FloatRect& frame)
+{
     HTMLMediaElement::setVideoFullscreenFrame(frame);
 
-    if (m_isWaitingForPictureInPictureWindowFrame) {
-        m_isWaitingForPictureInPictureWindowFrame = false;
-        m_isEnteringOrExitingPictureInPicture = false;
-#if ENABLE(PICTURE_IN_PICTURE_API)
-        if (m_pictureInPictureObserver)
-            m_pictureInPictureObserver->didEnterPictureInPicture(IntSize(frame.size()));
-#endif
-        return;
-    }
-
     if (toPresentationMode(fullscreenMode()) != VideoPresentationMode::PictureInPicture)
         return;
 
 #if ENABLE(PICTURE_IN_PICTURE_API)
-    if (!m_isEnteringOrExitingPictureInPicture && m_pictureInPictureObserver)
+    if (!m_isEnteringPictureInPicture && !m_isExitingPictureInPicture && m_pictureInPictureObserver)
         m_pictureInPictureObserver->pictureInPictureWindowResized(IntSize(frame.size()));
 #endif
 }

Modified: trunk/Source/WebCore/html/HTMLVideoElement.h (266727 => 266728)


--- trunk/Source/WebCore/html/HTMLVideoElement.h	2020-09-08 16:46:23 UTC (rev 266727)
+++ trunk/Source/WebCore/html/HTMLVideoElement.h	2020-09-08 17:38:25 UTC (rev 266728)
@@ -82,17 +82,22 @@
     RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) final;
 
 #if ENABLE(VIDEO_PRESENTATION_MODE)
-    enum class VideoPresentationMode { Inline, Fullscreen, PictureInPicture};
+    enum class VideoPresentationMode { Inline, Fullscreen, PictureInPicture };
+    static VideoPresentationMode toPresentationMode(HTMLMediaElementEnums::VideoFullscreenMode);
     WEBCORE_EXPORT bool webkitSupportsPresentationMode(VideoPresentationMode) const;
+    VideoPresentationMode webkitPresentationMode() const;
     void webkitSetPresentationMode(VideoPresentationMode);
-    VideoPresentationMode webkitPresentationMode() const;
-    void setFullscreenMode(VideoFullscreenMode);
-    void fullscreenModeChanged(VideoFullscreenMode) final;
 
+    WEBCORE_EXPORT void setPresentationMode(VideoPresentationMode);
+    WEBCORE_EXPORT void didEnterFullscreenOrPictureInPicture(const FloatSize&);
+    WEBCORE_EXPORT void didExitFullscreenOrPictureInPicture();
+
+#if ENABLE(FULLSCREEN_API) && ENABLE(VIDEO_USES_ELEMENT_FULLSCREEN)
     WEBCORE_EXPORT void didBecomeFullscreenElement() final;
-    WEBCORE_EXPORT void didStopBeingFullscreenElement() final;
-    void setVideoFullscreenFrame(FloatRect) final;
+#endif
 
+    void setVideoFullscreenFrame(const FloatRect&) final;
+
 #if ENABLE(PICTURE_IN_PICTURE_API)
     void setPictureInPictureObserver(PictureInPictureObserver*);
 #endif
@@ -133,11 +138,11 @@
 
     unsigned m_lastReportedVideoWidth { 0 };
     unsigned m_lastReportedVideoHeight { 0 };
-    bool m_isChangingPresentationMode { false };
+    bool m_isChangingVideoFullscreenMode { false };
 
 #if ENABLE(VIDEO_PRESENTATION_MODE)
-    bool m_isEnteringOrExitingPictureInPicture { false };
-    bool m_isWaitingForPictureInPictureWindowFrame { false };
+    bool m_isEnteringPictureInPicture { false };
+    bool m_isExitingPictureInPicture { false };
 #endif
 
 #if ENABLE(PICTURE_IN_PICTURE_API)

Modified: trunk/Source/WebCore/platform/cocoa/PlaybackSessionModelMediaElement.mm (266727 => 266728)


--- trunk/Source/WebCore/platform/cocoa/PlaybackSessionModelMediaElement.mm	2020-09-08 16:46:23 UTC (rev 266727)
+++ trunk/Source/WebCore/platform/cocoa/PlaybackSessionModelMediaElement.mm	2020-09-08 17:38:25 UTC (rev 266728)
@@ -325,9 +325,9 @@
 
     auto& element = downcast<HTMLVideoElement>(*m_mediaElement);
     if (element.fullscreenMode() == MediaPlayerEnums::VideoFullscreenModePictureInPicture)
-        element.setFullscreenMode(MediaPlayerEnums::VideoFullscreenModeNone);
+        element.setPresentationMode(HTMLVideoElement::VideoPresentationMode::Inline);
     else
-        element.setFullscreenMode(MediaPlayerEnums::VideoFullscreenModePictureInPicture);
+        element.setPresentationMode(HTMLVideoElement::VideoPresentationMode::PictureInPicture);
 #endif
 }
 

Modified: trunk/Source/WebCore/platform/cocoa/VideoFullscreenChangeObserver.h (266727 => 266728)


--- trunk/Source/WebCore/platform/cocoa/VideoFullscreenChangeObserver.h	2020-09-08 16:46:23 UTC (rev 266727)
+++ trunk/Source/WebCore/platform/cocoa/VideoFullscreenChangeObserver.h	2020-09-08 17:38:25 UTC (rev 266728)
@@ -37,7 +37,7 @@
     virtual void requestVideoContentLayer() = 0;
     virtual void returnVideoContentLayer() = 0;
     virtual void didSetupFullscreen() = 0;
-    virtual void didEnterFullscreen() = 0;
+    virtual void didEnterFullscreen(const FloatSize&) = 0;
     virtual void willExitFullscreen() = 0;
     virtual void didExitFullscreen() = 0;
     virtual void didCleanupFullscreen() = 0;

Modified: trunk/Source/WebCore/platform/cocoa/VideoFullscreenModelVideoElement.mm (266727 => 266728)


--- trunk/Source/WebCore/platform/cocoa/VideoFullscreenModelVideoElement.mm	2020-09-08 16:46:23 UTC (rev 266727)
+++ trunk/Source/WebCore/platform/cocoa/VideoFullscreenModelVideoElement.mm	2020-09-08 17:38:25 UTC (rev 266728)
@@ -152,8 +152,8 @@
 
 void VideoFullscreenModelVideoElement::requestFullscreenMode(HTMLMediaElementEnums::VideoFullscreenMode mode, bool finishedWithMedia)
 {
-    if (m_videoElement && m_videoElement->fullscreenMode() != mode)
-        m_videoElement->setFullscreenMode(mode);
+    if (m_videoElement)
+        m_videoElement->setPresentationMode(HTMLVideoElement::toPresentationMode(mode));
 
     if (m_videoElement && finishedWithMedia && mode == MediaPlayer::VideoFullscreenModeNone) {
         if (m_videoElement->document().isMediaDocument()) {
@@ -191,7 +191,7 @@
 void VideoFullscreenModelVideoElement::fullscreenModeChanged(HTMLMediaElementEnums::VideoFullscreenMode videoFullscreenMode)
 {
     if (m_videoElement)
-        m_videoElement->fullscreenModeChanged(videoFullscreenMode);
+        m_videoElement->setPresentationMode(HTMLVideoElement::toPresentationMode(videoFullscreenMode));
 }
 
 void VideoFullscreenModelVideoElement::requestRouteSharingPolicyAndContextUID(CompletionHandler<void(RouteSharingPolicy, String)>&& completionHandler)
@@ -219,7 +219,7 @@
 
     m_hasVideo = hasVideo;
 
-    for (auto& client : m_clients)
+    for (auto& client : copyToVector(m_clients))
         client->hasVideoChanged(m_hasVideo);
 }
 
@@ -230,37 +230,37 @@
 
     m_videoDimensions = videoDimensions;
 
-    for (auto& client : m_clients)
+    for (auto& client : copyToVector(m_clients))
         client->videoDimensionsChanged(m_videoDimensions);
 }
 
 void VideoFullscreenModelVideoElement::willEnterPictureInPicture()
 {
-    for (auto& client : m_clients)
+    for (auto& client : copyToVector(m_clients))
         client->willEnterPictureInPicture();
 }
 
 void VideoFullscreenModelVideoElement::didEnterPictureInPicture()
 {
-    for (auto& client : m_clients)
+    for (auto& client : copyToVector(m_clients))
         client->didEnterPictureInPicture();
 }
 
 void VideoFullscreenModelVideoElement::failedToEnterPictureInPicture()
 {
-    for (auto& client : m_clients)
+    for (auto& client : copyToVector(m_clients))
         client->failedToEnterPictureInPicture();
 }
 
 void VideoFullscreenModelVideoElement::willExitPictureInPicture()
 {
-    for (auto& client : m_clients)
+    for (auto& client : copyToVector(m_clients))
         client->willExitPictureInPicture();
 }
 
 void VideoFullscreenModelVideoElement::didExitPictureInPicture()
 {
-    for (auto& client : m_clients)
+    for (auto& client : copyToVector(m_clients))
         client->didExitPictureInPicture();
 }
 

Modified: trunk/Source/WebCore/platform/ios/VideoFullscreenInterfaceAVKit.h (266727 => 266728)


--- trunk/Source/WebCore/platform/ios/VideoFullscreenInterfaceAVKit.h	2020-09-08 16:46:23 UTC (rev 266727)
+++ trunk/Source/WebCore/platform/ios/VideoFullscreenInterfaceAVKit.h	2020-09-08 17:38:25 UTC (rev 266728)
@@ -147,8 +147,6 @@
     void enterFullscreenHandler(BOOL success, NSError *);
     bool isPlayingVideoInEnhancedFullscreen() const;
     WEBCORE_EXPORT void setReadyToStopPictureInPicture(BOOL);
-    WEBCORE_EXPORT bool willEnterStandbyFromPictureInPicture();
-    WEBCORE_EXPORT void setWillEnterStandbyFromPictureInPicture(BOOL);
 
     WEBCORE_EXPORT void setMode(HTMLMediaElementEnums::VideoFullscreenMode);
     void clearMode(HTMLMediaElementEnums::VideoFullscreenMode);
@@ -225,7 +223,6 @@
     bool m_enteringPictureInPicture { false };
     bool m_exitingPictureInPicture { false };
     bool m_readyToStopPictureInPicture { true };
-    bool m_willEnterStandbyFromPictureInPicture { false };
 };
 
 }

Modified: trunk/Source/WebCore/platform/ios/VideoFullscreenInterfaceAVKit.mm (266727 => 266728)


--- trunk/Source/WebCore/platform/ios/VideoFullscreenInterfaceAVKit.mm	2020-09-08 16:46:23 UTC (rev 266727)
+++ trunk/Source/WebCore/platform/ios/VideoFullscreenInterfaceAVKit.mm	2020-09-08 17:38:25 UTC (rev 266728)
@@ -196,6 +196,7 @@
 @property (nonatomic, copy, nullable) NSDictionary *pixelBufferAttributes;
 @property CGSize videoDimensions;
 @property CGRect modelVideoLayerFrame;
+- (FloatRect)calculateTargetVideoFrame;
 @end
 
 @implementation WebAVPlayerLayer {
@@ -257,6 +258,23 @@
     return _videoSublayer.get();
 }
 
+- (FloatRect)calculateTargetVideoFrame
+{
+    FloatRect targetVideoFrame;
+    float videoAspectRatio = self.videoDimensions.width / self.videoDimensions.height;
+
+    if ([AVLayerVideoGravityResize isEqualToString:self.videoGravity])
+        targetVideoFrame = self.bounds;
+    else if ([AVLayerVideoGravityResizeAspect isEqualToString:self.videoGravity])
+        targetVideoFrame = largestRectWithAspectRatioInsideRect(videoAspectRatio, self.bounds);
+    else if ([AVLayerVideoGravityResizeAspectFill isEqualToString:self.videoGravity])
+        targetVideoFrame = smallestRectWithAspectRatioAroundRect(videoAspectRatio, self.bounds);
+    else
+        ASSERT_NOT_REACHED();
+
+    return targetVideoFrame;
+}
+
 - (void)layoutSublayers
 {
     if ([_videoSublayer superlayer] != self)
@@ -283,14 +301,7 @@
     else
         ASSERT_NOT_REACHED();
 
-    if ([AVLayerVideoGravityResize isEqualToString:self.videoGravity])
-        targetVideoFrame = self.bounds;
-    else if ([AVLayerVideoGravityResizeAspect isEqualToString:self.videoGravity])
-        targetVideoFrame = largestRectWithAspectRatioInsideRect(videoAspectRatio, self.bounds);
-    else if ([AVLayerVideoGravityResizeAspectFill isEqualToString:self.videoGravity])
-        targetVideoFrame = smallestRectWithAspectRatioAroundRect(videoAspectRatio, self.bounds);
-    else
-        ASSERT_NOT_REACHED();
+    targetVideoFrame = [self calculateTargetVideoFrame];
 
     UIView *view = (UIView *)[_videoSublayer delegate];
     CGAffineTransform transform = CGAffineTransformMakeScale(targetVideoFrame.width() / sourceVideoFrame.width(), targetVideoFrame.height() / sourceVideoFrame.height());
@@ -470,10 +481,10 @@
 static void WebAVPlayerLayerView_startRoutingVideoToPictureInPicturePlayerLayerView(id aSelf, SEL)
 {
     WebAVPlayerLayerView *playerLayerView = aSelf;
-    WebAVPictureInPicturePlayerLayerView *pipView = (WebAVPictureInPicturePlayerLayerView *)[playerLayerView pictureInPicturePlayerLayerView];
+    auto *pipView = (WebAVPictureInPicturePlayerLayerView *)[playerLayerView pictureInPicturePlayerLayerView];
 
-    WebAVPlayerLayer *playerLayer = (WebAVPlayerLayer *)[playerLayerView playerLayer];
-    WebAVPlayerLayer *pipPlayerLayer = (WebAVPlayerLayer *)[pipView layer];
+    auto *playerLayer = (WebAVPlayerLayer *)[playerLayerView playerLayer];
+    auto *pipPlayerLayer = (WebAVPlayerLayer *)[pipView layer];
     [playerLayer setVideoGravity:AVLayerVideoGravityResizeAspect];
     [pipPlayerLayer setVideoSublayer:playerLayer.videoSublayer];
     [pipPlayerLayer setVideoDimensions:playerLayer.videoDimensions];
@@ -998,7 +1009,6 @@
     [playerController() setHasEnabledVideo:false];
     [playerController() setHasVideo:false];
 
-    m_willEnterStandbyFromPictureInPicture = false;
     if (m_exitingPictureInPicture) {
         m_exitingPictureInPicture = false;
         if (m_videoFullscreenModel)
@@ -1119,10 +1129,6 @@
 
     if (m_enterFullscreenNeedsEnterPictureInPicture)
         doEnterFullscreen();
-    else {
-        if (m_fullscreenChangeObserver)
-            m_fullscreenChangeObserver->didEnterFullscreen();
-    }
 
     m_enteringPictureInPicture = false;
 }
@@ -1136,9 +1142,6 @@
     if (m_currentMode.hasFullscreen())
         return;
 
-    if (m_fullscreenChangeObserver)
-        m_fullscreenChangeObserver->didEnterFullscreen();
-
     if (m_videoFullscreenModel)
         m_videoFullscreenModel->failedToEnterPictureInPicture();
 
@@ -1295,7 +1298,7 @@
 {
     Mode changes { m_currentMode.mode() ^ m_targetMode.mode() };
 
-    if (m_currentMode.hasVideo() && m_targetMode.hasVideo() && (m_standby != m_targetStandby)) {
+    if (m_currentMode.hasVideo() && m_targetMode.hasVideo()) {
         m_standby = m_targetStandby;
         finalizeSetup();
         return;
@@ -1449,8 +1452,16 @@
     }
     m_enterFullscreenNeedsExitPictureInPicture = false;
 
-    if (m_fullscreenChangeObserver)
-        m_fullscreenChangeObserver->didEnterFullscreen();
+    if (m_fullscreenChangeObserver) {
+        FloatSize size;
+        if (m_currentMode.hasPictureInPicture()) {
+            auto *pipView = (WebAVPictureInPicturePlayerLayerView *)[m_playerLayerView pictureInPicturePlayerLayerView];
+            auto *pipPlayerLayer = (WebAVPlayerLayer *)[pipView layer];
+            auto videoFrame = [pipPlayerLayer calculateTargetVideoFrame];
+            size = FloatSize(videoFrame.size());
+        }
+        m_fullscreenChangeObserver->didEnterFullscreen(size);
+    }
 }
 
 void VideoFullscreenInterfaceAVKit::doExitFullscreen()
@@ -1598,16 +1609,6 @@
         m_fullscreenChangeObserver->fullscreenWillReturnToInline();
 }
 
-bool VideoFullscreenInterfaceAVKit::willEnterStandbyFromPictureInPicture()
-{
-    return m_willEnterStandbyFromPictureInPicture;
-}
-
-void VideoFullscreenInterfaceAVKit::setWillEnterStandbyFromPictureInPicture(BOOL value)
-{
-    m_willEnterStandbyFromPictureInPicture = value;
-}
-
 static Optional<bool> isPictureInPictureSupported;
 
 void WebCore::setSupportsPictureInPicture(bool isSupported)

Modified: trunk/Source/WebCore/platform/ios/WebVideoFullscreenControllerAVKit.mm (266727 => 266728)


--- trunk/Source/WebCore/platform/ios/WebVideoFullscreenControllerAVKit.mm	2020-09-08 16:46:23 UTC (rev 266727)
+++ trunk/Source/WebCore/platform/ios/WebVideoFullscreenControllerAVKit.mm	2020-09-08 17:38:25 UTC (rev 266728)
@@ -28,20 +28,20 @@
 
 #if PLATFORM(IOS_FAMILY)
 
+#import "FrameView.h"
+#import "HTMLVideoElement.h"
 #import "Logging.h"
 #import "MediaSelectionOption.h"
 #import "PlaybackSessionInterfaceAVKit.h"
 #import "PlaybackSessionModelMediaElement.h"
+#import "RenderVideo.h"
 #import "TimeRanges.h"
 #import "VideoFullscreenChangeObserver.h"
 #import "VideoFullscreenInterfaceAVKit.h"
 #import "VideoFullscreenModelVideoElement.h"
+#import "WebCoreThreadRun.h"
 #import <QuartzCore/CoreAnimation.h>
 #import <UIKit/UIView.h>
-#import <WebCore/FrameView.h>
-#import <WebCore/HTMLVideoElement.h>
-#import <WebCore/RenderVideo.h>
-#import <WebCore/WebCoreThreadRun.h>
 #import <pal/ios/UIKitSoftLink.h>
 #import <pal/spi/cocoa/QuartzCoreSPI.h>
 
@@ -124,7 +124,7 @@
     void requestVideoContentLayer() final;
     void returnVideoContentLayer() final;
     void didSetupFullscreen() final;
-    void didEnterFullscreen() final { }
+    void didEnterFullscreen(const FloatSize&) final { }
     void willExitFullscreen() final;
     void didExitFullscreen() final;
     void didCleanupFullscreen() final;

Modified: trunk/Source/WebCore/platform/mac/VideoFullscreenInterfaceMac.mm (266727 => 266728)


--- trunk/Source/WebCore/platform/mac/VideoFullscreenInterfaceMac.mm	2020-09-08 16:46:23 UTC (rev 266727)
+++ trunk/Source/WebCore/platform/mac/VideoFullscreenInterfaceMac.mm	2020-09-08 17:38:25 UTC (rev 266728)
@@ -95,6 +95,7 @@
 
 enum class PIPState {
     NotInPIP,
+    EnteringPIP,
     InPIP,
     ExitingPIP
 };
@@ -210,12 +211,12 @@
 
 - (void)enterPIP
 {
-    if (_pipState == PIPState::InPIP)
+    if (_pipState == PIPState::EnteringPIP || _pipState == PIPState::InPIP)
         return;
 
     [_videoViewContainerController view].layer.backgroundColor = CGColorGetConstantColor(kCGColorBlack);
     [_pipViewController presentViewControllerAsPictureInPicture:_videoViewContainerController.get()];
-    _pipState = PIPState::InPIP;
+    _pipState = PIPState::EnteringPIP;
 }
 
 - (void)exitPIP
@@ -248,8 +249,25 @@
 
     ASSERT_UNUSED(videoViewContainer, videoViewContainer == _videoViewContainer);
 
-    if (_videoFullscreenInterfaceMac && _videoFullscreenInterfaceMac->videoFullscreenModel())
-        _videoFullscreenInterfaceMac->videoFullscreenModel()->setVideoLayerFrame([_videoViewContainer bounds]);
+    if (!_videoFullscreenInterfaceMac)
+        return;
+
+    if (_pipState == PIPState::EnteringPIP) {
+        // FIXME(rdar://problem/42250952)
+        // Currently, -[PIPViewController presentViewControllerAsPictureInPicture:] does not
+        // take a completionHandler parameter, so we use the first bounds change event
+        // as an indication that entering picture-in-picture is completed.
+        _pipState = PIPState::InPIP;
+
+        if (auto* model = _videoFullscreenInterfaceMac->videoFullscreenModel())
+            model->didEnterPictureInPicture();
+
+        if (auto* observer = _videoFullscreenInterfaceMac->videoFullscreenChangeObserver())
+            observer->didEnterFullscreen((WebCore::FloatSize)[_videoViewContainer bounds].size);
+    }
+
+    if (auto* model = _videoFullscreenInterfaceMac->videoFullscreenModel())
+        model->setVideoLayerFrame([_videoViewContainer bounds]);
 }
 
 - (void)superviewDidChangeForVideoViewContainer:(WebVideoViewContainer *)videoViewContainer
@@ -456,11 +474,6 @@
 #if ENABLE(WEB_PLAYBACK_CONTROLS_MANAGER)
         [m_playbackSessionInterface->playBackControlsManager() setPictureInPictureActive:YES];
 #endif
-
-        // FIXME(rdar://problem/42250952): Move this call into a completion handler or delegate callback.
-        m_videoFullscreenModel->didEnterPictureInPicture();
-        if (m_fullscreenChangeObserver)
-            m_fullscreenChangeObserver->didEnterFullscreen();
     }
 }
 

Modified: trunk/Source/WebKit/ChangeLog (266727 => 266728)


--- trunk/Source/WebKit/ChangeLog	2020-09-08 16:46:23 UTC (rev 266727)
+++ trunk/Source/WebKit/ChangeLog	2020-09-08 17:38:25 UTC (rev 266728)
@@ -1,3 +1,49 @@
+2020-09-08  Peng Liu  <[email protected]>
+
+        Clean up functions and state variables related to the picture-in-picture implementation
+        https://bugs.webkit.org/show_bug.cgi?id=215972
+
+        Reviewed by Jer Noble.
+
+        This patch adds an optional FloatSize parameter to the VideoFullscreenManager::DidEnterFullscreen message.
+        Also, it enables the picture-in-picture and fullscreen events when a video element enters picture-in-picture
+        from the fullscreen mode.
+
+        * UIProcess/Cocoa/VideoFullscreenManagerProxy.h:
+        * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
+        (WebKit::VideoFullscreenModelContext::didEnterFullscreen):
+        (WebKit::VideoFullscreenModelContext::prepareToExitFullscreen):
+        (WebKit::VideoFullscreenModelContext::willEnterPictureInPicture):
+        (WebKit::VideoFullscreenModelContext::didEnterPictureInPicture):
+        (WebKit::VideoFullscreenModelContext::failedToEnterPictureInPicture):
+        (WebKit::VideoFullscreenModelContext::willExitPictureInPicture):
+        (WebKit::VideoFullscreenModelContext::didExitPictureInPicture):
+        (WebKit::VideoFullscreenManagerProxy::ensureClientForContext):
+        (WebKit::VideoFullscreenManagerProxy::setupFullscreenWithID):
+        (WebKit::VideoFullscreenManagerProxy::enterFullscreen):
+        (WebKit::VideoFullscreenManagerProxy::didEnterFullscreen):
+        Use ensureClientForContext() instead of addClientForContext() in setupFullscreenWithID()
+        to avoid leaking VideoFullscreenInterfaceAVKit instances.
+        Iterate a copy of the HashSet of VideoFullscreenModelClient pointers because a callback may
+        remove the client itself during the iteration.
+
+        * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm:
+        (-[WKFullScreenWindowController prepareToExitPictureInPicture]):
+        * UIProcess/mac/WKFullScreenWindowController.h:
+        * UIProcess/mac/WKFullScreenWindowController.mm:
+        (-[WKFullScreenWindowController didExitPictureInPicture]):
+        Fix leaking of VideoFullscreenInterfaceMac.
+
+        * WebProcess/cocoa/VideoFullscreenManager.h:
+        * WebProcess/cocoa/VideoFullscreenManager.messages.in:
+        * WebProcess/cocoa/VideoFullscreenManager.mm:
+        (WebKit::VideoFullscreenManager::fullscreenModeChanged):
+        We need to change the fullscreen mode in the VideoFullscreenInterfaceContext instance as well.
+        (WebKit::VideoFullscreenManager::didEnterFullscreen):
+        (WebKit::VideoFullscreenManager::didCleanupFullscreen):
+        Call didExitFullscreenOrPictureInPicture() instead of didStopBeingFullscreenElement(), which
+        is for the FullscreenManager.
+
 2020-09-08  Mike Gorse  <[email protected]>
 
         [GTK] AcceleratedBackingStoreWayland might erroneously try to use SHM with older wpebackend-fdo

Modified: trunk/Source/WebKit/UIProcess/Cocoa/VideoFullscreenManagerProxy.h (266727 => 266728)


--- trunk/Source/WebKit/UIProcess/Cocoa/VideoFullscreenManagerProxy.h	2020-09-08 16:46:23 UTC (rev 266727)
+++ trunk/Source/WebKit/UIProcess/Cocoa/VideoFullscreenManagerProxy.h	2020-09-08 17:38:25 UTC (rev 266728)
@@ -107,7 +107,7 @@
     void requestVideoContentLayer() final;
     void returnVideoContentLayer() final;
     void didSetupFullscreen() final;
-    void didEnterFullscreen() final;
+    void didEnterFullscreen(const WebCore::FloatSize&) final;
     void willExitFullscreen() final;
     void didExitFullscreen() final;
     void didCleanupFullscreen() final;
@@ -159,6 +159,7 @@
     VideoFullscreenModelContext& ensureModel(PlaybackSessionContextIdentifier);
     PlatformVideoFullscreenInterface& ensureInterface(PlaybackSessionContextIdentifier);
     PlatformVideoFullscreenInterface* findInterface(PlaybackSessionContextIdentifier);
+    void ensureClientForContext(PlaybackSessionContextIdentifier);
     void addClientForContext(PlaybackSessionContextIdentifier);
     void removeClientForContext(PlaybackSessionContextIdentifier);
 
@@ -185,7 +186,7 @@
     void didSetupFullscreen(PlaybackSessionContextIdentifier);
     void willExitFullscreen(PlaybackSessionContextIdentifier);
     void didExitFullscreen(PlaybackSessionContextIdentifier);
-    void didEnterFullscreen(PlaybackSessionContextIdentifier);
+    void didEnterFullscreen(PlaybackSessionContextIdentifier, const WebCore::FloatSize&);
     void didCleanupFullscreen(PlaybackSessionContextIdentifier);
     void setVideoLayerFrame(PlaybackSessionContextIdentifier, WebCore::FloatRect);
     void setVideoLayerGravity(PlaybackSessionContextIdentifier, WebCore::MediaPlayerEnums::VideoGravity);

Modified: trunk/Source/WebKit/UIProcess/Cocoa/VideoFullscreenManagerProxy.mm (266727 => 266728)


--- trunk/Source/WebKit/UIProcess/Cocoa/VideoFullscreenManagerProxy.mm	2020-09-08 16:46:23 UTC (rev 266727)
+++ trunk/Source/WebKit/UIProcess/Cocoa/VideoFullscreenManagerProxy.mm	2020-09-08 17:38:25 UTC (rev 266728)
@@ -244,10 +244,10 @@
         m_manager->didSetupFullscreen(m_contextId);
 }
 
-void VideoFullscreenModelContext::didEnterFullscreen()
+void VideoFullscreenModelContext::didEnterFullscreen(const WebCore::FloatSize& size)
 {
     if (m_manager)
-        m_manager->didEnterFullscreen(m_contextId);
+        m_manager->didEnterFullscreen(m_contextId, size);
 }
 
 void VideoFullscreenModelContext::willExitFullscreen()
@@ -290,13 +290,13 @@
 
 void VideoFullscreenModelContext::prepareToExitFullscreen()
 {
-    for (auto& client : m_clients)
+    for (auto& client : copyToVector(m_clients))
         client->prepareToExitPictureInPicture();
 }
 
 void VideoFullscreenModelContext::willEnterPictureInPicture()
 {
-    for (auto& client : m_clients)
+    for (auto& client : copyToVector(m_clients))
         client->willEnterPictureInPicture();
 }
 
@@ -305,19 +305,19 @@
     if (m_manager)
         m_manager->hasVideoInPictureInPictureDidChange(true);
 
-    for (auto& client : m_clients)
+    for (auto& client : copyToVector(m_clients))
         client->didEnterPictureInPicture();
 }
 
 void VideoFullscreenModelContext::failedToEnterPictureInPicture()
 {
-    for (auto& client : m_clients)
+    for (auto& client : copyToVector(m_clients))
         client->failedToEnterPictureInPicture();
 }
 
 void VideoFullscreenModelContext::willExitPictureInPicture()
 {
-    for (auto& client : m_clients)
+    for (auto& client : copyToVector(m_clients))
         client->willExitPictureInPicture();
 }
 
@@ -326,7 +326,7 @@
     if (m_manager)
         m_manager->hasVideoInPictureInPictureDidChange(false);
 
-    for (auto& client : m_clients)
+    for (auto& client : copyToVector(m_clients))
         client->didExitPictureInPicture();
 }
 
@@ -461,6 +461,11 @@
     return std::get<1>(it->value).get();
 }
 
+void VideoFullscreenManagerProxy::ensureClientForContext(PlaybackSessionContextIdentifier contextId)
+{
+    m_clientCounts.add(contextId, 1);
+}
+
 void VideoFullscreenManagerProxy::addClientForContext(PlaybackSessionContextIdentifier contextId)
 {
     auto addResult = m_clientCounts.add(contextId, 1);
@@ -524,12 +529,7 @@
     MESSAGE_CHECK(videoLayerID);
 
     auto& [model, interface] = ensureModelAndInterface(contextId);
-#if PLATFORM(IOS_FAMILY)
-    if (interface->willEnterStandbyFromPictureInPicture())
-        interface->setWillEnterStandbyFromPictureInPicture(NO);
-    else if (videoFullscreenMode != HTMLMediaElementEnums::VideoFullscreenModePictureInPicture || !standby)
-        addClientForContext(contextId);
-#endif
+    ensureClientForContext(contextId);
 
     if (m_mockVideoPresentationModeEnabled) {
         if (!videoDimensions.isEmpty())
@@ -598,8 +598,7 @@
 void VideoFullscreenManagerProxy::enterFullscreen(PlaybackSessionContextIdentifier contextId)
 {
     if (m_mockVideoPresentationModeEnabled) {
-        didEnterFullscreen(contextId);
-        setVideoLayerFrame(contextId, {0, 0, m_mockPictureInPictureWindowSize.width(), m_mockPictureInPictureWindowSize.height()});
+        didEnterFullscreen(contextId, m_mockPictureInPictureWindowSize);
         return;
     }
 
@@ -774,9 +773,13 @@
     m_page->didExitFullscreen();
 }
 
-void VideoFullscreenManagerProxy::didEnterFullscreen(PlaybackSessionContextIdentifier contextId)
+void VideoFullscreenManagerProxy::didEnterFullscreen(PlaybackSessionContextIdentifier contextId, const WebCore::FloatSize& size)
 {
-    m_page->send(Messages::VideoFullscreenManager::DidEnterFullscreen(contextId));
+    Optional<FloatSize> optionalSize;
+    if (!size.isEmpty())
+        optionalSize = size;
+
+    m_page->send(Messages::VideoFullscreenManager::DidEnterFullscreen(contextId, optionalSize));
     m_page->didEnterFullscreen();
 }
 

Modified: trunk/Source/WebKit/UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm (266727 => 266728)


--- trunk/Source/WebKit/UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm	2020-09-08 16:46:23 UTC (rev 266727)
+++ trunk/Source/WebKit/UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm	2020-09-08 17:38:25 UTC (rev 266728)
@@ -953,7 +953,6 @@
         return;
 
     interface->setReadyToStopPictureInPicture(NO);
-    interface->setWillEnterStandbyFromPictureInPicture(YES);
     _returnToFullscreenFromPictureInPicture = YES;
 
     if (!_exitingFullScreen)

Modified: trunk/Source/WebKit/UIProcess/mac/WKFullScreenWindowController.h (266727 => 266728)


--- trunk/Source/WebKit/UIProcess/mac/WKFullScreenWindowController.h	2020-09-08 16:46:23 UTC (rev 266727)
+++ trunk/Source/WebKit/UIProcess/mac/WKFullScreenWindowController.h	2020-09-08 17:38:25 UTC (rev 266728)
@@ -88,6 +88,7 @@
 
 - (void)videoControlsManagerDidChange;
 - (void)didEnterPictureInPicture;
+- (void)didExitPictureInPicture;
 
 @end
 

Modified: trunk/Source/WebKit/UIProcess/mac/WKFullScreenWindowController.mm (266727 => 266728)


--- trunk/Source/WebKit/UIProcess/mac/WKFullScreenWindowController.mm	2020-09-08 16:46:23 UTC (rev 266727)
+++ trunk/Source/WebKit/UIProcess/mac/WKFullScreenWindowController.mm	2020-09-08 17:38:25 UTC (rev 266728)
@@ -80,6 +80,11 @@
         [m_parent didEnterPictureInPicture];
     }
 
+    void didExitPictureInPicture() final
+    {
+        [m_parent didExitPictureInPicture];
+    }
+
 private:
     WKFullScreenWindowController *m_parent { nullptr };
     RefPtr<WebCore::VideoFullscreenInterfaceMac> m_interface;
@@ -661,6 +666,11 @@
     [self requestExitFullScreen];
 }
 
+- (void)didExitPictureInPicture
+{
+    _videoFullscreenClient->setInterface(nullptr);
+}
+
 #pragma mark -
 #pragma mark Custom NSWindow Full Screen Animation
 

Modified: trunk/Source/WebKit/WebProcess/cocoa/VideoFullscreenManager.h (266727 => 266728)


--- trunk/Source/WebKit/WebProcess/cocoa/VideoFullscreenManager.h	2020-09-08 16:46:23 UTC (rev 266727)
+++ trunk/Source/WebKit/WebProcess/cocoa/VideoFullscreenManager.h	2020-09-08 17:38:25 UTC (rev 266728)
@@ -149,7 +149,7 @@
     void didSetupFullscreen(PlaybackSessionContextIdentifier);
     void willExitFullscreen(PlaybackSessionContextIdentifier);
     void didExitFullscreen(PlaybackSessionContextIdentifier);
-    void didEnterFullscreen(PlaybackSessionContextIdentifier);
+    void didEnterFullscreen(PlaybackSessionContextIdentifier, Optional<WebCore::FloatSize>);
     void didCleanupFullscreen(PlaybackSessionContextIdentifier);
     void setVideoLayerFrameFenced(PlaybackSessionContextIdentifier, WebCore::FloatRect bounds, IPC::Attachment fencePort);
     void setVideoLayerGravityEnum(PlaybackSessionContextIdentifier, unsigned gravity);

Modified: trunk/Source/WebKit/WebProcess/cocoa/VideoFullscreenManager.messages.in (266727 => 266728)


--- trunk/Source/WebKit/WebProcess/cocoa/VideoFullscreenManager.messages.in	2020-09-08 16:46:23 UTC (rev 266727)
+++ trunk/Source/WebKit/WebProcess/cocoa/VideoFullscreenManager.messages.in	2020-09-08 17:38:25 UTC (rev 266728)
@@ -29,7 +29,7 @@
     DidSetupFullscreen(WebKit::PlaybackSessionContextIdentifier contextId)
     WillExitFullscreen(WebKit::PlaybackSessionContextIdentifier contextId)
     DidExitFullscreen(WebKit::PlaybackSessionContextIdentifier contextId)
-    DidEnterFullscreen(WebKit::PlaybackSessionContextIdentifier contextId)
+    DidEnterFullscreen(WebKit::PlaybackSessionContextIdentifier contextId, Optional<WebCore::FloatSize> size)
     DidCleanupFullscreen(WebKit::PlaybackSessionContextIdentifier contextId)
     SetVideoLayerFrameFenced(WebKit::PlaybackSessionContextIdentifier contextId, WebCore::FloatRect bounds, IPC::Attachment fencePort)
     SetVideoLayerGravityEnum(WebKit::PlaybackSessionContextIdentifier contextId, unsigned gravity)

Modified: trunk/Source/WebKit/WebProcess/cocoa/VideoFullscreenManager.mm (266727 => 266728)


--- trunk/Source/WebKit/WebProcess/cocoa/VideoFullscreenManager.mm	2020-09-08 16:46:23 UTC (rev 266727)
+++ trunk/Source/WebKit/WebProcess/cocoa/VideoFullscreenManager.mm	2020-09-08 17:38:25 UTC (rev 266728)
@@ -342,7 +342,9 @@
 
 void VideoFullscreenManager::fullscreenModeChanged(PlaybackSessionContextIdentifier contextId, WebCore::HTMLMediaElementEnums::VideoFullscreenMode videoFullscreenMode)
 {
-    ensureModel(contextId).fullscreenModeChanged(videoFullscreenMode);
+    auto [model, interface] = ensureModelAndInterface(contextId);
+    model->fullscreenModeChanged(videoFullscreenMode);
+    interface->setFullscreenMode(videoFullscreenMode);
 }
 
 void VideoFullscreenManager::requestUpdateInlineRect(PlaybackSessionContextIdentifier contextId)
@@ -428,7 +430,7 @@
     });
 }
 
-void VideoFullscreenManager::didEnterFullscreen(PlaybackSessionContextIdentifier contextId)
+void VideoFullscreenManager::didEnterFullscreen(PlaybackSessionContextIdentifier contextId, Optional<WebCore::FloatSize> size)
 {
     LOG(Fullscreen, "VideoFullscreenManager::didEnterFullscreen(%p, %x)", this, contextId);
 
@@ -441,7 +443,7 @@
     if (!videoElement)
         return;
 
-    videoElement->didBecomeFullscreenElement();
+    videoElement->didEnterFullscreenOrPictureInPicture(size.valueOr(WebCore::FloatSize()));
 
     if (interface->targetIsFullscreen())
         return;
@@ -483,7 +485,7 @@
     });
 #endif
 }
-    
+
 void VideoFullscreenManager::didCleanupFullscreen(PlaybackSessionContextIdentifier contextId)
 {
     LOG(Fullscreen, "VideoFullscreenManager::didCleanupFullscreen(%p, %x)", this, contextId);
@@ -504,7 +506,7 @@
     model->setVideoFullscreenLayer(nil);
     RefPtr<HTMLVideoElement> videoElement = model->videoElement();
     if (videoElement)
-        videoElement->didStopBeingFullscreenElement();
+        videoElement->didExitFullscreenOrPictureInPicture();
 
     interface->setFullscreenMode(HTMLMediaElementEnums::VideoFullscreenModeNone);
     interface->setFullscreenStandby(false);
@@ -518,12 +520,12 @@
             protectedThis->enterVideoFullscreenForVideoElement(*videoElement, mode, standby);
     });
 }
-    
+
 void VideoFullscreenManager::setVideoLayerGravityEnum(PlaybackSessionContextIdentifier contextId, unsigned gravity)
 {
     ensureModel(contextId).setVideoLayerGravity((MediaPlayerEnums::VideoGravity)gravity);
 }
-    
+
 void VideoFullscreenManager::fullscreenWillReturnToInline(PlaybackSessionContextIdentifier contextId, bool isPageVisible)
 {
     if (!m_page)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to