Changeset 145798 in webkit


Ignore:
Timestamp:
Mar 14, 2013 2:43:34 AM (11 years ago)
Author:
sergio@webkit.org
Message:

Empty list items after drag&drop in contentEditable divs
https://bugs.webkit.org/show_bug.cgi?id=110610

Reviewed by Ryosuke Niwa.

Source/WebCore:

Perform a cleanup after moving operations. This will mainly prune
extra placeholders left by the editing algorithms. Also do not
leave empty <li> when moving them around inside a list element.

Tests: editing/pasteboard/cleanup-on-move.html

editing/pasteboard/drag-list-item.html

  • editing/MoveSelectionCommand.cpp:

(WebCore::MoveSelectionCommand::doApply): perform
cleanupAfterDeletion().

  • editing/ReplaceSelectionCommand.cpp:

(WebCore::ReplaceSelectionCommand::insertAsListItems): do not
insert an empty list item.

  • editing/MoveSelectionCommand.cpp:

(WebCore::MoveSelectionCommand::doApply):

  • editing/ReplaceSelectionCommand.cpp:

(WebCore::ReplaceSelectionCommand::insertAsListItems):

LayoutTests:

Some placeholders should not be left after performing a cleanup in
move operations, this includes the empty list items generated when
moving around list items inside a list.

I'm also moving drag-list-item.html to editing/pasteboard because
it fits much better there than under editing/selection.

  • editing/pasteboard/cleanup-on-move-expected.txt: Added.
  • editing/pasteboard/cleanup-on-move.html: Added.
  • editing/pasteboard/drag-list-item-expected.txt: Renamed from LayoutTests/editing/selection/drag-list-item-expected.txt.
  • editing/pasteboard/drag-list-item.html: Renamed from LayoutTests/editing/selection/drag-list-item.html.
  • editing/pasteboard/resources/select-and-drag.js: Added.

(selectAndDragToTarget): Selects nodes and drops them after a target node.

  • editing/pasteboard/drag-drop-list-expected.txt: Removed an empty <li>.
  • editing/pasteboard/paste-list-004-expected.txt: Removed 2 empty <li>.
  • editing/pasteboard/paste-list-004.html: Ditto.
  • editing/selection/4895428-1-expected.txt: Removed a <br>.
  • editing/selection/4895428-4-expected.txt: Ditto.
  • fast/events/ondragenter-expected.txt: Removed a blank line.
  • platform/chromium/fast/events/ondragenter-expected.txt: Ditto.
  • platform/efl/TestExpectations: Added cleanup-on-move.html to the skipped list.
  • platform/mac-wk2/TestExpectations: Ditto.
  • platform/qt/TestExpectations: Ditto.
  • platform/win/fast/events/ondragenter-expected.txt: Removed a blank line.
Location:
trunk
Files:
4 added
1 deleted
15 edited
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r145797 r145798  
     12013-03-14  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 Ryosuke Niwa.
     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        I'm also moving drag-list-item.html to editing/pasteboard because
     13        it fits much better there than under editing/selection.
     14
     15        * editing/pasteboard/cleanup-on-move-expected.txt: Added.
     16        * editing/pasteboard/cleanup-on-move.html: Added.
     17        * editing/pasteboard/drag-list-item-expected.txt: Renamed from LayoutTests/editing/selection/drag-list-item-expected.txt.
     18        * editing/pasteboard/drag-list-item.html: Renamed from LayoutTests/editing/selection/drag-list-item.html.
     19        * editing/pasteboard/resources/select-and-drag.js: Added.
     20        (selectAndDragToTarget): Selects nodes and drops them after a target node.
     21        * editing/pasteboard/drag-drop-list-expected.txt: Removed an empty <li>.
     22        * editing/pasteboard/paste-list-004-expected.txt: Removed 2 empty <li>.
     23        * editing/pasteboard/paste-list-004.html: Ditto.
     24        * editing/selection/4895428-1-expected.txt: Removed a <br>.
     25        * editing/selection/4895428-4-expected.txt: Ditto.
     26        * fast/events/ondragenter-expected.txt: Removed a blank line.
     27        * platform/chromium/fast/events/ondragenter-expected.txt: Ditto.
     28        * platform/efl/TestExpectations: Added cleanup-on-move.html to the skipped list.
     29        * platform/mac-wk2/TestExpectations: Ditto.
     30        * platform/qt/TestExpectations: Ditto.
     31        * platform/win/fast/events/ondragenter-expected.txt: Removed a blank line.
     32
    1332013-03-14  Eric Seidel  <eric@webkit.org>
    234
  • trunk/LayoutTests/editing/pasteboard/drag-drop-list-expected.txt

    r130411 r145798  
    1212| "
    1313"
    14 | <div>
    15 |   <br>
    1614| "
    1715"
  • trunk/LayoutTests/editing/pasteboard/drag-list-item-expected.txt

    r145797 r145798  
    11This test drags a selection of one <li> and drops them after another <li> in the first list. The same test is repeated in the second list but this time with two selected items instead of one. It verifies that the behavior is independent of how many fully selected items we move, i.e. fully selected <li> are moved as <li> and not just as plain text
    22
    3 The original list looks like this. 'two' is going to be selected and pasted after 'four':
     3The original list looks like this. 'two' is selected and is going to be dropped after 'four':
    44| "
    55"
     
    99| <li>
    1010|   id="two"
    11 |   "two"
     11|   "<#selection-anchor>two<#selection-focus>"
    1212| <li>
    1313|   id="three"
     
    2626|   "one"
    2727| <li>
    28 |   id="two"
    29 |   <br>
    30 | <li>
    3128|   id="three"
    3229|   "three"
     
    4037"
    4138
    42 The original list looks like this. 'two' and 'three' are going to be selected and pasted after 'four':
     39The original list looks like this. 'two' and 'three' are selected and are going to be dropped after 'four':
    4340| <li>
    4441|   id="one"
     
    4643| <li>
    4744|   id="two"
    48 |   "two"
     45|   "<#selection-anchor>two"
    4946| <li>
    5047|   id="three"
    51 |   "three"
     48|   "three<#selection-focus>"
    5249| <li>
    5350|   id="four"
     
    5956|   "one"
    6057| <li>
    61 |   id="two"
    62 |   <br>
    63 | <li>
    6458|   id="four"
    6559|   "four"
  • trunk/LayoutTests/editing/pasteboard/paste-list-004-expected.txt

    r55178 r145798  
    44three: three
    55one two: one two
    6 :
    76four: four
    87monsters walking: <span style="background-color:green"><b>monsters walking</b></span>
    98one two: one two
    10 :
    119cross the floor: <span style="background-color:green"><b>cross the floor</b></span>
    1210PASS
  • trunk/LayoutTests/editing/pasteboard/paste-list-004.html

    r55178 r145798  
    3030
    3131    // Place the cursor between "walking" and "cross"
    32     for (var i = 0; i < 2; ++i)
    33         moveSelectionForwardByLineCommand();
     32    moveSelectionForwardByLineCommand();
    3433    for (var i = 0; i < 2; ++i)
    3534        moveSelectionForwardByWordCommand();
     
    4342        "three",
    4443        "one two",
    45         "",
    4644        "four",
    4745        "monsters walking",
    4846        "one two",
    49         "",
    5047        "cross the floor"
    5148        ];
    52     if (listItems.length != 9)
    53         throw "Expected 8 list items, found " + listItems.length;
     49    if (listItems.length != 7)
     50        throw "Expected 7 list items, found " + listItems.length;
    5451    for (var i = 0; i < results.length; ++i) {
    5552        var actual = listItems[i].innerText.replace(/^\s+/g, "");
     
    5855    }
    5956
    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 beginning of 'cross the floor').
    6158    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)
    6360        throw "Wrong selection position";
    6461
  • trunk/LayoutTests/editing/selection/4895428-1-expected.txt

    r87466 r145798  
    66|   id="source"
    77|   style="border: 1px solid blue;"
    8 |   <br>
    98| "
    109"
  • trunk/LayoutTests/editing/selection/4895428-4-expected.txt

    r98899 r145798  
    88|   "
    99"
    10 |   <br>
    1110|   "
    1211"
  • trunk/LayoutTests/fast/events/ondragenter-expected.txt

    r130411 r145798  
    1 
    21Success: Text
    32This automated layout test checks to see that ondragenter events are being sent.
  • trunk/LayoutTests/platform/chromium/fast/events/ondragenter-expected.txt

    r97115 r145798  
    1 
    21Success: Text
    32This automated layout test checks to see that ondragenter events are being sent.
  • trunk/LayoutTests/platform/efl/TestExpectations

    r145782 r145798  
    455455webkit.org/b/86623 http/tests/security/drag-drop-different-origin.html
    456456webkit.org/b/86623 http/tests/security/drag-over-remote-content-iframe.html
    457 webkit.org/b/86623 editing/selection/drag-list-item.html [ Failure ]
     457webkit.org/b/86623 editing/pasteboard/cleanup-on-move.html [ Failure ]
     458webkit.org/b/86623 editing/pasteboard/drag-list-item.html [ Failure ]
    458459
    459460# Missing drag'n'drop, needs baselines
  • trunk/LayoutTests/platform/mac-wk2/TestExpectations

    r145593 r145798  
    1717# <https://bugs.webkit.org/show_bug.cgi?id=42194>
    1818editing/pasteboard/4947130.html
     19editing/pasteboard/cleanup-on-move.html
    1920editing/pasteboard/copy-standalone-image-crash.html
    2021editing/pasteboard/drag-and-drop-image-contenteditable.html
     
    2829editing/pasteboard/drag-image-in-about-blank-frame.html
    2930editing/pasteboard/drag-image-to-contenteditable-in-iframe.html
     31editing/pasteboard/drag-list-item.html
    3032editing/pasteboard/drag-selected-image-to-contenteditable.html
    3133editing/pasteboard/drop-file-svg.html
     
    6062editing/selection/doubleclick-whitespace-img-crash.html
    6163editing/selection/doubleclick-whitespace.html
    62 editing/selection/drag-list-item.html
    6364editing/selection/drag-select-1.html
    6465editing/selection/drag-select-rapidly.html
  • trunk/LayoutTests/platform/qt/TestExpectations

    r145797 r145798  
    573573fast/events/input-element-display-none-in-dragleave-crash.html
    574574fast/events/only-valid-drop-targets-receive-file-drop.html
     575
     576# New test added in r145195 is failing
     577webkit.org/b/111853 editing/pasteboard/cleanup-on-move.html [ Skip ]
     578webkit.org/b/111853 editing/pasteboard/drag-list-item.html [ Skip ]
    575579
    576580# =========================================================================== #
     
    26802684webkit.org/b/111606 fast/repaint/border-fit-lines.html [ Skip ]
    26812685
    2682 # New test added in r145195 is failing
    2683 webkit.org/b/111853 editing/selection/drag-list-item.html [ Skip ]
    2684 
    26852686# jack server is not running or cannot be started
    26862687fast/dom/beforeload/remove-video-poster-in-beforeload-listener.html
  • trunk/LayoutTests/platform/win/fast/events/ondragenter-expected.txt

    r97102 r145798  
    1 
    21Success: Text
    32This automated layout test checks to see that ondragenter events are being sent.
  • trunk/Source/WebCore/ChangeLog

    r145797 r145798  
     12013-03-14  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 Ryosuke Niwa.
     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        Tests: editing/pasteboard/cleanup-on-move.html
     13               editing/pasteboard/drag-list-item.html
     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        * editing/MoveSelectionCommand.cpp:
     22        (WebCore::MoveSelectionCommand::doApply):
     23        * editing/ReplaceSelectionCommand.cpp:
     24        (WebCore::ReplaceSelectionCommand::insertAsListItems):
     25
    1262013-03-14  Eric Seidel  <eric@webkit.org>
    227
  • trunk/Source/WebCore/editing/MoveSelectionCommand.cpp

    r123412 r145798  
    6666        pos = endingSelection().start();
    6767
     68    cleanupAfterDeletion(pos);
     69
    6870    setEndingSelection(VisibleSelection(pos, endingSelection().affinity(), endingSelection().isDirectional()));
    6971    if (!pos.anchorNode()->inDocument()) {
  • trunk/Source/WebCore/editing/ReplaceSelectionCommand.cpp

    r145562 r145798  
    14451445    if (isStart || isMiddle)
    14461446        lastNode = lastNode->previousSibling();
    1447     if (isMiddle)
    1448         insertNodeAfter(createListItemElement(document()), lastNode);
    14491447    return lastNode;
    14501448}
Note: See TracChangeset for help on using the changeset viewer.