[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:58:31 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 9e186994dcacc288d02d08ac3885b0614c7ac93b
Author: cblu <cblu at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Sat Nov 9 20:59:29 2002 +0000

    WebKit:
    
    	Fixed: 2991610 - Alexander should support services, including Speech
    
            * WebView.subproj/WebHTMLView.m:
            (+[WebHTMLView initialize]): register for service types
            (-[WebHTMLView dealloc]): moved to top of file
            (-[WebHTMLView copy:]): call _writeSelectionToPasteboard
            (-[WebHTMLView writeSelectionToPasteboard:types:]): call _writeSelectionToPasteboard
            (-[WebHTMLView validRequestorForSendType:returnType:]): return self for our pboard types
            * WebView.subproj/WebHTMLViewPrivate.h:
            * WebView.subproj/WebHTMLViewPrivate.m:
            (+[WebHTMLView _pasteboardTypes]): new, returns the array of supported pboard types
            (-[WebHTMLView _writeSelectionToPasteboard:]): new, adds data to pboard
            * WebView.subproj/WebImageView.m:
            (-[WebImageView initialize]): register for service types
            (-[WebImageView validateUserInterfaceItem:]): respond to copy
            (-[WebImageView validRequestorForSendType:returnType:]): return self for images
            (-[WebImageView writeImageToPasteboard:]): writes image data to pboard
            (-[WebImageView copy:]): calls writeImageToPasteboard
            (-[WebImageView writeSelectionToPasteboard:types:]): calls writeImageToPasteboard
    
    WebBrowser:
    
    	Open the URL in a new window as we do for other externally opened URLs.
    
            * ServicesProvider.m:
            (-[ServicesProvider openURL:userData:error:]):
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@2614 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index d8b99de..bd13d99 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,25 @@
+2002-11-09  Chris Blumenberg  <cblu at apple.com>
+
+	Fixed: 2991610 - Alexander should support services, including Speech
+
+        * WebView.subproj/WebHTMLView.m:
+        (+[WebHTMLView initialize]): register for service types
+        (-[WebHTMLView dealloc]): moved to top of file
+        (-[WebHTMLView copy:]): call _writeSelectionToPasteboard
+        (-[WebHTMLView writeSelectionToPasteboard:types:]): call _writeSelectionToPasteboard
+        (-[WebHTMLView validRequestorForSendType:returnType:]): return self for our pboard types
+        * WebView.subproj/WebHTMLViewPrivate.h:
+        * WebView.subproj/WebHTMLViewPrivate.m:
+        (+[WebHTMLView _pasteboardTypes]): new, returns the array of supported pboard types 
+        (-[WebHTMLView _writeSelectionToPasteboard:]): new, adds data to pboard
+        * WebView.subproj/WebImageView.m:
+        (-[WebImageView initialize]): register for service types
+        (-[WebImageView validateUserInterfaceItem:]): respond to copy
+        (-[WebImageView validRequestorForSendType:returnType:]): return self for images
+        (-[WebImageView writeImageToPasteboard:]): writes image data to pboard
+        (-[WebImageView copy:]): calls writeImageToPasteboard
+        (-[WebImageView writeSelectionToPasteboard:types:]): calls writeImageToPasteboard
+
 2002-11-08  Darin Adler  <darin at apple.com>
 
         * History.subproj/WebHistoryItem.m:
diff --git a/WebKit/ChangeLog-2002-12-03 b/WebKit/ChangeLog-2002-12-03
index d8b99de..bd13d99 100644
--- a/WebKit/ChangeLog-2002-12-03
+++ b/WebKit/ChangeLog-2002-12-03
@@ -1,3 +1,25 @@
+2002-11-09  Chris Blumenberg  <cblu at apple.com>
+
+	Fixed: 2991610 - Alexander should support services, including Speech
+
+        * WebView.subproj/WebHTMLView.m:
+        (+[WebHTMLView initialize]): register for service types
+        (-[WebHTMLView dealloc]): moved to top of file
+        (-[WebHTMLView copy:]): call _writeSelectionToPasteboard
+        (-[WebHTMLView writeSelectionToPasteboard:types:]): call _writeSelectionToPasteboard
+        (-[WebHTMLView validRequestorForSendType:returnType:]): return self for our pboard types
+        * WebView.subproj/WebHTMLViewPrivate.h:
+        * WebView.subproj/WebHTMLViewPrivate.m:
+        (+[WebHTMLView _pasteboardTypes]): new, returns the array of supported pboard types 
+        (-[WebHTMLView _writeSelectionToPasteboard:]): new, adds data to pboard
+        * WebView.subproj/WebImageView.m:
+        (-[WebImageView initialize]): register for service types
+        (-[WebImageView validateUserInterfaceItem:]): respond to copy
+        (-[WebImageView validRequestorForSendType:returnType:]): return self for images
+        (-[WebImageView writeImageToPasteboard:]): writes image data to pboard
+        (-[WebImageView copy:]): calls writeImageToPasteboard
+        (-[WebImageView writeSelectionToPasteboard:types:]): calls writeImageToPasteboard
+
 2002-11-08  Darin Adler  <darin at apple.com>
 
         * History.subproj/WebHistoryItem.m:
diff --git a/WebKit/WebView.subproj/WebHTMLView.m b/WebKit/WebView.subproj/WebHTMLView.m
index d8cedb8..8d72fae 100644
--- a/WebKit/WebView.subproj/WebHTMLView.m
+++ b/WebKit/WebView.subproj/WebHTMLView.m
@@ -49,6 +49,11 @@
 
 @implementation WebHTMLView
 
++(void)initialize
+{
+    [NSApp registerServicesMenuSendTypes:[[self class] _pasteboardTypes] returnTypes:nil];
+}
+
 - initWithFrame: (NSRect) frame
 {
     [super initWithFrame: frame];
@@ -63,13 +68,20 @@
     return self;
 }
 
+- (void)dealloc
+{
+    [self _reset];
+    [[NSNotificationCenter defaultCenter] removeObserver:self];
+    [_private release];
+    _private = nil;
+    [super dealloc];
+}
+
 - (BOOL)hasSelection
 {
     return [[[self _bridge] selectedText] length] != 0;
 }
 
-
-
 - (IBAction)takeFindStringFromSelection:(id)sender
 {
     NSPasteboard *findPasteboard;
@@ -88,29 +100,14 @@
 
 - (void)copy:(id)sender
 {
-    NSPasteboard *pboard = [NSPasteboard generalPasteboard];
-    NSAttributedString *attributedString;
-    NSData *attributedData;
-    WebBridge *b = [self _bridge];
-    
-#ifdef SUPPORT_HTML_PBOARD
-    [pboard declareTypes:[NSArray arrayWithObjects:NSStringPboardType, NSHTMLPboardType, NSRTFPboardType, nil] owner:nil];
-#endif
-    [pboard declareTypes:[NSArray arrayWithObjects:NSStringPboardType, NSRTFPboardType, nil] owner:nil];
-    [pboard setString:[b selectedText] forType:NSStringPboardType];
-    
-    // Put attributed string on the pasteboard.
-    attributedString = [b
-        attributedStringFrom: [b selectionStart] startOffset: [b selectionStartOffset]
-        to: [b selectionEnd] endOffset: [b selectionEndOffset]];
-    attributedData = [attributedString RTFFromRange:NSMakeRange(0, [attributedString length]) documentAttributes:nil];
-    [pboard setData:attributedData forType:NSRTFPboardType];
-
-#ifdef SUPPORT_HTML_PBOARD
-    // Put HTML on the pasteboard.
-#endif
+    [self _writeSelectionToPasteboard:[NSPasteboard generalPasteboard]];
 }
 
+- (BOOL)writeSelectionToPasteboard:(NSPasteboard *)pasteboard types:(NSArray *)types
+{
+    [self _writeSelectionToPasteboard:pasteboard];
+    return YES;
+}
 
 - (void)selectAll: sender
 {
@@ -137,14 +134,13 @@
     return YES;
 }
 
-
-- (void)dealloc 
+- (id)validRequestorForSendType:(NSString *)sendType returnType:(NSString *)returnType
 {
-    [self _reset];
-    [[NSNotificationCenter defaultCenter] removeObserver:self];
-    [_private release];
-    _private = nil;
-    [super dealloc];
+    if (sendType && ([[[self class] _pasteboardTypes] containsObject:sendType]) && [self hasSelection]){
+        return self;
+    }
+
+    return [super validRequestorForSendType:sendType returnType:returnType];
 }
 
 - (BOOL)acceptsFirstResponder
diff --git a/WebKit/WebView.subproj/WebHTMLViewPrivate.h b/WebKit/WebView.subproj/WebHTMLViewPrivate.h
index 25779f8..08f4ed2 100644
--- a/WebKit/WebView.subproj/WebHTMLViewPrivate.h
+++ b/WebKit/WebView.subproj/WebHTMLViewPrivate.h
@@ -57,4 +57,7 @@
 - (BOOL)_insideAnotherHTMLView;
 - (void)_updateMouseoverWithEvent:(NSEvent *)event;
 
++ (NSArray *)_pasteboardTypes;
+- (void)_writeSelectionToPasteboard:(NSPasteboard *)pasteboard;
+
 @end
diff --git a/WebKit/WebView.subproj/WebHTMLViewPrivate.m b/WebKit/WebView.subproj/WebHTMLViewPrivate.m
index 639c111..38c6a84 100644
--- a/WebKit/WebView.subproj/WebHTMLViewPrivate.m
+++ b/WebKit/WebView.subproj/WebHTMLViewPrivate.m
@@ -271,6 +271,37 @@ BOOL _modifierTrackingEnabled = FALSE;
     }
 }
 
++ (NSArray *)_pasteboardTypes
+{
+    return [NSArray arrayWithObjects:NSStringPboardType,
+#ifdef SUPPORT_HTML_PBOARD
+        NSHTMLPboardType,
+#endif
+        NSRTFPboardType, nil];
+}
+
+- (void)_writeSelectionToPasteboard:(NSPasteboard *)pasteboard
+{
+    NSAttributedString *attributedString;
+    NSData *attributedData;
+    WebBridge *b = [self _bridge];
+
+    [pasteboard declareTypes:[[self class] _pasteboardTypes] owner:nil];
+    [pasteboard setString:[b selectedText] forType:NSStringPboardType];
+
+    // Put attributed string on the pasteboard.
+    attributedString = [b attributedStringFrom:[b selectionStart]
+                                   startOffset:[b selectionStartOffset]
+                                            to:[b selectionEnd]
+                                     endOffset:[b selectionEndOffset]];
+    attributedData = [attributedString RTFFromRange:NSMakeRange(0, [attributedString length]) documentAttributes:nil];
+    [pasteboard setData:attributedData forType:NSRTFPboardType];
+
+#ifdef SUPPORT_HTML_PBOARD
+    // Put HTML on the pasteboard.
+#endif
+}
+
 @end
 
 @implementation NSView (WebHTMLViewPrivate)
diff --git a/WebKit/WebView.subproj/WebImageView.m b/WebKit/WebView.subproj/WebImageView.m
index fae1b5a..b1691e0 100644
--- a/WebKit/WebView.subproj/WebImageView.m
+++ b/WebKit/WebView.subproj/WebImageView.m
@@ -16,6 +16,11 @@
 
 @implementation WebImageView
 
+- (void)initialize
+{
+    [NSApp registerServicesMenuSendTypes:[NSArray arrayWithObject:NSTIFFPboardType] returnTypes:nil];
+}
+
 - (id)initWithFrame:(NSRect)frame
 {
     self = [super initWithFrame:frame];
@@ -101,6 +106,45 @@
     return [[self _web_parentWebView] controller];
 }
 
+- (BOOL)validateUserInterfaceItem:(id <NSValidatedUserInterfaceItem>)item
+{
+    if ([item action] == @selector(copy:)){
+        return ([representation image] != nil);
+    }
+
+    return YES;
+}
+
+- (id)validRequestorForSendType:(NSString *)sendType returnType:(NSString *)returnType
+{
+    if (sendType && [sendType isEqualToString:NSTIFFPboardType]){
+        return self;
+    }
+
+    return [super validRequestorForSendType:sendType returnType:returnType];
+}
+
+- (void)writeImageToPasteboard:(NSPasteboard *)pasteboard
+{
+    NSData *TIFFData = [[representation image] TIFFRepresentation];
+    
+    if(TIFFData){
+        [pasteboard declareTypes:[NSArray arrayWithObject:NSTIFFPboardType] owner:nil];
+        [pasteboard setData:TIFFData forType:NSTIFFPboardType];
+    }
+}
+
+- (void)copy:(id)sender
+{
+    [self writeImageToPasteboard:[NSPasteboard generalPasteboard]];
+}
+
+- (BOOL)writeSelectionToPasteboard:(NSPasteboard *)pasteboard types:(NSArray *)types
+{
+    [self writeImageToPasteboard:pasteboard];
+    return YES;
+}
+
 - (NSMenu *)menuForEvent:(NSEvent *)theEvent
 {
     WebView *webView = [self _web_parentWebView];

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list