+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.
// 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>
- (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];
}
- (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
[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