| Differences between
and this patch
- a/Source/WebCore/ChangeLog +21 lines
Lines 1-3 a/Source/WebCore/ChangeLog_sec1
1
2013-03-07  Sergio Villar Senin  <svillar@igalia.com>
2
3
        Empty list items after drag&drop in contentEditable divs
4
        https://bugs.webkit.org/show_bug.cgi?id=110610
5
6
        Reviewed by NOBODY (OOPS!).
7
8
        Perform a cleanup after moving operations. This will mainly prune
9
        extra placeholders left by the editing algorithms. Also do not
10
        leave empty <li> when moving them around inside a list element.
11
12
        No new tests required, added the corresponding changes to the
13
        already existing tests.
14
15
        * editing/MoveSelectionCommand.cpp:
16
        (WebCore::MoveSelectionCommand::doApply): perform
17
        cleanupAfterDeletion().
18
        * editing/ReplaceSelectionCommand.cpp:
19
        (WebCore::ReplaceSelectionCommand::insertAsListItems): do not
20
        insert an empty list item.
21
1
2013-03-06  Sergio Villar Senin  <svillar@igalia.com>
22
2013-03-06  Sergio Villar Senin  <svillar@igalia.com>
2
23
3
        Improve drag&drop of list items in contentEditable divs
24
        Improve drag&drop of list items in contentEditable divs
- a/Source/WebCore/editing/MoveSelectionCommand.cpp +2 lines
Lines 65-70 void MoveSelectionCommand::doApply() a/Source/WebCore/editing/MoveSelectionCommand.cpp_sec1
65
    if (!pos.anchorNode()->inDocument())
65
    if (!pos.anchorNode()->inDocument())
66
        pos = endingSelection().start();
66
        pos = endingSelection().start();
67
67
68
    cleanupAfterDeletion(pos);
69
68
    setEndingSelection(VisibleSelection(pos, endingSelection().affinity(), endingSelection().isDirectional()));
70
    setEndingSelection(VisibleSelection(pos, endingSelection().affinity(), endingSelection().isDirectional()));
69
    if (!pos.anchorNode()->inDocument()) {
71
    if (!pos.anchorNode()->inDocument()) {
70
        // Document was modified out from under us.
72
        // Document was modified out from under us.
- a/Source/WebCore/editing/ReplaceSelectionCommand.cpp -2 lines
Lines 1341-1348 Node* ReplaceSelectionCommand::insertAsListItems(PassRefPtr<HTMLElement> prpList a/Source/WebCore/editing/ReplaceSelectionCommand.cpp_sec1
1341
    }
1341
    }
1342
    if (isStart || isMiddle)
1342
    if (isStart || isMiddle)
1343
        lastNode = lastNode->previousSibling();
1343
        lastNode = lastNode->previousSibling();
1344
    if (isMiddle)
1345
        insertNodeAfter(createListItemElement(document()), lastNode);
1346
    return lastNode;
1344
    return lastNode;
1347
}
1345
}
1348
1346
- a/LayoutTests/ChangeLog +17 lines
Lines 1-3 a/LayoutTests/ChangeLog_sec1
1
2013-03-07  Sergio Villar Senin  <svillar@igalia.com>
2
3
        Empty list items after drag&drop in contentEditable divs
4
        https://bugs.webkit.org/show_bug.cgi?id=110610
5
6
        Reviewed by NOBODY (OOPS!).
7
8
        Some placeholders should not be left after performing a cleanup in
9
        move operations, this includes the empty list items generated when
10
        moving around list items inside a list.
11
12
        * editing/pasteboard/paste-list-004-expected.txt:
13
        * editing/pasteboard/paste-list-004.html: removed two empty <li>
14
        * editing/selection/4895428-1-expected.txt: removed a <br>.
15
        * editing/selection/4895428-4-expected.txt: ditto.
16
        * editing/selection/drag-list-item-expected.txt: ditto.
17
1
2013-03-06  Sergio Villar Senin  <svillar@igalia.com>
18
2013-03-06  Sergio Villar Senin  <svillar@igalia.com>
2
19
3
        Improve drag&drop of list items in contentEditable divs
20
        Improve drag&drop of list items in contentEditable divs
- a/LayoutTests/editing/pasteboard/paste-list-004-expected.txt -2 lines
Lines 3-13 Pasting a list item into the middle of another list item should split the target a/LayoutTests/editing/pasteboard/paste-list-004-expected.txt_sec1
3
one two: one two
3
one two: one two
4
three: three
4
three: three
5
one two: one two
5
one two: one two
6
:
7
four: four
6
four: four
8
monsters walking: <span style="background-color:green"><b>monsters walking</b></span>
7
monsters walking: <span style="background-color:green"><b>monsters walking</b></span>
9
one two: one two
8
one two: one two
10
:
11
cross the floor: <span style="background-color:green"><b>cross the floor</b></span>
9
cross the floor: <span style="background-color:green"><b>cross the floor</b></span>
12
PASS
10
PASS
13
11
- a/LayoutTests/editing/pasteboard/paste-list-004.html -8 / +5 lines
Lines 29-36 function editingTest() a/LayoutTests/editing/pasteboard/paste-list-004.html_sec1
29
    pasteCommand();
29
    pasteCommand();
30
30
31
    // Place the cursor between "walking" and "cross"
31
    // Place the cursor between "walking" and "cross"
32
    for (var i = 0; i < 2; ++i)
32
    moveSelectionForwardByLineCommand();
33
        moveSelectionForwardByLineCommand();
34
    for (var i = 0; i < 2; ++i)
33
    for (var i = 0; i < 2; ++i)
35
        moveSelectionForwardByWordCommand();
34
        moveSelectionForwardByWordCommand();
36
35
Lines 42-65 function editingTest() a/LayoutTests/editing/pasteboard/paste-list-004.html_sec2
42
        "one two",
41
        "one two",
43
        "three",
42
        "three",
44
        "one two",
43
        "one two",
45
        "",
46
        "four",
44
        "four",
47
        "monsters walking",
45
        "monsters walking",
48
        "one two",
46
        "one two",
49
        "",
50
        "cross the floor"
47
        "cross the floor"
51
        ];
48
        ];
52
    if (listItems.length != 9)
49
    if (listItems.length != 7)
53
        throw "Expected 8 list items, found " + listItems.length;
50
        throw "Expected 7 list items, found " + listItems.length;
54
    for (var i = 0; i < results.length; ++i) {
51
    for (var i = 0; i < results.length; ++i) {
55
        var actual = listItems[i].innerText.replace(/^\s+/g, "");
52
        var actual = listItems[i].innerText.replace(/^\s+/g, "");
56
        if (results[i] != actual)
53
        if (results[i] != actual)
57
            throw "Unexpected list item: " + i + "," + results[i] + "," + listItems[i].innerText;
54
            throw "Unexpected list item: " + i + "," + results[i] + "," + listItems[i].innerText;
58
    }
55
    }
59
56
60
    // Verify that the cursor is in the right place (on the blank line).
57
    // Verify that the cursor is in the right place (at the end of the pasted content).
61
    var selection = window.getSelection();
58
    var selection = window.getSelection();
62
    if (selection.baseNode != listItems[7] || selection.baseOffset != 0 || !selection.isCollapsed)
59
    if (selection.baseNode != listItems[6].firstChild.firstChild.firstChild || selection.baseOffset != 0 || !selection.isCollapsed)
63
        throw "Wrong selection position";
60
        throw "Wrong selection position";
64
61
65
    for (var i = 0; i < listItems.length; ++i) {
62
    for (var i = 0; i < listItems.length; ++i) {
- a/LayoutTests/editing/selection/4895428-1-expected.txt -1 lines
Lines 5-11 This tests dragging a selected table by mousing down on the contents of one of i a/LayoutTests/editing/selection/4895428-1-expected.txt_sec1
5
|   contenteditable="true"
5
|   contenteditable="true"
6
|   id="source"
6
|   id="source"
7
|   style="border: 1px solid blue;"
7
|   style="border: 1px solid blue;"
8
|   <br>
9
| "
8
| "
10
"
9
"
11
| <div>
10
| <div>
- a/LayoutTests/editing/selection/4895428-4-expected.txt -1 lines
Lines 7-13 This tests to see if an editable selection containing a focusable node is dragga a/LayoutTests/editing/selection/4895428-4-expected.txt_sec1
7
|   style="border: 1px solid blue;"
7
|   style="border: 1px solid blue;"
8
|   "
8
|   "
9
"
9
"
10
|   <br>
11
|   "
10
|   "
12
"
11
"
13
| "
12
| "
- a/LayoutTests/editing/selection/drag-list-item-expected.txt -6 lines
Lines 7-15 This test drags a selection of one <li> and drops them after another <li> in the a/LayoutTests/editing/selection/drag-list-item-expected.txt_sec1
7
|   id="alpha"
7
|   id="alpha"
8
|   "alpha"
8
|   "alpha"
9
| <li>
9
| <li>
10
|   id="beta"
11
|   <br>
12
| <li>
13
|   id="gamma"
10
|   id="gamma"
14
|   "gamma"
11
|   "gamma"
15
| <li>
12
| <li>
Lines 26-34 This test drags a selection of one <li> and drops them after another <li> in the a/LayoutTests/editing/selection/drag-list-item-expected.txt_sec2
26
|   id="alpha"
23
|   id="alpha"
27
|   "alpha"
24
|   "alpha"
28
| <li>
25
| <li>
29
|   id="beta"
30
|   <br>
31
| <li>
32
|   id="delta"
26
|   id="delta"
33
|   "delta"
27
|   "delta"
34
| <li>
28
| <li>

Return to Bug 110610