| Differences between
and this patch
- WebCore/ChangeLog +20 lines
Lines 1-3 WebCore/ChangeLog_sec1
1
2009-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): Always start a new command if the granularity is
17
        not CharacterGranularity. 
18
        (WebCore::TypingCommand::forwardDeleteKeyPressed): Always start a new command if the granularity is
19
        not CharacterGranularity. 
20
1
2009-10-30  Pavel Feldman  <pfeldman@chromium.org>
21
2009-10-30  Pavel Feldman  <pfeldman@chromium.org>
2
22
3
        Reviewed by Timothy Hatcher.
23
        Reviewed by Timothy Hatcher.
- WebCore/editing/TypingCommand.cpp -2 / +2 lines
Lines 90-96 void TypingCommand::deleteKeyPressed(Doc WebCore/editing/TypingCommand.cpp_sec1
90
    ASSERT(frame);
90
    ASSERT(frame);
91
    
91
    
92
    EditCommand* lastEditCommand = frame->editor()->lastEditCommand();
92
    EditCommand* lastEditCommand = frame->editor()->lastEditCommand();
93
    if (isOpenForMoreTypingCommand(lastEditCommand)) {
93
    if (granularity == CharacterGranularity && isOpenForMoreTypingCommand(lastEditCommand)) {
94
        static_cast<TypingCommand*>(lastEditCommand)->deleteKeyPressed(granularity, killRing);
94
        static_cast<TypingCommand*>(lastEditCommand)->deleteKeyPressed(granularity, killRing);
95
        return;
95
        return;
96
    }
96
    }
Lines 109-115 void TypingCommand::forwardDeleteKeyPres WebCore/editing/TypingCommand.cpp_sec2
109
    ASSERT(frame);
109
    ASSERT(frame);
110
    
110
    
111
    EditCommand* lastEditCommand = frame->editor()->lastEditCommand();
111
    EditCommand* lastEditCommand = frame->editor()->lastEditCommand();
112
    if (isOpenForMoreTypingCommand(lastEditCommand)) {
112
    if (granularity == CharacterGranularity && isOpenForMoreTypingCommand(lastEditCommand)) {
113
        static_cast<TypingCommand*>(lastEditCommand)->forwardDeleteKeyPressed(granularity, killRing);
113
        static_cast<TypingCommand*>(lastEditCommand)->forwardDeleteKeyPressed(granularity, killRing);
114
        return;
114
        return;
115
    }
115
    }
- LayoutTests/ChangeLog +11 lines
Lines 1-3 LayoutTests/ChangeLog_sec1
1
2009-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
1
2009-10-30  Kenneth Rohde Christiansen  <kenneth@webkit.org>
12
2009-10-30  Kenneth Rohde Christiansen  <kenneth@webkit.org>
2
13
3
        Unreviewed layout test fixes.
14
        Unreviewed layout test fixes.
- LayoutTests/editing/undo/undo-deleteWord-expected.txt +3 lines
Line 0 LayoutTests/editing/undo/undo-deleteWord-expected.txt_sec1
1
Tests: 
2
Undo a delete word after a series of insertText does not wipe out the entire content.
3
one two three four
- LayoutTests/editing/undo/undo-deleteWord.html +95 lines
Line 0 LayoutTests/editing/undo/undo-deleteWord.html_sec1
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
21
function 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
34
function undoNow()
35
{
36
    document.execCommand("Undo");
37
38
    if (window.layoutTestController)
39
        layoutTestController.notifyDone();
40
}
41
42
function editingTest() {
43
    typeCharacterCommand('o');
44
    typeCharacterCommand('n');
45
    typeCharacterCommand('e');
46
    typeCharacterCommand(' ');
47
    typeCharacterCommand('t');
48
    typeCharacterCommand('w');
49
    typeCharacterCommand('o');
50
    typeCharacterCommand(' ');
51
    typeCharacterCommand('t');
52
    typeCharacterCommand('h');
53
    typeCharacterCommand('r');
54
    typeCharacterCommand('e');
55
    typeCharacterCommand('e');
56
    typeCharacterCommand(' ');
57
    typeCharacterCommand('f');
58
    typeCharacterCommand('o');
59
    typeCharacterCommand('u');
60
    typeCharacterCommand('r');
61
62
    window.setTimeout(sendDeleteWordKey, 100);
63
}
64
65
</script>
66
67
<title>Editing Test</title> 
68
</head> 
69
<body>
70
71
<div class="explanation">
72
<div class="scenario">
73
Tests: 
74
<br>
75
Undo a delete word after a series of insertText does not wipe out the entire content.
76
</div>
77
</div>
78
79
<div contenteditable id="root">
80
<div id="test" class="editing"></div>
81
</div>
82
83
<script>
84
if (window.layoutTestController) {
85
    layoutTestController.dumpAsText();
86
    layoutTestController.waitUntilDone();
87
}
88
89
var selection = window.getSelection();
90
selection.setPosition(document.getElementById("test"), 0);
91
editingTest();
92
</script>
93
94
</body>
95
</html>

Return to Bug 30955