diff options
Diffstat (limited to 'WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm')
-rw-r--r-- | WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm b/WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm index 519e274..6917e5f 100644 --- a/WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm +++ b/WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm @@ -122,6 +122,20 @@ extern "C" { _pluginLayer = WKMakeRenderLayer(_proxy->renderContextID()); if (accleratedCompositingEnabled && _proxy->rendererType() == UseAcceleratedCompositing) { + // FIXME: This code can be shared between WebHostedNetscapePluginView and WebNetscapePluginView. +#ifndef BUILDING_ON_LEOPARD + // 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.releaseRef()); + + _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()]; +#endif + // 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(); @@ -166,8 +180,11 @@ extern "C" { if (!_proxy) return; - // Use AppKit to convert view coordinates to NSWindow coordinates. - NSRect boundsInWindow = [self convertRect:[self bounds] toView:nil]; + // The base coordinates of a window and it's contentView happen to be the equal at a userSpaceScaleFactor + // of 1. For non-1.0 scale factors this assumption is false. + NSView *windowContentView = [[self window] contentView]; + NSRect boundsInWindow = [self convertRect:[self bounds] toView:windowContentView]; + NSRect visibleRectInWindow; // Core Animation plug-ins need to be updated (with a 0,0,0,0 clipRect) when @@ -176,7 +193,7 @@ extern "C" { // compatible with this behavior. BOOL shouldClipOutPlugin = _pluginLayer && [self shouldClipOutPlugin]; if (!shouldClipOutPlugin) - visibleRectInWindow = [self convertRect:[self visibleRect] toView:nil]; + visibleRectInWindow = [self convertRect:[self visibleRect] toView:windowContentView]; else visibleRectInWindow = NSZeroRect; |