Diff
Modified: trunk/Source/WebKit/mac/ChangeLog (154077 => 154078)
--- trunk/Source/WebKit/mac/ChangeLog 2013-08-14 22:49:47 UTC (rev 154077)
+++ trunk/Source/WebKit/mac/ChangeLog 2013-08-14 23:03:23 UTC (rev 154078)
@@ -1,5 +1,59 @@
2013-08-14 Tim Horton <[email protected]>
+ Remotely hosted plugins don’t work in window-server-hosted WebKit1 views
+ https://bugs.webkit.org/show_bug.cgi?id=119709
+ <rdar://problem/14717572>
+
+ Reviewed by Anders Carlsson.
+
+ * Plugins/Hosted/NetscapePluginHostManager.h:
+ Add hostLayersInWindowServer argument to instantiatePlugin.
+
+ * Plugins/Hosted/NetscapePluginHostManager.mm:
+ (WebKit::NetscapePluginHostManager::instantiatePlugin):
+ Add hostLayersInWindowServer argument to instantiatePlugin, and pass it through to WebKitPluginHost.
+
+ * Plugins/Hosted/NetscapePluginHostProxy.mm:
+ (WKPCLayerHostingModeChanged):
+ Forward the notification that the plugin host changed its layer hosting mode
+ to the instance proxy.
+
+ * Plugins/Hosted/NetscapePluginInstanceProxy.h:
+ * Plugins/Hosted/NetscapePluginInstanceProxy.mm:
+ (WebKit::NetscapePluginInstanceProxy::setShouldHostLayersInWindowServer):
+ Ask the plugin host to re-host its layers when the layer hosting mode changes.
+
+ (WebKit::NetscapePluginInstanceProxy::layerHostingModeChanged):
+ Inform the WebHostedNetscapePluginView of the new layer hosting mode
+ when it changes. Also, store the new CAContext ID.
+
+ * Plugins/Hosted/WebHostedNetscapePluginView.h:
+ * Plugins/Hosted/WebHostedNetscapePluginView.mm:
+ (-[WebHostedNetscapePluginView windowHostsLayersInWindowServer]):
+ Determine whether the WebView's current window uses window-server hosting for its layers.
+
+ (-[WebHostedNetscapePluginView createPlugin]):
+ Drive-by spelling fix.
+ Factor _pluginLayer initialization out into createPluginLayer.
+ Instantiate the plugin with the appropriate layer hosting mode.
+
+ (-[WebHostedNetscapePluginView createPluginLayer]):
+
+ (-[WebHostedNetscapePluginView setHostsLayersInWindowServer:]):
+ Create a new _pluginLayer if the layer hosting mode changes.
+ Attach the new _pluginLayer to our parent layer.
+
+ (-[WebHostedNetscapePluginView updateAndSetWindow]):
+ Inform the NetscapePluginInstanceProxy if the layer hosting mode changes,
+ so it can inform the plugin host. We will asynchronously receive a reply
+ with the new hosting mode and renderContextID and switch to the new CAContext,
+ in setHostsLayersInWindowServer:.
+
+ * Plugins/Hosted/WebKitPluginClient.defs:
+ * Plugins/Hosted/WebKitPluginHost.defs:
+
+2013-08-14 Tim Horton <[email protected]>
+
REGRESSION (r153877): Plugin scanning slows creation of WebViews
https://bugs.webkit.org/show_bug.cgi?id=119665
<rdar://problem/14716549>
Modified: trunk/Source/WebKit/mac/Plugins/Hosted/NetscapePluginHostManager.h (154077 => 154078)
--- trunk/Source/WebKit/mac/Plugins/Hosted/NetscapePluginHostManager.h 2013-08-14 22:49:47 UTC (rev 154077)
+++ trunk/Source/WebKit/mac/Plugins/Hosted/NetscapePluginHostManager.h 2013-08-14 23:03:23 UTC (rev 154078)
@@ -44,14 +44,14 @@
public:
static NetscapePluginHostManager& shared();
- PassRefPtr<NetscapePluginInstanceProxy> instantiatePlugin(const String& pluginPath, cpu_type_t pluginArchitecture, const String& bundleIdentifier, WebHostedNetscapePluginView *, NSString *mimeType, NSArray *attributeKeys, NSArray *attributeValues, NSString *userAgent, NSURL *sourceURL, bool fullFrame, bool isPrivateBrowsingEnabled, bool isAcceleratedCompositingEnabled);
+ PassRefPtr<NetscapePluginInstanceProxy> instantiatePlugin(const String& pluginPath, cpu_type_t pluginArchitecture, const String& bundleIdentifier, WebHostedNetscapePluginView *, NSString *mimeType, NSArray *attributeKeys, NSArray *attributeValues, NSString *userAgent, NSURL *sourceURL, bool fullFrame, bool isPrivateBrowsingEnabled, bool isAcceleratedCompositingEnabled, bool hostLayersInWindowServer);
void pluginHostDied(NetscapePluginHostProxy*);
void createPropertyListFile(const String& pluginPath, cpu_type_t pluginArchitecture, const String& bundleIdentifier);
void didCreateWindow();
-
+
private:
NetscapePluginHostProxy* hostForPlugin(const String& pluginPath, cpu_type_t pluginArchitecture, const String& bundleIdentifier);
Modified: trunk/Source/WebKit/mac/Plugins/Hosted/NetscapePluginHostManager.mm (154077 => 154078)
--- trunk/Source/WebKit/mac/Plugins/Hosted/NetscapePluginHostManager.mm 2013-08-14 22:49:47 UTC (rev 154077)
+++ trunk/Source/WebKit/mac/Plugins/Hosted/NetscapePluginHostManager.mm 2013-08-14 23:03:23 UTC (rev 154078)
@@ -218,7 +218,7 @@
}
}
-PassRefPtr<NetscapePluginInstanceProxy> NetscapePluginHostManager::instantiatePlugin(const String& pluginPath, cpu_type_t pluginArchitecture, const String& bundleIdentifier, WebHostedNetscapePluginView *pluginView, NSString *mimeType, NSArray *attributeKeys, NSArray *attributeValues, NSString *userAgent, NSURL *sourceURL, bool fullFrame, bool isPrivateBrowsingEnabled, bool isAcceleratedCompositingEnabled)
+PassRefPtr<NetscapePluginInstanceProxy> NetscapePluginHostManager::instantiatePlugin(const String& pluginPath, cpu_type_t pluginArchitecture, const String& bundleIdentifier, WebHostedNetscapePluginView *pluginView, NSString *mimeType, NSArray *attributeKeys, NSArray *attributeValues, NSString *userAgent, NSURL *sourceURL, bool fullFrame, bool isPrivateBrowsingEnabled, bool isAcceleratedCompositingEnabled, bool hostLayersInWindowServer)
{
NetscapePluginHostProxy* hostProxy = hostForPlugin(pluginPath, pluginArchitecture, bundleIdentifier);
if (!hostProxy)
@@ -244,6 +244,7 @@
[properties.get() setObject:[NSNumber numberWithBool:fullFrame] forKey:@"fullFrame"];
[properties.get() setObject:[NSNumber numberWithBool:isPrivateBrowsingEnabled] forKey:@"privateBrowsingEnabled"];
[properties.get() setObject:[NSNumber numberWithBool:isAcceleratedCompositingEnabled] forKey:@"acceleratedCompositingEnabled"];
+ [properties.get() setObject:[NSNumber numberWithBool:hostLayersInWindowServer] forKey:@"hostLayersInWindowServer"];
NSData *data = "" dataFromPropertyList:properties.get() format:NSPropertyListBinaryFormat_v1_0 errorDescription:nil];
ASSERT(data);
Modified: trunk/Source/WebKit/mac/Plugins/Hosted/NetscapePluginHostProxy.mm (154077 => 154078)
--- trunk/Source/WebKit/mac/Plugins/Hosted/NetscapePluginHostProxy.mm 2013-08-14 22:49:47 UTC (rev 154077)
+++ trunk/Source/WebKit/mac/Plugins/Hosted/NetscapePluginHostProxy.mm 2013-08-14 23:03:23 UTC (rev 154078)
@@ -1097,6 +1097,20 @@
return KERN_SUCCESS;
}
+kern_return_t WKPCLayerHostingModeChanged(mach_port_t clientPort, uint32_t pluginID, boolean_t hostsLayersInWindowServer, uint32_t renderContextID)
+{
+ NetscapePluginHostProxy* hostProxy = pluginProxyMap().get(clientPort);
+ if (!hostProxy)
+ return KERN_FAILURE;
+
+ NetscapePluginInstanceProxy* instanceProxy = hostProxy->pluginInstance(pluginID);
+ if (!instanceProxy)
+ return KERN_FAILURE;
+
+ instanceProxy->layerHostingModeChanged(hostsLayersInWindowServer, renderContextID);
+ return KERN_SUCCESS;
+}
+
kern_return_t WKPCCheckIfAllowedToLoadURL(mach_port_t clientPort, uint32_t pluginID, data_t urlData, mach_msg_type_number_t urlLength,
data_t targetData, mach_msg_type_number_t targetLength, uint32_t *checkID)
{
Modified: trunk/Source/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.h (154077 => 154078)
--- trunk/Source/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.h 2013-08-14 22:49:47 UTC (rev 154077)
+++ trunk/Source/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.h 2013-08-14 23:03:23 UTC (rev 154078)
@@ -91,6 +91,9 @@
void focusChanged(bool hasFocus);
void windowFocusChanged(bool hasFocus);
void windowFrameChanged(NSRect frame);
+
+ void setShouldHostLayersInWindowServer(bool);
+ void layerHostingModeChanged(bool hostsLayersInWindowServer, uint32_t renderContextID);
void mouseEvent(NSView *pluginView, NSEvent *, NPCocoaEventType);
void keyEvent(NSView *pluginView, NSEvent *, NPCocoaEventType);
Modified: trunk/Source/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm (154077 => 154078)
--- trunk/Source/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm 2013-08-14 22:49:47 UTC (rev 154077)
+++ trunk/Source/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm 2013-08-14 23:03:23 UTC (rev 154078)
@@ -277,6 +277,19 @@
waitForReply<NetscapePluginInstanceProxy::BooleanReply>(requestID);
}
+
+void NetscapePluginInstanceProxy::setShouldHostLayersInWindowServer(bool shouldHostLayersInWindowServer)
+{
+ _WKPHPluginShouldHostLayersInWindowServerChanged(m_pluginHostProxy->port(), m_pluginID, shouldHostLayersInWindowServer);
+}
+
+void NetscapePluginInstanceProxy::layerHostingModeChanged(bool hostsLayersInWindowServer, uint32_t renderContextID)
+{
+ setRenderContextID(renderContextID);
+
+ [m_pluginView setHostsLayersInWindowServer:hostsLayersInWindowServer];
+}
+
void NetscapePluginInstanceProxy::stopAllStreams()
{
Vector<RefPtr<HostedNetscapePluginStream> > streamsCopy;
Modified: trunk/Source/WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.h (154077 => 154078)
--- trunk/Source/WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.h 2013-08-14 22:49:47 UTC (rev 154077)
+++ trunk/Source/WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.h 2013-08-14 23:03:23 UTC (rev 154078)
@@ -41,6 +41,7 @@
RetainPtr<NSArray> _attributeValues;
RetainPtr<CALayer> _pluginLayer;
+ BOOL _hostsLayersInWindowServer;
WKSoftwareCARendererRef _softwareRenderer;
NSSize _previousSize;
@@ -61,6 +62,7 @@
- (CALayer *)pluginLayer;
- (BOOL)getFormValue:(NSString **)value;
- (void)webFrame:(WebFrame *)webFrame didFinishLoadWithReason:(NPReason)reason;
+- (void)setHostsLayersInWindowServer:(bool)hostsLayersInWindowServer;
@end
Modified: trunk/Source/WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm (154077 => 154078)
--- trunk/Source/WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm 2013-08-14 22:49:47 UTC (rev 154077)
+++ trunk/Source/WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm 2013-08-14 23:03:23 UTC (rev 154078)
@@ -60,6 +60,12 @@
#include "WebKitPluginHost.h"
}
+#if HAVE(LAYER_HOSTING_IN_WINDOW_SERVER)
+@interface NSWindow (Details)
+- (BOOL)_hostsLayersInWindowServer;
+@end
+#endif
+
@implementation WebHostedNetscapePluginView
+ (void)initialize
@@ -101,48 +107,37 @@
_attributeKeys = adoptNS([keys copy]);
_attributeValues = adoptNS([values copy]);
-}
+}
+- (BOOL)windowHostsLayersInWindowServer
+{
+#if HAVE(LAYER_HOSTING_IN_WINDOW_SERVER)
+ return [[[self webView] window] _hostsLayersInWindowServer];
+#else
+ return false;
+#endif
+}
+
- (BOOL)createPlugin
{
ASSERT(!_proxy);
NSString *userAgent = [[self webView] userAgentForURL:_baseURL.get()];
- BOOL accleratedCompositingEnabled = false;
+ BOOL acceleratedCompositingEnabled = false;
#if USE(ACCELERATED_COMPOSITING)
- accleratedCompositingEnabled = [[[self webView] preferences] acceleratedCompositingEnabled];
+ acceleratedCompositingEnabled = [[[self webView] preferences] acceleratedCompositingEnabled];
#endif
-
- _proxy = NetscapePluginHostManager::shared().instantiatePlugin([_pluginPackage.get() path], [_pluginPackage.get() pluginHostArchitecture], [_pluginPackage.get() bundleIdentifier], self, _MIMEType.get(), _attributeKeys.get(), _attributeValues.get(), userAgent, _sourceURL.get(),
- _mode == NP_FULL, _isPrivateBrowsingEnabled, accleratedCompositingEnabled);
+ _hostsLayersInWindowServer = [self windowHostsLayersInWindowServer];
+
+ _proxy = NetscapePluginHostManager::shared().instantiatePlugin([_pluginPackage.get() path], [_pluginPackage.get() pluginHostArchitecture], [_pluginPackage.get() bundleIdentifier], self, _MIMEType.get(), _attributeKeys.get(), _attributeValues.get(), userAgent, _sourceURL.get(),
+ _mode == NP_FULL, _isPrivateBrowsingEnabled, acceleratedCompositingEnabled, _hostsLayersInWindowServer);
if (!_proxy)
return NO;
if (_proxy->rendererType() == UseSoftwareRenderer)
_softwareRenderer = WKSoftwareCARendererCreate(_proxy->renderContextID());
- else {
- _pluginLayer = WKMakeRenderLayer(_proxy->renderContextID());
-
- if (accleratedCompositingEnabled && _proxy->rendererType() == UseAcceleratedCompositing) {
- // FIXME: This code can be shared between WebHostedNetscapePluginView and WebNetscapePluginView.
- // Since this layer isn't going to be inserted into a view, we need to create another layer and flip its geometry
- // in order to get the coordinate system right.
- RetainPtr<CALayer> realPluginLayer = adoptNS(_pluginLayer.leakRef());
-
- _pluginLayer = adoptNS([[CALayer alloc] init]);
- _pluginLayer.get().bounds = realPluginLayer.get().bounds;
- _pluginLayer.get().geometryFlipped = YES;
-
- realPluginLayer.get().autoresizingMask = kCALayerWidthSizable | kCALayerHeightSizable;
- [_pluginLayer.get() addSublayer:realPluginLayer.get()];
-
- // Eagerly enter compositing mode, since we know we'll need it. This avoids firing setNeedsStyleRecalc()
- // for iframes that contain composited plugins at bad times. https://bugs.webkit.org/show_bug.cgi?id=39033
- core([self webFrame])->view()->enterCompositingMode();
- [self element]->setNeedsStyleRecalc(SyntheticStyleChange);
- } else
- self.wantsLayer = YES;
- }
+ else
+ [self createPluginLayer];
// Update the window frame.
_proxy->windowFrameChanged([[self window] frame]);
@@ -150,6 +145,51 @@
return YES;
}
+- (void)createPluginLayer
+{
+ BOOL acceleratedCompositingEnabled = false;
+#if USE(ACCELERATED_COMPOSITING)
+ acceleratedCompositingEnabled = [[[self webView] preferences] acceleratedCompositingEnabled];
+#endif
+
+ _pluginLayer = WKMakeRenderLayer(_proxy->renderContextID());
+
+ if (acceleratedCompositingEnabled && _proxy->rendererType() == UseAcceleratedCompositing) {
+ // FIXME: This code can be shared between WebHostedNetscapePluginView and WebNetscapePluginView.
+ // Since this layer isn't going to be inserted into a view, we need to create another layer and flip its geometry
+ // in order to get the coordinate system right.
+ RetainPtr<CALayer> realPluginLayer = adoptNS(_pluginLayer.leakRef());
+
+ _pluginLayer = adoptNS([[CALayer alloc] init]);
+ _pluginLayer.get().bounds = realPluginLayer.get().bounds;
+ _pluginLayer.get().geometryFlipped = YES;
+
+ _pluginLayer.get().backgroundColor = CGColorCreateGenericRGB(1, 0, 1, 1);
+
+ realPluginLayer.get().autoresizingMask = kCALayerWidthSizable | kCALayerHeightSizable;
+ [_pluginLayer.get() addSublayer:realPluginLayer.get()];
+
+ // Eagerly enter compositing mode, since we know we'll need it. This avoids firing setNeedsStyleRecalc()
+ // for iframes that contain composited plugins at bad times. https://bugs.webkit.org/show_bug.cgi?id=39033
+ core([self webFrame])->view()->enterCompositingMode();
+ [self element]->setNeedsStyleRecalc(SyntheticStyleChange);
+ } else
+ self.wantsLayer = YES;
+}
+
+- (void)setHostsLayersInWindowServer:(bool)hostsLayersInWindowServer
+{
+ if (_proxy->rendererType() == UseSoftwareRenderer)
+ return;
+
+ RetainPtr<CALayer> currentSuperlayer = [_pluginLayer superlayer];
+
+ _hostsLayersInWindowServer = hostsLayersInWindowServer;
+
+ [self createPluginLayer];
+ [self setLayer:currentSuperlayer.get()];
+}
+
// FIXME: This method is an ideal candidate to move up to the base class
- (CALayer *)pluginLayer
{
@@ -215,6 +255,10 @@
_previousSize = boundsInWindow.size;
_proxy->resize(boundsInWindow, visibleRectInWindow);
+
+ bool shouldHostLayersInWindowServer = [self windowHostsLayersInWindowServer];
+ if (_hostsLayersInWindowServer != shouldHostLayersInWindowServer)
+ _proxy->setShouldHostLayersInWindowServer(shouldHostLayersInWindowServer);
}
- (void)windowFocusChanged:(BOOL)hasFocus
Modified: trunk/Source/WebKit/mac/Plugins/Hosted/WebKitPluginClient.defs (154077 => 154078)
--- trunk/Source/WebKit/mac/Plugins/Hosted/WebKitPluginClient.defs 2013-08-14 22:49:47 UTC (rev 154077)
+++ trunk/Source/WebKit/mac/Plugins/Hosted/WebKitPluginClient.defs 2013-08-14 23:03:23 UTC (rev 154078)
@@ -231,8 +231,15 @@
returnValue :boolean_t;
result :data_t);
+// New Routines (must be added at the bottom of the file)
+
simpleroutine PCSetFullscreenWindowIsShowing(clientPort :mach_port_t;
isShowing :boolean_t);
simpleroutine PCSetException(clientPort :mach_port_t;
message :data_t);
+
+simpleroutine PCLayerHostingModeChanged(clientPort :mach_port_t;
+ pluginID :uint32_t;
+ hostsLayersInWindowServer :boolean_t;
+ renderContextID :uint32_t);
Modified: trunk/Source/WebKit/mac/Plugins/Hosted/WebKitPluginHost.defs (154077 => 154078)
--- trunk/Source/WebKit/mac/Plugins/Hosted/WebKitPluginHost.defs 2013-08-14 22:49:47 UTC (rev 154077)
+++ trunk/Source/WebKit/mac/Plugins/Hosted/WebKitPluginHost.defs 2013-08-14 23:03:23 UTC (rev 154078)
@@ -234,7 +234,9 @@
requestID :uint32_t;
returnValue :boolean_t;
result :data_t);
-
+
+// New Routines (must be added at the bottom of the file)
+
simpleroutine PHPluginInstanceDidDraw(pluginHostPort :mach_port_t;
pluginID :uint32_t);
simpleroutine PHPluginInstancePrivateBrowsingModeDidChange(pluginHostPort :mach_port_t;
@@ -248,3 +250,7 @@
height :uint32_t);
routine PHCreatePluginMIMETypesPreferences(pluginHostPort :mach_port_t);
+
+simpleroutine PHPluginShouldHostLayersInWindowServerChanged(pluginHostPort :mach_port_t;
+ pluginID :uint32_t;
+ shouldHostLayersInWindowServer :boolean_t);