[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:23:20 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit f2327cc04c8e788cdec1f20164670c2107fbeca2
Author: cblu <cblu at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Jul 3 22:58:55 2002 +0000

    	- Fix for 2975750
    	- Removed Java workaround since that will be fixed soon.
    
            * Plugins.subproj/IFPlugin.h:
            * Plugins.subproj/IFPlugin.m:
            (-[IFPlugin _openResourceFile]): added
            (-[IFPlugin _closeResourceFile:]): added
            (-[IFPlugin _getPluginInfo]): rename
            (-[IFPlugin initWithPath:]): simplified
            (-[IFPlugin load]): calls _openResourceFile
            (-[IFPlugin unload]): calls _closeResourceFile
            * Plugins.subproj/IFPluginView.mm:
            (-[IFPluginView setUpWindowAndPort]): removed Java workaround
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@1512 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 0e19bbc..5827ab0 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,19 @@
+2002-07-03  Chris Blumenberg  <cblu at apple.com>
+
+	- Fix for 2975750
+	- Removed Java workaround since that will be fixed soon.
+
+        * Plugins.subproj/IFPlugin.h:
+        * Plugins.subproj/IFPlugin.m:
+        (-[IFPlugin _openResourceFile]): added
+        (-[IFPlugin _closeResourceFile:]): added
+        (-[IFPlugin _getPluginInfo]): rename
+        (-[IFPlugin initWithPath:]): simplified
+        (-[IFPlugin load]): calls _openResourceFile
+        (-[IFPlugin unload]): calls _closeResourceFile
+        * Plugins.subproj/IFPluginView.mm:
+        (-[IFPluginView setUpWindowAndPort]): removed Java workaround
+
 2002-07-03  Darin Adler  <darin at apple.com>
 
         * Misc.subproj/IFException.h: Use Objective C header style rather than plain C.
diff --git a/WebKit/ChangeLog-2002-12-03 b/WebKit/ChangeLog-2002-12-03
index 0e19bbc..5827ab0 100644
--- a/WebKit/ChangeLog-2002-12-03
+++ b/WebKit/ChangeLog-2002-12-03
@@ -1,3 +1,19 @@
+2002-07-03  Chris Blumenberg  <cblu at apple.com>
+
+	- Fix for 2975750
+	- Removed Java workaround since that will be fixed soon.
+
+        * Plugins.subproj/IFPlugin.h:
+        * Plugins.subproj/IFPlugin.m:
+        (-[IFPlugin _openResourceFile]): added
+        (-[IFPlugin _closeResourceFile:]): added
+        (-[IFPlugin _getPluginInfo]): rename
+        (-[IFPlugin initWithPath:]): simplified
+        (-[IFPlugin load]): calls _openResourceFile
+        (-[IFPlugin unload]): calls _closeResourceFile
+        * Plugins.subproj/IFPluginView.mm:
+        (-[IFPluginView setUpWindowAndPort]): removed Java workaround
+
 2002-07-03  Darin Adler  <darin at apple.com>
 
         * Misc.subproj/IFException.h: Use Objective C header style rather than plain C.
diff --git a/WebKit/Plugins.subproj/IFPlugin.h b/WebKit/Plugins.subproj/IFPlugin.h
index 8a9df8c..15d2ed0 100644
--- a/WebKit/Plugins.subproj/IFPlugin.h
+++ b/WebKit/Plugins.subproj/IFPlugin.h
@@ -38,6 +38,7 @@
     uint16 pluginVersion;
     CFBundleRef bundle;
     CFragConnectionID connID; 
+    SInt16 resourceRef;
     
     NPP_NewProcPtr NPP_New;
     NPP_DestroyProcPtr NPP_Destroy;
diff --git a/WebKit/Plugins.subproj/IFPlugin.m b/WebKit/Plugins.subproj/IFPlugin.m
index bab37ae..4cd52bd 100644
--- a/WebKit/Plugins.subproj/IFPlugin.m
+++ b/WebKit/Plugins.subproj/IFPlugin.m
@@ -33,7 +33,33 @@ TransitionVector tVectorForFunctionPointer(FunctionPointer);
 
 @implementation IFPlugin
 
-- (void)_getPluginInfoForResourceFile:(SInt16)resRef
+- (SInt16)_openResourceFile
+{
+    FSRef fref;
+    OSErr err;
+    
+    if(isBundle){
+        return CFBundleOpenBundleResourceMap(bundle);
+    }else{
+        err = FSPathMakeRef((UInt8 *)[path cString], &fref, NULL);
+        if(err != noErr){
+            return -1;
+        }
+            
+        return FSOpenResFile(&fref, fsRdPerm);
+    }
+}
+
+- (void)_closeResourceFile:(SInt16)resRef
+{
+    if(isBundle){
+        CFBundleCloseBundleResourceMap(bundle, resRef);
+    }else{
+        CloseResFile(resRef);
+    }
+}
+
+- (BOOL)_getPluginInfo
 {
     Str255 theString;
     char temp[256], description[256];
@@ -41,8 +67,13 @@ TransitionVector tVectorForFunctionPointer(FunctionPointer);
     NSString *tempString;
     uint n, i;
     
-    mimeTypes = [NSMutableArray arrayWithCapacity:1];
+    SInt16 resRef = [self _openResourceFile];
+    if(resRef == -1)
+        return NO;
+    
     UseResFile(resRef);
+    
+    mimeTypes = [NSMutableArray arrayWithCapacity:1];
     for(n=1, i=0; 1; n+=2, i++){
         GetIndString(theString, 128, n);
         if (theString[0] == 0)
@@ -79,64 +110,49 @@ TransitionVector tVectorForFunctionPointer(FunctionPointer);
     CopyPascalStringToC(theString, temp);
     name = [[NSString stringWithCString:temp] retain]; // plugin's name
     [mimeTypes retain];
+    
+    [self _closeResourceFile:resRef];
+    
+    return YES;
 }
 
 - initWithPath:(NSString *)pluginPath
 {
     NSFileManager *fileManager;
     NSDictionary *fileInfo;
-    SInt16 resRef;
-    FSRef fref;
-    OSErr err;
     UInt32 type;
     CFURLRef pluginURL;
-        
+    
+    path = pluginPath;
     fileManager = [NSFileManager defaultManager];
     fileInfo = [fileManager fileAttributesAtPath:pluginPath traverseLink:YES];
     
     // single-file plug-in with resource fork
     if([[fileInfo objectForKey:@"NSFileType"] isEqualToString:@"NSFileTypeRegular"]){
-        if([[fileInfo objectForKey:@"NSFileHFSTypeCode"] unsignedLongValue] == FOUR_CHAR_CODE('BRPL') ||
-           [[fileInfo objectForKey:@"NSFileHFSTypeCode"] unsignedLongValue] == FOUR_CHAR_CODE('IEPL')){
-           
-            err = FSPathMakeRef((UInt8 *)[pluginPath cString], &fref, NULL);
-            if(err != noErr){
-                WEBKITDEBUG("IFPlugin: FSPathMakeRef failed. Error=%d\n", err);
-                return nil;
-            }
-            
-            resRef = FSOpenResFile(&fref, fsRdPerm);
-            if(resRef == -1) {
-                WEBKITDEBUG("IFPlugin: FSOpenResFile failed. Can't open resource file: %s, Error=%d\n", [pluginPath lossyCString], err);
-                return nil;
-            }
-            
-            [self _getPluginInfoForResourceFile:resRef];
-            CloseResFile(resRef);
-            isBundle = NO;
-        }else return nil;
-        
-    //bundle plug-in
+        type = [[fileInfo objectForKey:@"NSFileHFSTypeCode"] unsignedLongValue];
+        isBundle = NO;
+    
+    // bundle
     }else if([[fileInfo objectForKey:@"NSFileType"] isEqualToString:@"NSFileTypeDirectory"]){
         pluginURL = CFURLCreateWithFileSystemPath(NULL, (CFStringRef)pluginPath, kCFURLPOSIXPathStyle, TRUE);
         bundle = CFBundleCreate(NULL, pluginURL);
+        CFRelease(pluginURL);
         CFBundleGetPackageInfo(bundle, &type, NULL);
-        
-        if(type == FOUR_CHAR_CODE('BRPL') || type == FOUR_CHAR_CODE('IEPL') ){
-            resRef = CFBundleOpenBundleResourceMap(bundle);
-            [self _getPluginInfoForResourceFile:resRef];
-            CFBundleCloseBundleResourceMap(bundle, resRef);
-            isBundle = YES;
-        }else{
+        isBundle = YES;
+    }else{
+        return nil;
+    }
+    
+    if(type == FOUR_CHAR_CODE('BRPL') || type == FOUR_CHAR_CODE('IEPL') ){
+        if(![self _getPluginInfo]){
             return nil;
         }
-        CFRelease(pluginURL);
     }else{
         return nil;
     }
     
-    filename = [[pluginPath lastPathComponent] retain];
-    path = [pluginPath retain];
+    filename = [[path lastPathComponent] retain];
+    [path retain];
     isLoaded = NO;
     return self;
 }
@@ -206,6 +222,14 @@ TransitionVector tVectorForFunctionPointer(FunctionPointer);
         isCFM = TRUE;
     }
     
+    // Plugins (at least QT) require that you call UseResFile on the resource file before loading it.
+    
+    resourceRef = [self _openResourceFile];
+    if(resourceRef == -1)
+        return NO;
+    
+    UseResFile(resourceRef);
+    
     // swap function tables
     if(isCFM){
         browserFuncs.version = 11;
@@ -304,6 +328,9 @@ TransitionVector tVectorForFunctionPointer(FunctionPointer);
 - (void)unload
 {
     NPP_Shutdown();
+    
+    [self _closeResourceFile:resourceRef];
+    
     if(isBundle){
         CFBundleUnloadExecutable(bundle);
         CFRelease(bundle);
diff --git a/WebKit/Plugins.subproj/IFPluginView.mm b/WebKit/Plugins.subproj/IFPluginView.mm
index 42c6c6a..f2ff640 100644
--- a/WebKit/Plugins.subproj/IFPluginView.mm
+++ b/WebKit/Plugins.subproj/IFPluginView.mm
@@ -359,20 +359,10 @@ static char *newCString(NSString *string)
     NSRect contentViewFrame = [[[self window] contentView] frame];
     NSRect boundsInWindow = [self convertRect:[self bounds] toView:nil];
     NSRect visibleRectInWindow = [self convertRect:[self visibleRect] toView:nil];
-    float windowContentFrameHeight, toolbarHeight;
-        
-    if ([mime isEqualToString:@"application/x-java-applet"]) {
-        // The java plug-in assumes that the port is positioned 22 pixels down from the top-left corner of the window.
-        // This is incorrect if the window has a toolbar. Here's the workaround. 2973586
-        toolbarHeight = windowFrame.size.height - contentViewFrame.size.height - contentViewFrame.origin.y - 22;
-        windowContentFrameHeight = contentViewFrame.size.height + toolbarHeight;
-    } else {
-        windowContentFrameHeight = contentViewFrame.size.height;
-    }
     
     // flip Y coordinates
-    boundsInWindow.origin.y = windowContentFrameHeight - boundsInWindow.origin.y - boundsInWindow.size.height; 
-    visibleRectInWindow.origin.y = windowContentFrameHeight - visibleRectInWindow.origin.y - visibleRectInWindow.size.height;
+    boundsInWindow.origin.y = contentViewFrame.size.height - boundsInWindow.origin.y - boundsInWindow.size.height; 
+    visibleRectInWindow.origin.y = contentViewFrame.size.height - visibleRectInWindow.origin.y - visibleRectInWindow.size.height;
     
     nPort.port = port;
     
diff --git a/WebKit/Plugins.subproj/WebPlugin.h b/WebKit/Plugins.subproj/WebPlugin.h
index 8a9df8c..15d2ed0 100644
--- a/WebKit/Plugins.subproj/WebPlugin.h
+++ b/WebKit/Plugins.subproj/WebPlugin.h
@@ -38,6 +38,7 @@
     uint16 pluginVersion;
     CFBundleRef bundle;
     CFragConnectionID connID; 
+    SInt16 resourceRef;
     
     NPP_NewProcPtr NPP_New;
     NPP_DestroyProcPtr NPP_Destroy;
diff --git a/WebKit/Plugins.subproj/WebPlugin.m b/WebKit/Plugins.subproj/WebPlugin.m
index bab37ae..4cd52bd 100644
--- a/WebKit/Plugins.subproj/WebPlugin.m
+++ b/WebKit/Plugins.subproj/WebPlugin.m
@@ -33,7 +33,33 @@ TransitionVector tVectorForFunctionPointer(FunctionPointer);
 
 @implementation IFPlugin
 
-- (void)_getPluginInfoForResourceFile:(SInt16)resRef
+- (SInt16)_openResourceFile
+{
+    FSRef fref;
+    OSErr err;
+    
+    if(isBundle){
+        return CFBundleOpenBundleResourceMap(bundle);
+    }else{
+        err = FSPathMakeRef((UInt8 *)[path cString], &fref, NULL);
+        if(err != noErr){
+            return -1;
+        }
+            
+        return FSOpenResFile(&fref, fsRdPerm);
+    }
+}
+
+- (void)_closeResourceFile:(SInt16)resRef
+{
+    if(isBundle){
+        CFBundleCloseBundleResourceMap(bundle, resRef);
+    }else{
+        CloseResFile(resRef);
+    }
+}
+
+- (BOOL)_getPluginInfo
 {
     Str255 theString;
     char temp[256], description[256];
@@ -41,8 +67,13 @@ TransitionVector tVectorForFunctionPointer(FunctionPointer);
     NSString *tempString;
     uint n, i;
     
-    mimeTypes = [NSMutableArray arrayWithCapacity:1];
+    SInt16 resRef = [self _openResourceFile];
+    if(resRef == -1)
+        return NO;
+    
     UseResFile(resRef);
+    
+    mimeTypes = [NSMutableArray arrayWithCapacity:1];
     for(n=1, i=0; 1; n+=2, i++){
         GetIndString(theString, 128, n);
         if (theString[0] == 0)
@@ -79,64 +110,49 @@ TransitionVector tVectorForFunctionPointer(FunctionPointer);
     CopyPascalStringToC(theString, temp);
     name = [[NSString stringWithCString:temp] retain]; // plugin's name
     [mimeTypes retain];
+    
+    [self _closeResourceFile:resRef];
+    
+    return YES;
 }
 
 - initWithPath:(NSString *)pluginPath
 {
     NSFileManager *fileManager;
     NSDictionary *fileInfo;
-    SInt16 resRef;
-    FSRef fref;
-    OSErr err;
     UInt32 type;
     CFURLRef pluginURL;
-        
+    
+    path = pluginPath;
     fileManager = [NSFileManager defaultManager];
     fileInfo = [fileManager fileAttributesAtPath:pluginPath traverseLink:YES];
     
     // single-file plug-in with resource fork
     if([[fileInfo objectForKey:@"NSFileType"] isEqualToString:@"NSFileTypeRegular"]){
-        if([[fileInfo objectForKey:@"NSFileHFSTypeCode"] unsignedLongValue] == FOUR_CHAR_CODE('BRPL') ||
-           [[fileInfo objectForKey:@"NSFileHFSTypeCode"] unsignedLongValue] == FOUR_CHAR_CODE('IEPL')){
-           
-            err = FSPathMakeRef((UInt8 *)[pluginPath cString], &fref, NULL);
-            if(err != noErr){
-                WEBKITDEBUG("IFPlugin: FSPathMakeRef failed. Error=%d\n", err);
-                return nil;
-            }
-            
-            resRef = FSOpenResFile(&fref, fsRdPerm);
-            if(resRef == -1) {
-                WEBKITDEBUG("IFPlugin: FSOpenResFile failed. Can't open resource file: %s, Error=%d\n", [pluginPath lossyCString], err);
-                return nil;
-            }
-            
-            [self _getPluginInfoForResourceFile:resRef];
-            CloseResFile(resRef);
-            isBundle = NO;
-        }else return nil;
-        
-    //bundle plug-in
+        type = [[fileInfo objectForKey:@"NSFileHFSTypeCode"] unsignedLongValue];
+        isBundle = NO;
+    
+    // bundle
     }else if([[fileInfo objectForKey:@"NSFileType"] isEqualToString:@"NSFileTypeDirectory"]){
         pluginURL = CFURLCreateWithFileSystemPath(NULL, (CFStringRef)pluginPath, kCFURLPOSIXPathStyle, TRUE);
         bundle = CFBundleCreate(NULL, pluginURL);
+        CFRelease(pluginURL);
         CFBundleGetPackageInfo(bundle, &type, NULL);
-        
-        if(type == FOUR_CHAR_CODE('BRPL') || type == FOUR_CHAR_CODE('IEPL') ){
-            resRef = CFBundleOpenBundleResourceMap(bundle);
-            [self _getPluginInfoForResourceFile:resRef];
-            CFBundleCloseBundleResourceMap(bundle, resRef);
-            isBundle = YES;
-        }else{
+        isBundle = YES;
+    }else{
+        return nil;
+    }
+    
+    if(type == FOUR_CHAR_CODE('BRPL') || type == FOUR_CHAR_CODE('IEPL') ){
+        if(![self _getPluginInfo]){
             return nil;
         }
-        CFRelease(pluginURL);
     }else{
         return nil;
     }
     
-    filename = [[pluginPath lastPathComponent] retain];
-    path = [pluginPath retain];
+    filename = [[path lastPathComponent] retain];
+    [path retain];
     isLoaded = NO;
     return self;
 }
@@ -206,6 +222,14 @@ TransitionVector tVectorForFunctionPointer(FunctionPointer);
         isCFM = TRUE;
     }
     
+    // Plugins (at least QT) require that you call UseResFile on the resource file before loading it.
+    
+    resourceRef = [self _openResourceFile];
+    if(resourceRef == -1)
+        return NO;
+    
+    UseResFile(resourceRef);
+    
     // swap function tables
     if(isCFM){
         browserFuncs.version = 11;
@@ -304,6 +328,9 @@ TransitionVector tVectorForFunctionPointer(FunctionPointer);
 - (void)unload
 {
     NPP_Shutdown();
+    
+    [self _closeResourceFile:resourceRef];
+    
     if(isBundle){
         CFBundleUnloadExecutable(bundle);
         CFRelease(bundle);
diff --git a/WebKit/Plugins.subproj/WebPluginView.m b/WebKit/Plugins.subproj/WebPluginView.m
index 42c6c6a..f2ff640 100644
--- a/WebKit/Plugins.subproj/WebPluginView.m
+++ b/WebKit/Plugins.subproj/WebPluginView.m
@@ -359,20 +359,10 @@ static char *newCString(NSString *string)
     NSRect contentViewFrame = [[[self window] contentView] frame];
     NSRect boundsInWindow = [self convertRect:[self bounds] toView:nil];
     NSRect visibleRectInWindow = [self convertRect:[self visibleRect] toView:nil];
-    float windowContentFrameHeight, toolbarHeight;
-        
-    if ([mime isEqualToString:@"application/x-java-applet"]) {
-        // The java plug-in assumes that the port is positioned 22 pixels down from the top-left corner of the window.
-        // This is incorrect if the window has a toolbar. Here's the workaround. 2973586
-        toolbarHeight = windowFrame.size.height - contentViewFrame.size.height - contentViewFrame.origin.y - 22;
-        windowContentFrameHeight = contentViewFrame.size.height + toolbarHeight;
-    } else {
-        windowContentFrameHeight = contentViewFrame.size.height;
-    }
     
     // flip Y coordinates
-    boundsInWindow.origin.y = windowContentFrameHeight - boundsInWindow.origin.y - boundsInWindow.size.height; 
-    visibleRectInWindow.origin.y = windowContentFrameHeight - visibleRectInWindow.origin.y - visibleRectInWindow.size.height;
+    boundsInWindow.origin.y = contentViewFrame.size.height - boundsInWindow.origin.y - boundsInWindow.size.height; 
+    visibleRectInWindow.origin.y = contentViewFrame.size.height - visibleRectInWindow.origin.y - visibleRectInWindow.size.height;
     
     nPort.port = port;
     

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list