[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677

cblu cblu at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 05:55:03 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 133d52248dc00c723205c68ceb796c61fa3213d7
Author: cblu <cblu at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Sat Feb 2 01:58:46 2002 +0000

    Enabled plug-in detection for Javascript. Apple.com now works as it should. Also fixed plug-in deallocation
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@585 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/kwq/KWQKConfigBase.mm b/WebCore/kwq/KWQKConfigBase.mm
index 50f4b2d..96f8f3e 100644
--- a/WebCore/kwq/KWQKConfigBase.mm
+++ b/WebCore/kwq/KWQKConfigBase.mm
@@ -25,6 +25,15 @@
 
 #include <kwqdebug.h>
 #include <kconfig.h>
+#include <WKPlugin.h>
+#include <WKPluginDatabase.h>
+
+enum files{
+    pluginsinfo
+};
+
+int file;
+unsigned group;
 
 //FIX ME:
 static QString *tempQString = NULL;
@@ -46,7 +55,11 @@ KConfigBase::~KConfigBase()
 
 void KConfigBase::setGroup(const QString &pGroup)
 {
-    _logNotYetImplemented();
+    _logPartiallyImplemented();
+    
+    if(file == pluginsinfo){
+        group = pGroup.toUInt();
+    }
 }
 
 
@@ -62,8 +75,20 @@ void KConfigBase::writeEntry(const QString &pKey, const QStringList &rValue,
 QString KConfigBase::readEntry(const char *pKey, 
     const QString& aDefault=QString::null) const
 {
-    _logNotYetImplemented();
-    if (tempQString == NULL) {
+    _logPartiallyImplemented();
+    
+    if(file == pluginsinfo){
+        WKPlugin *plugin;
+        plugin = [[[WKPluginDatabase installedPlugins] plugins] objectAtIndex:group];
+        if(strcmp(pKey, "name") == 0){
+            return NSSTRING_TO_QSTRING([plugin name]);
+        }else if(strcmp(pKey, "file") == 0){
+            return NSSTRING_TO_QSTRING([plugin filename]);
+        }else if(strcmp(pKey, "description") == 0){
+            return NSSTRING_TO_QSTRING([plugin pluginDescription]);
+        }
+    }
+    if(tempQString == NULL) {
         tempQString = new QString();
     }
     return *tempQString;
@@ -73,7 +98,11 @@ QString KConfigBase::readEntry(const char *pKey,
 
 int KConfigBase::readNumEntry(const char *pKey, int nDefault=0) const
 {
-    _logNotYetImplemented();
+    _logPartiallyImplemented();
+    
+    if(file == pluginsinfo){
+        return [[[WKPluginDatabase installedPlugins] plugins] count];
+    }
     return 0;
 }
 
@@ -118,7 +147,10 @@ QStringList KConfigBase::readListEntry(const QString &pKey, char sep=',') const
 
 KConfig::KConfig(const QString &n, bool bReadOnly=false)
 {
-    _logNotYetImplemented();
+    _logPartiallyImplemented();
+    if(n.contains(pluginsinfo)){
+        file = pluginsinfo;
+    }
 }
 
 
diff --git a/WebCore/kwq/WKPlugin.h b/WebCore/kwq/WKPlugin.h
index d45a75c..397984f 100644
--- a/WebCore/kwq/WKPlugin.h
+++ b/WebCore/kwq/WKPlugin.h
@@ -12,8 +12,7 @@
 @interface WKPlugin : NSObject {
 
     NSDictionary *mimeTypes;
-    NSString *name;
-    NSString *executablePath;
+    NSString *name, *executablePath, *filename, *pluginDescription;
     BOOL isLoaded;
     NPPluginFuncs pluginFuncs;
     NPNetscapeFuncs browserFuncs;
@@ -39,6 +38,14 @@
 - (BOOL)initializeWithPath:(NSString *)plugin;
 - (void)load;
 - (void)unload;
+- (NSDictionary *)mimeTypes;
+- (NSString *)name;
+- (NSString *)filename;
+- (NSString *)executablePath;
+- (BOOL)isLoaded;
+- (NSString *)description;
+- (NSString *)pluginDescription;
+
 
 - (NPP_NewProcPtr)NPP_New;
 - (NPP_DestroyProcPtr)NPP_Destroy;
@@ -49,12 +56,6 @@
 - (NPP_StreamAsFileProcPtr)NPP_StreamAsFile;
 - (NPP_DestroyStreamProcPtr)NPP_DestroyStream;
 - (NPP_HandleEventProcPtr)NPP_HandleEvent;
-- (NSDictionary *)mimeTypes;
-- (NSString *)name;
-- (NSString *)executablePath;
-- (BOOL)isLoaded;
-- (NSString *)description;
-
 
 @end
     
diff --git a/WebCore/kwq/WKPlugin.mm b/WebCore/kwq/WKPlugin.mm
index 302550b..6c7adda 100644
--- a/WebCore/kwq/WKPlugin.mm
+++ b/WebCore/kwq/WKPlugin.mm
@@ -27,7 +27,8 @@
     fileInfo = [fileManager fileAttributesAtPath:plugin traverseLink:YES];
     if([[fileInfo objectForKey:@"NSFileType"] isEqualToString:@"NSFileTypeRegular"]){ 
         if([[fileInfo objectForKey:@"NSFileHFSTypeCode"] unsignedLongValue] == 1112690764){ // 1112690764 = 'BRPL'
-            name = [plugin lastPathComponent];
+            name = [plugin lastPathComponent]; // FIXME: Should the name of the plugin be the filename?
+            filename = [plugin lastPathComponent];
             executablePath = plugin;
             err = FSPathMakeRef((UInt8 *)[plugin cString], &fref, NULL);
             if(err != noErr){
@@ -41,6 +42,7 @@
             }
             mimeTypes = getMimeTypesForResourceFile(resRef);
             if(mimeTypes == nil) return FALSE;
+            //FIXME: Need to get plug-in's description
         }else return FALSE;
     }else if([[fileInfo objectForKey:@"NSFileType"] isEqualToString:@"NSFileTypeDirectory"]){
         pluginURL = CFURLCreateWithFileSystemPath(NULL, (CFStringRef)plugin, kCFURLPOSIXPathStyle, TRUE);
@@ -48,11 +50,13 @@
         bundle2 = [NSBundle bundleWithPath:plugin]; // CFBundleCopyExecutableURL doesn't return full path! Have to use NSBundle
         CFBundleGetPackageInfo(bundle, &type, NULL);
         if(type == 1112690764){  // 1112690764 = 'BRPL'
-            name = [plugin lastPathComponent];
+            name = [plugin lastPathComponent]; // FIXME: Should the name of the plugin be the filename?
+            filename = [plugin lastPathComponent];
             executablePath = [bundle2 executablePath];
             resRef = CFBundleOpenBundleResourceMap(bundle);
             mimeTypes = getMimeTypesForResourceFile(resRef);
             if(mimeTypes == nil) return FALSE;
+            //FIXME: Need to get plug-in's description
         }else return FALSE;
         CFRelease(bundle);
         CFRelease(pluginURL);
@@ -190,6 +194,10 @@
     return name;
 }
 
+- (NSString *)filename{
+    return filename;
+}
+
 - (NSString *)executablePath{
     return executablePath;
 }
@@ -198,6 +206,9 @@
     return isLoaded;
 }
 
+- (NSString *)pluginDescription{
+    return pluginDescription;
+}
 - (NSString *)description{
     NSMutableString *desc;
     
diff --git a/WebCore/kwq/WKPluginDatabase.h b/WebCore/kwq/WKPluginDatabase.h
index e0e163a..8062bef 100644
--- a/WebCore/kwq/WKPluginDatabase.h
+++ b/WebCore/kwq/WKPluginDatabase.h
@@ -16,8 +16,8 @@
 
 + (WKPluginDatabase *)installedPlugins;
 - (WKPlugin *)getPluginForMimeType:(NSString *)mimeType;
+- (NSArray *) plugins;
 
 @end
 
-NSMutableDictionary *getMimeTypesForResourceFile(SInt16 resRef);
 NSArray *findPlugins(void);
\ No newline at end of file
diff --git a/WebCore/kwq/WKPluginDatabase.mm b/WebCore/kwq/WKPluginDatabase.mm
index 371fc02..3adc39d 100644
--- a/WebCore/kwq/WKPluginDatabase.mm
+++ b/WebCore/kwq/WKPluginDatabase.mm
@@ -39,6 +39,10 @@ static WKPluginDatabase *__WKPluginDatabase = nil;
     return nil;
 }
 
+- (NSArray *) plugins{
+    return plugins;
+}
+
 @end
 
 NSArray *findPlugins(void){
diff --git a/WebCore/kwq/WKPluginView.h b/WebCore/kwq/WKPluginView.h
index ffad78d..c2e589d 100644
--- a/WebCore/kwq/WKPluginView.h
+++ b/WebCore/kwq/WKPluginView.h
@@ -14,9 +14,20 @@
 
 typedef NPStream* NPS;
 
+ at interface WKPluginViewNullEventSender : NSObject{
+    NPP instance;
+    NPP_HandleEventProcPtr NPP_HandleEvent;
+}
+
+-(id)initializeWithNPP:(NPP)pluginInstance functionPointer:(NPP_HandleEventProcPtr)HandleEventFunction;
+-(void)sendNullEvents;
+-(void)stop;
+ at end
+
 @interface WKPluginView : NSQuickDrawView {
     QWidget *widget;
     WKPlugin *plugin;
+    WKPluginViewNullEventSender *eventSender;
     
     NPP instance;
     NPP_t instanceStruct;
@@ -32,7 +43,7 @@ typedef NPStream* NPS;
             
     NSString *url, *mime;
     NSTrackingRectTag trackingTag;
-
+    
     NPP_NewProcPtr NPP_New;
     NPP_DestroyProcPtr NPP_Destroy;
     NPP_SetWindowProcPtr NPP_SetWindow;
@@ -57,7 +68,6 @@ typedef NPStream* NPS;
 -(BOOL)resignFirstResponder;
 -(void)sendActivateEvent;
 -(void)sendUpdateEvent;
--(void)sendNullEvents;
 -(void)mouseDown:(NSEvent *)theEvent;
 -(void)mouseUp:(NSEvent *)theEvent;
 -(void)mouseDragged:(NSEvent *)theEvent;
@@ -83,3 +93,4 @@ typedef NPStream* NPS;
 -(void)forceRedraw;
 
 @end
+
diff --git a/WebCore/kwq/WKPluginView.mm b/WebCore/kwq/WKPluginView.mm
index f993925..a0fccc3 100644
--- a/WebCore/kwq/WKPluginView.mm
+++ b/WebCore/kwq/WKPluginView.mm
@@ -15,7 +15,35 @@
 //#define USE_CARBON 1
 //#import <AppKit/NSWindow_Private.h>
 
+ at implementation WKPluginViewNullEventSender
 
+-(id)initializeWithNPP:(NPP)pluginInstance functionPointer:(NPP_HandleEventProcPtr)HandleEventFunction;
+{
+    instance = pluginInstance;
+    NPP_HandleEvent = HandleEventFunction;
+    return self;
+}
+
+-(void)sendNullEvents
+{
+    EventRecord event;
+    bool acceptedEvent;
+    UnsignedWide msecs;
+    
+    event.what = nullEvent;
+    Microseconds(&msecs);
+    event.when = (uint32)((double)UnsignedWideToUInt64(msecs) / 1000000 * 60); // microseconds to ticks
+    acceptedEvent = NPP_HandleEvent(instance, &event);
+    //KWQDebug("NPP_HandleEvent(nullEvent): %d  when: %u\n", acceptedEvent, event.when);
+    [self performSelector:@selector(sendNullEvents) withObject:nil afterDelay:.1];
+}
+
+-(void) stop
+{
+    [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(sendNullEvents) object:nil];
+}
+
+ at end
 
 @implementation WKPluginView
 
@@ -26,6 +54,7 @@
     NPSavedData saved;
     NSArray *attributes, *values;
     NSString *attributeString;
+    
     uint i;
         
     [super initWithFrame: r];
@@ -75,7 +104,8 @@
     }
     transferred = FALSE;
     trackingTag = [self addTrackingRect:r owner:self userData:nil assumeInside:NO];
-    [self performSelector:@selector(sendNullEvents) withObject:nil afterDelay:2];
+    eventSender = [[[WKPluginViewNullEventSender alloc] initializeWithNPP:instance functionPointer:NPP_HandleEvent] autorelease];
+    [eventSender sendNullEvents];
     return self;
 }
 
@@ -218,20 +248,6 @@
     return YES;
 }
 
--(void)sendNullEvents
-{
-    EventRecord event;
-    bool acceptedEvent;
-    UnsignedWide msecs;
-    
-    event.what = nullEvent;
-    Microseconds(&msecs);
-    event.when = (uint32)((double)UnsignedWideToUInt64(msecs) / 1000000 * 60); // microseconds to ticks
-    acceptedEvent = NPP_HandleEvent(instance, &event);
-    //KWQDebug("NPP_HandleEvent(nullEvent): %d  when: %u\n", acceptedEvent, event.when);
-    [self performSelector:@selector(sendNullEvents) withObject:nil afterDelay:0];
-}
-
 -(void)sendActivateEvent
 {
     EventRecord event;
@@ -454,13 +470,11 @@
 -(void)dealloc
 {
     NPError npErr;
-    //FIX ME: compiler can't find this method!
-    //[self cancelPreviousPerformRequestsWithTarget:self selector:@selector(sendNullEvents) object:nil];
+    
+    [eventSender stop];
     npErr = NPP_Destroy(instance, NULL);
     KWQDebug("NPP_Destroy: %d\n", npErr);
     [super dealloc];
 }
 
-
-
 @end
diff --git a/WebCore/src/kwq/KWQKConfigBase.mm b/WebCore/src/kwq/KWQKConfigBase.mm
index 50f4b2d..96f8f3e 100644
--- a/WebCore/src/kwq/KWQKConfigBase.mm
+++ b/WebCore/src/kwq/KWQKConfigBase.mm
@@ -25,6 +25,15 @@
 
 #include <kwqdebug.h>
 #include <kconfig.h>
+#include <WKPlugin.h>
+#include <WKPluginDatabase.h>
+
+enum files{
+    pluginsinfo
+};
+
+int file;
+unsigned group;
 
 //FIX ME:
 static QString *tempQString = NULL;
@@ -46,7 +55,11 @@ KConfigBase::~KConfigBase()
 
 void KConfigBase::setGroup(const QString &pGroup)
 {
-    _logNotYetImplemented();
+    _logPartiallyImplemented();
+    
+    if(file == pluginsinfo){
+        group = pGroup.toUInt();
+    }
 }
 
 
@@ -62,8 +75,20 @@ void KConfigBase::writeEntry(const QString &pKey, const QStringList &rValue,
 QString KConfigBase::readEntry(const char *pKey, 
     const QString& aDefault=QString::null) const
 {
-    _logNotYetImplemented();
-    if (tempQString == NULL) {
+    _logPartiallyImplemented();
+    
+    if(file == pluginsinfo){
+        WKPlugin *plugin;
+        plugin = [[[WKPluginDatabase installedPlugins] plugins] objectAtIndex:group];
+        if(strcmp(pKey, "name") == 0){
+            return NSSTRING_TO_QSTRING([plugin name]);
+        }else if(strcmp(pKey, "file") == 0){
+            return NSSTRING_TO_QSTRING([plugin filename]);
+        }else if(strcmp(pKey, "description") == 0){
+            return NSSTRING_TO_QSTRING([plugin pluginDescription]);
+        }
+    }
+    if(tempQString == NULL) {
         tempQString = new QString();
     }
     return *tempQString;
@@ -73,7 +98,11 @@ QString KConfigBase::readEntry(const char *pKey,
 
 int KConfigBase::readNumEntry(const char *pKey, int nDefault=0) const
 {
-    _logNotYetImplemented();
+    _logPartiallyImplemented();
+    
+    if(file == pluginsinfo){
+        return [[[WKPluginDatabase installedPlugins] plugins] count];
+    }
     return 0;
 }
 
@@ -118,7 +147,10 @@ QStringList KConfigBase::readListEntry(const QString &pKey, char sep=',') const
 
 KConfig::KConfig(const QString &n, bool bReadOnly=false)
 {
-    _logNotYetImplemented();
+    _logPartiallyImplemented();
+    if(n.contains(pluginsinfo)){
+        file = pluginsinfo;
+    }
 }
 
 
diff --git a/WebCore/src/kwq/WKPlugin.h b/WebCore/src/kwq/WKPlugin.h
index d45a75c..397984f 100644
--- a/WebCore/src/kwq/WKPlugin.h
+++ b/WebCore/src/kwq/WKPlugin.h
@@ -12,8 +12,7 @@
 @interface WKPlugin : NSObject {
 
     NSDictionary *mimeTypes;
-    NSString *name;
-    NSString *executablePath;
+    NSString *name, *executablePath, *filename, *pluginDescription;
     BOOL isLoaded;
     NPPluginFuncs pluginFuncs;
     NPNetscapeFuncs browserFuncs;
@@ -39,6 +38,14 @@
 - (BOOL)initializeWithPath:(NSString *)plugin;
 - (void)load;
 - (void)unload;
+- (NSDictionary *)mimeTypes;
+- (NSString *)name;
+- (NSString *)filename;
+- (NSString *)executablePath;
+- (BOOL)isLoaded;
+- (NSString *)description;
+- (NSString *)pluginDescription;
+
 
 - (NPP_NewProcPtr)NPP_New;
 - (NPP_DestroyProcPtr)NPP_Destroy;
@@ -49,12 +56,6 @@
 - (NPP_StreamAsFileProcPtr)NPP_StreamAsFile;
 - (NPP_DestroyStreamProcPtr)NPP_DestroyStream;
 - (NPP_HandleEventProcPtr)NPP_HandleEvent;
-- (NSDictionary *)mimeTypes;
-- (NSString *)name;
-- (NSString *)executablePath;
-- (BOOL)isLoaded;
-- (NSString *)description;
-
 
 @end
     
diff --git a/WebCore/src/kwq/WKPlugin.mm b/WebCore/src/kwq/WKPlugin.mm
index 302550b..6c7adda 100644
--- a/WebCore/src/kwq/WKPlugin.mm
+++ b/WebCore/src/kwq/WKPlugin.mm
@@ -27,7 +27,8 @@
     fileInfo = [fileManager fileAttributesAtPath:plugin traverseLink:YES];
     if([[fileInfo objectForKey:@"NSFileType"] isEqualToString:@"NSFileTypeRegular"]){ 
         if([[fileInfo objectForKey:@"NSFileHFSTypeCode"] unsignedLongValue] == 1112690764){ // 1112690764 = 'BRPL'
-            name = [plugin lastPathComponent];
+            name = [plugin lastPathComponent]; // FIXME: Should the name of the plugin be the filename?
+            filename = [plugin lastPathComponent];
             executablePath = plugin;
             err = FSPathMakeRef((UInt8 *)[plugin cString], &fref, NULL);
             if(err != noErr){
@@ -41,6 +42,7 @@
             }
             mimeTypes = getMimeTypesForResourceFile(resRef);
             if(mimeTypes == nil) return FALSE;
+            //FIXME: Need to get plug-in's description
         }else return FALSE;
     }else if([[fileInfo objectForKey:@"NSFileType"] isEqualToString:@"NSFileTypeDirectory"]){
         pluginURL = CFURLCreateWithFileSystemPath(NULL, (CFStringRef)plugin, kCFURLPOSIXPathStyle, TRUE);
@@ -48,11 +50,13 @@
         bundle2 = [NSBundle bundleWithPath:plugin]; // CFBundleCopyExecutableURL doesn't return full path! Have to use NSBundle
         CFBundleGetPackageInfo(bundle, &type, NULL);
         if(type == 1112690764){  // 1112690764 = 'BRPL'
-            name = [plugin lastPathComponent];
+            name = [plugin lastPathComponent]; // FIXME: Should the name of the plugin be the filename?
+            filename = [plugin lastPathComponent];
             executablePath = [bundle2 executablePath];
             resRef = CFBundleOpenBundleResourceMap(bundle);
             mimeTypes = getMimeTypesForResourceFile(resRef);
             if(mimeTypes == nil) return FALSE;
+            //FIXME: Need to get plug-in's description
         }else return FALSE;
         CFRelease(bundle);
         CFRelease(pluginURL);
@@ -190,6 +194,10 @@
     return name;
 }
 
+- (NSString *)filename{
+    return filename;
+}
+
 - (NSString *)executablePath{
     return executablePath;
 }
@@ -198,6 +206,9 @@
     return isLoaded;
 }
 
+- (NSString *)pluginDescription{
+    return pluginDescription;
+}
 - (NSString *)description{
     NSMutableString *desc;
     
diff --git a/WebCore/src/kwq/WKPluginDatabase.h b/WebCore/src/kwq/WKPluginDatabase.h
index e0e163a..8062bef 100644
--- a/WebCore/src/kwq/WKPluginDatabase.h
+++ b/WebCore/src/kwq/WKPluginDatabase.h
@@ -16,8 +16,8 @@
 
 + (WKPluginDatabase *)installedPlugins;
 - (WKPlugin *)getPluginForMimeType:(NSString *)mimeType;
+- (NSArray *) plugins;
 
 @end
 
-NSMutableDictionary *getMimeTypesForResourceFile(SInt16 resRef);
 NSArray *findPlugins(void);
\ No newline at end of file
diff --git a/WebCore/src/kwq/WKPluginDatabase.mm b/WebCore/src/kwq/WKPluginDatabase.mm
index 371fc02..3adc39d 100644
--- a/WebCore/src/kwq/WKPluginDatabase.mm
+++ b/WebCore/src/kwq/WKPluginDatabase.mm
@@ -39,6 +39,10 @@ static WKPluginDatabase *__WKPluginDatabase = nil;
     return nil;
 }
 
+- (NSArray *) plugins{
+    return plugins;
+}
+
 @end
 
 NSArray *findPlugins(void){
diff --git a/WebCore/src/kwq/WKPluginView.h b/WebCore/src/kwq/WKPluginView.h
index ffad78d..c2e589d 100644
--- a/WebCore/src/kwq/WKPluginView.h
+++ b/WebCore/src/kwq/WKPluginView.h
@@ -14,9 +14,20 @@
 
 typedef NPStream* NPS;
 
+ at interface WKPluginViewNullEventSender : NSObject{
+    NPP instance;
+    NPP_HandleEventProcPtr NPP_HandleEvent;
+}
+
+-(id)initializeWithNPP:(NPP)pluginInstance functionPointer:(NPP_HandleEventProcPtr)HandleEventFunction;
+-(void)sendNullEvents;
+-(void)stop;
+ at end
+
 @interface WKPluginView : NSQuickDrawView {
     QWidget *widget;
     WKPlugin *plugin;
+    WKPluginViewNullEventSender *eventSender;
     
     NPP instance;
     NPP_t instanceStruct;
@@ -32,7 +43,7 @@ typedef NPStream* NPS;
             
     NSString *url, *mime;
     NSTrackingRectTag trackingTag;
-
+    
     NPP_NewProcPtr NPP_New;
     NPP_DestroyProcPtr NPP_Destroy;
     NPP_SetWindowProcPtr NPP_SetWindow;
@@ -57,7 +68,6 @@ typedef NPStream* NPS;
 -(BOOL)resignFirstResponder;
 -(void)sendActivateEvent;
 -(void)sendUpdateEvent;
--(void)sendNullEvents;
 -(void)mouseDown:(NSEvent *)theEvent;
 -(void)mouseUp:(NSEvent *)theEvent;
 -(void)mouseDragged:(NSEvent *)theEvent;
@@ -83,3 +93,4 @@ typedef NPStream* NPS;
 -(void)forceRedraw;
 
 @end
+
diff --git a/WebCore/src/kwq/WKPluginView.mm b/WebCore/src/kwq/WKPluginView.mm
index f993925..a0fccc3 100644
--- a/WebCore/src/kwq/WKPluginView.mm
+++ b/WebCore/src/kwq/WKPluginView.mm
@@ -15,7 +15,35 @@
 //#define USE_CARBON 1
 //#import <AppKit/NSWindow_Private.h>
 
+ at implementation WKPluginViewNullEventSender
 
+-(id)initializeWithNPP:(NPP)pluginInstance functionPointer:(NPP_HandleEventProcPtr)HandleEventFunction;
+{
+    instance = pluginInstance;
+    NPP_HandleEvent = HandleEventFunction;
+    return self;
+}
+
+-(void)sendNullEvents
+{
+    EventRecord event;
+    bool acceptedEvent;
+    UnsignedWide msecs;
+    
+    event.what = nullEvent;
+    Microseconds(&msecs);
+    event.when = (uint32)((double)UnsignedWideToUInt64(msecs) / 1000000 * 60); // microseconds to ticks
+    acceptedEvent = NPP_HandleEvent(instance, &event);
+    //KWQDebug("NPP_HandleEvent(nullEvent): %d  when: %u\n", acceptedEvent, event.when);
+    [self performSelector:@selector(sendNullEvents) withObject:nil afterDelay:.1];
+}
+
+-(void) stop
+{
+    [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(sendNullEvents) object:nil];
+}
+
+ at end
 
 @implementation WKPluginView
 
@@ -26,6 +54,7 @@
     NPSavedData saved;
     NSArray *attributes, *values;
     NSString *attributeString;
+    
     uint i;
         
     [super initWithFrame: r];
@@ -75,7 +104,8 @@
     }
     transferred = FALSE;
     trackingTag = [self addTrackingRect:r owner:self userData:nil assumeInside:NO];
-    [self performSelector:@selector(sendNullEvents) withObject:nil afterDelay:2];
+    eventSender = [[[WKPluginViewNullEventSender alloc] initializeWithNPP:instance functionPointer:NPP_HandleEvent] autorelease];
+    [eventSender sendNullEvents];
     return self;
 }
 
@@ -218,20 +248,6 @@
     return YES;
 }
 
--(void)sendNullEvents
-{
-    EventRecord event;
-    bool acceptedEvent;
-    UnsignedWide msecs;
-    
-    event.what = nullEvent;
-    Microseconds(&msecs);
-    event.when = (uint32)((double)UnsignedWideToUInt64(msecs) / 1000000 * 60); // microseconds to ticks
-    acceptedEvent = NPP_HandleEvent(instance, &event);
-    //KWQDebug("NPP_HandleEvent(nullEvent): %d  when: %u\n", acceptedEvent, event.when);
-    [self performSelector:@selector(sendNullEvents) withObject:nil afterDelay:0];
-}
-
 -(void)sendActivateEvent
 {
     EventRecord event;
@@ -454,13 +470,11 @@
 -(void)dealloc
 {
     NPError npErr;
-    //FIX ME: compiler can't find this method!
-    //[self cancelPreviousPerformRequestsWithTarget:self selector:@selector(sendNullEvents) object:nil];
+    
+    [eventSender stop];
     npErr = NPP_Destroy(instance, NULL);
     KWQDebug("NPP_Destroy: %d\n", npErr);
     [super dealloc];
 }
 
-
-
 @end
diff --git a/WebKit/WebView.subproj/IFWebViewPrivate.mm b/WebKit/WebView.subproj/IFWebViewPrivate.mm
index 40f6b56..147c3c4 100644
--- a/WebKit/WebView.subproj/IFWebViewPrivate.mm
+++ b/WebKit/WebView.subproj/IFWebViewPrivate.mm
@@ -49,7 +49,7 @@
     count = [views count];
     while (count--){
         //WebKitDebugAtLevel(0x200, "Removing %p %s\n", [views objectAtIndex: 0], DEBUG_OBJECT([[[views objectAtIndex: 0] class] className]));
-        [[views objectAtIndex: 0] removeFromSuperviewWithoutNeedingDisplay]; 
+        [[views objectAtIndex: count] removeFromSuperviewWithoutNeedingDisplay]; 
     }
     [self setFrameSize: NSMakeSize (0,0)];
 }
diff --git a/WebKit/WebView.subproj/WKWebViewPrivate.mm b/WebKit/WebView.subproj/WKWebViewPrivate.mm
index 40f6b56..147c3c4 100644
--- a/WebKit/WebView.subproj/WKWebViewPrivate.mm
+++ b/WebKit/WebView.subproj/WKWebViewPrivate.mm
@@ -49,7 +49,7 @@
     count = [views count];
     while (count--){
         //WebKitDebugAtLevel(0x200, "Removing %p %s\n", [views objectAtIndex: 0], DEBUG_OBJECT([[[views objectAtIndex: 0] class] className]));
-        [[views objectAtIndex: 0] removeFromSuperviewWithoutNeedingDisplay]; 
+        [[views objectAtIndex: count] removeFromSuperviewWithoutNeedingDisplay]; 
     }
     [self setFrameSize: NSMakeSize (0,0)];
 }
diff --git a/WebKit/WebView.subproj/WebFrameViewPrivate.m b/WebKit/WebView.subproj/WebFrameViewPrivate.m
index 40f6b56..147c3c4 100644
--- a/WebKit/WebView.subproj/WebFrameViewPrivate.m
+++ b/WebKit/WebView.subproj/WebFrameViewPrivate.m
@@ -49,7 +49,7 @@
     count = [views count];
     while (count--){
         //WebKitDebugAtLevel(0x200, "Removing %p %s\n", [views objectAtIndex: 0], DEBUG_OBJECT([[[views objectAtIndex: 0] class] className]));
-        [[views objectAtIndex: 0] removeFromSuperviewWithoutNeedingDisplay]; 
+        [[views objectAtIndex: count] removeFromSuperviewWithoutNeedingDisplay]; 
     }
     [self setFrameSize: NSMakeSize (0,0)];
 }

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list