diff options
Diffstat (limited to 'WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm')
-rw-r--r-- | WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm | 45 |
1 files changed, 22 insertions, 23 deletions
diff --git a/WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm b/WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm index 0ad76f0..cd3724e 100644 --- a/WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm +++ b/WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm @@ -41,8 +41,9 @@ #import <WebCore/Frame.h> #import <WebCore/FrameLoaderTypes.h> #import <WebCore/HTMLPlugInElement.h> -#import <WebCore/runtime_root.h> +#import <WebCore/RenderEmbeddedObject.h> #import <WebCore/WebCoreObjCExtras.h> +#import <WebCore/runtime_root.h> #import <runtime/InitializeThreading.h> #import <wtf/Assertions.h> @@ -180,10 +181,9 @@ extern "C" { if (!shouldClipOutPlugin) visibleRectInWindow.origin.y = borderViewHeight - NSMaxY(visibleRectInWindow); - BOOL sizeChanged = !NSEqualSizes(_previousSize, boundsInWindow.size); _previousSize = boundsInWindow.size; - _proxy->resize(boundsInWindow, visibleRectInWindow, sizeChanged); + _proxy->resize(boundsInWindow, visibleRectInWindow); } - (void)windowFocusChanged:(BOOL)hasFocus @@ -287,6 +287,9 @@ extern "C" { - (void)handleMouseEntered:(NSEvent *)event { + // Set cursor to arrow. Plugins often handle cursor internally, but those that don't will just get this default one. + [[NSCursor arrowCursor] set]; + if (_isStarted && _proxy) _proxy->mouseEvent(self, event, NPCocoaEventMouseEntered); } @@ -295,6 +298,11 @@ extern "C" { { if (_isStarted && _proxy) _proxy->mouseEvent(self, event, NPCocoaEventMouseExited); + + // Set cursor back to arrow cursor. Because NSCursor doesn't know about changes that the plugin made, we could get confused about what we think the + // current cursor is otherwise. Therefore we have no choice but to unconditionally reset the cursor when the mouse exits the plugin. + // FIXME: This should be job of plugin host, see <rdar://problem/7654434>. + [[NSCursor arrowCursor] set]; } - (void)scrollWheel:(NSEvent *)event @@ -348,7 +356,9 @@ extern "C" { - (void)pluginHostDied { - _pluginHostDied = YES; + RenderEmbeddedObject* renderer = toRenderEmbeddedObject(_element->renderer()); + if (renderer) + renderer->setShowsCrashedPluginIndicator(); _pluginLayer = nil; _proxy = 0; @@ -359,6 +369,11 @@ extern "C" { [self invalidatePluginContentRect:[self bounds]]; } +- (void)visibleRectDidChange +{ + [super visibleRectDidChange]; + WKSyncSurfaceToView(self); +} - (void)drawRect:(NSRect)rect { @@ -369,28 +384,12 @@ extern "C" { _proxy->didDraw(); } else _proxy->print(reinterpret_cast<CGContextRef>([[NSGraphicsContext currentContext] graphicsPort]), [self bounds].size.width, [self bounds].size.height); + } else if ([self inFlatteningPaint] && [self supportsSnapshotting]) { + _proxy->snapshot(reinterpret_cast<CGContextRef>([[NSGraphicsContext currentContext] graphicsPort]), [self bounds].size.width, [self bounds].size.height); } - + return; } - - if (_pluginHostDied) { - static NSImage *nullPlugInImage; - if (!nullPlugInImage) { - NSBundle *bundle = [NSBundle bundleForClass:[WebHostedNetscapePluginView class]]; - nullPlugInImage = [[NSImage alloc] initWithContentsOfFile:[bundle pathForResource:@"nullplugin" ofType:@"tiff"]]; - [nullPlugInImage setFlipped:YES]; - } - - if (!nullPlugInImage) - return; - - NSSize imageSize = [nullPlugInImage size]; - NSSize viewSize = [self bounds].size; - - NSPoint point = NSMakePoint((viewSize.width - imageSize.width) / 2.0, (viewSize.height - imageSize.height) / 2.0); - [nullPlugInImage drawAtPoint:point fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:1.0]; - } } - (PassRefPtr<JSC::Bindings::Instance>)createPluginBindingsInstance:(PassRefPtr<JSC::Bindings::RootObject>)rootObject |