2010-02-23 Tony Chang <tony@chromium.org>
authortony@chromium.org <tony@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 23 Feb 2010 12:27:50 +0000 (12:27 +0000)
committertony@chromium.org <tony@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 23 Feb 2010 12:27:50 +0000 (12:27 +0000)
        Not reviewed.
        Revert r55135 because the layout test is failing on all the bots.
        https://bugs.webkit.org/show_bug.cgi?id=34634

        * editing/pasteboard/paste-list-004-expected.txt: Removed.
        * editing/pasteboard/paste-list-004.html: Removed.
2010-02-23  Tony Chang  <tony@chromium.org>

        Not reviewed.
        Revert r55135 because the layout test is failing on all the bots.
        https://bugs.webkit.org/show_bug.cgi?id=34634

        * editing/ReplaceSelectionCommand.cpp:
        (WebCore::ReplaceSelectionCommand::insertAsListItems):

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

LayoutTests/ChangeLog
LayoutTests/editing/pasteboard/paste-list-004-expected.txt [deleted file]
LayoutTests/editing/pasteboard/paste-list-004.html [deleted file]
WebCore/ChangeLog
WebCore/editing/ReplaceSelectionCommand.cpp

index ba2de77..9a51294 100644 (file)
@@ -1,3 +1,12 @@
+2010-02-23  Tony Chang  <tony@chromium.org>
+
+        Not reviewed.
+        Revert r55135 because the layout test is failing on all the bots.
+        https://bugs.webkit.org/show_bug.cgi?id=34634
+
+        * editing/pasteboard/paste-list-004-expected.txt: Removed.
+        * editing/pasteboard/paste-list-004.html: Removed.
+
 2010-02-23  Yuta Kitamura  <yutak@chromium.org>
 
         Reviewed by Dan Bernstein.
diff --git a/LayoutTests/editing/pasteboard/paste-list-004-expected.txt b/LayoutTests/editing/pasteboard/paste-list-004-expected.txt
deleted file mode 100644 (file)
index 8419c58..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-Pasting a list item into the middle of another list item should split the target list item into two with the pasted content in between.
-
-one two: one two
-three: three
-one two: one two
-:
-.four: .four
-monsters walking: <span style="background-color:green"><b>monsters walking</b></span>
-one two: one two
-:
-.cross the floor: <span style="background-color:green"><b>.cross the floor</b></span>
-PASS
-
-
diff --git a/LayoutTests/editing/pasteboard/paste-list-004.html b/LayoutTests/editing/pasteboard/paste-list-004.html
deleted file mode 100644 (file)
index bb38af2..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-<body contentEditable="true">
-<p>Pasting a list item into the middle of another list item should split the target list
-item into two with the pasted content in between.</p>
-<ul>
-    <li id="test">one two</li>
-    <li>three.four</li>
-    <li><span style="background-color:green"><b>monsters walking.cross the floor</b></span></li>
-</ul>
-
-<p id="results">FAIL</p>
-</body>
-<script src="../editing.js"></script>
-<script>
-function escapeHTML(text)
-{
-    return text.replace(/&/g, "&amp;").replace(/</g, "&lt;");
-}
-
-function editingTest()
-{
-    // Select the first list item.
-    extendSelectionForwardByLineCommand();
-    copyCommand();
-
-    // Place the cursor between "three" and "four".
-    moveSelectionForwardByLineCommand();
-    moveSelectionForwardByWordCommand();
-
-    pasteCommand();
-
-    // Place the cursor between "walking" and "cross"
-    for (var i = 0; i < 2; ++i)
-        moveSelectionForwardByLineCommand();
-    for (var i = 0; i < 2; ++i)
-        moveSelectionForwardByWordCommand();
-
-    pasteCommand();
-
-    // Verify that the list is as expected.
-    var listItems = document.getElementsByTagName("li");
-    var results = [
-        "one two",
-        "three",
-        "one two",
-        "",
-        ".four",
-        "monsters walking",
-        "one two",
-        "",
-        ".cross the floor"
-        ];
-    if (listItems.length != 9)
-        throw "Expected 8 list items, found " + listItems.length;
-    for (var i = 0; i < results.length; ++i) {
-        if (results[i] != listItems[i].innerText)
-            throw "Unexpected list item: " + i + "," + results[i] + "," + listItems[i].innerText;
-    }
-
-    // Verify that the cursor is in the right place (on the blank line).
-    var selection = window.getSelection();
-    if (selection.baseNode != listItems[7] || selection.baseOffset != 0 || !selection.isCollapsed)
-        throw "Wrong selection position";
-
-    for (var i = 0; i < listItems.length; ++i) {
-      listItems[i].innerHTML += ": " + escapeHTML(listItems[i].innerHTML);
-    }
-}
-
-runDumpAsTextEditingTest(false);
-document.getElementById("results").innerText = "PASS";
-</script>
index b49f4bf..b06db1e 100644 (file)
@@ -1,3 +1,12 @@
+2010-02-23  Tony Chang  <tony@chromium.org>
+
+        Not reviewed.
+        Revert r55135 because the layout test is failing on all the bots.
+        https://bugs.webkit.org/show_bug.cgi?id=34634
+
+        * editing/ReplaceSelectionCommand.cpp:
+        (WebCore::ReplaceSelectionCommand::insertAsListItems):
+
 2010-02-17  Steve Block  <steveblock@google.com>
 
         Reviewed by Ariya Hidayat.
index 0e5696e..bac090c 100644 (file)
@@ -1170,34 +1170,26 @@ Node* ReplaceSelectionCommand::insertAsListItems(PassRefPtr<Node> listElement, N
 
     bool isStart = isStartOfParagraph(insertPos);
     bool isEnd = isEndOfParagraph(insertPos);
-    bool isMiddle = !isStart && !isEnd;
-    Node* lastNode = insertionBlock;
-
-    // If we're in the middle of a list item, we should split it into two separate
-    // list items and insert these nodes between them.
-    if (isMiddle) {
-        int textNodeOffset = insertPos.offsetInContainerNode();
-        if (insertPos.node()->isTextNode() && textNodeOffset > 0)
-            splitTextNode(static_cast<Text*>(insertPos.node()), textNodeOffset);
-        splitTreeToNode(insertPos.node(), lastNode, true);
-    }
 
+    Node* lastNode = insertionBlock;
     while (RefPtr<Node> listItem = listElement->firstChild()) {
         ExceptionCode ec = 0;
         listElement->removeChild(listItem.get(), ec);
         ASSERT(!ec);
-        if (isStart || isMiddle)
+        if (isStart)
             insertNodeBefore(listItem, lastNode);
         else if (isEnd) {
             insertNodeAfter(listItem, lastNode);
             lastNode = listItem.get();
-        } else
-            ASSERT_NOT_REACHED();
+        } else {
+            // FIXME: If we're in the middle of a list item, we should split it into two separate
+            // list items and insert these nodes between them.  For now, just append the nodes.
+            insertNodeAfter(listItem, lastNode);
+            lastNode = listItem.get();
+        }
     }
-    if (isStart || isMiddle)
+    if (isStart)
         lastNode = lastNode->previousSibling();
-    if (isMiddle)
-        insertNodeAfter(createListItemElement(document()), lastNode);
     updateNodesInserted(lastNode);
     return lastNode;
 }