WebCore/ChangeLog

 12009-10-30 Enrica Casucci <enrica@apple.com>
 2
 3 Reviewed by NOBODY (OOPS!).
 4
 5 REGRESSION: In Mail, Undo does not restore some characters I have deleted at the end of a line
 6 https://bugs.webkit.org/show_bug.cgi?id=30955
 7 <rdar://problem/7067033>
 8
 9 When the command is deleteWordBackward or deleteWordForward
 10 we should not add to the open typing command, but
 11 create a new one.
 12
 13 Test: editing/undo/undo-deleteWord.html
 14
 15 * editing/TypingCommand.cpp:
 16 (WebCore::TypingCommand::deleteKeyPressed): Check if the call originated from
 17 a deleteWord command.
 18 (WebCore::TypingCommand::forwardDeleteKeyPressed): Check if the call originated from
 19 a deleteWord command.
 20
1212009-10-30 Pavel Feldman <pfeldman@chromium.org>
222
323 Reviewed by Timothy Hatcher.
50338

WebCore/editing/TypingCommand.cpp

@@void TypingCommand::deleteKeyPressed(Doc
9090 ASSERT(frame);
9191
9292 EditCommand* lastEditCommand = frame->editor()->lastEditCommand();
93  if (isOpenForMoreTypingCommand(lastEditCommand)) {
 93 if (!killRing && isOpenForMoreTypingCommand(lastEditCommand)) {
9494 static_cast<TypingCommand*>(lastEditCommand)->deleteKeyPressed(granularity, killRing);
9595 return;
9696 }

@@void TypingCommand::forwardDeleteKeyPres
109109 ASSERT(frame);
110110
111111 EditCommand* lastEditCommand = frame->editor()->lastEditCommand();
112  if (isOpenForMoreTypingCommand(lastEditCommand)) {
 112 if (!killRing && isOpenForMoreTypingCommand(lastEditCommand)) {
113113 static_cast<TypingCommand*>(lastEditCommand)->forwardDeleteKeyPressed(granularity, killRing);
114114 return;
115115 }
50338

LayoutTests/ChangeLog

 12009-10-30 Enrica Casucci <enrica@apple.com>
 2
 3 Reviewed by NOBODY (OOPS!).
 4
 5 REGRESSION: In Mail, Undo does not restore some characters I have deleted at the end of a line
 6 https://bugs.webkit.org/show_bug.cgi?id=30955
 7 <rdar://problem/7067033>
 8
 9 * editing/undo/undo-deleteWord-expected.txt: Added.
 10 * editing/undo/undo-deleteWord.html: Added.
 11
1122009-10-30 Kenneth Rohde Christiansen <kenneth@webkit.org>
213
314 Unreviewed layout test fixes.
50338

LayoutTests/editing/undo/undo-deleteWord-expected.txt

 1EDITING DELEGATE: shouldBeginEditingInDOMRange:range from 0 of DIV > BODY > HTML > #document to 3 of DIV > BODY > HTML > #document
 2EDITING DELEGATE: webViewDidBeginEditing:WebViewDidBeginEditingNotification
 3EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
 4EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV > DIV > BODY > HTML > #document to 0 of DIV > DIV > BODY > HTML > #document toDOMRange:range from 1 of #text > DIV > DIV > BODY > HTML > #document to 1 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
 5EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
 6EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
 7EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 1 of #text > DIV > DIV > BODY > HTML > #document to 1 of #text > DIV > DIV > BODY > HTML > #document toDOMRange:range from 2 of #text > DIV > DIV > BODY > HTML > #document to 2 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
 8EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
 9EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
 10EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 2 of #text > DIV > DIV > BODY > HTML > #document to 2 of #text > DIV > DIV > BODY > HTML > #document toDOMRange:range from 3 of #text > DIV > DIV > BODY > HTML > #document to 3 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
 11EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
 12EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
 13EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 3 of #text > DIV > DIV > BODY > HTML > #document to 3 of #text > DIV > DIV > BODY > HTML > #document toDOMRange:range from 4 of #text > DIV > DIV > BODY > HTML > #document to 4 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
 14EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
 15EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
 16EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 4 of #text > DIV > DIV > BODY > HTML > #document to 4 of #text > DIV > DIV > BODY > HTML > #document toDOMRange:range from 5 of #text > DIV > DIV > BODY > HTML > #document to 5 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
 17EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
 18EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
 19EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 5 of #text > DIV > DIV > BODY > HTML > #document to 5 of #text > DIV > DIV > BODY > HTML > #document toDOMRange:range from 6 of #text > DIV > DIV > BODY > HTML > #document to 6 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
 20EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
 21EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
 22EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 6 of #text > DIV > DIV > BODY > HTML > #document to 6 of #text > DIV > DIV > BODY > HTML > #document toDOMRange:range from 7 of #text > DIV > DIV > BODY > HTML > #document to 7 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
 23EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
 24EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
 25EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 7 of #text > DIV > DIV > BODY > HTML > #document to 7 of #text > DIV > DIV > BODY > HTML > #document toDOMRange:range from 8 of #text > DIV > DIV > BODY > HTML > #document to 8 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
 26EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
 27EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
 28EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 8 of #text > DIV > DIV > BODY > HTML > #document to 8 of #text > DIV > DIV > BODY > HTML > #document toDOMRange:range from 9 of #text > DIV > DIV > BODY > HTML > #document to 9 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
 29EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
 30EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
 31EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 9 of #text > DIV > DIV > BODY > HTML > #document to 9 of #text > DIV > DIV > BODY > HTML > #document toDOMRange:range from 10 of #text > DIV > DIV > BODY > HTML > #document to 10 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
 32EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
 33EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
 34EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 10 of #text > DIV > DIV > BODY > HTML > #document to 10 of #text > DIV > DIV > BODY > HTML > #document toDOMRange:range from 11 of #text > DIV > DIV > BODY > HTML > #document to 11 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
 35EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
 36EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
 37EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 11 of #text > DIV > DIV > BODY > HTML > #document to 11 of #text > DIV > DIV > BODY > HTML > #document toDOMRange:range from 12 of #text > DIV > DIV > BODY > HTML > #document to 12 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
 38EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
 39EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
 40EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 12 of #text > DIV > DIV > BODY > HTML > #document to 12 of #text > DIV > DIV > BODY > HTML > #document toDOMRange:range from 13 of #text > DIV > DIV > BODY > HTML > #document to 13 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
 41EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
 42EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
 43EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 13 of #text > DIV > DIV > BODY > HTML > #document to 13 of #text > DIV > DIV > BODY > HTML > #document toDOMRange:range from 14 of #text > DIV > DIV > BODY > HTML > #document to 14 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
 44EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
 45EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
 46EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 14 of #text > DIV > DIV > BODY > HTML > #document to 14 of #text > DIV > DIV > BODY > HTML > #document toDOMRange:range from 15 of #text > DIV > DIV > BODY > HTML > #document to 15 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
 47EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
 48EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
 49EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 15 of #text > DIV > DIV > BODY > HTML > #document to 15 of #text > DIV > DIV > BODY > HTML > #document toDOMRange:range from 16 of #text > DIV > DIV > BODY > HTML > #document to 16 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
 50EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
 51EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
 52EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 16 of #text > DIV > DIV > BODY > HTML > #document to 16 of #text > DIV > DIV > BODY > HTML > #document toDOMRange:range from 17 of #text > DIV > DIV > BODY > HTML > #document to 17 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
 53EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
 54EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
 55EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 17 of #text > DIV > DIV > BODY > HTML > #document to 17 of #text > DIV > DIV > BODY > HTML > #document toDOMRange:range from 18 of #text > DIV > DIV > BODY > HTML > #document to 18 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
 56EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
 57EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
 58EDITING DELEGATE: shouldDeleteDOMRange:range from 14 of #text > DIV > DIV > BODY > HTML > #document to 18 of #text > DIV > DIV > BODY > HTML > #document
 59EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 14 of #text > DIV > DIV > BODY > HTML > #document to 14 of #text > DIV > DIV > BODY > HTML > #document toDOMRange:range from 14 of #text > DIV > DIV > BODY > HTML > #document to 14 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
 60EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
 61EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
 62EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 14 of #text > DIV > DIV > BODY > HTML > #document to 14 of #text > DIV > DIV > BODY > HTML > #document toDOMRange:range from 14 of #text > DIV > DIV > BODY > HTML > #document to 18 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
 63EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
 64EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
 65layer at (0,0) size 800x600
 66 RenderView at (0,0) size 800x600
 67layer at (0,0) size 800x600
 68 RenderBlock {HTML} at (0,0) size 800x600
 69 RenderBody {BODY} at (8,8) size 784x584
 70 RenderBlock {DIV} at (0,0) size 784x128 [border: (2px solid #0000FF)]
 71 RenderBlock {DIV} at (14,14) size 756x84
 72 RenderText {#text} at (0,0) size 67x28
 73 text run at (0,0) width 67: "Tests: "
 74 RenderBR {BR} at (0,0) size 0x0
 75 RenderText {#text} at (0,28) size 725x56
 76 text run at (0,28) width 725: "Undo a delete word after a series of insertText does not wipe out the entire"
 77 text run at (0,56) width 78: "content."
 78 RenderBlock {DIV} at (0,152) size 784x22
 79 RenderBlock {DIV} at (0,0) size 784x22 [border: (2px solid #FF0000)]
 80 RenderText {#text} at (2,2) size 116x18
 81 text run at (2,2) width 116: "one two three four"
 82selection start: position 14 of child 0 {#text} of child 1 {DIV} of child 3 {DIV} of child 1 {BODY} of child 0 {HTML} of document
 83selection end: position 18 of child 0 {#text} of child 1 {DIV} of child 3 {DIV} of child 1 {BODY} of child 0 {HTML} of document
0

LayoutTests/editing/undo/undo-deleteWord.html

 1<html>
 2<head>
 3
 4<style>
 5.editing {
 6 border: 2px solid red;
 7}
 8.explanation {
 9 border: 2px solid blue;
 10 padding: 12px;
 11 font-size: 24px;
 12 margin-bottom: 24px;
 13}
 14.scenario { margin-bottom: 16px;}
 15.scenario:first-line { font-weight: bold; margin-bottom: 16px;}
 16</style>
 17<script src=../editing.js language="JavaScript" type="text/JavaScript" ></script>
 18
 19<script>
 20
 21function sendDeleteWordKey()
 22{
 23 var deleteWordModifiers;
 24 if (navigator.userAgent.search(/\bMac OS X\b/) != -1)
 25 deleteWordModifiers = ["altKey"];
 26 else
 27 deleteWordModifiers = ["ctrlKey"];
 28
 29 if (window.eventSender)
 30 eventSender.keyDown(String.fromCharCode(8), deleteWordModifiers);
 31 window.setTimeout(undoNow, 100);
 32}
 33
 34function undoNow()
 35{
 36 document.execCommand("Undo");
 37
 38 if (window.layoutTestController)
 39 layoutTestController.notifyDone();
 40}
 41
 42function editingTest() {
 43 if (window.layoutTestController)
 44 layoutTestController.waitUntilDone();
 45
 46 typeCharacterCommand('o');
 47 typeCharacterCommand('n');
 48 typeCharacterCommand('e');
 49 typeCharacterCommand(' ');
 50 typeCharacterCommand('t');
 51 typeCharacterCommand('w');
 52 typeCharacterCommand('o');
 53 typeCharacterCommand(' ');
 54 typeCharacterCommand('t');
 55 typeCharacterCommand('h');
 56 typeCharacterCommand('r');
 57 typeCharacterCommand('e');
 58 typeCharacterCommand('e');
 59 typeCharacterCommand(' ');
 60 typeCharacterCommand('f');
 61 typeCharacterCommand('o');
 62 typeCharacterCommand('u');
 63 typeCharacterCommand('r');
 64
 65 window.setTimeout(sendDeleteWordKey, 100);
 66}
 67
 68</script>
 69
 70<title>Editing Test</title>
 71</head>
 72<body>
 73
 74<div class="explanation">
 75<div class="scenario">
 76Tests:
 77<br>
 78Undo a delete word after a series of insertText does not wipe out the entire content.
 79</div>
 80</div>
 81
 82<div contenteditable id="root">
 83<div id="test" class="editing"></div>
 84</div>
 85
 86<script>
 87runEditingTest();
 88</script>
 89
 90</body>
 91</html>
0