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

darin darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 06:36:12 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 4f74e34edea29143c32f7746336f26ca6e8dd43d
Author: darin <darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Sep 4 20:42:17 2002 +0000

    	Did some minor plugin cleanup, mostly to make sure we don't
    	change pages while a plugin is tracking.
    
            * Plugins.subproj/WebPluginView.h: Add sendEvent and sendUpdateEvent.
    	Remove the NPP_HandleEvent method.
            * Plugins.subproj/WebPluginView.m:
            (-[WebNetscapePluginView sendEvent:]): Sets up the "defersCallbacks"
    	state, then sends the event.
    
            * Plugins.subproj/WebNetscapePluginViewPrivate.h: Added.
    	This stuff was shared in a different way before, and it
    	hadn't even been renamed.
            * WebKit.pbproj/project.pbxproj: Added file.
            * Plugins.subproj/npapi.m: Use the new private header.
    
            * Plugins.subproj/WebPluginNullEventSender.h: Hold a reference
    	to the view.
            * Plugins.subproj/WebPluginNullEventSender.m:
            (-[WebNetscapePluginNullEventSender initWithPluginView:]):
    	Retain the view.
            (-[WebNetscapePluginNullEventSender dealloc]): Release the view.
            (-[WebNetscapePluginNullEventSender sendNullEvents]): Use sendEvent:.
            (-[WebNetscapePluginNullEventSender stop]): No need for shouldStop.
    
            * WebView.subproj/WebDataSourcePrivate.m:
            (-[WebDataSourcePrivate init]): Don't set contentPolicy to an enum value,
    	when it's an object reference.
            (-[WebDataSourcePrivate dealloc]): Release contentPolicy to fix a leak.
    
            * WebView.subproj/WebHTMLView.m:
            (-[WebHTMLView mouseDragged:]): Set draggedURL to nil in the else case,
    	it was uninitialized before. Also center the icon better when dragging,
    	but shouldn't we be dragging something more than the icon here?
    
            * Misc.subproj/WebIconDatabase.m: (-[WebIconDatabase defaultIconWithSize:]):
    	Add a call to release. Doesn't really plug a leak, but cleaner this way.
    
            * Plugins.subproj/WebPlugin.m: Tweaks.
            * WebView.subproj/WebMainResourceClient.m: Tweaks only.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@1960 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 9355a4c..3ca850c 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,45 @@
+2002-09-04  Darin Adler  <darin at apple.com>
+
+	Did some minor plugin cleanup, mostly to make sure we don't
+	change pages while a plugin is tracking.
+
+        * Plugins.subproj/WebPluginView.h: Add sendEvent and sendUpdateEvent.
+	Remove the NPP_HandleEvent method.
+        * Plugins.subproj/WebPluginView.m:
+        (-[WebNetscapePluginView sendEvent:]): Sets up the "defersCallbacks"
+	state, then sends the event.
+
+        * Plugins.subproj/WebNetscapePluginViewPrivate.h: Added.
+	This stuff was shared in a different way before, and it
+	hadn't even been renamed.
+        * WebKit.pbproj/project.pbxproj: Added file.
+        * Plugins.subproj/npapi.m: Use the new private header.
+
+        * Plugins.subproj/WebPluginNullEventSender.h: Hold a reference
+	to the view.
+        * Plugins.subproj/WebPluginNullEventSender.m:
+        (-[WebNetscapePluginNullEventSender initWithPluginView:]):
+	Retain the view.
+        (-[WebNetscapePluginNullEventSender dealloc]): Release the view.
+        (-[WebNetscapePluginNullEventSender sendNullEvents]): Use sendEvent:.
+        (-[WebNetscapePluginNullEventSender stop]): No need for shouldStop.
+
+        * WebView.subproj/WebDataSourcePrivate.m:
+        (-[WebDataSourcePrivate init]): Don't set contentPolicy to an enum value,
+	when it's an object reference.
+        (-[WebDataSourcePrivate dealloc]): Release contentPolicy to fix a leak.
+
+        * WebView.subproj/WebHTMLView.m:
+        (-[WebHTMLView mouseDragged:]): Set draggedURL to nil in the else case,
+	it was uninitialized before. Also center the icon better when dragging,
+	but shouldn't we be dragging something more than the icon here?
+
+        * Misc.subproj/WebIconDatabase.m: (-[WebIconDatabase defaultIconWithSize:]):
+	Add a call to release. Doesn't really plug a leak, but cleaner this way.
+
+        * Plugins.subproj/WebPlugin.m: Tweaks.
+        * WebView.subproj/WebMainResourceClient.m: Tweaks only.
+
 2002-09-04  Ken Kocienda  <kocienda at apple.com>
 
 	Made more adjustments for API and behavior change that occurred in WebFoundation, 
diff --git a/WebKit/ChangeLog-2002-12-03 b/WebKit/ChangeLog-2002-12-03
index 9355a4c..3ca850c 100644
--- a/WebKit/ChangeLog-2002-12-03
+++ b/WebKit/ChangeLog-2002-12-03
@@ -1,3 +1,45 @@
+2002-09-04  Darin Adler  <darin at apple.com>
+
+	Did some minor plugin cleanup, mostly to make sure we don't
+	change pages while a plugin is tracking.
+
+        * Plugins.subproj/WebPluginView.h: Add sendEvent and sendUpdateEvent.
+	Remove the NPP_HandleEvent method.
+        * Plugins.subproj/WebPluginView.m:
+        (-[WebNetscapePluginView sendEvent:]): Sets up the "defersCallbacks"
+	state, then sends the event.
+
+        * Plugins.subproj/WebNetscapePluginViewPrivate.h: Added.
+	This stuff was shared in a different way before, and it
+	hadn't even been renamed.
+        * WebKit.pbproj/project.pbxproj: Added file.
+        * Plugins.subproj/npapi.m: Use the new private header.
+
+        * Plugins.subproj/WebPluginNullEventSender.h: Hold a reference
+	to the view.
+        * Plugins.subproj/WebPluginNullEventSender.m:
+        (-[WebNetscapePluginNullEventSender initWithPluginView:]):
+	Retain the view.
+        (-[WebNetscapePluginNullEventSender dealloc]): Release the view.
+        (-[WebNetscapePluginNullEventSender sendNullEvents]): Use sendEvent:.
+        (-[WebNetscapePluginNullEventSender stop]): No need for shouldStop.
+
+        * WebView.subproj/WebDataSourcePrivate.m:
+        (-[WebDataSourcePrivate init]): Don't set contentPolicy to an enum value,
+	when it's an object reference.
+        (-[WebDataSourcePrivate dealloc]): Release contentPolicy to fix a leak.
+
+        * WebView.subproj/WebHTMLView.m:
+        (-[WebHTMLView mouseDragged:]): Set draggedURL to nil in the else case,
+	it was uninitialized before. Also center the icon better when dragging,
+	but shouldn't we be dragging something more than the icon here?
+
+        * Misc.subproj/WebIconDatabase.m: (-[WebIconDatabase defaultIconWithSize:]):
+	Add a call to release. Doesn't really plug a leak, but cleaner this way.
+
+        * Plugins.subproj/WebPlugin.m: Tweaks.
+        * WebView.subproj/WebMainResourceClient.m: Tweaks only.
+
 2002-09-04  Ken Kocienda  <kocienda at apple.com>
 
 	Made more adjustments for API and behavior change that occurred in WebFoundation, 
diff --git a/WebKit/Misc.subproj/WebIconDatabase.m b/WebKit/Misc.subproj/WebIconDatabase.m
index 3c67426..9a0f25e 100644
--- a/WebKit/Misc.subproj/WebIconDatabase.m
+++ b/WebKit/Misc.subproj/WebIconDatabase.m
@@ -137,6 +137,7 @@ NSSize WebIconMediumSize = {32, 32};
         if (pathForDefaultImage != nil) {
             NSImage *icon = [[NSImage alloc] initByReferencingFile: pathForDefaultImage];
             _private->defaultIcons = [[NSMutableArray arrayWithObject:icon] retain];
+            [icon release];
         }
     }
 
diff --git a/WebKit/Plugins.subproj/WebNetscapePluginViewPrivate.h b/WebKit/Plugins.subproj/WebNetscapePluginViewPrivate.h
new file mode 100644
index 0000000..3f5e2ab
--- /dev/null
+++ b/WebKit/Plugins.subproj/WebNetscapePluginViewPrivate.h
@@ -0,0 +1,27 @@
+//
+//  WebPluginViewPrivate.h
+//  WebKit
+//
+//  Created by Darin Adler on Tue Aug 27 2002.
+//  Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
+//
+
+#import <WebPluginView.h>
+
+ at interface WebNetscapePluginView (WebNPPCallbacks)
+
+- (NPError)getURLNotify:(const char *)URL target:(const char *)target notifyData:(void *)notifyData;
+- (NPError)getURL:(const char *)URL target:(const char *)target;
+- (NPError)postURLNotify:(const char *)URL target:(const char *)target len:(UInt32)len buf:(const char *)buf file:(NPBool)file notifyData:(void *)notifyData;
+- (NPError)postURL:(const char *)URL target:(const char *)target len:(UInt32)len buf:(const char *)buf file:(NPBool)file;
+- (NPError)newStream:(NPMIMEType)type target:(const char *)target stream:(NPStream**)stream;
+- (NPError)write:(NPStream*)stream len:(SInt32)len buffer:(void *)buffer;
+- (NPError)destroyStream:(NPStream*)stream reason:(NPReason)reason;
+- (void)status:(const char *)message;
+- (NPError)getValue:(NPNVariable)variable value:(void *)value;
+- (NPError)setValue:(NPPVariable)variable value:(void *)value;
+- (void)invalidateRect:(NPRect *)invalidRect;
+- (void)invalidateRegion:(NPRegion)invalidateRegion;
+- (void)forceRedraw;
+
+ at end
diff --git a/WebKit/Plugins.subproj/WebPlugin.m b/WebKit/Plugins.subproj/WebPlugin.m
index fa4aeaa..9f1fc19 100644
--- a/WebKit/Plugins.subproj/WebPlugin.m
+++ b/WebKit/Plugins.subproj/WebPlugin.m
@@ -440,7 +440,7 @@ TransitionVector tVectorForFunctionPointer(FunctionPointer);
 
 FunctionPointer functionPointerForTVector(TransitionVector tvp)
 {
-    uint32 temp[6] = {0x3D800000, 0x618C0000, 0x800C0000, 0x804C0004, 0x7C0903A6, 0x4E800420};
+    const uint32 temp[6] = {0x3D800000, 0x618C0000, 0x800C0000, 0x804C0004, 0x7C0903A6, 0x4E800420};
     uint32 *newGlue = NULL;
 
     if (tvp != NULL) {
@@ -469,8 +469,3 @@ TransitionVector tVectorForFunctionPointer(FunctionPointer fp)
     }
     return (TransitionVector)newGlue;
 }
-
-
-
-
-
diff --git a/WebKit/Plugins.subproj/WebPluginNullEventSender.h b/WebKit/Plugins.subproj/WebPluginNullEventSender.h
index 3898b1e..1b516ea 100644
--- a/WebKit/Plugins.subproj/WebPluginNullEventSender.h
+++ b/WebKit/Plugins.subproj/WebPluginNullEventSender.h
@@ -4,18 +4,16 @@
 */
 
 #import <Foundation/Foundation.h>
-#import <npapi.h>
 
 @class WebNetscapePluginView;
 
- at interface WebNetscapePluginNullEventSender : NSObject{
-    NPP instance;
-    NPP_HandleEventProcPtr NPP_HandleEvent;
-    bool shouldStop;
-    NSWindow *window;
+ at interface WebNetscapePluginNullEventSender : NSObject
+{
+    WebNetscapePluginView *view;
 }
 
 -(id)initWithPluginView:(WebNetscapePluginView *)pluginView;
 -(void)sendNullEvents;
 -(void)stop;
- at end
\ No newline at end of file
+
+ at end
diff --git a/WebKit/Plugins.subproj/WebPluginNullEventSender.m b/WebKit/Plugins.subproj/WebPluginNullEventSender.m
index 0c731e8..bdb3ffd 100644
--- a/WebKit/Plugins.subproj/WebPluginNullEventSender.m
+++ b/WebKit/Plugins.subproj/WebPluginNullEventSender.m
@@ -13,48 +13,41 @@
 -(id)initWithPluginView:(WebNetscapePluginView *)pluginView
 {
     [super init];
-    
-    instance = [pluginView pluginInstance];
-    NPP_HandleEvent = [pluginView NPP_HandleEvent];
-    window = [[pluginView window] retain];
-    
+    view = [pluginView retain];
     return self;
 }
 
--(void) dealloc
+-(void)dealloc
 {
-    [window release];
-    
+    [view release];
     [super dealloc];
 }
 
 -(void)sendNullEvents
 {
-    if (!shouldStop) {
-        EventRecord event;
-        BOOL acceptedEvent;
-        
-        [WebNetscapePluginView getCarbonEvent:&event];
-        
-        // plug-in should not react to cursor position when not active.
-        if(![window isKeyWindow]){
-            event.where.v = 0;
-            event.where.h = 0;
-        }
-        acceptedEvent = NPP_HandleEvent(instance, &event);
-        
-        //WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPP_HandleEvent(nullEvent): %d  when: %u %d\n", acceptedEvent, (unsigned)event.when, shouldStop);
-        
-        [self performSelector:@selector(sendNullEvents) withObject:nil afterDelay:.01];
+    EventRecord event;
+    
+    [WebNetscapePluginView getCarbonEvent:&event];
+    
+    // plug-in should not react to cursor position when not active.
+    // FIXME: How does passing a v and h of 0 prevent it from reacting to the cursor position?
+    if (![[view window] isKeyWindow]) {
+        event.where.v = 0;
+        event.where.h = 0;
     }
+    
+    [view sendEvent:&event];
+    
+    //WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPP_HandleEvent(nullEvent): %d  when: %u %d\n", acceptedEvent, (unsigned)event.when, shouldStop);
+    
+    // FIXME: Why .01? Why not 0? Why not a larger number?
+    [self performSelector:@selector(sendNullEvents) withObject:nil afterDelay:.01];
 }
 
--(void) stop
+-(void)stop
 {
     WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "Stopping null events\n");
-    shouldStop = TRUE;
     [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(sendNullEvents) object:nil];
 }
 
 @end
-
diff --git a/WebKit/Plugins.subproj/WebPluginView.h b/WebKit/Plugins.subproj/WebPluginView.h
index 4be05d2..7fb6b05 100644
--- a/WebKit/Plugins.subproj/WebPluginView.h
+++ b/WebKit/Plugins.subproj/WebPluginView.h
@@ -54,10 +54,14 @@
 }
 
 - (id)initWithFrame:(NSRect)r plugin:(WebNetscapePlugin *)plugin URL:(NSURL *)URL baseURL:(NSURL *)baseURL mime:(NSString *)mimeType arguments:(NSDictionary *)arguments;
--(void)stop;
+- (void)stop;
+
 - (WebDataSource *)webDataSource;
 - (WebController *)webController;
-+(void)getCarbonEvent:(EventRecord *)carbonEvent;
+
++ (void)getCarbonEvent:(EventRecord *)carbonEvent;
+- (BOOL)sendEvent:(EventRecord *)event;
+- (BOOL)sendUpdateEvent;
 
 - (NPP)pluginInstance;
 - (NPP_NewStreamProcPtr)NPP_NewStream;
@@ -66,6 +70,5 @@
 - (NPP_StreamAsFileProcPtr)NPP_StreamAsFile;
 - (NPP_DestroyStreamProcPtr)NPP_DestroyStream;
 - (NPP_URLNotifyProcPtr)NPP_URLNotify;
-- (NPP_HandleEventProcPtr) NPP_HandleEvent;
 
 @end
diff --git a/WebKit/Plugins.subproj/WebPluginView.m b/WebKit/Plugins.subproj/WebPluginView.m
index 0f4f5c2..149a252 100644
--- a/WebKit/Plugins.subproj/WebPluginView.m
+++ b/WebKit/Plugins.subproj/WebPluginView.m
@@ -7,6 +7,7 @@
 
 #import <WebKit/WebPluginView.h>
 #import <WebKit/WebController.h>
+#import <WebKit/WebControllerPrivate.h>
 #import <WebKit/WebFrame.h>
 #import <WebKit/WebFramePrivate.h>
 #import <WebKit/WebDataSource.h>
@@ -110,10 +111,25 @@
     return message;
 }
 
--(void)sendActivateEvent:(BOOL)activate
+- (BOOL)sendEvent:(EventRecord *)event
+{
+    BOOL defers = [webController _defersCallbacks];
+    if (!defers) {
+        [webController _setDefersCallbacks:YES];
+    }
+
+    BOOL acceptedEvent = NPP_HandleEvent(instance, event);
+
+    if (!defers) {
+        [webController _setDefersCallbacks:NO];
+    }
+    
+    return acceptedEvent;
+}
+
+- (void)sendActivateEvent:(BOOL)activate
 {
     EventRecord event;
-    BOOL acceptedEvent;
     
     [self getCarbonEvent:&event];
     event.what = activateEvt;
@@ -122,27 +138,28 @@
     if (activate)
         event.modifiers |= activeFlag;
     
-    acceptedEvent = NPP_HandleEvent(instance, &event); 
+    BOOL acceptedEvent = [self sendEvent:&event]; 
     
     WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPP_HandleEvent(activateEvent): %d  isActive: %d\n", acceptedEvent, (event.modifiers & activeFlag));
 }
 
-- (void)sendUpdateEvent
+- (BOOL)sendUpdateEvent
 {
     EventRecord event;
-    BOOL acceptedEvent;
     
     [self getCarbonEvent:&event];
     event.what = updateEvt;
     WindowRef windowRef = [[self window] _windowRef];
     event.message = (UInt32)windowRef;
 
-    acceptedEvent = NPP_HandleEvent(instance, &event); 
+    BOOL acceptedEvent = [self sendEvent:&event]; 
     
     WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPP_HandleEvent(updateEvt): %d\n", acceptedEvent);
+    
+    return acceptedEvent;
 }
 
--(BOOL)acceptsFirstResponder
+- (BOOL)acceptsFirstResponder
 {
     return YES;
 }
@@ -150,12 +167,11 @@
 - (BOOL)becomeFirstResponder
 {
     EventRecord event;
-    BOOL acceptedEvent;
     
     [self getCarbonEvent:&event];
     event.what = getFocusEvent;
     
-    acceptedEvent = NPP_HandleEvent(instance, &event); 
+    BOOL acceptedEvent = [self sendEvent:&event]; 
     
     WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPP_HandleEvent(getFocusEvent): %d\n", acceptedEvent);
     return YES;
@@ -164,40 +180,36 @@
 - (BOOL)resignFirstResponder
 {
     EventRecord event;
-    BOOL acceptedEvent;
     
     [self getCarbonEvent:&event];
     event.what = loseFocusEvent;
     
-    acceptedEvent = NPP_HandleEvent(instance, &event);
+    BOOL acceptedEvent = [self sendEvent:&event];
     
     WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPP_HandleEvent(loseFocusEvent): %d\n", acceptedEvent);
     return YES;
 }
 
-
--(void)mouseDown:(NSEvent *)theEvent
+- (void)mouseDown:(NSEvent *)theEvent
 {
     EventRecord event;
-    BOOL acceptedEvent;
 
     [self getCarbonEvent:&event withEvent:theEvent];
     event.what = mouseDown;
 
-    acceptedEvent = NPP_HandleEvent(instance, &event);
+    BOOL acceptedEvent = [self sendEvent:&event];
     
     WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPP_HandleEvent(mouseDown): %d pt.v=%d, pt.h=%d\n", acceptedEvent, event.where.v, event.where.h);
 }
 
--(void)mouseUp:(NSEvent *)theEvent
+- (void)mouseUp:(NSEvent *)theEvent
 {
     EventRecord event;
-    BOOL acceptedEvent;
     
     [self getCarbonEvent:&event withEvent:theEvent];
     event.what = mouseUp;
 
-    acceptedEvent = NPP_HandleEvent(instance, &event);
+    BOOL acceptedEvent = [self sendEvent:&event];
     
     WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPP_HandleEvent(mouseUp): %d pt.v=%d, pt.h=%d\n", acceptedEvent, event.where.v, event.where.h);
 }
@@ -205,12 +217,11 @@
 - (void)mouseEntered:(NSEvent *)theEvent
 {
     EventRecord event;
-    BOOL acceptedEvent;
     
     [self getCarbonEvent:&event withEvent:theEvent];
     event.what = adjustCursorEvent;
 
-    acceptedEvent = NPP_HandleEvent(instance, &event);
+    BOOL acceptedEvent = [self sendEvent:&event];
     
     WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPP_HandleEvent(mouseEntered): %d\n", acceptedEvent);
 }
@@ -218,12 +229,11 @@
 - (void)mouseExited:(NSEvent *)theEvent
 {
     EventRecord event;
-    BOOL acceptedEvent;
         
     [self getCarbonEvent:&event withEvent:theEvent];
     event.what = adjustCursorEvent;
 
-    acceptedEvent = NPP_HandleEvent(instance, &event);
+    BOOL acceptedEvent = [self sendEvent:&event];
     
     WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPP_HandleEvent(mouseExited): %d\n", acceptedEvent);
     
@@ -234,7 +244,6 @@
 - (void)keyUp:(NSEvent *)theEvent
 {
     EventRecord event;
-    BOOL acceptedEvent;
 
     [self getCarbonEvent:&event withEvent:theEvent];
     event.what = keyUp;
@@ -243,7 +252,7 @@
         event.message = [self keyMessageForEvent:theEvent];
     }
     
-    acceptedEvent = NPP_HandleEvent(instance, &event);
+    BOOL acceptedEvent = [self sendEvent:&event];
 
     WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPP_HandleEvent(keyUp): %d charCode:%c keyCode:%lu\n",
                      acceptedEvent, (char) (event.message & charCodeMask), (event.message & keyCodeMask));
@@ -258,7 +267,6 @@
 - (void)keyDown:(NSEvent *)theEvent
 {
     EventRecord event;
-    BOOL acceptedEvent;
 
     // Some command keys are sent with both performKeyEquivalent and keyDown.
     // We should send only 1 keyDown to the plug-in, so we'll ignore this one.
@@ -273,7 +281,7 @@
         event.message = [self keyMessageForEvent:theEvent];
     }
     
-    acceptedEvent = NPP_HandleEvent(instance, &event);
+    BOOL acceptedEvent = [self sendEvent:&event];
 
     WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPP_HandleEvent(keyDown): %d charCode:%c keyCode:%lu\n",
                      acceptedEvent, (char) (event.message & charCodeMask), (event.message & keyCodeMask));
@@ -298,10 +306,10 @@
     return NO;
 }
 
+// Must subclass performKeyEquivalent: for command-modified keys to work.
 - (BOOL)performKeyEquivalent:(NSEvent *)theEvent
 {
     EventRecord event;
-    BOOL acceptedEvent;
 
     if(![self isInResponderChain]){
         return NO;
@@ -314,7 +322,7 @@
         event.message = [self keyMessageForEvent:theEvent];
     }
 
-    acceptedEvent = NPP_HandleEvent(instance, &event);
+    BOOL acceptedEvent = [self sendEvent:&event];
 
     WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPP_HandleEvent(performKeyEquivalent): %d charCode:%c keyCode:%lu\n",
                      acceptedEvent, (char) (event.message & charCodeMask), (event.message & keyCodeMask));
@@ -326,10 +334,10 @@
 - (NSMenu *)menuForEvent:(NSEvent *)theEvent
 {
     EventRecord event;
-    BOOL acceptedEvent;
     
     [self getCarbonEvent:&event withEvent:theEvent];
-    acceptedEvent = NPP_HandleEvent(instance, &event);
+    BOOL acceptedEvent = [self sendEvent:&event];
+    
     WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPP_HandleEvent(menuForEvent): %d pt.v=%d, pt.h=%d\n", acceptedEvent, event.where.v, event.where.h);
 
     return nil;
@@ -649,12 +657,10 @@
 
 - (void)provisionalDataSourceCommitted:(WebDataSource *)dataSource
 {
-    
 }
 
 - (void)dataSourceUpdated:(WebDataSource *)dataSource
 {
-
 }
  
 - (void)layout
@@ -666,8 +672,6 @@
     [self setUpWindowAndPort];
 }
 
-
-
 #pragma mark NSVIEW
 
 - (void)drawRect:(NSRect)rect
@@ -764,6 +768,50 @@
 
 #pragma mark PLUGIN-TO-BROWSER
 
+- (NPP)pluginInstance
+{
+    return instance;
+}
+
+- (NPP_NewStreamProcPtr)NPP_NewStream
+{
+    return NPP_NewStream;
+}
+
+- (NPP_WriteReadyProcPtr)NPP_WriteReady
+{
+    return NPP_WriteReady;
+}
+
+- (NPP_WriteProcPtr)NPP_Write
+{
+    return NPP_Write;
+}
+
+- (NPP_StreamAsFileProcPtr)NPP_StreamAsFile
+{
+    return NPP_StreamAsFile;
+}
+
+- (NPP_DestroyStreamProcPtr)NPP_DestroyStream
+{
+    return NPP_DestroyStream;
+}
+
+- (NPP_URLNotifyProcPtr)NPP_URLNotify
+{
+    return NPP_URLNotify;
+}
+
+- (NPP_HandleEventProcPtr)NPP_HandleEvent
+{
+    return NPP_HandleEvent;
+}
+
+ at end
+
+ at implementation WebNetscapePluginView (WebNPPCallbacks)
+
 - (NPError) loadURL:(NSString *)URLString inTarget:(NSString *)target withNotifyData:(void *)notifyData andHandleAttributes:(NSDictionary *)attributes
 {
     WebNetscapePluginStream *stream;
@@ -947,48 +995,4 @@
     [self sendUpdateEvent];
 }
 
-- (NPP)pluginInstance
-{
-    return instance;
-}
-
-- (NPP_NewStreamProcPtr)NPP_NewStream
-{
-    return NPP_NewStream;
-}
-
-- (NPP_WriteReadyProcPtr)NPP_WriteReady
-{
-    return NPP_WriteReady;
-}
-
-
-- (NPP_WriteProcPtr)NPP_Write
-{
-    return NPP_Write;
-}
-
-
-- (NPP_StreamAsFileProcPtr)NPP_StreamAsFile
-{
-    return NPP_StreamAsFile;
-}
-
-
-- (NPP_DestroyStreamProcPtr)NPP_DestroyStream
-{
-    return NPP_DestroyStream;
-}
-
-
-- (NPP_URLNotifyProcPtr)NPP_URLNotify
-{
-    return NPP_URLNotify;
-}
-
-- (NPP_HandleEventProcPtr) NPP_HandleEvent
-{
-    return NPP_HandleEvent;
-}
-
 @end
diff --git a/WebKit/Plugins.subproj/npapi.m b/WebKit/Plugins.subproj/npapi.m
index 623899e..e378e0c 100644
--- a/WebKit/Plugins.subproj/npapi.m
+++ b/WebKit/Plugins.subproj/npapi.m
@@ -24,24 +24,9 @@
  */
 
 #import "npapi.h"
-#import "WebKitDebug.h"
-
- at interface WebPluginView : NSObject
--(NPError)getURLNotify:(const char *)URL target:(const char *)target notifyData:(void *)notifyData;
--(NPError)getURL:(const char *)URL target:(const char *)target;
--(NPError)postURLNotify:(const char *)URL target:(const char *)target len:(UInt32)len buf:(const char *)buf file:(NPBool)file notifyData:(void *)notifyData;
--(NPError)postURL:(const char *)URL target:(const char *)target len:(UInt32)len buf:(const char *)buf file:(NPBool)file;
--(NPError)newStream:(NPMIMEType)type target:(const char *)target stream:(NPStream**)stream;
--(NPError)write:(NPStream*)stream len:(SInt32)len buffer:(void *)buffer;
--(NPError)destroyStream:(NPStream*)stream reason:(NPReason)reason;
--(void)status:(const char *)message;
--(NPError)getValue:(NPNVariable)variable value:(void *)value;
--(NPError)setValue:(NPPVariable)variable value:(void *)value;
--(void)invalidateRect:(NPRect *)invalidRect;
--(void)invalidateRegion:(NPRegion)invalidateRegion;
--(void)forceRedraw;
- at end
 
+#import "WebKitDebug.h"
+#import "WebNetscapePluginViewPrivate.h"
 
 // general plug-in to browser functions
 
@@ -86,49 +71,49 @@ NPError NPN_RequestRead(NPStream* stream, NPByteRange* rangeList)
 
 NPError NPN_GetURLNotify(NPP instance, const char* URL, const char* target, void* notifyData)
 {
-    WebPluginView *plugin = (WebPluginView *)instance->ndata;
+    WebNetscapePluginView *plugin = (WebNetscapePluginView *)instance->ndata;
     return [plugin getURLNotify:URL target:target notifyData:notifyData];
 }
 
 NPError NPN_GetURL(NPP instance, const char* URL, const char* target)
 {
-    WebPluginView *plugin = (WebPluginView *)instance->ndata;
+    WebNetscapePluginView *plugin = (WebNetscapePluginView *)instance->ndata;
     return [plugin getURL:URL target:target];
 }
 
 NPError NPN_PostURLNotify(NPP instance, const char* URL, const char* target, UInt32 len, const char* buf, NPBool file, void* notifyData)
 {
-    WebPluginView *plugin = (WebPluginView *)instance->ndata;
+    WebNetscapePluginView *plugin = (WebNetscapePluginView *)instance->ndata;
     return [plugin postURLNotify:URL target:target len:len buf:buf file:file notifyData:notifyData];
 }
 
 NPError NPN_PostURL(NPP instance, const char* URL, const char* target, UInt32 len, const char* buf, NPBool file)
 {
-    WebPluginView *plugin = (WebPluginView *)instance->ndata;
+    WebNetscapePluginView *plugin = (WebNetscapePluginView *)instance->ndata;
     return [plugin postURL:URL target:target len:len buf:buf file:file];
 }
 
 NPError NPN_NewStream(NPP instance, NPMIMEType type, const char* target, NPStream** stream)
 {
-    WebPluginView *plugin = (WebPluginView *)instance->ndata;
+    WebNetscapePluginView *plugin = (WebNetscapePluginView *)instance->ndata;
     return [plugin newStream:type target:target stream:stream];
 }
 
 SInt32	NPN_Write(NPP instance, NPStream* stream, SInt32 len, void* buffer)
 {
-    WebPluginView *plugin = (WebPluginView *)instance->ndata;
+    WebNetscapePluginView *plugin = (WebNetscapePluginView *)instance->ndata;
     return [plugin write:stream len:len buffer:buffer];
 }
 
 NPError NPN_DestroyStream(NPP instance, NPStream* stream, NPReason reason)
 {
-    WebPluginView *plugin = (WebPluginView *)instance->ndata;
+    WebNetscapePluginView *plugin = (WebNetscapePluginView *)instance->ndata;
     return [plugin destroyStream:stream reason:reason];
 }
 
 void NPN_Status(NPP instance, const char* message)
 {
-    WebPluginView *plugin = (WebPluginView *)instance->ndata;
+    WebNetscapePluginView *plugin = (WebNetscapePluginView *)instance->ndata;
     [plugin status:message];
 }
 
@@ -147,19 +132,19 @@ NPError NPN_SetValue(NPP instance, NPPVariable variable, void *value)
 
 void NPN_InvalidateRect(NPP instance, NPRect *invalidRect)
 {
-    WebPluginView *plugin = (WebPluginView *)instance->ndata;
+    WebNetscapePluginView *plugin = (WebNetscapePluginView *)instance->ndata;
     [plugin invalidateRect:invalidRect];
 }
 
 void NPN_InvalidateRegion(NPP instance, NPRegion invalidRegion)
 {
-    WebPluginView *plugin = (WebPluginView *)instance->ndata;
+    WebNetscapePluginView *plugin = (WebNetscapePluginView *)instance->ndata;
     [plugin invalidateRegion:invalidRegion];
 }
 
 void NPN_ForceRedraw(NPP instance)
 {
-    WebPluginView *plugin = (WebPluginView *)instance->ndata;
+    WebNetscapePluginView *plugin = (WebNetscapePluginView *)instance->ndata;
     [plugin forceRedraw];
 }
 
diff --git a/WebKit/WebKit.pbproj/project.pbxproj b/WebKit/WebKit.pbproj/project.pbxproj
index 7f948d8..caed43e 100644
--- a/WebKit/WebKit.pbproj/project.pbxproj
+++ b/WebKit/WebKit.pbproj/project.pbxproj
@@ -272,6 +272,7 @@
 				F560BEBE030DAF4401C1A526,
 				F528E3EC031E91AD01CA2ACA,
 				F528E3EE031E91AD01CA2ACA,
+				931A72D303265920008635CE,
 			);
 			isa = PBXHeadersBuildPhase;
 			runOnlyForDeploymentPostprocessing = 0;
@@ -1137,6 +1138,28 @@
 //392
 //393
 //394
+//930
+//931
+//932
+//933
+//934
+		931A72D203265920008635CE = {
+			fileEncoding = 30;
+			isa = PBXFileReference;
+			path = WebNetscapePluginViewPrivate.h;
+			refType = 4;
+		};
+		931A72D303265920008635CE = {
+			fileRef = 931A72D203265920008635CE;
+			isa = PBXBuildFile;
+			settings = {
+			};
+		};
+//930
+//931
+//932
+//933
+//934
 //9C0
 //9C1
 //9C2
@@ -2350,6 +2373,7 @@
 		F5EBC45202134BB601CA1520 = {
 			children = (
 				F5EBC45502134BC301CA1520,
+				931A72D203265920008635CE,
 				F5EBC45602134BC301CA1520,
 				F5883BE0025E5E9D01000102,
 				F5883BE1025E5E9D01000102,
diff --git a/WebKit/WebView.subproj/WebDataSourcePrivate.m b/WebKit/WebView.subproj/WebDataSourcePrivate.m
index fc60231..49e3ed6 100644
--- a/WebKit/WebView.subproj/WebDataSourcePrivate.m
+++ b/WebKit/WebView.subproj/WebDataSourcePrivate.m
@@ -41,16 +41,6 @@
 
 - init
 {
-    // Unnecessary, but I like to know that these ivars should be nil.
-    parent = nil;
-    frames = nil;
-    controller = nil;
-    inputURL = nil;
-    
-    primaryLoadComplete = NO;
-    
-    contentPolicy = WebContentPolicyNone;
-    
     encoding = [[WebCoreEncodings charsetNameForEncoding:[[WebPreferences standardPreferences] defaultTextEncoding]] retain];
     overrideEncoding = kCFStringEncodingInvalidId;
 
@@ -83,10 +73,10 @@
     [contentType release];
     [errors release];
     [mainDocumentError release];
+    [contentPolicy release];
     [iconLoader setDelegate:nil];
     [iconLoader release];
     [iconURL release];
-    
 
     [super dealloc];
 }
diff --git a/WebKit/WebView.subproj/WebHTMLView.m b/WebKit/WebView.subproj/WebHTMLView.m
index 6176bc4..e053480 100644
--- a/WebKit/WebView.subproj/WebHTMLView.m
+++ b/WebKit/WebView.subproj/WebHTMLView.m
@@ -431,10 +431,12 @@
         if(imageURL || linkURL){
             [_private->draggedURL release];
             
-            if(imageURL)
+            if (imageURL)
                 _private->draggedURL = imageURL;
             else if (linkURL)
                 _private->draggedURL = linkURL;
+            else
+                _private->draggedURL = nil;
             
             [_private->draggedURL retain];
             
@@ -444,16 +446,19 @@
             [self dragPromisedFilesOfTypes: fileType fromRect: rect source: self slideBack: YES event: event];
 #else
             NSPasteboard *pasteboard = [NSPasteboard pasteboardWithName:NSDragPboard];
-        
+            
             [pasteboard declareTypes:[NSArray arrayWithObject:NSURLPboardType] owner:nil];
             [_private->draggedURL writeToPasteboard: pasteboard];
+            NSSize offset = WebIconSmallSize;
+            offset.width /= 2;
+            offset.height /= 2;
             [self dragImage:[[WebIconDatabase sharedIconDatabase] defaultIconWithSize:WebIconSmallSize]
-                        at:[self convertPoint:[event locationInWindow] fromView:nil]
-                    offset:NSMakeSize(0.0,0.0)
-                    event:event
-                pasteboard:pasteboard
-                    source:self
-                slideBack:NO];
+                         at:[self convertPoint:[event locationInWindow] fromView:nil]
+                     offset:offset
+                      event:event
+                 pasteboard:pasteboard
+                     source:self
+                  slideBack:NO];
 #endif
             return;
         }
diff --git a/WebKit/WebView.subproj/WebMainResourceClient.m b/WebKit/WebView.subproj/WebMainResourceClient.m
index 5f8c31d..be1051f 100644
--- a/WebKit/WebView.subproj/WebMainResourceClient.m
+++ b/WebKit/WebView.subproj/WebMainResourceClient.m
@@ -22,7 +22,7 @@
 #import <WebFoundation/WebFileTypeMappings.h>
 #import <WebFoundation/WebResourceHandle.h>
 
-// FIXME: This is quite similar WebSubresourceClient; they should share code.
+// FIXME: This is quite similar to WebSubresourceClient; they should share code.
 
 @implementation WebMainResourceClient
 
@@ -81,7 +81,6 @@
     WebLoadProgress *progress = [WebLoadProgress progressWithResourceHandle:handle];
     WebContentAction contentAction = [[dataSource contentPolicy] policyAction];
 
-    
     if (contentAction == WebContentPolicySaveAndOpenExternally || contentAction == WebContentPolicySave) {
         if (isComplete) {
             [dataSource _setPrimaryLoadComplete:YES];
@@ -153,16 +152,15 @@
        [dataSource _setResourceData:resourceData];
     }
 
-    if(contentAction == WebContentPolicyShow){
+    if (contentAction == WebContentPolicyShow) {
         [[dataSource representation] finishedLoadingWithDataSource:dataSource];
     }
     
     // Either send a final error message or a final progress message.
     WebError *nonTerminalError = [handle error];
-    if (nonTerminalError){
+    if (nonTerminalError) {
         [self receivedError:nonTerminalError forHandle:handle];
-    }
-    else {
+    } else {
         [self receivedProgressWithHandle:handle complete:YES];
     }
     
@@ -185,7 +183,6 @@
     
     // Check the mime type and ask the client for the content policy.
     if(isFirstChunk){
-    
         // Make assumption that if the contentType is the default 
         // and there is no extension, this is text/html
         if([contentType isEqualToString:@"application/octet-stream"] && [[[currentURL path] pathExtension] isEqualToString:@""])
@@ -230,8 +227,7 @@
 	[[[dataSource controller] locationChangeHandler] locationChangeDone:nil forDataSource:dataSource];
         break;
     default:
-        [NSException raise:NSInvalidArgumentException format:
-@"contentPolicyForMIMEType:URL:inFrame: returned an invalid content policy."];
+        [NSException raise:NSInvalidArgumentException format:@"contentPolicyForMIMEType:URL:inFrame: returned an invalid content policy."];
     }
 
     [self receivedProgressWithHandle:handle complete:NO];
@@ -255,7 +251,6 @@
     [self didStopLoading];
 }
 
-
 - (void)handleDidRedirect:(WebResourceHandle *)handle toURL:(NSURL *)URL
 {
     WEBKITDEBUGLEVEL(WEBKIT_LOG_REDIRECT, "URL = %s\n", DEBUG_OBJECT(URL));
diff --git a/WebKit/WebView.subproj/WebMainResourceLoader.m b/WebKit/WebView.subproj/WebMainResourceLoader.m
index 5f8c31d..be1051f 100644
--- a/WebKit/WebView.subproj/WebMainResourceLoader.m
+++ b/WebKit/WebView.subproj/WebMainResourceLoader.m
@@ -22,7 +22,7 @@
 #import <WebFoundation/WebFileTypeMappings.h>
 #import <WebFoundation/WebResourceHandle.h>
 
-// FIXME: This is quite similar WebSubresourceClient; they should share code.
+// FIXME: This is quite similar to WebSubresourceClient; they should share code.
 
 @implementation WebMainResourceClient
 
@@ -81,7 +81,6 @@
     WebLoadProgress *progress = [WebLoadProgress progressWithResourceHandle:handle];
     WebContentAction contentAction = [[dataSource contentPolicy] policyAction];
 
-    
     if (contentAction == WebContentPolicySaveAndOpenExternally || contentAction == WebContentPolicySave) {
         if (isComplete) {
             [dataSource _setPrimaryLoadComplete:YES];
@@ -153,16 +152,15 @@
        [dataSource _setResourceData:resourceData];
     }
 
-    if(contentAction == WebContentPolicyShow){
+    if (contentAction == WebContentPolicyShow) {
         [[dataSource representation] finishedLoadingWithDataSource:dataSource];
     }
     
     // Either send a final error message or a final progress message.
     WebError *nonTerminalError = [handle error];
-    if (nonTerminalError){
+    if (nonTerminalError) {
         [self receivedError:nonTerminalError forHandle:handle];
-    }
-    else {
+    } else {
         [self receivedProgressWithHandle:handle complete:YES];
     }
     
@@ -185,7 +183,6 @@
     
     // Check the mime type and ask the client for the content policy.
     if(isFirstChunk){
-    
         // Make assumption that if the contentType is the default 
         // and there is no extension, this is text/html
         if([contentType isEqualToString:@"application/octet-stream"] && [[[currentURL path] pathExtension] isEqualToString:@""])
@@ -230,8 +227,7 @@
 	[[[dataSource controller] locationChangeHandler] locationChangeDone:nil forDataSource:dataSource];
         break;
     default:
-        [NSException raise:NSInvalidArgumentException format:
-@"contentPolicyForMIMEType:URL:inFrame: returned an invalid content policy."];
+        [NSException raise:NSInvalidArgumentException format:@"contentPolicyForMIMEType:URL:inFrame: returned an invalid content policy."];
     }
 
     [self receivedProgressWithHandle:handle complete:NO];
@@ -255,7 +251,6 @@
     [self didStopLoading];
 }
 
-
 - (void)handleDidRedirect:(WebResourceHandle *)handle toURL:(NSURL *)URL
 {
     WEBKITDEBUGLEVEL(WEBKIT_LOG_REDIRECT, "URL = %s\n", DEBUG_OBJECT(URL));

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list