Reviewed by Chris.
authorharrison <harrison@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 1 Mar 2005 21:53:55 +0000 (21:53 +0000)
committerharrison <harrison@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 1 Mar 2005 21:53:55 +0000 (21:53 +0000)
        <rdar://problem/3915560> Mail would like an SPI to enable "smart" text paste/drop

        * WebView.subproj/WebHTMLView.m:
        (-[WebHTMLView _smartDeleteRangeForProposedRange:]):
        (-[WebHTMLView _smartInsertForString:replacingRange:beforeString:afterString:]):
        New.

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

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

index 2dc4488da96ebb6cf7fddfe7ede2b2ab892eae58..11bbc87fe6ab94a176e33f3104f56604b37423ba 100644 (file)
@@ -1,3 +1,14 @@
+2005-03-01  David Harrison  <harrison@apple.com>
+
+        Reviewed by Chris.
+        
+        <rdar://problem/3915560> Mail would like an SPI to enable "smart" text paste/drop
+
+        * WebView.subproj/WebHTMLView.m:
+        (-[WebHTMLView _smartDeleteRangeForProposedRange:]):
+        (-[WebHTMLView _smartInsertForString:replacingRange:beforeString:afterString:]):
+        New.
+
 2005-02-28  John Sullivan  <sullivan@apple.com>
 
         Reviewed by Ken.
index 62a156afedcd432deccb61c907ace89e72972823..c215c171515c6a9b30779fafee1fc813c1580740 100644 (file)
@@ -4702,6 +4702,27 @@ static DOMRange *unionDOMRanges(DOMRange *a, DOMRange *b)
     return [[self _webView] smartInsertDeleteEnabled] && [[self _bridge] selectionGranularity] == WebSelectByWord;
 }
 
+- (DOMRange *)_smartDeleteRangeForProposedRange:(DOMRange *)proposedRange
+{
+    if (proposedRange == nil || [self _canSmartCopyOrDelete] == NO)
+        return nil;
+    
+    return [[self _bridge] smartDeleteRangeForProposedRange:proposedRange];
+}
+
+- (void)_smartInsertForString:(NSString *)pasteString replacingRange:(DOMRange *)rangeToReplace beforeString:(NSString **)beforeString afterString:(NSString **)afterString
+{
+    if (pasteString == nil || rangeToReplace == nil || [[self _webView] smartInsertDeleteEnabled] == NO) {
+        if (beforeString)
+            *beforeString = nil;
+        if (afterString)
+            *afterString = nil;
+        return;
+    }
+    
+    [[self _bridge] smartInsertForString:pasteString replacingRange:rangeToReplace beforeString:beforeString afterString:afterString];
+}
+
 - (BOOL)_wasFirstResponderAtMouseDownTime:(NSResponder *)responder
 {
     return responder == _private->firstResponderAtMouseDownTime;