Changeset 246928 in webkit
- Timestamp:
- Jun 28, 2019, 10:39:53 AM (6 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r246926 r246928 1 2019-06-28 Jer Noble <jer.noble@apple.com> 2 3 Add new -[WKWebView _closeAllMediaPresentations] SPI 4 https://bugs.webkit.org/show_bug.cgi?id=199294 5 <rdar://problem/51965958> 6 7 Reviewed by Alex Christensen. 8 9 Add a new SPI that will close all out-of-window media presentations, including 10 picture-in-picture, video fullscreen, and element fullscreen. 11 12 Drive-by fixes: 13 14 + -[WKApplicationStateTrackingView didMoveToWindow] incorrectly assumes that a WKWebView will 15 never be moved frome one window to another, and asserts. 16 17 + -[WKFullScreenWindowController close] doesn't fire the correct 'webkitfullscreenchange' event 18 when called in the middle of animating into fullscreen. 19 20 * UIProcess/API/Cocoa/WKWebView.mm: 21 (-[WKWebView _closeAllMediaPresentations]): 22 * UIProcess/API/Cocoa/WKWebViewPrivate.h: 23 * UIProcess/Cocoa/VideoFullscreenManagerProxy.h: 24 * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm: 25 (WebKit::VideoFullscreenManagerProxy::forEachSession): 26 * UIProcess/ios/WKApplicationStateTrackingView.mm: 27 (-[WKApplicationStateTrackingView didMoveToWindow]): 28 * UIProcess/mac/WKFullScreenWindowController.h: 29 * UIProcess/mac/WKFullScreenWindowController.mm: 30 (-[WKFullScreenWindowController exitFullScreenImmediately]): 31 (-[WKFullScreenWindowController close]): 32 1 33 2019-06-28 Antti Koivisto <antti@apple.com> 2 34 -
trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm
r246892 r246928 55 55 #import "UserMediaProcessManager.h" 56 56 #import "VersionChecks.h" 57 #import "VideoFullscreenManagerProxy.h" 57 58 #import "ViewGestureController.h" 58 59 #import "ViewSnapshotStore.h" … … 4736 4737 } 4737 4738 4739 - (void)_closeAllMediaPresentations 4740 { 4741 if (auto videoFullscreenManager = _page->videoFullscreenManager()) { 4742 videoFullscreenManager->forEachSession([] (auto& model, auto& interface) { 4743 model.requestFullscreenMode(WebCore::HTMLMediaElementEnums::VideoFullscreenModeNone); 4744 }); 4745 } 4746 4747 if (auto fullScreenManager = _page->fullScreenManager(); fullScreenManager && fullScreenManager->isFullScreen()) 4748 fullScreenManager->close(); 4749 } 4750 4738 4751 - (void)_stopAllMediaPlayback 4739 4752 { -
trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h
r246892 r246928 424 424 - (void)_suspendAllMediaPlayback; 425 425 - (void)_resumeAllMediaPlayback; 426 - (void)_closeAllMediaPresentations; 426 427 427 428 - (void)_requestTextInputContextsInRect:(CGRect)rect completionHandler:(void(^)(NSArray<_WKTextInputContext *> *))completionHandler WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA)); -
trunk/Source/WebKit/UIProcess/Cocoa/VideoFullscreenManagerProxy.h
r239709 r246928 139 139 PlatformVideoFullscreenInterface* controlsManagerInterface(); 140 140 141 void forEachSession(Function<void(WebCore::VideoFullscreenModel&, PlatformVideoFullscreenInterface&)>&&); 142 141 143 private: 142 144 friend class VideoFullscreenModelContext; -
trunk/Source/WebKit/UIProcess/Cocoa/VideoFullscreenManagerProxy.mm
r245796 r246928 467 467 } 468 468 469 void VideoFullscreenManagerProxy::forEachSession(Function<void(VideoFullscreenModel&, PlatformVideoFullscreenInterface&)>&& callback) 470 { 471 if (m_contextMap.isEmpty()) 472 return; 473 474 Vector<ModelInterfaceTuple> values; 475 values.reserveInitialCapacity(m_contextMap.size()); 476 for (auto& value : m_contextMap.values()) 477 values.uncheckedAppend(value); 478 479 for (auto& value : values) { 480 RefPtr<VideoFullscreenModelContext> model; 481 RefPtr<PlatformVideoFullscreenInterface> interface; 482 std::tie(model, interface) = value; 483 484 ASSERT(model); 485 ASSERT(interface); 486 if (!model || !interface) 487 continue; 488 489 callback(*model, *interface); 490 } 491 } 492 469 493 #pragma mark Messages from VideoFullscreenManager 470 494 -
trunk/Source/WebKit/UIProcess/ios/WKApplicationStateTrackingView.mm
r244113 r246928 63 63 - (void)didMoveToWindow 64 64 { 65 if (!self._contentView.window )65 if (!self._contentView.window || _applicationStateTracker) 66 66 return; 67 67 68 ASSERT(!_applicationStateTracker);69 68 _applicationStateTracker = std::make_unique<WebKit::ApplicationStateTracker>(self, @selector(_applicationDidEnterBackground), @selector(_applicationDidFinishSnapshottingAfterEnteringBackground), @selector(_applicationWillEnterForeground)); 70 69 -
trunk/Source/WebKit/UIProcess/mac/WKFullScreenWindowController.h
r239475 r246928 78 78 - (void)enterFullScreen:(NSScreen *)screen; 79 79 - (void)exitFullScreen; 80 - (void)exitFullScreenImmediately; 80 81 - (void)requestExitFullScreen; 81 82 - (void)close; -
trunk/Source/WebKit/UIProcess/mac/WKFullScreenWindowController.mm
r244545 r246928 421 421 } 422 422 423 - (void)exitFullScreenImmediately 424 { 425 if (![self isFullScreen]) 426 return; 427 428 [self _manager]->requestExitFullScreen(); 429 [_webViewPlaceholder setExitWarningVisible:NO]; 430 [self _manager]->willExitFullScreen(); 431 _fullScreenState = ExitingFullScreen; 432 [self finishedExitFullScreenAnimation:YES]; 433 } 434 423 435 - (void)requestExitFullScreen 424 436 { … … 582 594 // in response. 583 595 if ([self isFullScreen]) 584 [self exitFullScreen ];596 [self exitFullScreenImmediately]; 585 597 586 598 if (_fullScreenState == ExitingFullScreen) -
trunk/Tools/ChangeLog
r246927 r246928 1 2019-06-28 Jer Noble <jer.noble@apple.com> 2 3 Add new -[WKWebView _closeAllMediaPresentations] SPI 4 https://bugs.webkit.org/show_bug.cgi?id=199294 5 <rdar://problem/51965958> 6 7 Reviewed by Alex Christensen. 8 9 * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: 10 * TestWebKitAPI/Tests/WebKitCocoa/WKWebViewCloseAllMediaPresentations.mm: Added. 11 (TEST): 12 1 13 2019-06-28 Sihui Liu <sihui_liu@apple.com> 2 14 -
trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
r246927 r246928 852 852 CDC9442F1EF205D60059C3C4 /* mediastreamtrack-detached.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = CDC9442B1EF1FBD20059C3C4 /* mediastreamtrack-detached.html */; }; 853 853 CDCFA7AA1E45183200C2433D /* SampleMap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CDCFA7A91E45122F00C2433D /* SampleMap.cpp */; }; 854 CDD68F0D22C18317000CF0AE /* WKWebViewCloseAllMediaPresentations.mm in Sources */ = {isa = PBXBuildFile; fileRef = CDD68F0C22C18317000CF0AE /* WKWebViewCloseAllMediaPresentations.mm */; }; 854 855 CDE195B51CFE0B880053D256 /* FullscreenTopContentInset.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = CDE195B21CFE0ADE0053D256 /* FullscreenTopContentInset.html */; }; 855 856 CDF0B78A216D48DC00421ECC /* CloseWebViewDuringEnterFullscreen.mm in Sources */ = {isa = PBXBuildFile; fileRef = CDF0B789216D484300421ECC /* CloseWebViewDuringEnterFullscreen.mm */; }; … … 2251 2252 CDC9442C1EF1FC080059C3C4 /* MediaStreamTrackDetached.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = MediaStreamTrackDetached.mm; sourceTree = "<group>"; }; 2252 2253 CDCFA7A91E45122F00C2433D /* SampleMap.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SampleMap.cpp; sourceTree = "<group>"; }; 2254 CDD68F0C22C18317000CF0AE /* WKWebViewCloseAllMediaPresentations.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKWebViewCloseAllMediaPresentations.mm; sourceTree = "<group>"; }; 2253 2255 CDE195B21CFE0ADE0053D256 /* FullscreenTopContentInset.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = FullscreenTopContentInset.html; sourceTree = "<group>"; }; 2254 2256 CDE195B31CFE0ADE0053D256 /* FullscreenTopContentInset.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = FullscreenTopContentInset.mm; sourceTree = "<group>"; }; … … 2814 2816 CD7F89DB22A86CDA00D683AE /* WKWebViewSuspendAllMediaPlayback.mm */, 2815 2817 9984FACA1CFFAEEE008D198C /* WKWebViewTextInput.mm */, 2818 CDD68F0C22C18317000CF0AE /* WKWebViewCloseAllMediaPresentations.mm */, 2816 2819 ); 2817 2820 name = "WebKit Cocoa"; … … 4351 4354 46C519DA1D355AB200DAA51A /* LocalStorageNullEntries.mm in Sources */, 4352 4355 8C10AF99206467A90018FD90 /* LocalStoragePersistence.mm in Sources */, 4356 CDD68F0D22C18317000CF0AE /* WKWebViewCloseAllMediaPresentations.mm in Sources */, 4353 4357 7A6A2C701DCCFA8C00C0D085 /* LocalStorageQuirkTest.mm in Sources */, 4354 4358 076E507F1F4513D6006E9F5A /* Logging.cpp in Sources */,
Note:
See TracChangeset
for help on using the changeset viewer.