Title: [238045] trunk/Source/WebKit
Revision
238045
Author
[email protected]
Date
2018-11-09 10:58:08 -0800 (Fri, 09 Nov 2018)

Log Message

Make use of _UIRemoteView instead of CALayerHost if possible for WKRemoteView
https://bugs.webkit.org/show_bug.cgi?id=191449
<rdar://problem/45884977>

Reviewed by Eric Carlson.

UIRemoteView has some nice process assertion management that it would
be nice to not duplicate. So, we can just use it instead of CALayerHost!

* Platform/spi/ios/UIKitSPI.h:
* UIProcess/DrawingAreaProxy.h:
(WebKit::DrawingAreaProxy::page const):
* UIProcess/RemoteLayerTree/ios/RemoteLayerTreeHostIOS.mm:
(-[WKUIRemoteView hitTest:withEvent:]):
(-[WKUIRemoteView description]):
(createRemoteView):
(WebKit::RemoteLayerTreeHost::createLayer):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (238044 => 238045)


--- trunk/Source/WebKit/ChangeLog	2018-11-09 18:42:24 UTC (rev 238044)
+++ trunk/Source/WebKit/ChangeLog	2018-11-09 18:58:08 UTC (rev 238045)
@@ -1,3 +1,23 @@
+2018-11-09  Tim Horton  <[email protected]>
+
+        Make use of _UIRemoteView instead of CALayerHost if possible for WKRemoteView
+        https://bugs.webkit.org/show_bug.cgi?id=191449
+        <rdar://problem/45884977>
+
+        Reviewed by Eric Carlson.
+
+        UIRemoteView has some nice process assertion management that it would
+        be nice to not duplicate. So, we can just use it instead of CALayerHost!
+
+        * Platform/spi/ios/UIKitSPI.h:
+        * UIProcess/DrawingAreaProxy.h:
+        (WebKit::DrawingAreaProxy::page const):
+        * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeHostIOS.mm:
+        (-[WKUIRemoteView hitTest:withEvent:]):
+        (-[WKUIRemoteView description]):
+        (createRemoteView):
+        (WebKit::RemoteLayerTreeHost::createLayer):
+
 2018-11-09  Eric Carlson  <[email protected]>
 
         [MediaStream] Make screen capture an experimental feature

Modified: trunk/Source/WebKit/Platform/spi/ios/UIKitSPI.h (238044 => 238045)


--- trunk/Source/WebKit/Platform/spi/ios/UIKitSPI.h	2018-11-09 18:42:24 UTC (rev 238044)
+++ trunk/Source/WebKit/Platform/spi/ios/UIKitSPI.h	2018-11-09 18:58:08 UTC (rev 238045)
@@ -1043,6 +1043,13 @@
 - (CGFloat)getVerticalOverlapForView:(UIView *)view usingKeyboardInfo:(NSDictionary *)info;
 @end
 
+@interface _UILayerHostView : UIView
+@end
+
+@interface _UIRemoteView : _UILayerHostView
+- (instancetype)initWithFrame:(CGRect)frame pid:(pid_t)pid contextID:(uint32_t)contextID;
+@end
+
 #if __has_include(<UIKit/UITextInputMultiDocument.h>)
 #import <UIKit/UITextInputMultiDocument.h>
 #else

Modified: trunk/Source/WebKit/UIProcess/DrawingAreaProxy.h (238044 => 238045)


--- trunk/Source/WebKit/UIProcess/DrawingAreaProxy.h	2018-11-09 18:42:24 UTC (rev 238044)
+++ trunk/Source/WebKit/UIProcess/DrawingAreaProxy.h	2018-11-09 18:58:08 UTC (rev 238045)
@@ -106,6 +106,8 @@
 
     virtual void dispatchPresentationCallbacksAfterFlushingLayers(const Vector<CallbackID>&) { }
 
+    WebPageProxy& page() const { return m_webPageProxy; }
+
 protected:
     explicit DrawingAreaProxy(DrawingAreaType, WebPageProxy&);
 

Modified: trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/RemoteLayerTreeHostIOS.mm (238044 => 238045)


--- trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/RemoteLayerTreeHostIOS.mm	2018-11-09 18:42:24 UTC (rev 238044)
+++ trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/RemoteLayerTreeHostIOS.mm	2018-11-09 18:58:08 UTC (rev 238045)
@@ -28,7 +28,9 @@
 
 #if PLATFORM(IOS_FAMILY)
 
+#import "RemoteLayerTreeDrawingAreaProxy.h"
 #import "UIKitSPI.h"
+#import "WebPageProxy.h"
 #import <UIKit/UIScrollView.h>
 #import <pal/spi/cocoa/QuartzCoreSPI.h>
 
@@ -155,6 +157,44 @@
 
 @end
 
+#if USE(UIREMOTEVIEW_CONTEXT_HOSTING)
+@interface WKUIRemoteView : _UIRemoteView
+@end
+
+@implementation WKUIRemoteView
+
+- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event
+{
+    return [self _findDescendantViewAtPoint:point withEvent:event];
+}
+
+- (NSString *)description
+{
+    NSString *viewDescription = [super description];
+    NSString *webKitDetails = [NSString stringWithFormat:@" layerID = %llu \"%@\"", WebKit::RemoteLayerTreeHost::layerID(self.layer), self.layer.name ? self.layer.name : @""];
+    return [viewDescription stringByAppendingString:webKitDetails];
+}
+
+@end
+#endif
+
+static RetainPtr<UIView> createRemoteView(pid_t pid, uint32_t contextID)
+{
+#if USE(UIREMOTEVIEW_CONTEXT_HOSTING)
+    // FIXME: Remove this respondsToSelector check when possible.
+    static BOOL canUseUIRemoteView;
+    static std::once_flag initializeCanUseUIRemoteView;
+    std::call_once(initializeCanUseUIRemoteView, [] {
+        canUseUIRemoteView = [_UIRemoteView instancesRespondToSelector:@selector(initWithFrame:pid:contextID:)];
+    });
+    if (canUseUIRemoteView)
+        return adoptNS([[WKUIRemoteView alloc] initWithFrame:CGRectZero pid:pid contextID:contextID]);
+#else
+    UNUSED_PARAM(pid);
+#endif
+    return adoptNS([[WKRemoteView alloc] initWithFrame:CGRectZero contextID:contextID]);
+}
+
 @interface WKBackdropView : _UIBackdropView
 @end
 
@@ -208,7 +248,7 @@
     case PlatformCALayer::LayerTypeAVPlayerLayer:
     case PlatformCALayer::LayerTypeContentsProvidedLayer:
         if (!m_isDebugLayerTreeHost) {
-            view = adoptNS([[WKRemoteView alloc] initWithFrame:CGRectZero contextID:properties.hostingContextID]);
+            view = createRemoteView(m_drawingArea->page().processIdentifier(), properties.hostingContextID);
             if (properties.type == PlatformCALayer::LayerTypeAVPlayerLayer) {
                 // Invert the scale transform added in the WebProcess to fix <rdar://problem/18316542>.
                 float inverseScale = 1 / properties.hostingDeviceScaleFactor;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to