LayoutTests:
authorjusting <justing@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 18 Oct 2006 19:22:45 +0000 (19:22 +0000)
committerjusting <justing@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 18 Oct 2006 19:22:45 +0000 (19:22 +0000)
        Reviewed by harrison

        <rdar://problem/4765600>
        REGRESSION: Mail.app: smart deletion of words does not work

        * editing/deleting/smart-delete-003-expected.checksum: Added.
        * editing/deleting/smart-delete-003-expected.png: Added.
        * editing/deleting/smart-delete-003-expected.txt: Added.
        * editing/deleting/smart-delete-003.html: Added.
        * editing/deleting/smart-delete-004-expected.checksum: Added.
        * editing/deleting/smart-delete-004-expected.png: Added.
        * editing/deleting/smart-delete-004-expected.txt: Added.
        * editing/deleting/smart-delete-004.html: Added.

WebKit:

        Reviewed by harrison

        <rdar://problem/4765600>
        REGRESSION: Mail.app: smart deletion of words does not work

        Regressed when we pushed selecion expansion down into WebCore.  It's OK
        to try a smart delete from _deleteWithDirection:, which is called by
        deleteFoward: and deleteBackward: if the current selection is a
        range.

        * WebView/WebHTMLView.m:
        (-[NSArray _deleteWithDirection:granularity:killRing:isTypingAction:]):

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

LayoutTests/ChangeLog
LayoutTests/editing/deleting/smart-delete-003-expected.checksum [new file with mode: 0644]
LayoutTests/editing/deleting/smart-delete-003-expected.png [new file with mode: 0644]
LayoutTests/editing/deleting/smart-delete-003-expected.txt [new file with mode: 0644]
LayoutTests/editing/deleting/smart-delete-003.html [new file with mode: 0644]
LayoutTests/editing/deleting/smart-delete-004-expected.checksum [new file with mode: 0644]
LayoutTests/editing/deleting/smart-delete-004-expected.png [new file with mode: 0644]
LayoutTests/editing/deleting/smart-delete-004-expected.txt [new file with mode: 0644]
LayoutTests/editing/deleting/smart-delete-004.html [new file with mode: 0644]
WebKit/ChangeLog
WebKit/WebView/WebHTMLView.m

index ea7a70e836e27daaf8274a3e8204fbba79c9aa11..9862b9f8c750e52c7a125f9dbfefffeb0daaa416 100644 (file)
@@ -1,3 +1,19 @@
+2006-10-17  Justin Garcia  <justin.garcia@apple.com>
+
+        Reviewed by harrison
+
+        <rdar://problem/4765600>
+        REGRESSION: Mail.app: smart deletion of words does not work
+
+        * editing/deleting/smart-delete-003-expected.checksum: Added.
+        * editing/deleting/smart-delete-003-expected.png: Added.
+        * editing/deleting/smart-delete-003-expected.txt: Added.
+        * editing/deleting/smart-delete-003.html: Added.
+        * editing/deleting/smart-delete-004-expected.checksum: Added.
+        * editing/deleting/smart-delete-004-expected.png: Added.
+        * editing/deleting/smart-delete-004-expected.txt: Added.
+        * editing/deleting/smart-delete-004.html: Added.
+        
 2006-10-18  Adam Roben  <aroben@apple.com>
 
         Reviewed by Maciej.
diff --git a/LayoutTests/editing/deleting/smart-delete-003-expected.checksum b/LayoutTests/editing/deleting/smart-delete-003-expected.checksum
new file mode 100644 (file)
index 0000000..304c4b1
--- /dev/null
@@ -0,0 +1 @@
+63468c9c237c04e458fae3bbc7a1c2a6
\ No newline at end of file
diff --git a/LayoutTests/editing/deleting/smart-delete-003-expected.png b/LayoutTests/editing/deleting/smart-delete-003-expected.png
new file mode 100644 (file)
index 0000000..3770b41
Binary files /dev/null and b/LayoutTests/editing/deleting/smart-delete-003-expected.png differ
diff --git a/LayoutTests/editing/deleting/smart-delete-003-expected.txt b/LayoutTests/editing/deleting/smart-delete-003-expected.txt
new file mode 100644 (file)
index 0000000..a07a0af
--- /dev/null
@@ -0,0 +1,25 @@
+EDITING DELEGATE: shouldBeginEditingInDOMRange:range from 0 of DIV > BODY > HTML > #document to 1 of DIV > BODY > HTML > #document
+EDITING DELEGATE: webViewDidBeginEditing:WebViewDidBeginEditingNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldDeleteDOMRange:range from 4 of #text > DIV > BODY > HTML > #document to 7 of #text > DIV > BODY > HTML > #document
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 4 of #text > DIV > BODY > HTML > #document to 7 of #text > DIV > BODY > HTML > #document toDOMRange:range from 3 of #text > DIV > BODY > HTML > #document to 3 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (8,8) size 784x584
+      RenderBlock {P} at (0,0) size 784x36
+        RenderText {#text} at (0,0) size 768x36
+          text run at (0,0) width 392: "This tests deleting a selection created with a word granularity. "
+          text run at (392,0) width 348: "To run it manually, double click on 'bar' and hit delete. "
+          text run at (740,0) width 28: "You"
+          text run at (0,18) width 125: "should see 'foo bar'."
+      RenderBlock {DIV} at (0,52) size 784x18
+        RenderText {#text} at (0,0) size 47x18
+          text run at (0,0) width 47: "foo baz"
+caret: position 3 of child 0 {#text} of child 2 {DIV} of child 0 {BODY} of child 0 {HTML} of document
diff --git a/LayoutTests/editing/deleting/smart-delete-003.html b/LayoutTests/editing/deleting/smart-delete-003.html
new file mode 100644 (file)
index 0000000..281bb80
--- /dev/null
@@ -0,0 +1,15 @@
+<p>This tests deleting a selection created with a word granularity.  To run it manually, double click on 'bar' and hit delete.  You should see 'foo bar'.</p>
+<div id="div" contenteditable="true">foo bar baz</div>
+
+<script>
+if (window.layoutTestController) {
+    var div = document.getElementById("div");
+    var sel = window.getSelection();
+    
+    sel.setPosition(div, 0);
+    sel.modify("move", "forward", "word");
+    sel.modify("move", "forward", "word");
+    sel.modify("extend", "backward", "word");
+    textInputController.doCommand("deleteBackward:");
+}
+</script>
diff --git a/LayoutTests/editing/deleting/smart-delete-004-expected.checksum b/LayoutTests/editing/deleting/smart-delete-004-expected.checksum
new file mode 100644 (file)
index 0000000..99219f4
--- /dev/null
@@ -0,0 +1 @@
+cdfd56093cf3801b073bd1297242add8
\ No newline at end of file
diff --git a/LayoutTests/editing/deleting/smart-delete-004-expected.png b/LayoutTests/editing/deleting/smart-delete-004-expected.png
new file mode 100644 (file)
index 0000000..789abfe
Binary files /dev/null and b/LayoutTests/editing/deleting/smart-delete-004-expected.png differ
diff --git a/LayoutTests/editing/deleting/smart-delete-004-expected.txt b/LayoutTests/editing/deleting/smart-delete-004-expected.txt
new file mode 100644 (file)
index 0000000..41ad1dd
--- /dev/null
@@ -0,0 +1,25 @@
+EDITING DELEGATE: shouldBeginEditingInDOMRange:range from 0 of DIV > BODY > HTML > #document to 1 of DIV > BODY > HTML > #document
+EDITING DELEGATE: webViewDidBeginEditing:WebViewDidBeginEditingNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldDeleteDOMRange:range from 4 of #text > DIV > BODY > HTML > #document to 7 of #text > DIV > BODY > HTML > #document
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 4 of #text > DIV > BODY > HTML > #document to 7 of #text > DIV > BODY > HTML > #document toDOMRange:range from 3 of #text > DIV > BODY > HTML > #document to 3 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (8,8) size 784x584
+      RenderBlock {P} at (0,0) size 784x36
+        RenderText {#text} at (0,0) size 745x36
+          text run at (0,0) width 392: "This tests deleting a selection created with a word granularity. "
+          text run at (392,0) width 353: "To run it manually, double click on 'bar' and hit forward"
+          text run at (0,18) width 45: "delete. "
+          text run at (45,18) width 157: "You should see 'foo bar'."
+      RenderBlock {DIV} at (0,52) size 784x18
+        RenderText {#text} at (0,0) size 47x18
+          text run at (0,0) width 47: "foo baz"
+caret: position 3 of child 0 {#text} of child 2 {DIV} of child 0 {BODY} of child 0 {HTML} of document
diff --git a/LayoutTests/editing/deleting/smart-delete-004.html b/LayoutTests/editing/deleting/smart-delete-004.html
new file mode 100644 (file)
index 0000000..83279b0
--- /dev/null
@@ -0,0 +1,15 @@
+<p>This tests deleting a selection created with a word granularity.  To run it manually, double click on 'bar' and hit forward delete.  You should see 'foo bar'.</p>
+<div id="div" contenteditable="true">foo bar baz</div>
+
+<script>
+if (window.layoutTestController) {
+    var div = document.getElementById("div");
+    var sel = window.getSelection();
+    
+    sel.setPosition(div, 0);
+    sel.modify("move", "forward", "word");
+    sel.modify("move", "forward", "word");
+    sel.modify("extend", "backward", "word");
+    textInputController.doCommand("deleteForward:");
+}
+</script>
index cbebfce459b9243166ef724e913910dd9dde847c..e76e5243da3b5e767bb3d14352ac562f89f6d3b7 100644 (file)
@@ -1,3 +1,18 @@
+2006-10-17  Justin Garcia  <justin.garcia@apple.com>
+
+        Reviewed by harrison
+        
+        <rdar://problem/4765600>
+        REGRESSION: Mail.app: smart deletion of words does not work
+        
+        Regressed when we pushed selecion expansion down into WebCore.  It's OK
+        to try a smart delete from _deleteWithDirection:, which is called by
+        deleteFoward: and deleteBackward: if the current selection is a 
+        range.
+    
+        * WebView/WebHTMLView.m:
+        (-[NSArray _deleteWithDirection:granularity:killRing:isTypingAction:]):
+
 2006-10-13  Justin Garcia  <justin.garcia@apple.com>
 
         Reviewed by harrison
index be6932962d0687a118800bb8a7224e2793a84bf0..3352fe6e63b4c96444f3d00ed7aaf1d2801feb9e 100644 (file)
@@ -4319,15 +4319,16 @@ NSStrokeColorAttributeName        /* NSColor, default nil: same as foreground co
     if (![self _canEdit])
         return NO;
 
-    DOMRange *range;
+    DOMRange *range = [self _selectedRange];
     WebDeletionAction deletionAction = deleteSelectionAction;
 
+    BOOL smartDeleteOK = NO;
+    
     if ([self _hasSelection]) {
-        range = [self _selectedRange];
+        smartDeleteOK = YES;
         if (isTypingAction)
             deletionAction = deleteKeyAction;
     } else {
-        range = [self _selectedRange];
         switch (direction) {
             case WebBridgeSelectForward:
             case WebBridgeSelectRight:
@@ -4342,7 +4343,7 @@ NSStrokeColorAttributeName        /* NSColor, default nil: same as foreground co
 
     if (range == nil)
         return NO;
-    [self _deleteRange:range killRing:killRing prepend:NO smartDeleteOK:NO deletionAction:deletionAction granularity:granularity];
+    [self _deleteRange:range killRing:killRing prepend:NO smartDeleteOK:smartDeleteOK deletionAction:deletionAction granularity:granularity];
     return YES;
 }