Add WKWebViewConfiguration._canShowWhileLocked SPI
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 10 May 2019 18:52:05 +0000 (18:52 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 10 May 2019 18:52:05 +0000 (18:52 +0000)
https://bugs.webkit.org/show_bug.cgi?id=197777
<rdar://problem/50065100>

Reviewed by Tim Horton.

Source/WebCore/PAL:

* pal/spi/cocoa/QuartzCoreSPI.h:

Source/WebKit:

* Platform/mac/LayerHostingContext.h:
* Platform/mac/LayerHostingContext.mm:
(WebKit::LayerHostingContext::createForExternalHostingProcess):
* Shared/WebPageCreationParameters.cpp:
(WebKit::WebPageCreationParameters::encode const):
(WebKit::WebPageCreationParameters::decode):
* Shared/WebPageCreationParameters.h:
* UIProcess/API/APIPageConfiguration.cpp:
(API::PageConfiguration::copy const):
* UIProcess/API/APIPageConfiguration.h:
(API::PageConfiguration::canShowWhileLocked const):
(API::PageConfiguration::setCanShowWhileLocked):
* UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
(-[WKWebViewConfiguration _setCanShowWhileLocked:]):
(-[WKWebViewConfiguration _canShowWhileLocked]):
* UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::creationParameters):
* WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemoteCustom.mm:
(WebKit::PlatformCALayerRemoteCustom::PlatformCALayerRemoteCustom):
* WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.h:
* WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.mm:
(WebKit::RemoteLayerTreeContext::canShowWhileLocked const):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::m_canShowWhileLocked):
(WebKit::m_shrinkToFitContentTimer): Deleted.
* WebProcess/WebPage/WebPage.h:
(WebKit::WebPage::canShowWhileLocked const):

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

17 files changed:
Source/WebCore/PAL/ChangeLog
Source/WebCore/PAL/pal/spi/cocoa/QuartzCoreSPI.h
Source/WebKit/ChangeLog
Source/WebKit/Platform/mac/LayerHostingContext.h
Source/WebKit/Platform/mac/LayerHostingContext.mm
Source/WebKit/Shared/WebPageCreationParameters.cpp
Source/WebKit/Shared/WebPageCreationParameters.h
Source/WebKit/UIProcess/API/APIPageConfiguration.cpp
Source/WebKit/UIProcess/API/APIPageConfiguration.h
Source/WebKit/UIProcess/API/Cocoa/WKWebViewConfiguration.mm
Source/WebKit/UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h
Source/WebKit/UIProcess/WebPageProxy.cpp
Source/WebKit/WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemoteCustom.mm
Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.h
Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.mm
Source/WebKit/WebProcess/WebPage/WebPage.cpp
Source/WebKit/WebProcess/WebPage/WebPage.h

index 61521bb..5e75b25 100644 (file)
@@ -1,3 +1,13 @@
+2019-05-10  Chris Dumez  <cdumez@apple.com>
+
+        Add WKWebViewConfiguration._canShowWhileLocked SPI
+        https://bugs.webkit.org/show_bug.cgi?id=197777
+        <rdar://problem/50065100>
+
+        Reviewed by Tim Horton.
+
+        * pal/spi/cocoa/QuartzCoreSPI.h:
+
 2019-05-09  Daniel Bates  <dabates@apple.com>
 
         [iOS] Numpad comma key has incorrect keyIdentifier property
index 3d4341e..2bd52de 100644 (file)
@@ -238,6 +238,7 @@ extern NSString * const kCAContextIgnoresHitTest;
 extern NSString * const kCAContextPortNumber;
 
 #if PLATFORM(IOS_FAMILY)
+extern NSString * const kCAContextSecure;
 extern NSString * const kCAContentsFormatRGBA10XR;
 #endif
 
index a39e573..11da521 100644 (file)
@@ -1,3 +1,40 @@
+2019-05-10  Chris Dumez  <cdumez@apple.com>
+
+        Add WKWebViewConfiguration._canShowWhileLocked SPI
+        https://bugs.webkit.org/show_bug.cgi?id=197777
+        <rdar://problem/50065100>
+
+        Reviewed by Tim Horton.
+
+        * Platform/mac/LayerHostingContext.h:
+        * Platform/mac/LayerHostingContext.mm:
+        (WebKit::LayerHostingContext::createForExternalHostingProcess):
+        * Shared/WebPageCreationParameters.cpp:
+        (WebKit::WebPageCreationParameters::encode const):
+        (WebKit::WebPageCreationParameters::decode):
+        * Shared/WebPageCreationParameters.h:
+        * UIProcess/API/APIPageConfiguration.cpp:
+        (API::PageConfiguration::copy const):
+        * UIProcess/API/APIPageConfiguration.h:
+        (API::PageConfiguration::canShowWhileLocked const):
+        (API::PageConfiguration::setCanShowWhileLocked):
+        * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
+        (-[WKWebViewConfiguration _setCanShowWhileLocked:]):
+        (-[WKWebViewConfiguration _canShowWhileLocked]):
+        * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::creationParameters):
+        * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemoteCustom.mm:
+        (WebKit::PlatformCALayerRemoteCustom::PlatformCALayerRemoteCustom):
+        * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.h:
+        * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.mm:
+        (WebKit::RemoteLayerTreeContext::canShowWhileLocked const):
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::m_canShowWhileLocked):
+        (WebKit::m_shrinkToFitContentTimer): Deleted.
+        * WebProcess/WebPage/WebPage.h:
+        (WebKit::WebPage::canShowWhileLocked const):
+
 2019-05-10  Michael Catanzaro  <mcatanzaro@igalia.com>
 
         Fix a bunch of compiler warnings
index 5797793..99cadfe 100644 (file)
@@ -40,17 +40,26 @@ class MachSendRight;
 namespace WebKit {
 
 using LayerHostingContextID = uint32_t;
+    
+struct LayerHostingContextOptions {
+#if PLATFORM(IOS_FAMILY)
+    bool canShowWhileLocked { false };
+#endif
+};
 
 class LayerHostingContext {
     WTF_MAKE_NONCOPYABLE(LayerHostingContext); WTF_MAKE_FAST_ALLOCATED;
 public:
     static std::unique_ptr<LayerHostingContext> createForPort(const WTF::MachSendRight& serverPort);
+    
 #if HAVE(OUT_OF_PROCESS_LAYER_HOSTING)
-    static std::unique_ptr<LayerHostingContext> createForExternalHostingProcess();
+    static std::unique_ptr<LayerHostingContext> createForExternalHostingProcess(const LayerHostingContextOptions& = { });
+
 #if PLATFORM(MAC)
     static std::unique_ptr<LayerHostingContext> createForExternalPluginHostingProcess();
 #endif
-#endif
+    
+#endif // HAVE(OUT_OF_PROCESS_LAYER_HOSTING)
 
     LayerHostingContext();
     ~LayerHostingContext();
index 910bb3f..f4633b4 100644 (file)
@@ -50,7 +50,7 @@ std::unique_ptr<LayerHostingContext> LayerHostingContext::createForPort(const Ma
 }
 
 #if HAVE(OUT_OF_PROCESS_LAYER_HOSTING)
-std::unique_ptr<LayerHostingContext> LayerHostingContext::createForExternalHostingProcess()
+std::unique_ptr<LayerHostingContext> LayerHostingContext::createForExternalHostingProcess(const LayerHostingContextOptions& options)
 {
     auto layerHostingContext = std::make_unique<LayerHostingContext>();
     layerHostingContext->m_layerHostingMode = LayerHostingMode::OutOfProcess;
@@ -59,6 +59,7 @@ std::unique_ptr<LayerHostingContext> LayerHostingContext::createForExternalHosti
     // Use a very large display ID to ensure that the context is never put on-screen 
     // without being explicitly parented. See <rdar://problem/16089267> for details.
     layerHostingContext->m_context = [CAContext remoteContextWithOptions:@{
+        kCAContextSecure: @(options.canShowWhileLocked),
 #if HAVE(CORE_ANIMATION_RENDER_SERVER)
         kCAContextIgnoresHitTest : @YES,
         kCAContextDisplayId : @10000
@@ -66,9 +67,13 @@ std::unique_ptr<LayerHostingContext> LayerHostingContext::createForExternalHosti
     }];
 #elif !PLATFORM(IOSMAC) && ENABLE(WEBPROCESS_WINDOWSERVER_BLOCKING)
     [CAContext setAllowsCGSConnections:NO];
-    layerHostingContext->m_context = [CAContext remoteContextWithOptions:@{kCAContextCIFilterBehavior :  @"ignore"}];
+    layerHostingContext->m_context = [CAContext remoteContextWithOptions:@{
+        kCAContextCIFilterBehavior :  @"ignore",
+    }];
 #else
-    layerHostingContext->m_context = [CAContext contextWithCGSConnection:CGSMainConnectionID() options:@{ kCAContextCIFilterBehavior : @"ignore" }];
+    layerHostingContext->m_context = [CAContext contextWithCGSConnection:CGSMainConnectionID() options:@{
+        kCAContextCIFilterBehavior : @"ignore",
+    }];
 #endif
     
     return layerHostingContext;
index bd9db40..89f535d 100644 (file)
@@ -96,6 +96,7 @@ void WebPageCreationParameters::encode(IPC::Encoder& encoder) const
     encoder << maximumUnobscuredSize;
     encoder << deviceOrientation;
     encoder << keyboardIsAttached;
+    encoder << canShowWhileLocked;
     encoder << overrideViewportArguments;
 #endif
 #if PLATFORM(COCOA)
@@ -283,6 +284,8 @@ Optional<WebPageCreationParameters> WebPageCreationParameters::decode(IPC::Decod
         return WTF::nullopt;
     if (!decoder.decode(parameters.keyboardIsAttached))
         return WTF::nullopt;
+    if (!decoder.decode(parameters.canShowWhileLocked))
+        return WTF::nullopt;
 
     Optional<Optional<WebCore::ViewportArguments>> overrideViewportArguments;
     decoder >> overrideViewportArguments;
index 0243bd1..43af461 100644 (file)
@@ -155,6 +155,7 @@ struct WebPageCreationParameters {
     WebCore::FloatSize maximumUnobscuredSize;
     int32_t deviceOrientation { 0 };
     bool keyboardIsAttached { false };
+    bool canShowWhileLocked { false };
     Optional<WebCore::ViewportArguments> overrideViewportArguments;
 #endif
 #if PLATFORM(COCOA)
index 177b999..eb9f13e 100644 (file)
@@ -72,6 +72,7 @@ Ref<PageConfiguration> PageConfiguration::copy() const
     copy->m_treatsSHA1SignedCertificatesAsInsecure = this->m_treatsSHA1SignedCertificatesAsInsecure;
 #if PLATFORM(IOS_FAMILY)
     copy->m_alwaysRunsAtForegroundPriority = this->m_alwaysRunsAtForegroundPriority;
+    copy->m_canShowWhileLocked = this->m_canShowWhileLocked;
 #endif
     copy->m_initialCapitalizationEnabled = this->m_initialCapitalizationEnabled;
     copy->m_waitsForPaintAfterViewDidMoveToWindow = this->m_waitsForPaintAfterViewDidMoveToWindow;
index 64a494a..0c51afd 100644 (file)
@@ -94,7 +94,10 @@ public:
 
 #if PLATFORM(IOS_FAMILY)
     bool alwaysRunsAtForegroundPriority() { return m_alwaysRunsAtForegroundPriority; }
-    void setAlwaysRunsAtForegroundPriority(bool alwaysRunsAtForegroundPriority) { m_alwaysRunsAtForegroundPriority = alwaysRunsAtForegroundPriority; } 
+    void setAlwaysRunsAtForegroundPriority(bool alwaysRunsAtForegroundPriority) { m_alwaysRunsAtForegroundPriority = alwaysRunsAtForegroundPriority; }
+    
+    bool canShowWhileLocked() const { return m_canShowWhileLocked; }
+    void setCanShowWhileLocked(bool canShowWhileLocked) { m_canShowWhileLocked = canShowWhileLocked; }
 #endif
     bool initialCapitalizationEnabled() { return m_initialCapitalizationEnabled; }
     void setInitialCapitalizationEnabled(bool initialCapitalizationEnabled) { m_initialCapitalizationEnabled = initialCapitalizationEnabled; }
@@ -147,6 +150,7 @@ private:
     bool m_treatsSHA1SignedCertificatesAsInsecure { true };
 #if PLATFORM(IOS_FAMILY)
     bool m_alwaysRunsAtForegroundPriority { false };
+    bool m_canShowWhileLocked { false };
 #endif
     bool m_initialCapitalizationEnabled { true };
     bool m_waitsForPaintAfterViewDidMoveToWindow { true };
index 7e8916a..636eb6e 100644 (file)
@@ -771,6 +771,16 @@ ALLOW_DEPRECATED_DECLARATIONS_END
     _shouldDecidePolicyBeforeLoadingQuickLookPreview = shouldDecide;
 }
 
+- (void)_setCanShowWhileLocked:(BOOL)value
+{
+    _pageConfiguration->setCanShowWhileLocked(value);
+}
+
+- (BOOL)_canShowWhileLocked
+{
+    return _pageConfiguration->canShowWhileLocked();
+}
+
 #endif // PLATFORM(IOS_FAMILY)
 
 - (BOOL)_invisibleAutoplayNotPermitted
index 78027fd..8cbe0a4 100644 (file)
@@ -83,6 +83,7 @@ typedef NS_ENUM(NSUInteger, _WKDragLiftDelay) {
 @property (nonatomic, setter=_setLongPressActionsEnabled:) BOOL _longPressActionsEnabled WK_API_AVAILABLE(ios(12.0));
 @property (nonatomic, setter=_setSystemPreviewEnabled:) BOOL _systemPreviewEnabled WK_API_AVAILABLE(ios(12.0));
 @property (nonatomic, setter=_setShouldDecidePolicyBeforeLoadingQuickLookPreview:) BOOL _shouldDecidePolicyBeforeLoadingQuickLookPreview WK_API_AVAILABLE(ios(WK_IOS_TBA));
+@property (nonatomic, setter=_setCanShowWhileLocked:) BOOL _canShowWhileLocked WK_API_AVAILABLE(ios(WK_IOS_TBA));
 #else
 @property (nonatomic, setter=_setShowsURLsInToolTips:) BOOL _showsURLsInToolTips WK_API_AVAILABLE(macos(10.12));
 @property (nonatomic, setter=_setServiceControlsEnabled:) BOOL _serviceControlsEnabled WK_API_AVAILABLE(macos(10.12));
index a8ab15e..1ac051d 100644 (file)
@@ -7126,6 +7126,7 @@ WebPageCreationParameters WebPageProxy::creationParameters(WebProcessProxy& proc
     parameters.deviceOrientation = m_deviceOrientation;
     parameters.keyboardIsAttached = isInHardwareKeyboardMode();
     parameters.overrideViewportArguments = m_overrideViewportArguments;
+    parameters.canShowWhileLocked = m_configuration->canShowWhileLocked();
 #endif
 
 #if PLATFORM(MAC)
index 52a9bd4..a9b4faa 100644 (file)
@@ -59,7 +59,11 @@ PlatformCALayerRemoteCustom::PlatformCALayerRemoteCustom(LayerType layerType, Pl
         break;
 #if HAVE(OUT_OF_PROCESS_LAYER_HOSTING)
     case LayerHostingMode::OutOfProcess:
-        m_layerHostingContext = LayerHostingContext::createForExternalHostingProcess();
+        m_layerHostingContext = LayerHostingContext::createForExternalHostingProcess({
+#if PLATFORM(IOS_FAMILY)
+            context.canShowWhileLocked()
+#endif
+        });
 #if PLATFORM(IOS_FAMILY)
         if (layerType == LayerTypeAVPlayerLayer) {
             float scaleFactor = context.deviceScaleFactor();
index d408057..57a0259 100644 (file)
@@ -77,6 +77,10 @@ public:
     bool nextFlushIsForImmediatePaint() const { return m_nextFlushIsForImmediatePaint; }
 
     void adoptLayersFromContext(RemoteLayerTreeContext&);
+    
+#if PLATFORM(IOS_FAMILY)
+    bool canShowWhileLocked() const;
+#endif
 
 private:
     // WebCore::GraphicsLayerFactory
index 68b157a..f425d11 100644 (file)
@@ -78,6 +78,13 @@ LayerHostingMode RemoteLayerTreeContext::layerHostingMode() const
     return m_webPage.layerHostingMode();
 }
 
+#if PLATFORM(IOS_FAMILY)
+bool RemoteLayerTreeContext::canShowWhileLocked() const
+{
+    return m_webPage.canShowWhileLocked();
+}
+#endif
+
 void RemoteLayerTreeContext::layerDidEnterContext(PlatformCALayerRemote& layer, PlatformCALayer::LayerType type)
 {
     GraphicsLayer::PlatformLayerID layerID = layer.layerID();
index 944bea5..843a890 100644 (file)
@@ -414,6 +414,7 @@ WebPage::WebPage(uint64_t pageID, WebPageCreationParameters&& parameters)
     , m_overrideScreenSize(parameters.overrideScreenSize)
     , m_deviceOrientation(parameters.deviceOrientation)
     , m_keyboardIsAttached(parameters.keyboardIsAttached)
+    , m_canShowWhileLocked(parameters.canShowWhileLocked)
 #endif
     , m_layerVolatilityTimer(*this, &WebPage::layerVolatilityTimerFired)
     , m_activityState(parameters.activityState)
index c29645d..a38eb8b 100644 (file)
@@ -958,6 +958,8 @@ public:
     void hardwareKeyboardAvailabilityChanged(bool keyboardIsAttached);
 
     void updateStringForFind(const String&);
+    
+    bool canShowWhileLocked() const { return m_canShowWhileLocked; }
 #endif
 
 #if ENABLE(IOS_TOUCH_EVENTS)
@@ -1829,6 +1831,7 @@ private:
     WebCore::FloatSize m_maximumUnobscuredSize;
     int32_t m_deviceOrientation { 0 };
     bool m_keyboardIsAttached { false };
+    bool m_canShowWhileLocked { false };
     bool m_inDynamicSizeUpdate { false };
     HashMap<std::pair<WebCore::IntSize, double>, WebCore::IntPoint> m_dynamicSizeUpdateHistory;
     RefPtr<WebCore::Node> m_pendingSyntheticClickNode;