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


The following commit has been merged in the debian/unstable branch:
commit 9ca491767fe2e225d675caebf5c472a76a2580a7
Author: cblu <cblu at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Jun 1 20:53:33 2004 +0000

    WebCore:
    
            Reviewed by kocienda.
    
            * kwq/WebCoreBridge.h:
            * kwq/WebCoreBridge.mm:
            (-[WebCoreBridge dragCaretDOMRange]): new, lets WebKit pass the drag caret DOM range to the editing delegate
    
    WebKit:
    
    	Made paste and drop ask the delegate before making any replacements.
    
            Reviewed by kocienda.
    
            * WebView.subproj/WebHTMLView.m:
            (-[WebHTMLView _pasteWithPasteboard:allowPlainText:]): renamed, now calls _shouldInsertFragment:replacingDOMRange:givenAction:
            (-[WebHTMLView _shouldInsertFragment:replacingDOMRange:givenAction:]): new, asks delegate
            (-[WebHTMLView concludeDragForDraggingInfo:]): now calls _shouldInsertFragment:replacingDOMRange:givenAction:
            (-[WebHTMLView paste:]): call renamed _pasteWithPasteboard:allowPlainText:
            (-[WebHTMLView pasteAsRichText:]): ditto
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@6734 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 6ff9c6d..4bd7b97 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,11 @@
+2004-06-01  Chris Blumenberg  <cblu at apple.com>
+
+        Reviewed by kocienda.
+
+        * kwq/WebCoreBridge.h:
+        * kwq/WebCoreBridge.mm:
+        (-[WebCoreBridge dragCaretDOMRange]): new, lets WebKit pass the drag caret DOM range to the editing delegate
+
 2004-05-28  John Louch  <ouch at apple.com>
 
         Reviewed by gramps.
diff --git a/WebCore/kwq/WebCoreBridge.h b/WebCore/kwq/WebCoreBridge.h
index f7f34bb..cbbc553 100644
--- a/WebCore/kwq/WebCoreBridge.h
+++ b/WebCore/kwq/WebCoreBridge.h
@@ -307,6 +307,7 @@ typedef enum {
 - (void)moveSelectionToDragCaret:(DOMDocumentFragment *)selectionFragment;
 - (void)moveDragCaretToPoint:(NSPoint)point;
 - (void)removeDragCaret;
+- (DOMRange *)dragCaretDOMRange;
 
 - (void)deleteSelection;
 - (void)deleteKeyPressed;
diff --git a/WebCore/kwq/WebCoreBridge.mm b/WebCore/kwq/WebCoreBridge.mm
index 6ea0c55..5d893d4 100644
--- a/WebCore/kwq/WebCoreBridge.mm
+++ b/WebCore/kwq/WebCoreBridge.mm
@@ -1518,6 +1518,11 @@ static HTMLFormElementImpl *formElementFromDOMElement(DOMElement *element)
     _part->setDragCaret(Selection());
 }
 
+- (DOMRange *)dragCaretDOMRange
+{
+    return [DOMRange _rangeWithImpl:_part->dragCaret().toRange().handle()];
+}
+
 - (void)deleteSelection
 {
     if (!_part || !_part->xmlDocImpl())
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 98eb522..e4a0261 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,16 @@
+2004-06-01  Chris Blumenberg  <cblu at apple.com>
+
+	Made paste and drop ask the delegate before making any replacements.
+
+        Reviewed by kocienda.
+
+        * WebView.subproj/WebHTMLView.m:
+        (-[WebHTMLView _pasteWithPasteboard:allowPlainText:]): renamed, now calls _shouldInsertFragment:replacingDOMRange:givenAction:
+        (-[WebHTMLView _shouldInsertFragment:replacingDOMRange:givenAction:]): new, asks delegate
+        (-[WebHTMLView concludeDragForDraggingInfo:]): now calls _shouldInsertFragment:replacingDOMRange:givenAction:
+        (-[WebHTMLView paste:]): call renamed _pasteWithPasteboard:allowPlainText:
+        (-[WebHTMLView pasteAsRichText:]): ditto
+
 2004-05-28  Darin Adler  <darin at apple.com>
 
         Reviewed by Maciej.
diff --git a/WebKit/WebView.subproj/WebHTMLView.m b/WebKit/WebView.subproj/WebHTMLView.m
index 2594d37..2112c37 100644
--- a/WebKit/WebView.subproj/WebHTMLView.m
+++ b/WebKit/WebView.subproj/WebHTMLView.m
@@ -87,7 +87,8 @@ static BOOL forceRealHitTest = NO;
 
 @interface WebHTMLView (WebFileInternal)
 - (DOMDocumentFragment *)_documentFragmentFromPasteboard:(NSPasteboard *)pasteboard allowPlainText:(BOOL)allowPlainText;
-- (void)_replaceSelectionWithPasteboard:(NSPasteboard *)pasteboard selectReplacement:(BOOL)selectReplacement allowPlainText:(BOOL)allowPlainText;
+- (void)_pasteWithPasteboard:(NSPasteboard *)pasteboard allowPlainText:(BOOL)allowPlainText;
+- (BOOL)_shouldInsertFragment:(DOMDocumentFragment *)fragment replacingDOMRange:(DOMRange *)range givenAction:(WebViewInsertAction)action;
 @end
 
 @interface WebHTMLView (WebHTMLViewPrivate)
@@ -212,11 +213,23 @@ static WebElementOrTextFilter *elementOrTextFilterInstance = nil;
     return nil;
 }
 
-- (void)_replaceSelectionWithPasteboard:(NSPasteboard *)pasteboard selectReplacement:(BOOL)selectReplacement allowPlainText:(BOOL)allowPlainText
+- (void)_pasteWithPasteboard:(NSPasteboard *)pasteboard allowPlainText:(BOOL)allowPlainText
 {
     DOMDocumentFragment *fragment = [self _documentFragmentFromPasteboard:pasteboard allowPlainText:allowPlainText];
-    if (fragment) {
-        [[self _bridge] replaceSelectionWithFragment:fragment selectReplacement:selectReplacement];
+    WebBridge *bridge = [self _bridge];
+    if (fragment && [self _shouldInsertFragment:fragment replacingDOMRange:[bridge selectedDOMRange] givenAction:WebViewInsertActionPasted]) {
+        [bridge replaceSelectionWithFragment:fragment selectReplacement:NO];
+    }
+}
+
+- (BOOL)_shouldInsertFragment:(DOMDocumentFragment *)fragment replacingDOMRange:(DOMRange *)range givenAction:(WebViewInsertAction)action
+{
+    WebView *webView = [self _webView];
+    DOMNode *child = [fragment firstChild];
+    if ([fragment lastChild] == child && [child isKindOfClass:[DOMCharacterData class]]) {
+        return [[webView _editingDelegateForwarder] webView:webView shouldInsertText:[(DOMCharacterData *)child data] replacingDOMRange:range givenAction:action];
+    } else {
+        return [[webView _editingDelegateForwarder] webView:webView shouldInsertNode:fragment replacingDOMRange:range givenAction:action];
     }
 }
 
@@ -890,7 +903,6 @@ static WebHTMLView *lastHitView = nil;
     [timer release];
 }
 
-
 - (void)_autoscroll
 {
     int isStillDown;
@@ -1751,14 +1763,16 @@ static WebHTMLView *lastHitView = nil;
     } else {
         BOOL didInsert = NO;
         if ([self _canProcessDragWithDraggingInfo:draggingInfo] && [[self _webView] _webKitDragRespondsToDragging]) {
-            if (_private->initiatedDrag && [[self _bridge] isSelectionEditable]) {
-                DOMDocumentFragment *fragment = [self _documentFragmentFromPasteboard:[draggingInfo draggingPasteboard] allowPlainText:YES];
-                [bridge moveSelectionToDragCaret:fragment];
-            } else {
-                [bridge setSelectionToDragCaret];
-                [self _replaceSelectionWithPasteboard:[draggingInfo draggingPasteboard] selectReplacement:YES allowPlainText:YES];
+            DOMDocumentFragment *fragment = [self _documentFragmentFromPasteboard:[draggingInfo draggingPasteboard] allowPlainText:YES];
+            if (fragment && [self _shouldInsertFragment:fragment replacingDOMRange:[bridge dragCaretDOMRange] givenAction:WebViewInsertActionDropped]) {
+                if (_private->initiatedDrag && [bridge isSelectionEditable]) {
+                    [bridge moveSelectionToDragCaret:fragment];
+                } else {
+                    [bridge setSelectionToDragCaret];
+                    [bridge replaceSelectionWithFragment:fragment selectReplacement:YES];
+                }
+                didInsert = YES;
             }
-            didInsert = YES;
         }
         [bridge removeDragCaret];
         return didInsert;
@@ -2318,7 +2332,7 @@ static WebHTMLView *lastHitView = nil;
 
 - (void)paste:(id)sender
 {
-    [self _replaceSelectionWithPasteboard:[NSPasteboard generalPasteboard] selectReplacement:NO allowPlainText:YES];
+    [self _pasteWithPasteboard:[NSPasteboard generalPasteboard] allowPlainText:YES];
 }
 
 - (void)copyFont:(id)sender
@@ -2343,7 +2357,7 @@ static WebHTMLView *lastHitView = nil;
 
 - (void)pasteAsRichText:(id)sender
 {
-    [self _replaceSelectionWithPasteboard:[NSPasteboard generalPasteboard] selectReplacement:NO allowPlainText:NO];
+    [self _pasteWithPasteboard:[NSPasteboard generalPasteboard] allowPlainText:NO];
 }
 
 - (DOMCSSStyleDeclaration *)_fontManagerOperationAsStyle

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list