[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:26:01 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 4c0b7f8df25dea6ca1e7859f6b410b8a8949bbb4
Author: cblu <cblu at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Sun Jul 21 21:23:44 2002 +0000

    WebKit:
    
    	Used darin-inspired code factoring to fix 3000801 (alex doesn't accept drag of webloc file) in 3 places where we accept drags.
    
            * Misc.subproj/WebNSViewExtras.h:
            * Misc.subproj/WebNSViewExtras.m:
            (-[NSView _web_parentWebView]): no changes
            (-[NSView _web_acceptableDragTypes]): added
            (-[NSView _web_bestURLForDraggingInfo:]): added
            (-[NSView _web_dragOperationForDraggingInfo:]): added
            * WebKit.pbproj/project.pbxproj: made WebNSViewExtras.h public
            * WebView.subproj/WebView.m:
            (-[WebView initWithFrame:]): calls _web_acceptableDragTypes
            (-[WebView draggingEntered:]): calls _web_dragOperationForDraggingInfo
            (-[WebView concludeDragOperation:]): calls _web_bestURLForDraggingInfo
    
    WebBrowser:
    
    	Used darin-inspired code factoring to fix 3000801 (alex doesn't accept drag of webloc file)
    	in 3 places where we accept drags.
    
            * BrowserNSViewExtras.h:
            * BrowserNSViewExtras.m: removed locationField specific drag methods
            * LocationFieldEditor.m:
            (-[LocationFieldEditor acceptableDragTypes]): calls _web_acceptableDragTypes
            (-[LocationFieldEditor draggingEntered:]): calls _web_dragOperationForDraggingInfo
            (-[LocationFieldEditor draggingUpdated:]): calls _web_dragOperationForDraggingInfo
            (-[LocationFieldEditor concludeDragOperation:]): calls _web_bestURLForDraggingInfo
            * LocationTextField.m:
            (-[LocationTextField awakeFromNib]): calls _web_acceptableDragTypes
            (-[LocationTextField draggingEntered:]): calls _web_dragOperationForDraggingInfo
            (-[LocationTextField draggingUpdated:]): calls _web_dragOperationForDraggingInfo
            (-[LocationTextField concludeDragOperation:]): calls _web_bestURLForDraggingInfo
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@1620 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index b74acc1..3119d30 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,4 +1,19 @@
 2002-07-21  Chris Blumenberg  <cblu at apple.com>
+	Used darin-inspired code factoring to fix 3000801 (alex doesn't accept drag of webloc file) in 3 places where we accept drags.
+     
+        * Misc.subproj/WebNSViewExtras.h:
+        * Misc.subproj/WebNSViewExtras.m:
+        (-[NSView _web_parentWebView]): no changes
+        (-[NSView _web_acceptableDragTypes]): added
+        (-[NSView _web_bestURLForDraggingInfo:]): added
+        (-[NSView _web_dragOperationForDraggingInfo:]): added
+        * WebKit.pbproj/project.pbxproj: made WebNSViewExtras.h public
+        * WebView.subproj/WebView.m:
+        (-[WebView initWithFrame:]): calls _web_acceptableDragTypes
+        (-[WebView draggingEntered:]): calls _web_dragOperationForDraggingInfo
+        (-[WebView concludeDragOperation:]): calls _web_bestURLForDraggingInfo
+
+2002-07-21  Chris Blumenberg  <cblu at apple.com>
 
 	- We were loading icons when page loads ended in error. Fixed.
 	- Special-case file URLs once instead of twice by moving NSWorkspace
diff --git a/WebKit/ChangeLog-2002-12-03 b/WebKit/ChangeLog-2002-12-03
index b74acc1..3119d30 100644
--- a/WebKit/ChangeLog-2002-12-03
+++ b/WebKit/ChangeLog-2002-12-03
@@ -1,4 +1,19 @@
 2002-07-21  Chris Blumenberg  <cblu at apple.com>
+	Used darin-inspired code factoring to fix 3000801 (alex doesn't accept drag of webloc file) in 3 places where we accept drags.
+     
+        * Misc.subproj/WebNSViewExtras.h:
+        * Misc.subproj/WebNSViewExtras.m:
+        (-[NSView _web_parentWebView]): no changes
+        (-[NSView _web_acceptableDragTypes]): added
+        (-[NSView _web_bestURLForDraggingInfo:]): added
+        (-[NSView _web_dragOperationForDraggingInfo:]): added
+        * WebKit.pbproj/project.pbxproj: made WebNSViewExtras.h public
+        * WebView.subproj/WebView.m:
+        (-[WebView initWithFrame:]): calls _web_acceptableDragTypes
+        (-[WebView draggingEntered:]): calls _web_dragOperationForDraggingInfo
+        (-[WebView concludeDragOperation:]): calls _web_bestURLForDraggingInfo
+
+2002-07-21  Chris Blumenberg  <cblu at apple.com>
 
 	- We were loading icons when page loads ended in error. Fixed.
 	- Special-case file URLs once instead of twice by moving NSWorkspace
diff --git a/WebKit/Misc.subproj/WebNSViewExtras.h b/WebKit/Misc.subproj/WebNSViewExtras.h
index a7ceefc..6db9368 100644
--- a/WebKit/Misc.subproj/WebNSViewExtras.h
+++ b/WebKit/Misc.subproj/WebNSViewExtras.h
@@ -9,7 +9,22 @@
 
 @interface NSView (WebExtras)
 
+// Finds the first superview with the provided name. Returns nil if none is found.
 - (NSView *) _web_superviewWithName:(NSString *)viewName;
+
+// Returns the first WebView superview. Only works if self is the WebView's document view.
 - (WebView *)_web_parentWebView;
 
+// FIXME: The following can be class methods
+
+// Returns an array with NSURLPboardType, NSStringPboardType and NSFilenamesPboardType pasteboard types
+- (NSArray *)_web_acceptableDragTypes;
+
+// Finds the best URL from the NSURLPboardType, NSStringPboardType and NSFilenamesPboardType pasteboard types
+// and gives priority to http and https URLs
+- (NSURL *)_web_bestURLForDraggingInfo:(id <NSDraggingInfo>)sender;
+
+// Convenience method. Returns NSDragOperationCopy if _web_bestURLForDraggingInfo doesn't return nil.
+// Returns NSDragOperationNone otherwise.
+- (NSDragOperation)_web_dragOperationForDraggingInfo:(id <NSDraggingInfo>)sender;
 @end
diff --git a/WebKit/Misc.subproj/WebNSViewExtras.m b/WebKit/Misc.subproj/WebNSViewExtras.m
index ba6c9f4..7294d1c 100644
--- a/WebKit/Misc.subproj/WebNSViewExtras.m
+++ b/WebKit/Misc.subproj/WebNSViewExtras.m
@@ -3,9 +3,13 @@
         Copyright (c) 2002, Apple, Inc. All rights reserved.
 */
 
+#import <WebKit/WebController.h>
 #import <WebKit/WebNSViewExtras.h>
 #import <WebKit/WebView.h>
 
+#import <WebFoundation/WebNSStringExtras.h>
+#import <WebFoundation/WebNSURLExtras.h>
+
 #ifdef DEBUG_VIEWS
 @interface NSObject (Foo)
 - (void*)_renderFramePart;
@@ -39,6 +43,47 @@
     return nil;
 }
 
+- (NSArray *)_web_acceptableDragTypes
+{
+    return [NSArray arrayWithObjects:NSURLPboardType, NSStringPboardType, NSFilenamesPboardType, nil];
+}
+
+- (NSURL *)_web_bestURLForDraggingInfo:(id <NSDraggingInfo>)sender
+{
+    NSPasteboard *draggingPasteboard = [sender draggingPasteboard];        
+    NSURL *bestURL = [NSURL URLFromPasteboard:draggingPasteboard];
+    NSString *scheme = [bestURL scheme];
+    
+    if(!bestURL || ![scheme isEqualToString:@"http"] || ![scheme isEqualToString:@"https"]){
+
+        NSString *URLString = [draggingPasteboard stringForType:NSStringPboardType];
+        if(URLString && [URLString _web_looksLikeAbsoluteURL]){
+            bestURL = [NSURL _web_URLWithString:URLString];
+        }
+
+        if(!bestURL){
+            NSArray *files = [draggingPasteboard propertyListForType:NSFilenamesPboardType];
+            if(files && [files count] == 1){
+                NSString *file = [files objectAtIndex:0];
+                if([WebController canShowFile:file]){
+                    bestURL = [NSURL fileURLWithPath:file];
+                }
+            }
+        }
+    }
+
+    return bestURL;
+}
+
+- (NSDragOperation)_web_dragOperationForDraggingInfo:(id <NSDraggingInfo>)sender
+{
+    if([self _web_bestURLForDraggingInfo:sender]){
+        return NSDragOperationCopy;
+    } else {
+        return NSDragOperationNone;
+    }
+}
+
 #ifdef DEBUG_VIEWS
 - (void)_web_printViewHierarchy: (int)level
 {
diff --git a/WebKit/WebKit.pbproj/project.pbxproj b/WebKit/WebKit.pbproj/project.pbxproj
index 227ee80..c72f017 100644
--- a/WebKit/WebKit.pbproj/project.pbxproj
+++ b/WebKit/WebKit.pbproj/project.pbxproj
@@ -1316,6 +1316,9 @@
 			fileRef = F508946902B71D59018A9CD4;
 			isa = PBXBuildFile;
 			settings = {
+				ATTRIBUTES = (
+					Public,
+				);
 			};
 		};
 		F508946C02B71D59018A9CD4 = {
diff --git a/WebKit/WebView.subproj/WebFrameView.m b/WebKit/WebView.subproj/WebFrameView.m
index c18f8c7..f39bf26 100644
--- a/WebKit/WebView.subproj/WebFrameView.m
+++ b/WebKit/WebView.subproj/WebFrameView.m
@@ -20,9 +20,9 @@
 #import <WebKit/WebImageRendererFactory.h>
 #import <WebKit/WebCookieAdapter.h>
 #import <WebKit/WebKitStatisticsPrivate.h>
+#import <WebKit/WebNSViewExtras.h>
 
 #import <WebFoundation/WebNSDictionaryExtras.h>
-#import <WebFoundation/WebNSStringExtras.h>
 #import <WebFoundation/WebNSURLExtras.h>
 #import <WebFoundation/WebFoundation.h>
 
@@ -68,9 +68,7 @@ enum {
     [scrollView setAutoresizingMask: NSViewWidthSizable | NSViewHeightSizable];
     [self addSubview: scrollView];
     
-    _private->draggingTypes = [[NSArray arrayWithObjects:@"NSFilenamesPboardType", 
-                                    @"NSURLPboardType", @"NSStringPboardType", nil] retain];
-    [self registerForDraggedTypes:_private->draggingTypes];
+    [self registerForDraggedTypes:[self _web_acceptableDragTypes]];
     
     ++WebViewCount;
     
@@ -138,25 +136,7 @@ enum {
 
 - (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender
 {
-    NSString *dragType, *file, *URLString;
-    NSArray *files;
-        
-    dragType = [[sender draggingPasteboard] availableTypeFromArray:_private->draggingTypes];
-    if([dragType isEqualToString:@"NSFilenamesPboardType"]){
-        files = [[sender draggingPasteboard] propertyListForType:@"NSFilenamesPboardType"];
-        file = [files objectAtIndex:0];
-        
-        if([files count] == 1 && [WebController canShowFile:file])
-            return NSDragOperationCopy;
-            
-    }else if([dragType isEqualToString:@"NSURLPboardType"]){
-        return NSDragOperationCopy;
-    }else if([dragType isEqualToString:@"NSStringPboardType"]){
-        URLString = [[sender draggingPasteboard] stringForType:@"NSStringPboardType"];
-        if([URLString _web_looksLikeAbsoluteURL])
-            return NSDragOperationCopy;
-    }
-    return NSDragOperationNone;
+    return [self _web_dragOperationForDraggingInfo:sender];
 }
 
 - (BOOL)prepareForDragOperation:(id <NSDraggingInfo>)sender
@@ -171,33 +151,16 @@ enum {
 
 - (void)concludeDragOperation:(id <NSDraggingInfo>)sender
 {
-    WebDataSource *dataSource;
-    WebFrame *frame;
-    NSArray *files;
-    NSString *file, *dragType;
-    NSURL *URL=nil;
-
-    dragType = [[sender draggingPasteboard] availableTypeFromArray:_private->draggingTypes];
-    if([dragType isEqualToString:@"NSFilenamesPboardType"]){
-        files = [[sender draggingPasteboard] propertyListForType:@"NSFilenamesPboardType"];
-        file = [files objectAtIndex:0];
-        URL = [NSURL fileURLWithPath:file];
-    }else if([dragType isEqualToString:@"NSURLPboardType"]){
-        URL = [NSURL URLFromPasteboard:[sender draggingPasteboard]];
-    }else if([dragType isEqualToString:@"NSStringPboardType"]){
-        URL = [NSURL _web_URLWithString:[[sender draggingPasteboard] stringForType:@"NSStringPboardType"]];
-    }
+    NSURL *URL = [self _web_bestURLForDraggingInfo:sender];
 
-    if(!URL){
-        return;
-    }
-    
-    dataSource = [[WebDataSource alloc] initWithURL:URL];
-    frame = [[self controller] mainFrame];
-    if ([frame setProvisionalDataSource:dataSource]) {
-        [frame startLoading];
+    if(URL){
+        WebDataSource *dataSource = [[WebDataSource alloc] initWithURL:URL];
+        WebFrame *frame = [[self controller] mainFrame];
+        if ([frame setProvisionalDataSource:dataSource]){
+            [frame startLoading];
+        }
+        [dataSource release];
     }
-    [dataSource release];
 }
 
 + (void) registerViewClass:(Class)viewClass forMIMEType:(NSString *)MIMEType

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list