summaryrefslogtreecommitdiffstats
path: root/WebKit/mac/Plugins/WebBaseNetscapePluginView.mm
diff options
context:
space:
mode:
Diffstat (limited to 'WebKit/mac/Plugins/WebBaseNetscapePluginView.mm')
-rw-r--r--WebKit/mac/Plugins/WebBaseNetscapePluginView.mm136
1 files changed, 51 insertions, 85 deletions
diff --git a/WebKit/mac/Plugins/WebBaseNetscapePluginView.mm b/WebKit/mac/Plugins/WebBaseNetscapePluginView.mm
index e93509a..b6b8b64 100644
--- a/WebKit/mac/Plugins/WebBaseNetscapePluginView.mm
+++ b/WebKit/mac/Plugins/WebBaseNetscapePluginView.mm
@@ -41,12 +41,10 @@
#import "WebView.h"
#import "WebViewInternal.h"
-#import <WebCore/WebCoreObjCExtras.h>
#import <WebCore/AuthenticationMac.h>
#import <WebCore/BitmapImage.h>
#import <WebCore/Credential.h>
#import <WebCore/CredentialStorage.h>
-#import <WebCore/CString.h>
#import <WebCore/Document.h>
#import <WebCore/Element.h>
#import <WebCore/Frame.h>
@@ -57,9 +55,12 @@
#import <WebCore/ProtectionSpace.h>
#import <WebCore/RenderView.h>
#import <WebCore/RenderWidget.h>
+#import <WebCore/WebCoreObjCExtras.h>
#import <WebKit/DOMPrivate.h>
#import <runtime/InitializeThreading.h>
#import <wtf/Assertions.h>
+#import <wtf/Threading.h>
+#import <wtf/text/CString.h>
#define LoginWindowDidSwitchFromUserNotification @"WebLoginWindowDidSwitchFromUserNotification"
#define LoginWindowDidSwitchToUserNotification @"WebLoginWindowDidSwitchToUserNotification"
@@ -107,7 +108,7 @@ bool WebHaltablePlugin::isWindowed() const
String WebHaltablePlugin::pluginName() const
{
- return [[m_view pluginPackage] name];
+ return [[m_view pluginPackage] pluginInfo].name;
}
@implementation WebBaseNetscapePluginView
@@ -115,6 +116,7 @@ String WebHaltablePlugin::pluginName() const
+ (void)initialize
{
JSC::initializeThreading();
+ WTF::initializeMainThreadToProcessMainThread();
#ifndef BUILDING_ON_TIGER
WebCoreObjCFinalizeOnMainThread(self);
#endif
@@ -144,7 +146,7 @@ String WebHaltablePlugin::pluginName() const
#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD)
// Enable "kiosk mode" when instantiating the QT plug-in inside of Dashboard. See <rdar://problem/6878105>
if ([[[NSBundle mainBundle] bundleIdentifier] isEqualToString:@"com.apple.dashboard.client"] &&
- [[[_pluginPackage.get() bundle] bundleIdentifier] isEqualToString:@"com.apple.QuickTime Plugin.plugin"]) {
+ [_pluginPackage.get() bundleIdentifier] == "com.apple.QuickTime Plugin.plugin") {
RetainPtr<NSMutableArray> mutableKeys(AdoptNS, [keys mutableCopy]);
RetainPtr<NSMutableArray> mutableValues(AdoptNS, [values mutableCopy]);
@@ -232,6 +234,16 @@ String WebHaltablePlugin::pluginName() const
ASSERT_NOT_REACHED();
}
+- (void)handleMouseEntered:(NSEvent *)event
+{
+ ASSERT_NOT_REACHED();
+}
+
+- (void)handleMouseExited:(NSEvent *)event
+{
+ ASSERT_NOT_REACHED();
+}
+
- (void)focusChanged
{
ASSERT_NOT_REACHED();
@@ -314,8 +326,6 @@ String WebHaltablePlugin::pluginName() const
- (void)restartTimers
{
- ASSERT([self window]);
-
[self stopTimers];
if (!_isStarted || [[self window] isMiniaturized])
@@ -327,13 +337,10 @@ String WebHaltablePlugin::pluginName() const
- (NSRect)_windowClipRect
{
RenderObject* renderer = _element->renderer();
-
- if (renderer && renderer->view()) {
- if (FrameView* frameView = renderer->view()->frameView())
- return frameView->windowClipRectForLayer(renderer->enclosingLayer(), true);
- }
-
- return NSZeroRect;
+ if (!renderer || !renderer->view())
+ return NSZeroRect;
+
+ return toRenderWidget(renderer)->windowClipRect();
}
- (NSRect)visibleRect
@@ -343,6 +350,11 @@ String WebHaltablePlugin::pluginName() const
return NSIntersectionRect([self convertRect:[self _windowClipRect] fromView:nil], [super visibleRect]);
}
+- (void)visibleRectDidChange
+{
+ [self renewGState];
+}
+
- (BOOL)acceptsFirstResponder
{
return YES;
@@ -496,9 +508,9 @@ String WebHaltablePlugin::pluginName() const
ASSERT(_isStarted);
Element *element = [self element];
#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD)
- CGImageRef cgImage = CGImageRetain([core([self webFrame])->nodeImage(element) CGImageForProposedRect:nil context:nil hints:nil]);
+ CGImageRef cgImage = CGImageRetain([core([self webFrame])->nodeImage(element).get() CGImageForProposedRect:nil context:nil hints:nil]);
#else
- RetainPtr<CGImageSourceRef> imageRef(AdoptCF, CGImageSourceCreateWithData((CFDataRef)[core([self webFrame])->nodeImage(element) TIFFRepresentation], 0));
+ RetainPtr<CGImageSourceRef> imageRef(AdoptCF, CGImageSourceCreateWithData((CFDataRef)[core([self webFrame])->nodeImage(element).get() TIFFRepresentation], 0));
CGImageRef cgImage = CGImageSourceCreateImageAtIndex(imageRef.get(), 0, 0);
#endif
ASSERT(cgImage);
@@ -545,22 +557,28 @@ String WebHaltablePlugin::pluginName() const
return _isHalted;
}
-- (BOOL)superviewsHaveSuperviews
+- (BOOL)shouldClipOutPlugin
{
- NSView *contentView = [[self window] contentView];
- for (NSView *view = self; view; view = [view superview]) {
- if (view == contentView)
- return YES;
+ NSWindow *window = [self window];
+ return !window || [window isMiniaturized] || [NSApp isHidden] || ![self isDescendantOf:[[self window] contentView]] || [self isHiddenOrHasHiddenAncestor];
+}
+
+- (BOOL)inFlatteningPaint
+{
+ RenderObject* renderer = _element->renderer();
+ if (renderer && renderer->view()) {
+ if (FrameView* frameView = renderer->view()->frameView())
+ return frameView->paintBehavior() & PaintBehaviorFlattenCompositingLayers;
}
+
return NO;
}
-- (BOOL)shouldClipOutPlugin
+- (BOOL)supportsSnapshotting
{
- NSWindow *window = [self window];
- return !window || [window isMiniaturized] || [NSApp isHidden] || ![self superviewsHaveSuperviews] || [self isHiddenOrHasHiddenAncestor];
+ return [_pluginPackage.get() supportsSnapshotting];
}
-
+
- (BOOL)hasBeenHalted
{
return _hasBeenHalted;
@@ -897,7 +915,7 @@ String WebHaltablePlugin::pluginName() const
}
-- (CString)resolvedURLStringForURL:(const char*)url target:(const char*)target;
+- (CString)resolvedURLStringForURL:(const char*)url target:(const char*)target
{
String relativeURLString = String::fromUTF8(url);
if (relativeURLString.isNull())
@@ -928,70 +946,18 @@ String WebHaltablePlugin::pluginName() const
}
}
+#ifndef BUILDING_ON_TIGER
+- (CALayer *)pluginLayer
+{
+ ASSERT_NOT_REACHED();
+ return nil;
+}
+#endif
+
@end
namespace WebKit {
-#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD)
-CString proxiesForURL(NSURL *url)
-{
- RetainPtr<CFDictionaryRef> systemProxies(AdoptCF, CFNetworkCopySystemProxySettings());
- if (!systemProxies)
- return "DIRECT";
-
- RetainPtr<CFArrayRef> proxiesForURL(AdoptCF, CFNetworkCopyProxiesForURL((CFURLRef)url, systemProxies.get()));
- CFIndex proxyCount = proxiesForURL ? CFArrayGetCount(proxiesForURL.get()) : 0;
- if (!proxyCount)
- return "DIRECT";
-
- // proxiesForURL is a CFArray of CFDictionaries. Each dictionary represents a proxy.
- // The format of the result should be:
- // "PROXY host[:port]" (for HTTP proxy) or
- // "SOCKS host[:port]" (for SOCKS proxy) or
- // A combination of the above, separated by semicolon, in the order that they should be tried.
- String proxies;
- for (CFIndex i = 0; i < proxyCount; ++i) {
- CFDictionaryRef proxy = static_cast<CFDictionaryRef>(CFArrayGetValueAtIndex(proxiesForURL.get(), i));
- if (!proxy)
- continue;
-
- CFStringRef type = static_cast<CFStringRef>(CFDictionaryGetValue(proxy, kCFProxyTypeKey));
- bool isHTTP = type == kCFProxyTypeHTTP || type == kCFProxyTypeHTTPS;
- bool isSOCKS = type == kCFProxyTypeSOCKS;
-
- // We can only report HTTP and SOCKS proxies.
- if (!isHTTP && !isSOCKS)
- continue;
-
- CFStringRef host = static_cast<CFStringRef>(CFDictionaryGetValue(proxy, kCFProxyHostNameKey));
- CFNumberRef port = static_cast<CFNumberRef>(CFDictionaryGetValue(proxy, kCFProxyPortNumberKey));
-
- // If we are inserting multiple entries, add a separator
- if (!proxies.isEmpty())
- proxies += ";";
-
- if (isHTTP)
- proxies += "PROXY ";
- else if (isSOCKS)
- proxies += "SOCKS ";
-
- proxies += host;
-
- if (port) {
- SInt32 intPort;
- CFNumberGetValue(port, kCFNumberSInt32Type, &intPort);
-
- proxies += ":" + String::number(intPort);
- }
- }
-
- if (proxies.isEmpty())
- return "DIRECT";
-
- return proxies.utf8();
-}
-#endif
-
bool getAuthenticationInfo(const char* protocolStr, const char* hostStr, int32_t port, const char* schemeStr, const char* realmStr,
CString& username, CString& password)
{