WebKit Bugzilla
Attachment 341535 Details for
Bug 186065
: Auto-pip should use main content heuristic.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-186065-20180529162934.patch (text/plain), 8.77 KB, created by
Jer Noble
on 2018-05-29 16:29:36 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Jer Noble
Created:
2018-05-29 16:29:36 PDT
Size:
8.77 KB
patch
obsolete
>Subversion Revision: 232261 >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index 3c71da1f42cf45a7c22c0fc67ef255eb47d6ea55..34199d3438b5c115ebdd55fbac09d324d0ac0b0d 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,29 @@ >+2018-05-29 Jer Noble <jer.noble@apple.com> >+ >+ Auto-pip should use main content heuristic. >+ https://bugs.webkit.org/show_bug.cgi?id=186065 >+ <rdar://problem/35862502> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Make the m_pipStandbyElement clearable, which will allow the auto-pip mechanism to be torn down. Add >+ a WebProcess-side notification when the main content changes, to facilitate this. >+ >+ * WebProcess/FullScreen/WebFullScreenManager.cpp: >+ (WebKit::WebFullScreenManager::videoControlsManagerDidChange): >+ (WebKit::WebFullScreenManager::setPIPStandbyElement): >+ (WebKit::WebFullScreenManager::didEnterFullScreen): >+ (WebKit::WebFullScreenManager::willExitFullScreen): >+ * WebProcess/FullScreen/WebFullScreenManager.h: >+ * WebProcess/WebPage/WebPage.cpp: >+ (WebKit::WebPage::videoControlsManagerDidChange): >+ * WebProcess/WebPage/WebPage.h: >+ * WebProcess/cocoa/PlaybackSessionManager.h: >+ * WebProcess/cocoa/PlaybackSessionManager.mm: >+ (WebKit::PlaybackSessionManager::setUpPlaybackControlsManager): >+ (WebKit::PlaybackSessionManager::clearPlaybackControlsManager): >+ (WebKit::PlaybackSessionManager::currentPlaybackControlsElement const): >+ > 2018-05-29 Jer Noble <jer.noble@apple.com> > > Fix a few issues in WKFullScreenViewController >diff --git a/Source/WebKit/WebProcess/FullScreen/WebFullScreenManager.cpp b/Source/WebKit/WebProcess/FullScreen/WebFullScreenManager.cpp >index 963f1b9d5f666a1ce51d7a73568f1881c5ab225a..3bff5a439128cced55c894e924ca9ed6d4e8151b 100644 >--- a/Source/WebKit/WebProcess/FullScreen/WebFullScreenManager.cpp >+++ b/Source/WebKit/WebProcess/FullScreen/WebFullScreenManager.cpp >@@ -45,6 +45,10 @@ > #include <WebCore/Settings.h> > #include <WebCore/TypedElementDescendantIterator.h> > >+#if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)) >+#include "PlaybackSessionManager.h" >+#endif >+ > using namespace WebCore; > > namespace WebKit { >@@ -81,6 +85,28 @@ WebCore::Element* WebFullScreenManager::element() > return m_element.get(); > } > >+void WebFullScreenManager::videoControlsManagerDidChange() >+{ >+#if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)) >+ auto* currentPlaybackControlsElement = m_page->playbackSessionManager().currentPlaybackControlsElement(); >+ setPIPStandbyElement(is<HTMLVideoElement>(currentPlaybackControlsElement) ? downcast<HTMLVideoElement>(currentPlaybackControlsElement) : nullptr); >+#endif >+} >+ >+void WebFullScreenManager::setPIPStandbyElement(WebCore::HTMLVideoElement* pipStandbyElement) >+{ >+ if (pipStandbyElement == m_pipStandbyElement) >+ return; >+ >+ if (m_pipStandbyElement) >+ m_pipStandbyElement->setVideoFullscreenStandby(false); >+ >+ m_pipStandbyElement = pipStandbyElement; >+ >+ if (m_pipStandbyElement) >+ m_pipStandbyElement->setVideoFullscreenStandby(true); >+} >+ > void WebFullScreenManager::didReceiveMessage(IPC::Connection& connection, IPC::Decoder& decoder) > { > didReceiveWebFullScreenManagerMessage(connection, decoder); >@@ -125,10 +151,9 @@ void WebFullScreenManager::didEnterFullScreen() > ASSERT(m_element); > m_element->document().webkitDidEnterFullScreenForElement(m_element.get()); > >-#if ENABLE(VIDEO) >- m_pipStandbyElement = descendantsOfType<HTMLVideoElement>(*m_element).first(); >- if (m_pipStandbyElement) >- m_pipStandbyElement->setVideoFullscreenStandby(true); >+#if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)) >+ auto* currentPlaybackControlsElement = m_page->playbackSessionManager().currentPlaybackControlsElement(); >+ setPIPStandbyElement(is<HTMLVideoElement>(currentPlaybackControlsElement) ? downcast<HTMLVideoElement>(currentPlaybackControlsElement) : nullptr); > #endif > } > >@@ -137,9 +162,7 @@ void WebFullScreenManager::willExitFullScreen() > ASSERT(m_element); > > #if ENABLE(VIDEO) >- if (m_pipStandbyElement) >- m_pipStandbyElement->setVideoFullscreenStandby(false); >- m_pipStandbyElement = nullptr; >+ setPIPStandbyElement(nullptr); > #endif > > m_finalFrame = screenRectOfContents(m_element.get()); >diff --git a/Source/WebKit/WebProcess/FullScreen/WebFullScreenManager.h b/Source/WebKit/WebProcess/FullScreen/WebFullScreenManager.h >index cd9478037c4f1e414b63c9ab400a27d207aa99fc..c170fa2aeaa72e5cf1f30261969de4228da05a79 100644 >--- a/Source/WebKit/WebProcess/FullScreen/WebFullScreenManager.h >+++ b/Source/WebKit/WebProcess/FullScreen/WebFullScreenManager.h >@@ -65,11 +65,15 @@ public: > > WebCore::Element* element(); > >+ void videoControlsManagerDidChange(); >+ > void close(); > > protected: > WebFullScreenManager(WebPage*); > >+ void setPIPStandbyElement(WebCore::HTMLVideoElement*); >+ > void setAnimatingFullScreen(bool); > void requestExitFullScreen(); > void saveScrollPosition(); >diff --git a/Source/WebKit/WebProcess/WebPage/WebPage.cpp b/Source/WebKit/WebProcess/WebPage/WebPage.cpp >index f58cc943cf960026d3e91a002f4e677bcfc4bbed..707a01297c25ba671543273e4df35908b099a4d1 100644 >--- a/Source/WebKit/WebProcess/WebPage/WebPage.cpp >+++ b/Source/WebKit/WebProcess/WebPage/WebPage.cpp >@@ -3293,6 +3293,15 @@ VideoFullscreenManager& WebPage::videoFullscreenManager() > m_videoFullscreenManager = VideoFullscreenManager::create(*this, playbackSessionManager()); > return *m_videoFullscreenManager; > } >+ >+void WebPage::videoControlsManagerDidChange() >+{ >+#if ENABLE(FULLSCREEN_API) >+ if (auto* manager = fullScreenManager()) >+ manager->videoControlsManagerDidChange(); >+#endif >+} >+ > #endif > > #if PLATFORM(IOS) >diff --git a/Source/WebKit/WebProcess/WebPage/WebPage.h b/Source/WebKit/WebProcess/WebPage/WebPage.h >index 333c7cc83e3249070910c4c3ea9b788eab06b900..bba6d328d90217f2d3fc45bd8db61d0ac6a70a44 100644 >--- a/Source/WebKit/WebProcess/WebPage/WebPage.h >+++ b/Source/WebKit/WebProcess/WebPage/WebPage.h >@@ -298,6 +298,7 @@ public: > #if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)) > PlaybackSessionManager& playbackSessionManager(); > VideoFullscreenManager& videoFullscreenManager(); >+ void videoControlsManagerDidChange(); > #endif > > #if PLATFORM(IOS) >diff --git a/Source/WebKit/WebProcess/cocoa/PlaybackSessionManager.h b/Source/WebKit/WebProcess/cocoa/PlaybackSessionManager.h >index 7f406854cac6f2a65dac29081744581111f25336..d297dac2297fff9ab88f6180b9e9d928e502812f 100644 >--- a/Source/WebKit/WebProcess/cocoa/PlaybackSessionManager.h >+++ b/Source/WebKit/WebProcess/cocoa/PlaybackSessionManager.h >@@ -109,6 +109,8 @@ public: > void clearPlaybackControlsManager(); > uint64_t contextIdForMediaElement(WebCore::HTMLMediaElement&); > >+ WebCore::HTMLMediaElement* currentPlaybackControlsElement() const; >+ > protected: > friend class PlaybackSessionInterfaceContext; > friend class VideoFullscreenManager; >diff --git a/Source/WebKit/WebProcess/cocoa/PlaybackSessionManager.mm b/Source/WebKit/WebProcess/cocoa/PlaybackSessionManager.mm >index c5df31e0fce940b5743b1fdf8f7f3131ad83fd3a..b010d3076b0b30c98050319091bf7093f8c027b4 100644 >--- a/Source/WebKit/WebProcess/cocoa/PlaybackSessionManager.mm >+++ b/Source/WebKit/WebProcess/cocoa/PlaybackSessionManager.mm >@@ -278,19 +278,21 @@ void PlaybackSessionManager::setUpPlaybackControlsManager(WebCore::HTMLMediaElem > } > > addClientForContext(m_controlsManagerContextId); >+ >+ m_page->videoControlsManagerDidChange(); > m_page->send(Messages::PlaybackSessionManagerProxy::SetUpPlaybackControlsManagerWithID(m_controlsManagerContextId), m_page->pageID()); > } > > void PlaybackSessionManager::clearPlaybackControlsManager() > { >-#if PLATFORM(MAC) > if (!m_controlsManagerContextId) > return; > > removeClientForContext(m_controlsManagerContextId); > m_controlsManagerContextId = 0; >+ >+ m_page->videoControlsManagerDidChange(); > m_page->send(Messages::PlaybackSessionManagerProxy::ClearPlaybackControlsManager(), m_page->pageID()); >-#endif > } > > uint64_t PlaybackSessionManager::contextIdForMediaElement(WebCore::HTMLMediaElement& mediaElement) >@@ -301,6 +303,18 @@ uint64_t PlaybackSessionManager::contextIdForMediaElement(WebCore::HTMLMediaElem > return contextId; > } > >+WebCore::HTMLMediaElement* PlaybackSessionManager::currentPlaybackControlsElement() const >+{ >+ if (!m_controlsManagerContextId) >+ return nullptr; >+ >+ auto iter = m_contextMap.find(m_controlsManagerContextId); >+ if (iter == m_contextMap.end()) >+ return nullptr; >+ >+ return std::get<0>(iter->value)->mediaElement(); >+} >+ > #pragma mark Interface to PlaybackSessionInterfaceContext: > > void PlaybackSessionManager::resetMediaState(uint64_t contextId)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 186065
:
341525
| 341535