Title: [221543] trunk/Source
Revision
221543
Author
[email protected]
Date
2017-09-02 20:43:08 -0700 (Sat, 02 Sep 2017)

Log Message

[CA] Upstream QuartzCore-related WebKitSystemInterface functions
https://bugs.webkit.org/show_bug.cgi?id=176270

Reviewed by Tim Horton.

Source/WebCore:

* platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
(PlatformCALayerCocoa::enumerateRectsBeingDrawn):
* platform/graphics/cocoa/WebCoreCALayerExtras.h:
* platform/graphics/cocoa/WebCoreCALayerExtras.mm:
(+[CALayer _web_renderLayerWithContextID:]):
* platform/ios/WebCoreSystemInterfaceIOS.mm:
* platform/mac/WebCoreSystemInterface.h:
* platform/mac/WebCoreSystemInterface.mm:

Source/WebCore/PAL:

* pal/spi/cocoa/QuartzCoreSPI.h:

Source/WebKit:

* Platform/mac/LayerHostingContext.mm:
(WebKit::LayerHostingContext::createForPort):
(WebKit::LayerHostingContext::createForExternalHostingProcess):
* UIProcess/mac/PageClientImpl.mm:
(WebKit::PageClientImpl::enterAcceleratedCompositingMode):
(WebKit::PageClientImpl::updateAcceleratedCompositingMode):
* UIProcess/mac/RemoteLayerTreeHost.mm:
(WebKit::RemoteLayerTreeHost::createLayer):
* WebProcess/Plugins/Netscape/mac/PluginProxyMac.mm:
(WebKit::makeRenderLayer):
* WebProcess/WebCoreSupport/mac/WebSystemInterface.mm:
(InitWebCoreSystemInterface):

Source/WebKitLegacy/mac:

* Plugins/Hosted/NetscapePluginHostManager.mm:
(WebKit::NetscapePluginHostManager::spawnPluginHost):
* Plugins/Hosted/WebHostedNetscapePluginView.h:
* Plugins/Hosted/WebHostedNetscapePluginView.mm:
(WebKit::SoftwareCARenderer::SoftwareCARenderer):
(WebKit::SoftwareCARenderer::~SoftwareCARenderer):
(WebKit::SoftwareCARenderer::context const):
(WebKit::SoftwareCARenderer::renderContext const):
(WebKit::SoftwareCARenderer::render):
(-[WebHostedNetscapePluginView createPlugin]):
(-[WebHostedNetscapePluginView createPluginLayer]):
(-[WebHostedNetscapePluginView destroyPlugin]):
(-[WebHostedNetscapePluginView drawRect:]):
* WebCoreSupport/WebSystemInterface.mm:
(InitWebCoreSystemInterface):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (221542 => 221543)


--- trunk/Source/WebCore/ChangeLog	2017-09-03 02:31:13 UTC (rev 221542)
+++ trunk/Source/WebCore/ChangeLog	2017-09-03 03:43:08 UTC (rev 221543)
@@ -1,3 +1,19 @@
+2017-09-02  Andy Estes  <[email protected]>
+
+        [CA] Upstream QuartzCore-related WebKitSystemInterface functions
+        https://bugs.webkit.org/show_bug.cgi?id=176270
+
+        Reviewed by Tim Horton.
+
+        * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
+        (PlatformCALayerCocoa::enumerateRectsBeingDrawn):
+        * platform/graphics/cocoa/WebCoreCALayerExtras.h:
+        * platform/graphics/cocoa/WebCoreCALayerExtras.mm:
+        (+[CALayer _web_renderLayerWithContextID:]):
+        * platform/ios/WebCoreSystemInterfaceIOS.mm:
+        * platform/mac/WebCoreSystemInterface.h:
+        * platform/mac/WebCoreSystemInterface.mm:
+
 2017-09-02  Emilio Cobos Álvarez  <[email protected]>
 
         Wrong getComputedStyle result for pseudo-elements in display: none subtrees.

Modified: trunk/Source/WebCore/PAL/ChangeLog (221542 => 221543)


--- trunk/Source/WebCore/PAL/ChangeLog	2017-09-03 02:31:13 UTC (rev 221542)
+++ trunk/Source/WebCore/PAL/ChangeLog	2017-09-03 03:43:08 UTC (rev 221543)
@@ -1,3 +1,12 @@
+2017-09-02  Andy Estes  <[email protected]>
+
+        [CA] Upstream QuartzCore-related WebKitSystemInterface functions
+        https://bugs.webkit.org/show_bug.cgi?id=176270
+
+        Reviewed by Tim Horton.
+
+        * pal/spi/cocoa/QuartzCoreSPI.h:
+
 2017-09-01  Andy Estes  <[email protected]>
 
         Try again to fix the Internal iOS Simulator build after r221485.

Modified: trunk/Source/WebCore/PAL/pal/spi/cocoa/QuartzCoreSPI.h (221542 => 221543)


--- trunk/Source/WebCore/PAL/pal/spi/cocoa/QuartzCoreSPI.h	2017-09-03 02:31:13 UTC (rev 221542)
+++ trunk/Source/WebCore/PAL/pal/spi/cocoa/QuartzCoreSPI.h	2017-09-03 03:43:08 UTC (rev 221543)
@@ -23,14 +23,16 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#import <CoreVideo/CoreVideo.h>
 #import <QuartzCore/QuartzCore.h>
+#import <pal/spi/cg/CoreGraphicsSPI.h>
 #import <pal/spi/cocoa/IOSurfaceSPI.h>
 
 #if USE(APPLE_INTERNAL_SDK)
 
-#include <QuartzCore/CABackingStore.h>
-#include <QuartzCore/CAColorMatrix.h>
-#include <QuartzCore/CARenderServer.h>
+#import <QuartzCore/CABackingStore.h>
+#import <QuartzCore/CAColorMatrix.h>
+#import <QuartzCore/CARenderServer.h>
 
 #ifdef __OBJC__
 
@@ -43,17 +45,27 @@
 #import <QuartzCore/CADisplay.h>
 #endif
 
+#if PLATFORM(MAC)
+#import <QuartzCore/CARenderCG.h>
+#endif
+
 #endif // __OBJC__
 
 #else
 
 #ifdef __OBJC__
+typedef struct _CARenderContext CARenderContext;
+
 @interface CAContext : NSObject
 @end
 
 @interface CAContext ()
 + (NSArray *)allContexts;
++ (CAContext *)localContext;
 + (CAContext *)remoteContextWithOptions:(NSDictionary *)dict;
+#if PLATFORM(MAC)
++ (CAContext *)contextWithCGSConnection:(CGSConnectionID)cid options:(NSDictionary *)dict;
+#endif
 + (id)objectForSlot:(uint32_t)name;
 - (uint32_t)createImageSlot:(CGSize)size hasAlpha:(BOOL)flag;
 - (void)deleteSlot:(uint32_t)name;
@@ -71,6 +83,7 @@
 @property (readonly) uint32_t contextId;
 @property (strong) CALayer *layer;
 @property CGColorSpaceRef colorSpace;
+@property (readonly) CARenderContext* renderContext;
 @end
 
 @interface CALayer ()
@@ -180,6 +193,19 @@
 
 void CABackingStoreCollectBlocking(void);
 
+typedef struct _CARenderCGContext CARenderCGContext;
+typedef struct _CARenderContext CARenderContext;
+typedef struct _CARenderUpdate CARenderUpdate;
+CARenderCGContext *CARenderCGNew(uint32_t feature_flags);
+CARenderUpdate* CARenderUpdateBegin(void* buffer, size_t, CFTimeInterval, const CVTimeStamp*, uint32_t finished_seed, const CGRect* bounds);
+bool CARenderServerStart();
+mach_port_t CARenderServerGetPort();
+void CARenderCGDestroy(CARenderCGContext*);
+void CARenderCGRender(CARenderCGContext*, CARenderUpdate*, CGContextRef);
+void CARenderUpdateAddContext(CARenderUpdate*, CARenderContext*);
+void CARenderUpdateAddRect(CARenderUpdate*, const CGRect*);
+void CARenderUpdateFinish(CARenderUpdate*);
+
 WTF_EXTERN_C_END
 
 extern NSString * const kCAFilterColorInvert;
@@ -204,9 +230,11 @@
 extern NSString * const kCAFilterDifferenceBlendMode;
 extern NSString * const kCAFilterExclusionBlendMode;
 
+extern NSString * const kCAContextCIFilterBehavior;
 extern NSString * const kCAContextDisplayName;
 extern NSString * const kCAContextDisplayId;
 extern NSString * const kCAContextIgnoresHitTest;
+extern NSString * const kCAContextPortNumber;
 
 #if PLATFORM(IOS)
 extern NSString * const kCAContentsFormatRGBA10XR;

Modified: trunk/Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm (221542 => 221543)


--- trunk/Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm	2017-09-03 02:31:13 UTC (rev 221542)
+++ trunk/Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm	2017-09-03 03:43:08 UTC (rev 221543)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2010, 2015 Apple Inc. All rights reserved.
+ * Copyright (C) 2010-2017 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -1207,7 +1207,21 @@
 
 void PlatformCALayerCocoa::enumerateRectsBeingDrawn(CGContextRef context, void (^block)(CGRect))
 {
-    wkCALayerEnumerateRectsBeingDrawnWithBlock(m_layer.get(), context, block);
+    CGSRegionObj region = (CGSRegionObj)[m_layer regionBeingDrawn];
+    if (!region) {
+        block(CGContextGetClipBoundingBox(context));
+        return;
+    }
+
+    CGAffineTransform inverseTransform = CGAffineTransformInvert(CGContextGetCTM(context));
+    CGSRegionEnumeratorObj enumerator = CGSRegionEnumerator(region);
+    const CGRect* nextRect;
+    while ((nextRect = CGSNextRect(enumerator))) {
+        CGRect rectToDraw = CGRectApplyAffineTransform(*nextRect, inverseTransform);
+        block(rectToDraw);
+    }
+    
+    CGSReleaseRegionEnumerator(enumerator);
 }
 
 unsigned PlatformCALayerCocoa::backingStoreBytesPerPixel() const

Modified: trunk/Source/WebCore/platform/graphics/cocoa/WebCoreCALayerExtras.h (221542 => 221543)


--- trunk/Source/WebCore/platform/graphics/cocoa/WebCoreCALayerExtras.h	2017-09-03 02:31:13 UTC (rev 221542)
+++ trunk/Source/WebCore/platform/graphics/cocoa/WebCoreCALayerExtras.h	2017-09-03 03:43:08 UTC (rev 221543)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2013-2017 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -23,15 +23,11 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
 
-#ifndef WebCoreCALayerExtras_h
-#define WebCoreCALayerExtras_h
-
 #import <QuartzCore/QuartzCore.h>
 
 @interface CALayer (WebCoreCALayerExtras)
 
 - (void)web_disableAllActions;
++ (CALayer *)_web_renderLayerWithContextID:(uint32_t)contextID;
 
 @end
-
-#endif // WebCoreCALayerExtras_h

Modified: trunk/Source/WebCore/platform/graphics/cocoa/WebCoreCALayerExtras.mm (221542 => 221543)


--- trunk/Source/WebCore/platform/graphics/cocoa/WebCoreCALayerExtras.mm	2017-09-03 02:31:13 UTC (rev 221542)
+++ trunk/Source/WebCore/platform/graphics/cocoa/WebCoreCALayerExtras.mm	2017-09-03 03:43:08 UTC (rev 221543)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2013-2017 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -24,9 +24,10 @@
  */
 
 #import "config.h"
-
 #import "WebCoreCALayerExtras.h"
 
+#import <pal/spi/cocoa/QuartzCoreSPI.h>
+
 @implementation CALayer (WebCoreCALayerExtras)
 
 - (void)web_disableAllActions
@@ -55,4 +56,11 @@
     };
 }
 
++ (CALayer *)_web_renderLayerWithContextID:(uint32_t)contextID
+{
+    CALayerHost *layerHost = [CALayerHost layer];
+    layerHost.contextId = contextID;
+    return layerHost;
+}
+
 @end

Modified: trunk/Source/WebCore/platform/ios/WebCoreSystemInterfaceIOS.mm (221542 => 221543)


--- trunk/Source/WebCore/platform/ios/WebCoreSystemInterfaceIOS.mm	2017-09-03 02:31:13 UTC (rev 221542)
+++ trunk/Source/WebCore/platform/ios/WebCoreSystemInterfaceIOS.mm	2017-09-03 03:43:08 UTC (rev 221543)
@@ -26,7 +26,6 @@
 #import "config.h"
 #import "WebCoreSystemInterface.h"
 
-WEBCORE_EXPORT void (*wkCALayerEnumerateRectsBeingDrawnWithBlock)(CALayer *, CGContextRef context, void (^block)(CGRect rect));
 WEBCORE_EXPORT void (*wkClearGlyphVector)(void* glyphs);
 WEBCORE_EXPORT OSStatus (*wkConvertCharToGlyphs)(void* styleGroup, const UniChar*, unsigned numCharacters, void* glyphs);
 WEBCORE_EXPORT id (*wkCreateNSURLConnectionDelegateProxy)(void);
@@ -36,8 +35,6 @@
 WEBCORE_EXPORT CFHTTPMessageRef (*wkCopyCONNECTProxyResponse)(CFReadStreamRef, CFURLRef responseURL, CFStringRef proxyHost, CFNumberRef proxyPort);
 WEBCORE_EXPORT void (*wkSetLayerContentsScale)(CALayer *);
 
-WEBCORE_EXPORT void(*wkDestroyRenderingResources)(void);
-
 WEBCORE_EXPORT bool (*wkCaptionAppearanceHasUserPreferences)(void);
 WEBCORE_EXPORT bool (*wkCaptionAppearanceShowCaptionsWhenAvailable)(void);
 WEBCORE_EXPORT CGColorRef(*wkCaptionAppearanceCopyForegroundColor)(void);

Modified: trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.h (221542 => 221543)


--- trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.h	2017-09-03 02:31:13 UTC (rev 221542)
+++ trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.h	2017-09-03 03:43:08 UTC (rev 221543)
@@ -117,8 +117,6 @@
 
 // In alphabetical order.
 
-extern void (*wkCALayerEnumerateRectsBeingDrawnWithBlock)(CALayer *, CGContextRef, void (^block)(CGRect rect));
-
 typedef enum {
     wkPatternTilingNoDistortion,
     wkPatternTilingConstantSpacingMinimalDistortion,
@@ -131,7 +129,6 @@
 extern void (*wkDrawMediaUIPart)(int part, CGContextRef context, CGRect rect, unsigned state);
 extern double (*wkGetNSURLResponseCalculatedExpiration)(NSURLResponse *response);
 extern BOOL (*wkGetNSURLResponseMustRevalidate)(NSURLResponse *response);
-extern UInt8 (*wkGetNSEventKeyChar)(NSEvent *);
 extern BOOL (*wkHitTestMediaUIPart)(int part, CGRect bounds, CGPoint point);
 extern void (*wkMeasureMediaUIPart)(int part, CGRect *bounds, CGSize *naturalSize);
 extern NSView *(*wkCreateMediaUIBackgroundView)(void);

Modified: trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.mm (221542 => 221543)


--- trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.mm	2017-09-03 02:31:13 UTC (rev 221542)
+++ trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.mm	2017-09-03 03:43:08 UTC (rev 221543)
@@ -30,7 +30,6 @@
 
 #import <Foundation/Foundation.h>
 
-void (*wkCALayerEnumerateRectsBeingDrawnWithBlock)(CALayer *, CGContextRef context, void (^block)(CGRect rect));
 void (*wkDrawBezeledTextArea)(NSRect, BOOL enabled);
 void (*wkDrawMediaSliderTrack)(CGContextRef context, CGRect rect, float timeLoaded, float currentTime,
     float duration, unsigned state);
@@ -41,7 +40,6 @@
 NSControl *(*wkCreateMediaUIControl)(int);
 NSTimeInterval (*wkGetNSURLResponseCalculatedExpiration)(NSURLResponse *response);
 BOOL (*wkGetNSURLResponseMustRevalidate)(NSURLResponse *response);
-UInt8 (*wkGetNSEventKeyChar)(NSEvent *);
 void (*wkPopupMenu)(NSMenu*, NSPoint location, float width, NSView*, int selectedItem, NSFont*, NSControlSize controlSize, bool usesCustomAppearance);
 unsigned (*wkQTIncludeOnlyModernMediaFileTypes)(void);
 void (*wkQTMovieDisableComponent)(uint32_t[5]);

Modified: trunk/Source/WebKit/ChangeLog (221542 => 221543)


--- trunk/Source/WebKit/ChangeLog	2017-09-03 02:31:13 UTC (rev 221542)
+++ trunk/Source/WebKit/ChangeLog	2017-09-03 03:43:08 UTC (rev 221543)
@@ -1,3 +1,23 @@
+2017-09-02  Andy Estes  <[email protected]>
+
+        [CA] Upstream QuartzCore-related WebKitSystemInterface functions
+        https://bugs.webkit.org/show_bug.cgi?id=176270
+
+        Reviewed by Tim Horton.
+
+        * Platform/mac/LayerHostingContext.mm:
+        (WebKit::LayerHostingContext::createForPort):
+        (WebKit::LayerHostingContext::createForExternalHostingProcess):
+        * UIProcess/mac/PageClientImpl.mm:
+        (WebKit::PageClientImpl::enterAcceleratedCompositingMode):
+        (WebKit::PageClientImpl::updateAcceleratedCompositingMode):
+        * UIProcess/mac/RemoteLayerTreeHost.mm:
+        (WebKit::RemoteLayerTreeHost::createLayer):
+        * WebProcess/Plugins/Netscape/mac/PluginProxyMac.mm:
+        (WebKit::makeRenderLayer):
+        * WebProcess/WebCoreSupport/mac/WebSystemInterface.mm:
+        (InitWebCoreSystemInterface):
+
 2017-09-02  Tim Horton  <[email protected]>
 
         Move UI Process part of the Remote Layer Tree code out of a Mac-specific directory

Modified: trunk/Source/WebKit/Platform/mac/LayerHostingContext.mm (221542 => 221543)


--- trunk/Source/WebKit/Platform/mac/LayerHostingContext.mm	2017-09-03 02:31:13 UTC (rev 221542)
+++ trunk/Source/WebKit/Platform/mac/LayerHostingContext.mm	2017-09-03 03:43:08 UTC (rev 221543)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2012 Apple Inc. All rights reserved.
+ * Copyright (C) 2012-2017 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -28,6 +28,7 @@
 
 #import <WebCore/MachSendRight.h>
 #import <WebKitSystemInterface.h>
+#import <pal/spi/cg/CoreGraphicsSPI.h>
 #import <pal/spi/cocoa/QuartzCoreSPI.h>
 
 using namespace WebCore;
@@ -38,8 +39,15 @@
 {
     auto layerHostingContext = std::make_unique<LayerHostingContext>();
 
+    NSDictionary *options = @{
+        kCAContextPortNumber : @(serverPort.sendRight()),
+#if PLATFORM(MAC)
+        kCAContextCIFilterBehavior : @"ignore",
+#endif
+    };
+
     layerHostingContext->m_layerHostingMode = LayerHostingMode::InProcess;
-    layerHostingContext->m_context = (CAContext *)WKCAContextMakeRemoteWithServerPort(serverPort.sendRight());
+    layerHostingContext->m_context = [CAContext remoteContextWithOptions:options];
 
     return layerHostingContext;
 }
@@ -57,7 +65,7 @@
         kCAContextIgnoresHitTest : @YES,
         kCAContextDisplayId : @10000 }];
 #else
-    layerHostingContext->m_context = (CAContext *)WKCAContextMakeRemoteForWindowServer();
+    layerHostingContext->m_context = [CAContext contextWithCGSConnection:CGSMainConnectionID() options:@{ kCAContextCIFilterBehavior : @"ignore" }];
 #endif
     
     return layerHostingContext;

Modified: trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm (221542 => 221543)


--- trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm	2017-09-03 02:31:13 UTC (rev 221542)
+++ trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm	2017-09-03 03:43:08 UTC (rev 221543)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2012 Apple Inc. All rights reserved.
+ * Copyright (C) 2012-2017 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -38,6 +38,7 @@
 #import <WebCore/IOSurface.h>
 #import <WebCore/PlatformLayer.h>
 #import <WebCore/WebActionDisablingCALayerDelegate.h>
+#import <WebCore/WebCoreCALayerExtras.h>
 #import <WebKitSystemInterface.h>
 #import <pal/spi/cocoa/QuartzCoreSPI.h>
 
@@ -261,7 +262,7 @@
     case PlatformCALayer::LayerTypeAVPlayerLayer:
     case PlatformCALayer::LayerTypeContentsProvidedLayer:
         if (!m_isDebugLayerTreeHost)
-            layer = WKMakeRenderLayer(properties.hostingContextID);
+            layer = [CALayer _web_renderLayerWithContextID:properties.hostingContextID];
         else
             layer = adoptNS([[CALayer alloc] init]);
         break;

Modified: trunk/Source/WebKit/UIProcess/mac/PageClientImplMac.mm (221542 => 221543)


--- trunk/Source/WebKit/UIProcess/mac/PageClientImplMac.mm	2017-09-03 02:31:13 UTC (rev 221542)
+++ trunk/Source/WebKit/UIProcess/mac/PageClientImplMac.mm	2017-09-03 03:43:08 UTC (rev 221543)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2010, 2011, 2016 Apple Inc. All rights reserved.
+ * Copyright (C) 2010-2017 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -69,6 +69,7 @@
 #import <WebCore/TextIndicatorWindow.h>
 #import <WebCore/TextUndoInsertionMarkupMac.h>
 #import <WebCore/ValidationBubble.h>
+#import <WebCore/WebCoreCALayerExtras.h>
 #import <WebKitSystemInterface.h>
 #import <wtf/text/CString.h>
 #import <wtf/text/WTFString.h>
@@ -481,7 +482,7 @@
 {
     ASSERT(!layerTreeContext.isEmpty());
 
-    CALayer *renderLayer = WKMakeRenderLayer(layerTreeContext.contextID);
+    CALayer *renderLayer = [CALayer _web_renderLayerWithContextID:layerTreeContext.contextID];
     m_impl->setAcceleratedCompositingRootLayer(renderLayer);
 }
 
@@ -494,7 +495,7 @@
 {
     ASSERT(!layerTreeContext.isEmpty());
 
-    CALayer *renderLayer = WKMakeRenderLayer(layerTreeContext.contextID);
+    CALayer *renderLayer = [CALayer _web_renderLayerWithContextID:layerTreeContext.contextID];
     m_impl->setAcceleratedCompositingRootLayer(renderLayer);
 }
 

Modified: trunk/Source/WebKit/WebProcess/Plugins/Netscape/mac/PluginProxyMac.mm (221542 => 221543)


--- trunk/Source/WebKit/WebProcess/Plugins/Netscape/mac/PluginProxyMac.mm	2017-09-03 02:31:13 UTC (rev 221542)
+++ trunk/Source/WebKit/WebProcess/Plugins/Netscape/mac/PluginProxyMac.mm	2017-09-03 03:43:08 UTC (rev 221543)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2010-2017 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -32,6 +32,7 @@
 #import "PluginControllerProxyMessages.h"
 #import "PluginProcessConnection.h"
 #import <QuartzCore/QuartzCore.h>
+#import <WebCore/WebCoreCALayerExtras.h>
 #import <WebKitSystemInterface.h>
 
 const static double fadeInDuration = 0.5;
@@ -40,7 +41,7 @@
 
 static void makeRenderLayer(CALayer *pluginLayer, uint32_t layerHostingContextID)
 {
-    CALayer *renderLayer = WKMakeRenderLayer(layerHostingContextID);
+    CALayer *renderLayer = [CALayer _web_renderLayerWithContextID:layerHostingContextID];
     [renderLayer setFrame:[pluginLayer bounds]];
     [renderLayer setAutoresizingMask:kCALayerWidthSizable | kCALayerHeightSizable];
     [pluginLayer setSublayers:[NSArray arrayWithObject:renderLayer]];

Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm (221542 => 221543)


--- trunk/Source/WebKit/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm	2017-09-03 02:31:13 UTC (rev 221542)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm	2017-09-03 03:43:08 UTC (rev 221543)
@@ -36,13 +36,11 @@
     static dispatch_once_t initOnce;
     
     dispatch_once(&initOnce, ^{
-        INIT(CALayerEnumerateRectsBeingDrawnWithBlock);
         INIT(CopyCONNECTProxyResponse);
 #if !PLATFORM(IOS)
         INIT(DrawBezeledTextArea);
         INIT(DrawMediaSliderTrack);
         INIT(DrawMediaUIPart);
-        INIT(GetNSEventKeyChar);
         INIT(HitTestMediaUIPart);
         INIT(MeasureMediaUIPart);
         INIT(QTIncludeOnlyModernMediaFileTypes);

Modified: trunk/Source/WebKitLegacy/mac/ChangeLog (221542 => 221543)


--- trunk/Source/WebKitLegacy/mac/ChangeLog	2017-09-03 02:31:13 UTC (rev 221542)
+++ trunk/Source/WebKitLegacy/mac/ChangeLog	2017-09-03 03:43:08 UTC (rev 221543)
@@ -1,3 +1,26 @@
+2017-09-02  Andy Estes  <[email protected]>
+
+        [CA] Upstream QuartzCore-related WebKitSystemInterface functions
+        https://bugs.webkit.org/show_bug.cgi?id=176270
+
+        Reviewed by Tim Horton.
+
+        * Plugins/Hosted/NetscapePluginHostManager.mm:
+        (WebKit::NetscapePluginHostManager::spawnPluginHost):
+        * Plugins/Hosted/WebHostedNetscapePluginView.h:
+        * Plugins/Hosted/WebHostedNetscapePluginView.mm:
+        (WebKit::SoftwareCARenderer::SoftwareCARenderer):
+        (WebKit::SoftwareCARenderer::~SoftwareCARenderer):
+        (WebKit::SoftwareCARenderer::context const):
+        (WebKit::SoftwareCARenderer::renderContext const):
+        (WebKit::SoftwareCARenderer::render):
+        (-[WebHostedNetscapePluginView createPlugin]):
+        (-[WebHostedNetscapePluginView createPluginLayer]):
+        (-[WebHostedNetscapePluginView destroyPlugin]):
+        (-[WebHostedNetscapePluginView drawRect:]):
+        * WebCoreSupport/WebSystemInterface.mm:
+        (InitWebCoreSystemInterface):
+
 2017-09-01  Andy Estes  <[email protected]>
 
         [CG] Upstream CoreGraphics-related WebKitSystemInterface functions

Modified: trunk/Source/WebKitLegacy/mac/Plugins/Hosted/NetscapePluginHostManager.mm (221542 => 221543)


--- trunk/Source/WebKitLegacy/mac/Plugins/Hosted/NetscapePluginHostManager.mm	2017-09-03 02:31:13 UTC (rev 221542)
+++ trunk/Source/WebKitLegacy/mac/Plugins/Hosted/NetscapePluginHostManager.mm	2017-09-03 03:43:08 UTC (rev 221543)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ * Copyright (C) 2008-2017 Apple Inc. All Rights Reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -34,6 +34,7 @@
 #import "WebNetscapePluginPackage.h"
 #import <WebCore/WebCoreNSStringExtras.h>
 #import <mach/mach_port.h>
+#import <pal/spi/cocoa/QuartzCoreSPI.h>
 #import <pal/spi/cocoa/ServersSPI.h>
 #import <spawn.h>
 #import <wtf/Assertions.h>
@@ -107,7 +108,10 @@
             return false;
     }
 
-    mach_port_t renderServerPort = WKInitializeRenderServer();
+    if (!CARenderServerStart())
+        return MACH_PORT_NULL;
+
+    mach_port_t renderServerPort = CARenderServerGetPort();
     if (renderServerPort == MACH_PORT_NULL)
         return false;
 

Modified: trunk/Source/WebKitLegacy/mac/Plugins/Hosted/WebHostedNetscapePluginView.h (221542 => 221543)


--- trunk/Source/WebKitLegacy/mac/Plugins/Hosted/WebHostedNetscapePluginView.h	2017-09-03 02:31:13 UTC (rev 221542)
+++ trunk/Source/WebKitLegacy/mac/Plugins/Hosted/WebHostedNetscapePluginView.h	2017-09-03 03:43:08 UTC (rev 221543)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ * Copyright (C) 2008-2017 Apple Inc. All Rights Reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -27,12 +27,12 @@
 
 #import "WebBaseNetscapePluginView.h"
 #import "WebKitSystemInterface.h"
-
 #import <wtf/RefPtr.h>
 
 namespace WebKit {
-    class HostedNetscapePluginStream;
-    class NetscapePluginInstanceProxy;
+class HostedNetscapePluginStream;
+class NetscapePluginInstanceProxy;
+class SoftwareCARenderer;
 }
 
 @interface WebHostedNetscapePluginView : WebBaseNetscapePluginView<WebPluginManualLoader>
@@ -42,7 +42,7 @@
     
     RetainPtr<CALayer> _pluginLayer;
     BOOL _hostsLayersInWindowServer;
-    WKSoftwareCARendererRef _softwareRenderer;
+    std::unique_ptr<WebKit::SoftwareCARenderer> _softwareRenderer;
     
     NSSize _previousSize;
     RefPtr<WebKit::NetscapePluginInstanceProxy> _proxy;

Modified: trunk/Source/WebKitLegacy/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm (221542 => 221543)


--- trunk/Source/WebKitLegacy/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm	2017-09-03 02:31:13 UTC (rev 221542)
+++ trunk/Source/WebKitLegacy/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm	2017-09-03 03:43:08 UTC (rev 221543)
@@ -45,8 +45,10 @@
 #import <WebCore/HTMLPlugInElement.h>
 #import <WebCore/RenderEmbeddedObject.h>
 #import <WebCore/ResourceError.h>
+#import <WebCore/WebCoreCALayerExtras.h>
 #import <WebCore/WebCoreObjCExtras.h>
 #import <WebCore/runtime_root.h>
+#import <pal/spi/cocoa/QuartzCoreSPI.h>
 #import <runtime/InitializeThreading.h>
 #import <wtf/Assertions.h>
 #import <wtf/MainThread.h>
@@ -56,6 +58,38 @@
 using namespace WebCore;
 using namespace WebKit;
 
+namespace WebKit {
+    
+class SoftwareCARenderer {
+public:
+    explicit SoftwareCARenderer(uint32_t contextID)
+        : m_context { [CAContext localContext] }
+        , m_renderContext { CARenderCGNew(0) }
+    {
+        [m_context setLayer:[CALayer _web_renderLayerWithContextID:contextID]];
+    }
+
+    ~SoftwareCARenderer()
+    {
+        CARenderCGDestroy(m_renderContext);
+    }
+
+    void render(CGContextRef context, CGRect rect)
+    {
+        CARenderUpdate* update = CARenderUpdateBegin(nullptr, 0, CACurrentMediaTime(), nullptr, 0, &rect);
+        CARenderUpdateAddContext(update, [m_context renderContext]);
+        CARenderUpdateAddRect(update, &rect);
+        CARenderCGRender(m_renderContext, update, context);
+        CARenderUpdateFinish(update);
+    }
+
+private:
+    RetainPtr<CAContext> m_context;
+    CARenderCGContext* m_renderContext;
+};
+
+}
+
 extern "C" {
 #include "WebKitPluginClientServer.h"
 #include "WebKitPluginHost.h"
@@ -135,7 +169,7 @@
         return NO;
 
     if (_proxy->rendererType() == UseSoftwareRenderer)
-        _softwareRenderer = WKSoftwareCARendererCreate(_proxy->renderContextID());
+        _softwareRenderer = std::make_unique<SoftwareCARenderer>(_proxy->renderContextID());
     else
         [self createPluginLayer];
     
@@ -150,7 +184,7 @@
     BOOL acceleratedCompositingEnabled = false;
     acceleratedCompositingEnabled = [[[self webView] preferences] acceleratedCompositingEnabled];
 
-    _pluginLayer = WKMakeRenderLayer(_proxy->renderContextID());
+    _pluginLayer = [CALayer _web_renderLayerWithContextID:_proxy->renderContextID()];
 
     if (acceleratedCompositingEnabled && _proxy->rendererType() == UseAcceleratedCompositing) {
         // FIXME: This code can be shared between WebHostedNetscapePluginView and WebNetscapePluginView.
@@ -274,11 +308,7 @@
 - (void)destroyPlugin
 {
     if (_proxy) {
-        if (_softwareRenderer) {
-            WKSoftwareCARendererDestroy(_softwareRenderer);
-            _softwareRenderer = 0;
-        }
-        
+        _softwareRenderer = nullptr;
         _proxy->destroy();
         _proxy = nullptr;
     }
@@ -450,7 +480,7 @@
     if (_proxy) {
         if (_softwareRenderer) {
             if ([NSGraphicsContext currentContextDrawingToScreen]) {
-                WKSoftwareCARendererRender(_softwareRenderer, (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort], NSRectToCGRect(rect));
+                _softwareRenderer->render((CGContextRef)[[NSGraphicsContext currentContext] graphicsPort], NSRectToCGRect(rect));
                 _proxy->didDraw();
             } else
                 _proxy->print(reinterpret_cast<CGContextRef>([[NSGraphicsContext currentContext] graphicsPort]), [self bounds].size.width, [self bounds].size.height);

Modified: trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebSystemInterface.mm (221542 => 221543)


--- trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebSystemInterface.mm	2017-09-03 02:31:13 UTC (rev 221542)
+++ trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebSystemInterface.mm	2017-09-03 03:43:08 UTC (rev 221543)
@@ -42,13 +42,11 @@
     if (didInit)
         return;
 
-    INIT(CALayerEnumerateRectsBeingDrawnWithBlock);
     INIT(CopyCONNECTProxyResponse);
 #if !PLATFORM(IOS)
     INIT(DrawBezeledTextArea);
     INIT(DrawMediaUIPart);
     INIT(DrawMediaSliderTrack);
-    INIT(GetNSEventKeyChar);
     INIT(HitTestMediaUIPart);
     INIT(MeasureMediaUIPart);
     INIT(CreateMediaUIBackgroundView);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to