Title: [229472] trunk/Source
Revision
229472
Author
[email protected]
Date
2018-03-09 10:59:33 -0800 (Fri, 09 Mar 2018)

Log Message

Add isPictureInPictureActive messaging across WebKit process boundary
https://bugs.webkit.org/show_bug.cgi?id=183499

Reviewed by Eric Carlson.

Source/WebCore:

* platform/cocoa/PlaybackSessionModel.h:
(WebCore::PlaybackSessionModelClient::pictureInPictureActiveChanged):
* platform/cocoa/PlaybackSessionModelMediaElement.h:
* platform/cocoa/PlaybackSessionModelMediaElement.mm:
(WebCore::PlaybackSessionModelMediaElement::updateForEventName):
(WebCore::PlaybackSessionModelMediaElement::isPictureInPictureActive const):
* platform/ios/WebVideoFullscreenControllerAVKit.mm:
(VideoFullscreenControllerContext::isPictureInPictureActive const):

Source/WebKit:

* UIProcess/Cocoa/PlaybackSessionManagerProxy.h:
* UIProcess/Cocoa/PlaybackSessionManagerProxy.messages.in:
* UIProcess/Cocoa/PlaybackSessionManagerProxy.mm:
(WebKit::PlaybackSessionModelContext::pictureInPictureActiveChanged):
(WebKit::PlaybackSessionManagerProxy::pictureInPictureActiveChanged):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (229471 => 229472)


--- trunk/Source/WebCore/ChangeLog	2018-03-09 18:51:27 UTC (rev 229471)
+++ trunk/Source/WebCore/ChangeLog	2018-03-09 18:59:33 UTC (rev 229472)
@@ -1,3 +1,19 @@
+2018-03-09  Jer Noble  <[email protected]>
+
+        Add isPictureInPictureActive messaging across WebKit process boundary
+        https://bugs.webkit.org/show_bug.cgi?id=183499
+
+        Reviewed by Eric Carlson.
+
+        * platform/cocoa/PlaybackSessionModel.h:
+        (WebCore::PlaybackSessionModelClient::pictureInPictureActiveChanged):
+        * platform/cocoa/PlaybackSessionModelMediaElement.h:
+        * platform/cocoa/PlaybackSessionModelMediaElement.mm:
+        (WebCore::PlaybackSessionModelMediaElement::updateForEventName):
+        (WebCore::PlaybackSessionModelMediaElement::isPictureInPictureActive const):
+        * platform/ios/WebVideoFullscreenControllerAVKit.mm:
+        (VideoFullscreenControllerContext::isPictureInPictureActive const):
+
 2018-03-09  Basuke Suzuki  <[email protected]>
 
         [Curl] Implement connection limit.

Modified: trunk/Source/WebCore/platform/cocoa/PlaybackSessionModel.h (229471 => 229472)


--- trunk/Source/WebCore/platform/cocoa/PlaybackSessionModel.h	2018-03-09 18:51:27 UTC (rev 229471)
+++ trunk/Source/WebCore/platform/cocoa/PlaybackSessionModel.h	2018-03-09 18:59:33 UTC (rev 229472)
@@ -81,6 +81,7 @@
     virtual String externalPlaybackLocalizedDeviceName() const = 0;
     virtual bool wirelessVideoPlaybackDisabled() const = 0;
     virtual bool isMuted() const = 0;
+    virtual bool isPictureInPictureActive() const = 0;
 };
 
 class PlaybackSessionModelClient {
@@ -100,6 +101,7 @@
     virtual void externalPlaybackChanged(bool /* enabled */, PlaybackSessionModel::ExternalPlaybackTargetType, const String& /* localizedDeviceName */) { }
     virtual void wirelessVideoPlaybackDisabledChanged(bool) { }
     virtual void mutedChanged(bool) { }
+    virtual void pictureInPictureActiveChanged(bool) { }
 };
 
 }

Modified: trunk/Source/WebCore/platform/cocoa/PlaybackSessionModelMediaElement.h (229471 => 229472)


--- trunk/Source/WebCore/platform/cocoa/PlaybackSessionModelMediaElement.h	2018-03-09 18:51:27 UTC (rev 229471)
+++ trunk/Source/WebCore/platform/cocoa/PlaybackSessionModelMediaElement.h	2018-03-09 18:59:33 UTC (rev 229472)
@@ -92,6 +92,7 @@
     String externalPlaybackLocalizedDeviceName() const final;
     bool wirelessVideoPlaybackDisabled() const final;
     bool isMuted() const final;
+    bool isPictureInPictureActive() const final;
 
 protected:
     WEBCORE_EXPORT PlaybackSessionModelMediaElement();

Modified: trunk/Source/WebCore/platform/cocoa/PlaybackSessionModelMediaElement.mm (229471 => 229472)


--- trunk/Source/WebCore/platform/cocoa/PlaybackSessionModelMediaElement.mm	2018-03-09 18:51:27 UTC (rev 229471)
+++ trunk/Source/WebCore/platform/cocoa/PlaybackSessionModelMediaElement.mm	2018-03-09 18:59:33 UTC (rev 229472)
@@ -165,6 +165,15 @@
         }
     }
 
+    if (all
+        || eventName == eventNames().webkitpresentationmodechangedEvent) {
+        bool isPictureInPictureActive = this->isPictureInPictureActive();
+
+        for (auto client : m_clients)
+            client->pictureInPictureActiveChanged(isPictureInPictureActive);
+    }
+
+
     // We don't call updateMediaSelectionIndices() in the all case, since
     // updateMediaSelectionOptions() will also update the selection indices.
     if (eventName == eventNames().changeEvent)
@@ -529,6 +538,14 @@
     return m_mediaElement ? m_mediaElement->muted() : false;
 }
 
+bool PlaybackSessionModelMediaElement::isPictureInPictureActive() const
+{
+    if (!m_mediaElement)
+        return false;
+
+    return (m_mediaElement->fullscreenMode() & HTMLMediaElementEnums::VideoFullscreenModePictureInPicture) == HTMLMediaElementEnums::VideoFullscreenModePictureInPicture;
 }
 
+}
+
 #endif

Modified: trunk/Source/WebCore/platform/ios/WebVideoFullscreenControllerAVKit.mm (229471 => 229472)


--- trunk/Source/WebCore/platform/ios/WebVideoFullscreenControllerAVKit.mm	2018-03-09 18:51:27 UTC (rev 229471)
+++ trunk/Source/WebCore/platform/ios/WebVideoFullscreenControllerAVKit.mm	2018-03-09 18:59:33 UTC (rev 229472)
@@ -197,6 +197,7 @@
     bool hasVideo() const override;
     FloatSize videoDimensions() const override;
     bool isMuted() const override;
+    bool isPictureInPictureActive() const override;
 
     HashSet<PlaybackSessionModelClient*> m_playbackClients;
     HashSet<VideoFullscreenModelClient*> m_fullscreenClients;
@@ -588,6 +589,12 @@
     return m_playbackModel ? m_playbackModel->isMuted() : false;
 }
 
+bool VideoFullscreenControllerContext::isPictureInPictureActive() const
+{
+    ASSERT(isUIThread());
+    return m_playbackModel ? m_playbackModel->isPictureInPictureActive() : false;
+}
+
 FloatSize VideoFullscreenControllerContext::videoDimensions() const
 {
     ASSERT(isUIThread());

Modified: trunk/Source/WebKit/ChangeLog (229471 => 229472)


--- trunk/Source/WebKit/ChangeLog	2018-03-09 18:51:27 UTC (rev 229471)
+++ trunk/Source/WebKit/ChangeLog	2018-03-09 18:59:33 UTC (rev 229472)
@@ -1,3 +1,16 @@
+2018-03-09  Jer Noble  <[email protected]>
+
+        Add isPictureInPictureActive messaging across WebKit process boundary
+        https://bugs.webkit.org/show_bug.cgi?id=183499
+
+        Reviewed by Eric Carlson.
+
+        * UIProcess/Cocoa/PlaybackSessionManagerProxy.h:
+        * UIProcess/Cocoa/PlaybackSessionManagerProxy.messages.in:
+        * UIProcess/Cocoa/PlaybackSessionManagerProxy.mm:
+        (WebKit::PlaybackSessionModelContext::pictureInPictureActiveChanged):
+        (WebKit::PlaybackSessionManagerProxy::pictureInPictureActiveChanged):
+
 2018-03-09  Stephan Szabo  <[email protected]>
 
         Add guard for wtf/glib include

Modified: trunk/Source/WebKit/UIProcess/Cocoa/PlaybackSessionManagerProxy.h (229471 => 229472)


--- trunk/Source/WebKit/UIProcess/Cocoa/PlaybackSessionManagerProxy.h	2018-03-09 18:51:27 UTC (rev 229471)
+++ trunk/Source/WebKit/UIProcess/Cocoa/PlaybackSessionManagerProxy.h	2018-03-09 18:59:33 UTC (rev 229472)
@@ -84,6 +84,7 @@
     void externalPlaybackChanged(bool, PlaybackSessionModel::ExternalPlaybackTargetType, const String&);
     void wirelessVideoPlaybackDisabledChanged(bool);
     void mutedChanged(bool);
+    void pictureInPictureActiveChanged(bool);
 
 private:
     friend class VideoFullscreenModelContext;
@@ -131,6 +132,7 @@
     String externalPlaybackLocalizedDeviceName() const final { return m_externalPlaybackLocalizedDeviceName; }
     bool wirelessVideoPlaybackDisabled() const final { return m_wirelessVideoPlaybackDisabled; }
     bool isMuted() const final { return m_muted; }
+    bool isPictureInPictureActive() const final { return m_pictureInPictureActive; }
 
     PlaybackSessionManagerProxy* m_manager;
     uint64_t m_contextId;
@@ -156,6 +158,7 @@
     String m_externalPlaybackLocalizedDeviceName;
     bool m_wirelessVideoPlaybackDisabled { false };
     bool m_muted { false };
+    bool m_pictureInPictureActive { false };
 };
 
 class PlaybackSessionManagerProxy : public RefCounted<PlaybackSessionManagerProxy>, private IPC::MessageReceiver {
@@ -202,6 +205,7 @@
     void rateChanged(uint64_t contextId, bool isPlaying, double rate);
     void handleControlledElementIDResponse(uint64_t, String) const;
     void mutedChanged(uint64_t contextId, bool muted);
+    void pictureInPictureActiveChanged(uint64_t contextId, bool pictureInPictureActive);
 
     // Messages to PlaybackSessionManager
     void play(uint64_t contextId);

Modified: trunk/Source/WebKit/UIProcess/Cocoa/PlaybackSessionManagerProxy.messages.in (229471 => 229472)


--- trunk/Source/WebKit/UIProcess/Cocoa/PlaybackSessionManagerProxy.messages.in	2018-03-09 18:51:27 UTC (rev 229471)
+++ trunk/Source/WebKit/UIProcess/Cocoa/PlaybackSessionManagerProxy.messages.in	2018-03-09 18:59:33 UTC (rev 229472)
@@ -37,6 +37,7 @@
     PlaybackStartedTimeChanged(uint64_t contextId, double playbackStartedTime)
     RateChanged(uint64_t contextId, bool isPlaying, double rate)
     MutedChanged(uint64_t contextId, bool muted);
+    PictureInPictureActiveChanged(uint64_t contextId, bool pictureInPictureActive)
     SetUpPlaybackControlsManagerWithID(uint64_t contextId)
     ClearPlaybackControlsManager()
 

Modified: trunk/Source/WebKit/UIProcess/Cocoa/PlaybackSessionManagerProxy.mm (229471 => 229472)


--- trunk/Source/WebKit/UIProcess/Cocoa/PlaybackSessionManagerProxy.mm	2018-03-09 18:51:27 UTC (rev 229471)
+++ trunk/Source/WebKit/UIProcess/Cocoa/PlaybackSessionManagerProxy.mm	2018-03-09 18:59:33 UTC (rev 229472)
@@ -258,6 +258,13 @@
         client->mutedChanged(muted);
 }
 
+void PlaybackSessionModelContext::pictureInPictureActiveChanged(bool active)
+{
+    m_pictureInPictureActive = active;
+    for (auto* client : m_clients)
+        client->pictureInPictureActiveChanged(active);
+}
+
 #pragma mark - PlaybackSessionManagerProxy
 
 RefPtr<PlaybackSessionManagerProxy> PlaybackSessionManagerProxy::create(WebPageProxy& page)
@@ -454,6 +461,10 @@
     ensureModel(contextId).rateChanged(isPlaying, rate);
 }
 
+void PlaybackSessionManagerProxy::pictureInPictureActiveChanged(uint64_t contextId, bool active)
+{
+    ensureModel(contextId).pictureInPictureActiveChanged(active);
+}
 
 void PlaybackSessionManagerProxy::handleControlledElementIDResponse(uint64_t contextId, String identifier) const
 {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to