Fixed: <rdar://problem/3802232> REGRESSION (Mail): WebCore Editing must do smart...
authorcblu <cblu@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 15 Sep 2004 18:26:35 +0000 (18:26 +0000)
committercblu <cblu@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 15 Sep 2004 18:26:35 +0000 (18:26 +0000)
        Reviewed by kocienda.

        * WebView.subproj/WebHTMLView.m:
        (-[WebHTMLView _writeSelectionToPasteboard:]): call instance method not class method to get pasteboard types since the types depends on the current selection granularity
        (-[WebHTMLView pasteboardTypesForSelection]): if the selection granularity is "word" include the smart pasteboard type
        (-[WebHTMLView writeSelectionWithPasteboardTypes:toPasteboard:]): put nil on the pasteboard for smart copy

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@7572 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebKit/ChangeLog
WebKit/WebView.subproj/WebHTMLView.m

index f99f7eb4e9531de3b8097c59c17657a4b5663835..6699b5002e5b3441b58155f465b861c626695c3a 100644 (file)
@@ -1,3 +1,14 @@
+2004-09-15  Chris Blumenberg  <cblu@apple.com>
+
+       Fixed: <rdar://problem/3802232> REGRESSION (Mail): WebCore Editing must do smart copy
+       
+        Reviewed by kocienda.
+
+        * WebView.subproj/WebHTMLView.m:
+        (-[WebHTMLView _writeSelectionToPasteboard:]): call instance method not class method to get pasteboard types since the types depends on the current selection granularity
+        (-[WebHTMLView pasteboardTypesForSelection]): if the selection granularity is "word" include the smart pasteboard type
+        (-[WebHTMLView writeSelectionWithPasteboardTypes:toPasteboard:]): put nil on the pasteboard for smart copy
+
 2004-09-14  Darin Adler  <darin@apple.com>
 
         Reviewed by Maciej.
index 7f07a1f4dcd59b86071d20e4785cbda2b08788ad..4ad97562b5d9383da71a06b68ab5d044c8b4d013 100644 (file)
@@ -124,6 +124,9 @@ void _NSResetKillRingOperationFlag(void);
 // Any non-zero value will do, but using something recognizable might help us debug some day.
 #define TRACKING_RECT_TAG 0xBADFACE
 
+// FIXME: This constant is copied from AppKit's _NXSmartPaste constant.
+#define WebSmartPastePboardType @"NeXT smart paste pasteboard type"
+
 static BOOL forceRealHitTest = NO;
 
 @interface WebHTMLView (WebTextSizing) <_web_WebDocumentTextSizing>
@@ -788,7 +791,7 @@ static WebHTMLView *lastHitView = nil;
 - (void)_writeSelectionToPasteboard:(NSPasteboard *)pasteboard
 {
     ASSERT([self _hasSelection]);
-    NSArray *types = [[self class] _selectionPasteboardTypes];
+    NSArray *types = [self pasteboardTypesForSelection];
     [pasteboard declareTypes:types owner:nil];
     [self writeSelectionWithPasteboardTypes:types toPasteboard:pasteboard];
 }
@@ -1353,7 +1356,13 @@ static WebHTMLView *lastHitView = nil;
 
 - (NSArray *)pasteboardTypesForSelection
 {
-    return [[self class] _selectionPasteboardTypes];
+    if ([[self _bridge] selectionGranularity] == WebSelectByWord) {
+        NSMutableArray *types = [[[[self class] _selectionPasteboardTypes] mutableCopy] autorelease];
+        [types addObject:WebSmartPastePboardType];
+        return types;
+    } else {
+        return [[self class] _selectionPasteboardTypes];
+    }
 }
 
 - (void)writeSelectionWithPasteboardTypes:(NSArray *)types toPasteboard:(NSPasteboard *)pasteboard
@@ -1388,6 +1397,10 @@ static WebHTMLView *lastHitView = nil;
         [pasteboard setString:s forType:NSStringPboardType];
         [s release];
     }
+    
+    if ([types containsObject:WebSmartPastePboardType] && [[self _bridge] selectionGranularity] == WebSelectByWord) {
+        [pasteboard setData:nil forType:WebSmartPastePboardType];
+    }
 }
 
 - (BOOL)writeSelectionToPasteboard:(NSPasteboard *)pasteboard types:(NSArray *)types