Changeset 271737 in webkit
- Timestamp:
- Jan 21, 2021 10:11:21 PM (18 months ago)
- Location:
- trunk/Source/WebKit
- Files:
-
- 4 edited
-
ChangeLog (modified) (1 diff)
-
WebProcess/WebPage/WebPage.cpp (modified) (1 diff)
-
WebProcess/cocoa/VideoFullscreenManager.h (modified) (2 diffs)
-
WebProcess/cocoa/VideoFullscreenManager.mm (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r271714 r271737 1 2021-01-21 Peng Liu <peng.liu6@apple.com> 2 3 PiP video subtitles stop updating when Safari is backgrounded 4 https://bugs.webkit.org/show_bug.cgi?id=220660 5 6 Reviewed by Darin Adler. 7 8 Subtitles in the picture-in-picture window will stop updating when the browser is 9 in the background because we freeze the layer tree when a browser is in the background. 10 This patch fixes this issue by avoiding freezing the layer tree if a video is playing 11 in picture-in-picture when the browser is in the background. 12 13 * WebProcess/WebPage/WebPage.cpp: 14 (WebKit::WebPage::updateDrawingAreaLayerTreeFreezeState): 15 * WebProcess/cocoa/VideoFullscreenManager.h: 16 * WebProcess/cocoa/VideoFullscreenManager.mm: 17 (WebKit::VideoFullscreenManager::videoInPictureInPicture const): 18 (WebKit::VideoFullscreenManager::enterVideoFullscreenForVideoElement): 19 (WebKit::VideoFullscreenManager::exitVideoFullscreenForVideoElement): 20 (WebKit::VideoFullscreenManager::exitVideoFullscreenToModeWithoutAnimation): 21 1 22 2021-01-21 Alex Christensen <achristensen@webkit.org> 2 23 -
trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp
r271713 r271737 2644 2644 if (!m_drawingArea) 2645 2645 return; 2646 2647 #if ENABLE(VIDEO_PRESENTATION_MODE) 2648 // When the browser is in the background, we should not freeze the layer tree 2649 // if the page has a video playing in picture-in-picture. 2650 if (m_videoFullscreenManager && m_videoFullscreenManager->hasVideoPlayingInPictureInPicture() && m_layerTreeFreezeReasons.hasExactlyOneBitSet() && m_layerTreeFreezeReasons.contains(LayerTreeFreezeReason::BackgroundApplication)) { 2651 m_drawingArea->setLayerTreeStateIsFrozen(false); 2652 return; 2653 } 2654 #endif 2655 2646 2656 m_drawingArea->setLayerTreeStateIsFrozen(!!m_layerTreeFreezeReasons); 2647 2657 } -
trunk/Source/WebKit/WebProcess/cocoa/VideoFullscreenManager.h
r269557 r271737 118 118 119 119 void invalidate(); 120 120 121 bool hasVideoPlayingInPictureInPicture() const; 122 121 123 void didReceiveMessage(IPC::Connection&, IPC::Decoder&) override; 122 124 … … 170 172 PlaybackSessionContextIdentifier m_controlsManagerContextId; 171 173 HashMap<PlaybackSessionContextIdentifier, int> m_clientCounts; 174 WeakPtr<WebCore::HTMLVideoElement> m_videoElementInPictureInPicture; 172 175 }; 173 176 -
trunk/Source/WebKit/WebProcess/cocoa/VideoFullscreenManager.mm
r271503 r271737 149 149 } 150 150 151 bool VideoFullscreenManager::hasVideoPlayingInPictureInPicture() const 152 { 153 return !!m_videoElementInPictureInPicture; 154 } 155 151 156 VideoFullscreenManager::ModelInterfaceTuple VideoFullscreenManager::createModelAndInterface(PlaybackSessionContextIdentifier contextId) 152 157 { … … 266 271 interface->setTargetIsFullscreen(false); 267 272 273 if (mode == HTMLMediaElementEnums::VideoFullscreenModePictureInPicture) 274 m_videoElementInPictureInPicture = makeWeakPtr(videoElement); 275 268 276 interface->setFullscreenMode(mode); 269 277 interface->setFullscreenStandby(standby); … … 296 304 } 297 305 298 void VideoFullscreenManager::exitVideoFullscreenForVideoElement( WebCore::HTMLVideoElement& videoElement, CompletionHandler<void(bool)>&& completionHandler)306 void VideoFullscreenManager::exitVideoFullscreenForVideoElement(HTMLVideoElement& videoElement, CompletionHandler<void(bool)>&& completionHandler) 299 307 { 300 308 LOG(Fullscreen, "VideoFullscreenManager::exitVideoFullscreenForVideoElement(%p)", this); … … 309 317 } 310 318 311 m_page->sendWithAsyncReply(Messages::VideoFullscreenManagerProxy::ExitFullscreen(contextId, inlineVideoFrame(videoElement)), [protectedThis = makeRefPtr(this), this, contextId, completionHandler = WTFMove(completionHandler)](auto success) mutable {319 m_page->sendWithAsyncReply(Messages::VideoFullscreenManagerProxy::ExitFullscreen(contextId, inlineVideoFrame(videoElement)), [protectedThis = makeRefPtr(this), this, contextId, videoElementPtr = &videoElement, completionHandler = WTFMove(completionHandler)](auto success) mutable { 312 320 if (!success) { 313 321 completionHandler(false); … … 315 323 } 316 324 325 if (m_videoElementInPictureInPicture == videoElementPtr) 326 m_videoElementInPictureInPicture = nullptr; 327 317 328 auto& interface = ensureInterface(contextId); 318 329 interface.setTargetIsFullscreen(false); … … 322 333 } 323 334 324 void VideoFullscreenManager::exitVideoFullscreenToModeWithoutAnimation( WebCore::HTMLVideoElement& videoElement, WebCore::HTMLMediaElementEnums::VideoFullscreenMode targetMode)335 void VideoFullscreenManager::exitVideoFullscreenToModeWithoutAnimation(HTMLVideoElement& videoElement, WebCore::HTMLMediaElementEnums::VideoFullscreenMode targetMode) 325 336 { 326 337 LOG(Fullscreen, "VideoFullscreenManager::exitVideoFullscreenToModeWithoutAnimation(%p)", this); … … 328 339 ASSERT(m_page); 329 340 ASSERT(m_videoElements.contains(&videoElement)); 341 342 if (m_videoElementInPictureInPicture == &videoElement) 343 m_videoElementInPictureInPicture = nullptr; 330 344 331 345 auto contextId = m_videoElements.get(&videoElement);
Note: See TracChangeset
for help on using the changeset viewer.