Unconditionalize more methods in VideoFullscreenInterface (and related classes)
authorjer.noble@apple.com <jer.noble@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 9 Mar 2018 22:56:51 +0000 (22:56 +0000)
committerjer.noble@apple.com <jer.noble@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 9 Mar 2018 22:56:51 +0000 (22:56 +0000)
https://bugs.webkit.org/show_bug.cgi?id=183501

Reviewed by Eric Carlson.

Source/WebCore:

No need for these methods to be PLATFORM(MAC) only.

* platform/cocoa/PlaybackSessionModel.h:
(WebCore::PlaybackSessionModelClient::ensureControlsManager):
* platform/ios/VideoFullscreenInterfaceAVKit.h:
* platform/ios/VideoFullscreenInterfaceAVKit.mm:
(VideoFullscreenInterfaceAVKit::isPlayingVideoInEnhancedFullscreen const):
* platform/mac/VideoFullscreenInterfaceMac.h:

Source/WebKit:

No reason for these methods to be PLATFORM(MAC) only.

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _videoControlsManagerDidChange]):
* UIProcess/API/Cocoa/WKWebViewInternal.h:
* UIProcess/Cocoa/PlaybackSessionManagerProxy.mm:
(WebKit::PlaybackSessionManagerProxy::setUpPlaybackControlsManagerWithID):
(WebKit::PlaybackSessionManagerProxy::clearPlaybackControlsManager):
* UIProcess/Cocoa/VideoFullscreenManagerProxy.h:
* UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
* UIProcess/PageClient.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::isPlayingMediaDidChange):
(WebKit::WebPageProxy::handleControlledElementIDResponse const):
(WebKit::WebPageProxy::isPlayingVideoInEnhancedFullscreen const):
* UIProcess/WebPageProxy.h:
* UIProcess/ios/PageClientImplIOS.h:
* UIProcess/ios/PageClientImplIOS.mm:
(WebKit::PageClientImpl::videoControlsManagerDidChange):
* UIProcess/ios/WKFullScreenWindowControllerIOS.h:
* UIProcess/ios/WKFullScreenWindowControllerIOS.mm:
(-[WKFullScreenWindowController videoControlsManagerDidChange]):
* WebProcess/cocoa/PlaybackSessionManager.mm:
(WebKit::PlaybackSessionManager::setUpPlaybackControlsManager):

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

19 files changed:
Source/WebCore/ChangeLog
Source/WebCore/platform/cocoa/PlaybackSessionModel.h
Source/WebCore/platform/ios/VideoFullscreenInterfaceAVKit.h
Source/WebCore/platform/ios/VideoFullscreenInterfaceAVKit.mm
Source/WebCore/platform/mac/VideoFullscreenInterfaceMac.h
Source/WebKit/ChangeLog
Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm
Source/WebKit/UIProcess/API/Cocoa/WKWebViewInternal.h
Source/WebKit/UIProcess/Cocoa/PlaybackSessionManagerProxy.mm
Source/WebKit/UIProcess/Cocoa/VideoFullscreenManagerProxy.h
Source/WebKit/UIProcess/Cocoa/VideoFullscreenManagerProxy.mm
Source/WebKit/UIProcess/PageClient.h
Source/WebKit/UIProcess/WebPageProxy.cpp
Source/WebKit/UIProcess/WebPageProxy.h
Source/WebKit/UIProcess/ios/PageClientImplIOS.h
Source/WebKit/UIProcess/ios/PageClientImplIOS.mm
Source/WebKit/UIProcess/ios/WKFullScreenWindowControllerIOS.h
Source/WebKit/UIProcess/ios/WKFullScreenWindowControllerIOS.mm
Source/WebKit/WebProcess/cocoa/PlaybackSessionManager.mm

index 1b7729d..e323817 100644 (file)
@@ -1,3 +1,19 @@
+2018-03-09  Jer Noble  <jer.noble@apple.com>
+
+        Unconditionalize more methods in VideoFullscreenInterface (and related classes)
+        https://bugs.webkit.org/show_bug.cgi?id=183501
+
+        Reviewed by Eric Carlson.
+
+        No need for these methods to be PLATFORM(MAC) only.
+
+        * platform/cocoa/PlaybackSessionModel.h:
+        (WebCore::PlaybackSessionModelClient::ensureControlsManager):
+        * platform/ios/VideoFullscreenInterfaceAVKit.h:
+        * platform/ios/VideoFullscreenInterfaceAVKit.mm:
+        (VideoFullscreenInterfaceAVKit::isPlayingVideoInEnhancedFullscreen const):
+        * platform/mac/VideoFullscreenInterfaceMac.h:
+
 2018-03-09  Youenn Fablet  <youenn@apple.com>
 
         ServiceWorker should respect IDB and DOMCache partitioning
index 313ca84..747809d 100644 (file)
@@ -102,6 +102,7 @@ public:
     virtual void wirelessVideoPlaybackDisabledChanged(bool) { }
     virtual void mutedChanged(bool) { }
     virtual void pictureInPictureActiveChanged(bool) { }
+    virtual void ensureControlsManager() { }
 };
 
 }
index e7149a4..52f8a12 100644 (file)
@@ -151,6 +151,7 @@ public:
     void exitFullscreenHandler(BOOL success, NSError *);
     void enterFullscreenHandler(BOOL success, NSError *);
 #endif
+    bool isPlayingVideoInEnhancedFullscreen() const;
 
     void setMode(HTMLMediaElementEnums::VideoFullscreenMode);
     void clearMode(HTMLMediaElementEnums::VideoFullscreenMode);
index dfb0695..03efbde 100644 (file)
@@ -1620,6 +1620,11 @@ void VideoFullscreenInterfaceAVKit::clearMode(HTMLMediaElementEnums::VideoFullsc
         m_videoFullscreenModel->fullscreenModeChanged(m_currentMode.mode());
 }
 
+bool VideoFullscreenInterfaceAVKit::isPlayingVideoInEnhancedFullscreen() const
+{
+    return hasMode(WebCore::HTMLMediaElementEnums::VideoFullscreenModePictureInPicture) && [playerController() isPlaying];
+}
+
 #endif // HAVE(AVKIT)
 
 bool WebCore::supportsPictureInPicture()
index 1c74b84..8c09f12 100644 (file)
@@ -64,6 +64,7 @@ public:
     // PlaybackSessionModelClient
     WEBCORE_EXPORT void rateChanged(bool isPlaying, float playbackRate) override;
     WEBCORE_EXPORT void externalPlaybackChanged(bool  enabled, PlaybackSessionModel::ExternalPlaybackTargetType, const String& localizedDeviceName) override;
+    WEBCORE_EXPORT void ensureControlsManager() override;
 
     // VideoFullscreenModelClient
     WEBCORE_EXPORT void hasVideoChanged(bool) final;
@@ -77,7 +78,6 @@ public:
     WEBCORE_EXPORT void invalidate();
     void requestHideAndExitFullscreen() { }
     WEBCORE_EXPORT void preparedToReturnToInline(bool visible, const IntRect& inlineRect, NSWindow *parentWindow);
-    WEBCORE_EXPORT void ensureControlsManager();
 
     HTMLMediaElementEnums::VideoFullscreenMode mode() const { return m_mode; }
     bool hasMode(HTMLMediaElementEnums::VideoFullscreenMode mode) const { return m_mode & mode; }
index 81ca3b5..24a07e8 100644 (file)
@@ -1,3 +1,35 @@
+2018-03-09  Jer Noble  <jer.noble@apple.com>
+
+        Unconditionalize more methods in VideoFullscreenInterface (and related classes)
+        https://bugs.webkit.org/show_bug.cgi?id=183501
+
+        Reviewed by Eric Carlson.
+
+        No reason for these methods to be PLATFORM(MAC) only.
+
+        * UIProcess/API/Cocoa/WKWebView.mm:
+        (-[WKWebView _videoControlsManagerDidChange]):
+        * UIProcess/API/Cocoa/WKWebViewInternal.h:
+        * UIProcess/Cocoa/PlaybackSessionManagerProxy.mm:
+        (WebKit::PlaybackSessionManagerProxy::setUpPlaybackControlsManagerWithID):
+        (WebKit::PlaybackSessionManagerProxy::clearPlaybackControlsManager):
+        * UIProcess/Cocoa/VideoFullscreenManagerProxy.h:
+        * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
+        * UIProcess/PageClient.h:
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::isPlayingMediaDidChange):
+        (WebKit::WebPageProxy::handleControlledElementIDResponse const):
+        (WebKit::WebPageProxy::isPlayingVideoInEnhancedFullscreen const):
+        * UIProcess/WebPageProxy.h:
+        * UIProcess/ios/PageClientImplIOS.h:
+        * UIProcess/ios/PageClientImplIOS.mm:
+        (WebKit::PageClientImpl::videoControlsManagerDidChange):
+        * UIProcess/ios/WKFullScreenWindowControllerIOS.h:
+        * UIProcess/ios/WKFullScreenWindowControllerIOS.mm:
+        (-[WKFullScreenWindowController videoControlsManagerDidChange]):
+        * WebProcess/cocoa/PlaybackSessionManager.mm:
+        (WebKit::PlaybackSessionManager::setUpPlaybackControlsManager):
+
 2018-03-09  Per Arne Vollan  <pvollan@apple.com>
 
         Create CA layer contexts with +remoteContextWithOptions.
index f4f3c14..c0432ed 100644 (file)
@@ -1564,6 +1564,14 @@ static WebCore::Color scrollViewBackgroundColor(WKWebView *webView)
         [_scrollView setIndicatorStyle:UIScrollViewIndicatorStyleDefault];
 }
 
+- (void)_videoControlsManagerDidChange
+{
+#if ENABLE(FULLSCREEN_API)
+    if (_fullScreenWindowController)
+        [_fullScreenWindowController videoControlsManagerDidChange];
+#endif
+}
+
 - (CGPoint)_adjustedContentOffset:(CGPoint)point
 {
     CGPoint result = point;
index db7513d..05d462b 100644 (file)
@@ -114,6 +114,8 @@ struct PrintInfo;
 
 - (void)_updateScrollViewBackground;
 
+- (void)_videoControlsManagerDidChange;
+
 - (void)_navigationGestureDidBegin;
 - (void)_navigationGestureDidEnd;
 - (BOOL)_isNavigationSwipeGestureRecognizer:(UIGestureRecognizer *)recognizer;
index b5072a0..c59953d 100644 (file)
@@ -346,7 +346,6 @@ void PlaybackSessionManagerProxy::removeClientForContext(uint64_t contextId)
 
 void PlaybackSessionManagerProxy::setUpPlaybackControlsManagerWithID(uint64_t contextId)
 {
-#if PLATFORM(MAC)
     if (m_controlsManagerContextId == contextId)
         return;
 
@@ -358,21 +357,16 @@ void PlaybackSessionManagerProxy::setUpPlaybackControlsManagerWithID(uint64_t co
     addClientForContext(m_controlsManagerContextId);
 
     m_page->videoControlsManagerDidChange();
-#else
-    UNUSED_PARAM(contextId);
-#endif
 }
 
 void PlaybackSessionManagerProxy::clearPlaybackControlsManager()
 {
-#if PLATFORM(MAC)
     if (!m_controlsManagerContextId)
         return;
 
     removeClientForContext(m_controlsManagerContextId);
     m_controlsManagerContextId = 0;
     m_page->videoControlsManagerDidChange();
-#endif
 }
 
 void PlaybackSessionManagerProxy::resetMediaState(uint64_t contextId)
index b20aba3..3cb81a7 100644 (file)
@@ -118,7 +118,7 @@ public:
     void applicationDidBecomeActive();
     bool isVisible() const;
 
-#if PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)
+#if ENABLE(VIDEO_PRESENTATION_MODE)
     bool isPlayingVideoInEnhancedFullscreen() const;
 #endif
 
index 76718e4..4ff2774 100644 (file)
@@ -279,7 +279,7 @@ bool VideoFullscreenManagerProxy::mayAutomaticallyShowVideoPictureInPicture() co
     return false;
 }
 
-#if PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)
+#if ENABLE(VIDEO_PRESENTATION_MODE)
 bool VideoFullscreenManagerProxy::isPlayingVideoInEnhancedFullscreen() const
 {
     for (auto& tuple : m_contextMap.values()) {
index ad42019..4dcac57 100644 (file)
@@ -350,10 +350,10 @@ public:
     virtual void* immediateActionAnimationControllerForHitTestResult(RefPtr<API::HitTestResult>, uint64_t, RefPtr<API::Object>) = 0;
 
     virtual void didHandleAcceptedCandidate() = 0;
-
-    virtual void videoControlsManagerDidChange() = 0;
 #endif
 
+    virtual void videoControlsManagerDidChange() { };
+
 #if ENABLE(WIRELESS_PLAYBACK_TARGET) && !PLATFORM(IOS)
     virtual WebCore::WebMediaSessionManager& mediaSessionManager() = 0;
 #endif
index 4326a73..28b43cd 100644 (file)
@@ -6803,13 +6803,10 @@ void WebPageProxy::isPlayingMediaDidChange(MediaProducer::MediaStateFlags newSta
     if ((oldState & playingMediaMask) != (m_mediaState & playingMediaMask))
         m_uiClient->isPlayingMediaDidChange(*this);
 
-#if PLATFORM(MAC)
     if ((oldState & MediaProducer::HasAudioOrVideo) != (m_mediaState & MediaProducer::HasAudioOrVideo))
         videoControlsManagerDidChange();
-#endif
 }
 
-#if PLATFORM(MAC)
 void WebPageProxy::videoControlsManagerDidChange()
 {
     m_pageClient.videoControlsManagerDidChange();
@@ -6834,7 +6831,9 @@ void WebPageProxy::requestControlledElementID() const
 
 void WebPageProxy::handleControlledElementIDResponse(const String& identifier) const
 {
+#if PLATFORM(MAC)
     m_pageClient.handleControlledElementIDResponse(identifier);
+#endif
 }
 
 bool WebPageProxy::isPlayingVideoInEnhancedFullscreen() const
@@ -6845,7 +6844,6 @@ bool WebPageProxy::isPlayingVideoInEnhancedFullscreen() const
     return false;
 #endif
 }
-#endif
 
 #if PLATFORM(COCOA)
 void WebPageProxy::requestActiveNowPlayingSessionInfo(Ref<NowPlayingInfoCallback>&& callback)
index 54a7488..8cc4a10 100644 (file)
@@ -1129,13 +1129,11 @@ public:
     WebCore::MediaProducer::MediaStateFlags mediaStateFlags() const { return m_mediaState; }
     void handleAutoplayEvent(WebCore::AutoplayEvent, OptionSet<WebCore::AutoplayEventFlags>);
 
-#if PLATFORM(MAC)
     void videoControlsManagerDidChange();
     bool hasActiveVideoForControlsManager() const;
     void requestControlledElementID() const;
     void handleControlledElementIDResponse(const String&) const;
     bool isPlayingVideoInEnhancedFullscreen() const;
-#endif
 
 #if PLATFORM(COCOA)
     void requestActiveNowPlayingSessionInfo(Ref<NowPlayingInfoCallback>&&);
index 560ab6f..7671cb2 100644 (file)
@@ -190,6 +190,7 @@ private:
     void didCompleteSyntheticClick() override;
 
     void didChangeBackgroundColor() override;
+    void videoControlsManagerDidChange() override;
 
     void refView() override;
     void derefView() override;
index 3a3ed66..59849f0 100644 (file)
@@ -742,6 +742,11 @@ void PageClientImpl::didChangeBackgroundColor()
     [m_webView _updateScrollViewBackground];
 }
 
+void PageClientImpl::videoControlsManagerDidChange()
+{
+    [m_webView _videoControlsManagerDidChange];
+}
+
 void PageClientImpl::refView()
 {
     [m_contentView retain];
index 5304799..9eab623 100644 (file)
@@ -53,6 +53,7 @@ class IntRect;
 - (void)beganEnterFullScreenWithInitialFrame:(CGRect)initialFrame finalFrame:(CGRect)finalFrame;
 - (void)beganExitFullScreenWithInitialFrame:(CGRect)initialFrame finalFrame:(CGRect)finalFrame;
 - (void)webViewDidRemoveFromSuperviewWhileInFullscreen;
+- (void)videoControlsManagerDidChange;
 
 @end
 
index 6a29981..6f031f3 100644 (file)
@@ -847,6 +847,10 @@ static UIEdgeInsets mirrorEdgeInsets(UIEdgeInsets insets)
         [self exitFullscreenImmediately];
 }
 
+- (void)videoControlsManagerDidChange
+{
+}
+
 #pragma mark -
 #pragma mark Internal Interface
 
index 1ae3636..0563f9a 100644 (file)
@@ -250,7 +250,6 @@ void PlaybackSessionManager::removeClientForContext(uint64_t contextId)
 
 void PlaybackSessionManager::setUpPlaybackControlsManager(WebCore::HTMLMediaElement& mediaElement)
 {
-#if PLATFORM(MAC)
     auto foundIterator = m_mediaElements.find(&mediaElement);
     if (foundIterator != m_mediaElements.end()) {
         uint64_t contextId = foundIterator->value;
@@ -271,7 +270,6 @@ void PlaybackSessionManager::setUpPlaybackControlsManager(WebCore::HTMLMediaElem
 
     addClientForContext(m_controlsManagerContextId);
     m_page->send(Messages::PlaybackSessionManagerProxy::SetUpPlaybackControlsManagerWithID(m_controlsManagerContextId), m_page->pageID());
-#endif
 }
 
 void PlaybackSessionManager::clearPlaybackControlsManager()