[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 06:10:57 UTC 2009
The following commit has been merged in the debian/unstable branch:
commit df2e09f0f2dafb37ed2e4560cc4ceeecdf20e389
Author: cblu <cblu at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Mon May 6 23:14:12 2002 +0000
Made start and stop work cleaner.
Now observe defaults changes so that plug-ins
are disabled or enabled immediately (2871725).
* Plugins.subproj/IFPluginNullEventSender.m:
(-[IFPluginNullEventSender sendNullEvents]):
* Plugins.subproj/IFPluginView.h:
* Plugins.subproj/IFPluginView.mm:
(-[IFPluginView initWithFrame:plugin:url:mime:arguments:mode:]):
(-[IFPluginView start]):
(-[IFPluginView stop]):
(-[IFPluginView drawRect:]):
(-[IFPluginView windowWillClose:]):
(-[IFPluginView defaultsHaveChanged:]):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@1101 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 43b317d..c669525 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,21 @@
+2002-05-06 Chris Blumenberg <cblu at apple.com>
+
+ Made start and stop work cleaner.
+
+ Now observe defaults changes so that plug-ins
+ are disabled or enabled immediately (2871725).
+
+ * Plugins.subproj/IFPluginNullEventSender.m:
+ (-[IFPluginNullEventSender sendNullEvents]):
+ * Plugins.subproj/IFPluginView.h:
+ * Plugins.subproj/IFPluginView.mm:
+ (-[IFPluginView initWithFrame:plugin:url:mime:arguments:mode:]):
+ (-[IFPluginView start]):
+ (-[IFPluginView stop]):
+ (-[IFPluginView drawRect:]):
+ (-[IFPluginView windowWillClose:]):
+ (-[IFPluginView defaultsHaveChanged:]):
+
2002-05-06 Richard J. Williamson <rjw at apple.com>
Fixed width measurement regression. We lost the final ROUND_TO_INT
diff --git a/WebKit/ChangeLog-2002-12-03 b/WebKit/ChangeLog-2002-12-03
index 43b317d..c669525 100644
--- a/WebKit/ChangeLog-2002-12-03
+++ b/WebKit/ChangeLog-2002-12-03
@@ -1,3 +1,21 @@
+2002-05-06 Chris Blumenberg <cblu at apple.com>
+
+ Made start and stop work cleaner.
+
+ Now observe defaults changes so that plug-ins
+ are disabled or enabled immediately (2871725).
+
+ * Plugins.subproj/IFPluginNullEventSender.m:
+ (-[IFPluginNullEventSender sendNullEvents]):
+ * Plugins.subproj/IFPluginView.h:
+ * Plugins.subproj/IFPluginView.mm:
+ (-[IFPluginView initWithFrame:plugin:url:mime:arguments:mode:]):
+ (-[IFPluginView start]):
+ (-[IFPluginView stop]):
+ (-[IFPluginView drawRect:]):
+ (-[IFPluginView windowWillClose:]):
+ (-[IFPluginView defaultsHaveChanged:]):
+
2002-05-06 Richard J. Williamson <rjw at apple.com>
Fixed width measurement regression. We lost the final ROUND_TO_INT
diff --git a/WebKit/Plugins.subproj/IFPluginNullEventSender.m b/WebKit/Plugins.subproj/IFPluginNullEventSender.m
index b46bf0e..e6a3e80 100644
--- a/WebKit/Plugins.subproj/IFPluginNullEventSender.m
+++ b/WebKit/Plugins.subproj/IFPluginNullEventSender.m
@@ -28,8 +28,8 @@
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 %d\n", acceptedEvent, (unsigned)event.when, shouldStop);
- [self performSelector:@selector(sendNullEvents) withObject:nil afterDelay:.1];
+ //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];
}
}
diff --git a/WebKit/Plugins.subproj/IFPluginView.h b/WebKit/Plugins.subproj/IFPluginView.h
index 5b30735..8f5dfe7 100644
--- a/WebKit/Plugins.subproj/IFPluginView.h
+++ b/WebKit/Plugins.subproj/IFPluginView.h
@@ -26,7 +26,7 @@
NP_Port nPort;
NPP_t instanceStruct;
- BOOL isFlipped, transferred, isHidden, isStarted, fullMode;
+ BOOL canRestart, isHidden, isStarted, fullMode;
NSString *URL, *mime;
NSURL *baseURL;
diff --git a/WebKit/Plugins.subproj/IFPluginView.mm b/WebKit/Plugins.subproj/IFPluginView.mm
index b750104..4504c93 100644
--- a/WebKit/Plugins.subproj/IFPluginView.mm
+++ b/WebKit/Plugins.subproj/IFPluginView.mm
@@ -113,7 +113,7 @@ newCString(NSString *string)
}
// Initialize globals
- transferred = NO;
+ canRestart = YES;
isStarted = NO;
filesToErase = [[NSMutableArray alloc] init];
activeURLHandles = [[NSMutableArray alloc] init];
@@ -233,31 +233,59 @@ newCString(NSString *string)
{
NPSavedData saved;
NPError npErr;
+ NSNotificationCenter *notificationCenter;
+ NSWindow *theWindow;
+
+ if(isStarted || !canRestart)
+ return;
isStarted = YES;
npErr = NPP_New((char *)[mime cString], instance, fullMode ? NP_FULL : NP_EMBED, argsCount, cAttributes, cValues, &saved);
-
WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPP_New: %d\n", npErr);
// Create a WindowRef is one doesn't already exist
[[self window] _windowRef];
+
+ [self setWindow];
+
+ theWindow = [self window];
+ notificationCenter = [NSNotificationCenter defaultCenter];
+ [notificationCenter addObserver:self selector:@selector(viewHasMoved:) name:@"NSViewBoundsDidChangeNotification" object:[self findSuperview:@"NSClipView"]];
+ [notificationCenter addObserver:self selector:@selector(viewHasMoved:) name:@"NSWindowDidResizeNotification" object:theWindow];
+ [notificationCenter addObserver:self selector:@selector(windowWillClose:) name:@"NSWindowWillCloseNotification" object:theWindow];
+ [notificationCenter addObserver:self selector:@selector(windowBecameKey:) name:@"NSWindowDidBecomeKeyNotification" object:theWindow];
+ [notificationCenter addObserver:self selector:@selector(windowResignedKey:) name:@"NSWindowDidResignKeyNotification" object:theWindow];
+ [notificationCenter addObserver:self selector:@selector(defaultsHaveChanged:) name:@"NSUserDefaultsDidChangeNotification" object:nil];
+
+ [self sendActivateEvent:[theWindow isKeyWindow]];
+ if(URL)
+ [self newStream:[NSURL URLWithString:URL] mimeType:mime notifyData:NULL];
+ eventSender = [[IFPluginNullEventSender alloc] initializeWithNPP:instance functionPointer:NPP_HandleEvent];
+ [eventSender sendNullEvents];
+ trackingTag = [self addTrackingRect:[self bounds] owner:self userData:nil assumeInside:NO];
+
+ id webView = [self findSuperview:@"IFWebView"];
+ webController = [webView controller];
+ webDataSource = [[webController frameForView:webView] dataSource];
}
- (void)stop
{
NPError npErr;
- if (isStarted){
- [activeURLHandles makeObjectsPerformSelector:@selector(cancelLoadInBackground)];
- [eventSender stop];
- [eventSender release];
- [[NSNotificationCenter defaultCenter] removeObserver:self];
- [self removeTrackingRect:trackingTag];
- npErr = NPP_Destroy(instance, NULL);
- WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPP_Destroy: %d\n", npErr);
- isStarted = NO;
- }
+ if (!isStarted)
+ return;
+
+ isStarted = NO;
+
+ [activeURLHandles makeObjectsPerformSelector:@selector(cancelLoadInBackground)];
+ [eventSender stop];
+ [eventSender release];
+ [[NSNotificationCenter defaultCenter] removeObserver:self];
+ [self removeTrackingRect:trackingTag];
+ npErr = NPP_Destroy(instance, NULL);
+ WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPP_Destroy: %d\n", npErr);
}
- (NSView *) findSuperview:(NSString *)viewName
@@ -310,32 +338,10 @@ newCString(NSString *string)
- (void)drawRect:(NSRect)rect
{
- if(!transferred){
- NSNotificationCenter *notificationCenter;
- NSWindow *theWindow;
-
+ if(!isStarted)
[self start];
- [self setWindow];
- theWindow = [self window];
- notificationCenter = [NSNotificationCenter defaultCenter];
- [notificationCenter addObserver:self selector:@selector(viewHasMoved:) name:@"NSViewBoundsDidChangeNotification" object:[self findSuperview:@"NSClipView"]];
- [notificationCenter addObserver:self selector:@selector(viewHasMoved:) name:@"NSWindowDidResizeNotification" object:theWindow];
- [notificationCenter addObserver:self selector:@selector(windowWillClose:) name:@"NSWindowWillCloseNotification" object:theWindow];
- [notificationCenter addObserver:self selector:@selector(windowBecameKey:) name:@"NSWindowDidBecomeKeyNotification" object:theWindow];
- [notificationCenter addObserver:self selector:@selector(windowResignedKey:) name:@"NSWindowDidResignKeyNotification" object:theWindow];
- [self sendActivateEvent:[theWindow isKeyWindow]];
- if(URL)
- [self newStream:[NSURL URLWithString:URL] mimeType:mime notifyData:NULL];
- eventSender = [[IFPluginNullEventSender alloc] initializeWithNPP:instance functionPointer:NPP_HandleEvent];
- [eventSender sendNullEvents];
- transferred = YES;
- trackingTag = [self addTrackingRect:[self bounds] owner:self userData:nil assumeInside:NO];
-
- id webView = [self findSuperview:@"IFWebView"];
- webController = [webView controller];
- webDataSource = [[webController frameForView:webView] dataSource];
- }
- [self sendUpdateEvent];
+ if(isStarted)
+ [self sendUpdateEvent];
}
- (BOOL)isFlipped
@@ -485,6 +491,19 @@ newCString(NSString *string)
[self stop];
}
+- (void) defaultsHaveChanged:(NSNotification *)notification
+{
+ NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
+ if([defaults boolForKey:@"WebKitPluginsEnabled"]){
+ canRestart = YES;
+ [self start];
+ }else{
+ canRestart = NO;
+ [self stop];
+ [self setNeedsDisplay:YES];
+ }
+}
+
#pragma mark IFURLHANDLE
diff --git a/WebKit/Plugins.subproj/WebPluginNullEventSender.m b/WebKit/Plugins.subproj/WebPluginNullEventSender.m
index b46bf0e..e6a3e80 100644
--- a/WebKit/Plugins.subproj/WebPluginNullEventSender.m
+++ b/WebKit/Plugins.subproj/WebPluginNullEventSender.m
@@ -28,8 +28,8 @@
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 %d\n", acceptedEvent, (unsigned)event.when, shouldStop);
- [self performSelector:@selector(sendNullEvents) withObject:nil afterDelay:.1];
+ //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];
}
}
diff --git a/WebKit/Plugins.subproj/WebPluginView.h b/WebKit/Plugins.subproj/WebPluginView.h
index 5b30735..8f5dfe7 100644
--- a/WebKit/Plugins.subproj/WebPluginView.h
+++ b/WebKit/Plugins.subproj/WebPluginView.h
@@ -26,7 +26,7 @@
NP_Port nPort;
NPP_t instanceStruct;
- BOOL isFlipped, transferred, isHidden, isStarted, fullMode;
+ BOOL canRestart, isHidden, isStarted, fullMode;
NSString *URL, *mime;
NSURL *baseURL;
diff --git a/WebKit/Plugins.subproj/WebPluginView.m b/WebKit/Plugins.subproj/WebPluginView.m
index b750104..4504c93 100644
--- a/WebKit/Plugins.subproj/WebPluginView.m
+++ b/WebKit/Plugins.subproj/WebPluginView.m
@@ -113,7 +113,7 @@ newCString(NSString *string)
}
// Initialize globals
- transferred = NO;
+ canRestart = YES;
isStarted = NO;
filesToErase = [[NSMutableArray alloc] init];
activeURLHandles = [[NSMutableArray alloc] init];
@@ -233,31 +233,59 @@ newCString(NSString *string)
{
NPSavedData saved;
NPError npErr;
+ NSNotificationCenter *notificationCenter;
+ NSWindow *theWindow;
+
+ if(isStarted || !canRestart)
+ return;
isStarted = YES;
npErr = NPP_New((char *)[mime cString], instance, fullMode ? NP_FULL : NP_EMBED, argsCount, cAttributes, cValues, &saved);
-
WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPP_New: %d\n", npErr);
// Create a WindowRef is one doesn't already exist
[[self window] _windowRef];
+
+ [self setWindow];
+
+ theWindow = [self window];
+ notificationCenter = [NSNotificationCenter defaultCenter];
+ [notificationCenter addObserver:self selector:@selector(viewHasMoved:) name:@"NSViewBoundsDidChangeNotification" object:[self findSuperview:@"NSClipView"]];
+ [notificationCenter addObserver:self selector:@selector(viewHasMoved:) name:@"NSWindowDidResizeNotification" object:theWindow];
+ [notificationCenter addObserver:self selector:@selector(windowWillClose:) name:@"NSWindowWillCloseNotification" object:theWindow];
+ [notificationCenter addObserver:self selector:@selector(windowBecameKey:) name:@"NSWindowDidBecomeKeyNotification" object:theWindow];
+ [notificationCenter addObserver:self selector:@selector(windowResignedKey:) name:@"NSWindowDidResignKeyNotification" object:theWindow];
+ [notificationCenter addObserver:self selector:@selector(defaultsHaveChanged:) name:@"NSUserDefaultsDidChangeNotification" object:nil];
+
+ [self sendActivateEvent:[theWindow isKeyWindow]];
+ if(URL)
+ [self newStream:[NSURL URLWithString:URL] mimeType:mime notifyData:NULL];
+ eventSender = [[IFPluginNullEventSender alloc] initializeWithNPP:instance functionPointer:NPP_HandleEvent];
+ [eventSender sendNullEvents];
+ trackingTag = [self addTrackingRect:[self bounds] owner:self userData:nil assumeInside:NO];
+
+ id webView = [self findSuperview:@"IFWebView"];
+ webController = [webView controller];
+ webDataSource = [[webController frameForView:webView] dataSource];
}
- (void)stop
{
NPError npErr;
- if (isStarted){
- [activeURLHandles makeObjectsPerformSelector:@selector(cancelLoadInBackground)];
- [eventSender stop];
- [eventSender release];
- [[NSNotificationCenter defaultCenter] removeObserver:self];
- [self removeTrackingRect:trackingTag];
- npErr = NPP_Destroy(instance, NULL);
- WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPP_Destroy: %d\n", npErr);
- isStarted = NO;
- }
+ if (!isStarted)
+ return;
+
+ isStarted = NO;
+
+ [activeURLHandles makeObjectsPerformSelector:@selector(cancelLoadInBackground)];
+ [eventSender stop];
+ [eventSender release];
+ [[NSNotificationCenter defaultCenter] removeObserver:self];
+ [self removeTrackingRect:trackingTag];
+ npErr = NPP_Destroy(instance, NULL);
+ WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPP_Destroy: %d\n", npErr);
}
- (NSView *) findSuperview:(NSString *)viewName
@@ -310,32 +338,10 @@ newCString(NSString *string)
- (void)drawRect:(NSRect)rect
{
- if(!transferred){
- NSNotificationCenter *notificationCenter;
- NSWindow *theWindow;
-
+ if(!isStarted)
[self start];
- [self setWindow];
- theWindow = [self window];
- notificationCenter = [NSNotificationCenter defaultCenter];
- [notificationCenter addObserver:self selector:@selector(viewHasMoved:) name:@"NSViewBoundsDidChangeNotification" object:[self findSuperview:@"NSClipView"]];
- [notificationCenter addObserver:self selector:@selector(viewHasMoved:) name:@"NSWindowDidResizeNotification" object:theWindow];
- [notificationCenter addObserver:self selector:@selector(windowWillClose:) name:@"NSWindowWillCloseNotification" object:theWindow];
- [notificationCenter addObserver:self selector:@selector(windowBecameKey:) name:@"NSWindowDidBecomeKeyNotification" object:theWindow];
- [notificationCenter addObserver:self selector:@selector(windowResignedKey:) name:@"NSWindowDidResignKeyNotification" object:theWindow];
- [self sendActivateEvent:[theWindow isKeyWindow]];
- if(URL)
- [self newStream:[NSURL URLWithString:URL] mimeType:mime notifyData:NULL];
- eventSender = [[IFPluginNullEventSender alloc] initializeWithNPP:instance functionPointer:NPP_HandleEvent];
- [eventSender sendNullEvents];
- transferred = YES;
- trackingTag = [self addTrackingRect:[self bounds] owner:self userData:nil assumeInside:NO];
-
- id webView = [self findSuperview:@"IFWebView"];
- webController = [webView controller];
- webDataSource = [[webController frameForView:webView] dataSource];
- }
- [self sendUpdateEvent];
+ if(isStarted)
+ [self sendUpdateEvent];
}
- (BOOL)isFlipped
@@ -485,6 +491,19 @@ newCString(NSString *string)
[self stop];
}
+- (void) defaultsHaveChanged:(NSNotification *)notification
+{
+ NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
+ if([defaults boolForKey:@"WebKitPluginsEnabled"]){
+ canRestart = YES;
+ [self start];
+ }else{
+ canRestart = NO;
+ [self stop];
+ [self setNeedsDisplay:YES];
+ }
+}
+
#pragma mark IFURLHANDLE
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list