Improve coordination for creating UIWindow instances.
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 7 May 2019 03:51:58 +0000 (03:51 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 7 May 2019 03:51:58 +0000 (03:51 +0000)
https://bugs.webkit.org/show_bug.cgi?id=197578.
<rdar://problem/50456965>.

Patch by James Savage <james.savage@apple.com> on 2019-05-06
Reviewed by Wenson Hsieh.

Source/WebCore:

* platform/ios/VideoFullscreenInterfaceAVKit.mm:
(makeWindowFromView): Pull out window creation.
(VideoFullscreenInterfaceAVKit::doSetup): Call new helper function.

Source/WebKit:

* UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm:
(makeWindowFromView): Pull out window creation.
(-[WKFullScreenWindowController enterFullScreen]): Call new helper function.

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

Source/WebCore/ChangeLog
Source/WebCore/platform/ios/VideoFullscreenInterfaceAVKit.mm
Source/WebKit/ChangeLog
Source/WebKit/UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm

index 278519b..0424c9e 100644 (file)
@@ -1,3 +1,15 @@
+2019-05-06  James Savage  <james.savage@apple.com>
+
+        Improve coordination for creating UIWindow instances.
+        https://bugs.webkit.org/show_bug.cgi?id=197578.
+        <rdar://problem/50456965>.
+
+        Reviewed by Wenson Hsieh.
+
+        * platform/ios/VideoFullscreenInterfaceAVKit.mm:
+        (makeWindowFromView): Pull out window creation.
+        (VideoFullscreenInterfaceAVKit::doSetup): Call new helper function.
+
 2019-05-06  Tim Horton  <timothy_horton@apple.com>
 
         _overrideViewportWithArguments does not work when called before loading
index 03ce20c..f11f9d8 100644 (file)
@@ -1174,6 +1174,15 @@ void VideoFullscreenInterfaceAVKit::setInlineRect(const IntRect& inlineRect, boo
         doExitFullscreen();
 }
 
+#if USE(APPLE_INTERNAL_SDK)
+#import <WebKitAdditions/VideoFullscreenInterfaceAVKitAdditions.mm>
+#else
+static RetainPtr<UIWindow> makeWindowFromView(UIView *)
+{
+    return adoptNS([PAL::allocUIWindowInstance() initWithFrame:[[PAL::getUIScreenClass() mainScreen] bounds]]);
+}
+#endif
+
 void VideoFullscreenInterfaceAVKit::doSetup()
 {
     Mode changes { m_currentMode.mode() ^ m_targetMode.mode() };
@@ -1196,8 +1205,7 @@ void VideoFullscreenInterfaceAVKit::doSetup()
 
 #if !PLATFORM(WATCHOS)
     if (![[m_parentView window] _isHostedInAnotherProcess] && !m_window) {
-        if (!m_window)
-            m_window = adoptNS([PAL::allocUIWindowInstance() initWithFrame:[[PAL::getUIScreenClass() mainScreen] bounds]]);
+        m_window = makeWindowFromView(m_parentView.get());
         [m_window setBackgroundColor:clearUIColor()];
         if (!m_viewController)
             m_viewController = adoptNS([PAL::allocUIViewControllerInstance() init]);
index 0afee79..75c373d 100644 (file)
@@ -1,3 +1,15 @@
+2019-05-06  James Savage  <james.savage@apple.com>
+
+        Improve coordination for creating UIWindow instances.
+        https://bugs.webkit.org/show_bug.cgi?id=197578.
+        <rdar://problem/50456965>.
+
+        Reviewed by Wenson Hsieh.
+
+        * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm:
+        (makeWindowFromView): Pull out window creation.
+        (-[WKFullScreenWindowController enterFullScreen]): Call new helper function.
+
 2019-05-06  Tim Horton  <timothy_horton@apple.com>
 
         _overrideViewportWithArguments does not work when called before loading
index 0078021..405dc06 100644 (file)
@@ -489,6 +489,15 @@ static const NSTimeInterval kAnimationDuration = 0.2;
 #pragma mark -
 #pragma mark External Interface
 
+#if USE(APPLE_INTERNAL_SDK)
+#import <WebKitAdditions/WKFullScreenWindowControllerIOSAdditions.mm>
+#else
+static RetainPtr<UIWindow> makeWindowFromView(UIView *)
+{
+    return adoptNS([[UIWindow alloc] init]);
+}
+#endif
+
 - (void)enterFullScreen
 {
     if ([self isFullScreen])
@@ -504,7 +513,7 @@ static const NSTimeInterval kAnimationDuration = 0.2;
 
     _fullScreenState = WebKit::WaitingToEnterFullScreen;
 
-    _window = adoptNS([[UIWindow alloc] init]);
+    _window = makeWindowFromView(webView.get());
     [_window setBackgroundColor:[UIColor clearColor]];
     [_window setWindowLevel:UIWindowLevelNormal - 1];
     [_window setHidden:NO];