LayoutTests:
authorharrison <harrison@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 20 Dec 2006 15:40:34 +0000 (15:40 +0000)
committerharrison <harrison@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 20 Dec 2006 15:40:34 +0000 (15:40 +0000)
        Reviewed by John Sullivan.

        Test for <rdar://problem/4570218> REGRESSION (?-10.4.7): cntl-K only works the first time

        * editing/deleting/delete-to-end-of-paragraph-expected.checksum: Added.
        * editing/deleting/delete-to-end-of-paragraph-expected.png: Added.
        * editing/deleting/delete-to-end-of-paragraph-expected.txt: Added.
        * editing/deleting/delete-to-end-of-paragraph.html: Added.

WebCore:

        Reviewed by John Sullivan.

        <rdar://problem/4570218> REGRESSION (?-10.4.7): cntl-K only works the first time

        Test:
        * editing/deleting/delete-to-end-of-paragraph.html

        * editing/TypingCommand.cpp:
        (WebCore::TypingCommand::forwardDeleteKeyPressed):
        If the selection was a caret at the end of the paragraph, extend selection so it wraps to the start of next paragraph (if any),

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

LayoutTests/ChangeLog
LayoutTests/editing/deleting/delete-to-end-of-paragraph-expected.checksum [new file with mode: 0644]
LayoutTests/editing/deleting/delete-to-end-of-paragraph-expected.png [new file with mode: 0644]
LayoutTests/editing/deleting/delete-to-end-of-paragraph-expected.txt [new file with mode: 0644]
LayoutTests/editing/deleting/delete-to-end-of-paragraph.html [new file with mode: 0644]
WebCore/ChangeLog
WebCore/editing/TypingCommand.cpp

index 3de8a8b..e5bc01e 100644 (file)
@@ -1,3 +1,14 @@
+2006-12-20  David Harrison  <harrison@apple.com>
+
+        Reviewed by John Sullivan.
+
+        Test for <rdar://problem/4570218> REGRESSION (?-10.4.7): cntl-K only works the first time
+
+        * editing/deleting/delete-to-end-of-paragraph-expected.checksum: Added.
+        * editing/deleting/delete-to-end-of-paragraph-expected.png: Added.
+        * editing/deleting/delete-to-end-of-paragraph-expected.txt: Added.
+        * editing/deleting/delete-to-end-of-paragraph.html: Added.
+
 2006-12-20  David Kilzer  <ddkilzer@kilzer.net>
 
         Reviewed by Darin.
diff --git a/LayoutTests/editing/deleting/delete-to-end-of-paragraph-expected.checksum b/LayoutTests/editing/deleting/delete-to-end-of-paragraph-expected.checksum
new file mode 100644 (file)
index 0000000..5f74020
--- /dev/null
@@ -0,0 +1 @@
+129b5e901892fd77f7b72ace3277bec7
\ No newline at end of file
diff --git a/LayoutTests/editing/deleting/delete-to-end-of-paragraph-expected.png b/LayoutTests/editing/deleting/delete-to-end-of-paragraph-expected.png
new file mode 100644 (file)
index 0000000..c9b3bf6
Binary files /dev/null and b/LayoutTests/editing/deleting/delete-to-end-of-paragraph-expected.png differ
diff --git a/LayoutTests/editing/deleting/delete-to-end-of-paragraph-expected.txt b/LayoutTests/editing/deleting/delete-to-end-of-paragraph-expected.txt
new file mode 100644 (file)
index 0000000..ed37ce1
--- /dev/null
@@ -0,0 +1,23 @@
+EDITING DELEGATE: shouldBeginEditingInDOMRange:range from 0 of BODY > HTML > #document to 5 of BODY > HTML > #document
+EDITING DELEGATE: webViewDidBeginEditing:WebViewDidBeginEditingNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldDeleteDOMRange:range from 0 of #text > DIV > BODY > HTML > #document to 13 of #text > DIV > BODY > HTML > #document
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 0 of DIV > BODY > HTML > #document to 0 of DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+EDITING DELEGATE: shouldDeleteDOMRange:range from 0 of DIV > BODY > HTML > #document to 0 of DIV > BODY > HTML > #document
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 0 of DIV > BODY > HTML > #document to 0 of 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 {DIV} at (0,0) size 600x18
+        RenderInline {SPAN} at (0,0) size 76x18
+          RenderText {#text} at (0,0) size 76x18
+            text run at (0,0) width 76: "four five six"
+caret: position 0 of child 0 {#text} of child 0 {SPAN} of child 1 {DIV} of child 1 {BODY} of child 0 {HTML} of document
diff --git a/LayoutTests/editing/deleting/delete-to-end-of-paragraph.html b/LayoutTests/editing/deleting/delete-to-end-of-paragraph.html
new file mode 100644 (file)
index 0000000..8ac332c
--- /dev/null
@@ -0,0 +1,41 @@
+<html>
+<head>
+
+<style>
+.editing { 
+    font-size: 24px; 
+    width: 600px; 
+}
+</style>
+<script src=../editing.js language="JavaScript" type="text/JavaScript" ></script>
+
+<script>
+
+function editingTest() {
+    if (window.layoutTestController) {
+        
+        try {
+            // test for 4570218 by using double deleteToEndOfParagraph
+            textInputController.doCommand("deleteToEndOfParagraph:");    
+            textInputController.doCommand("deleteToEndOfParagraph:");    
+
+        } catch (ex) {
+            document.write("Exception: " + ex.description);
+        }
+    } else {
+        document.write("(cannot run interactively)");
+    }
+}
+
+</script>
+
+<title>Editing Test</title> 
+</head> 
+<body contenteditable id="root">
+<div id="test" class="editing">one two three</div><div>four five six</div>
+<script>
+runEditingTest();
+</script>
+
+</body>
+</html>
index 71f913c..86f036f 100644 (file)
@@ -1,3 +1,16 @@
+2006-12-20  David Harrison  <harrison@apple.com>
+
+        Reviewed by John Sullivan.
+
+        <rdar://problem/4570218> REGRESSION (?-10.4.7): cntl-K only works the first time
+
+        Test:
+        * editing/deleting/delete-to-end-of-paragraph.html
+        
+        * editing/TypingCommand.cpp:
+        (WebCore::TypingCommand::forwardDeleteKeyPressed):
+        If the selection was a caret at the end of the paragraph, extend selection so it wraps to the start of next paragraph (if any),
+
 2006-12-20  Nikolas Zimmermann  <zimmermann@kde.org>
 
         Build fix, reviewed by Mitz.
index 4ae5f99..8f17e4a 100644 (file)
@@ -382,6 +382,11 @@ void TypingCommand::forwardDeleteKeyPressed(TextGranularity granularity)
                 typingAddedToOpenCommand();
                 return;
             }
+
+            // deleting to end of paragraph when at end of paragraph needs to merge the next paragraph (if any)
+            if (granularity == ParagraphBoundary && selectionController.selection().isCaret() && isEndOfParagraph(selectionController.selection().visibleEnd()))
+                selectionController.modify(SelectionController::EXTEND, SelectionController::FORWARD, CharacterGranularity);
+
             selectionToDelete = selectionController.selection();
             
             break;