[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.21-584-g1e41756

eric at webkit.org eric at webkit.org
Fri Feb 26 22:23:44 UTC 2010


The following commit has been merged in the webkit-1.1 branch:
commit 7da5b3e136e6c0cec275156f32a9420ee78a6bee
Author: eric at webkit.org <eric at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Feb 18 06:28:30 2010 +0000

    2010-02-17  Tony Chang  <tony at chromium.org>
    
            Reviewed by Eric Seidel.
    
            https://bugs.webkit.org/show_bug.cgi?id=34737
            Test to verify that pasting styled list items works
            the same as pasting unstyle list items.
    
            * editing/pasteboard/paste-list-003-expected.txt: Added.
            * editing/pasteboard/paste-list-003.html: Added.
    2010-02-17  Tony Chang  <tony at chromium.org>
    
            Reviewed by Eric Seidel.
    
            https://bugs.webkit.org/show_bug.cgi?id=34737
            Copying styled list items then pasting into a list
            should work the same as copying unstyle list items:
            it shouldn't indent an extra level, but styles should
            be copied.
    
            Small cleanups to insertAsListItems to make variable names
            more descriptive.
    
            Test: editing/pasteboard/paste-list-003.html
    
            * editing/ReplaceSelectionCommand.cpp:
            (WebCore::ReplaceSelectionCommand::doApply):
            (WebCore::ReplaceSelectionCommand::insertAsListItems):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@54931 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 0935dd0..7af1252 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,14 @@
+2010-02-17  Tony Chang  <tony at chromium.org>
+
+        Reviewed by Eric Seidel.
+
+        https://bugs.webkit.org/show_bug.cgi?id=34737
+        Test to verify that pasting styled list items works
+        the same as pasting unstyle list items.
+
+        * editing/pasteboard/paste-list-003-expected.txt: Added.
+        * editing/pasteboard/paste-list-003.html: Added.
+
 2010-02-17  Hayato Ito  <hayato at chromium.org>
 
         Reviewed by Eric Seidel.
diff --git a/LayoutTests/editing/pasteboard/paste-list-003-expected.txt b/LayoutTests/editing/pasteboard/paste-list-003-expected.txt
new file mode 100644
index 0000000..30965f7
--- /dev/null
+++ b/LayoutTests/editing/pasteboard/paste-list-003-expected.txt
@@ -0,0 +1,11 @@
+Copy/pasting list items in a list. This test should be run with DRT for pasteboard access.
+
+PASS
+
+one: <b>one</b>
+two: <span style="background-color: green">two</span>
+three: three
+one: <b>one</b>
+two: <span style="background-color: green; ">two</span>
+four: <span style="background-color: orange"><i>four</i></span>
+i love counting, counting to the number four: i love counting, counting to the number four
diff --git a/LayoutTests/editing/pasteboard/paste-list-003.html b/LayoutTests/editing/pasteboard/paste-list-003.html
new file mode 100644
index 0000000..4965e20
--- /dev/null
+++ b/LayoutTests/editing/pasteboard/paste-list-003.html
@@ -0,0 +1,62 @@
+<html>
+<script src=../editing.js></script>
+<script>
+function escapeHTML(text)
+{
+    return text.replace(/&/g, "&amp;").replace(/</g, "&lt;");
+}
+
+function editingTest()
+{
+    // Select "one" and "two".
+    for (i = 0; i < 2; i++)
+        extendSelectionForwardByLineCommand();
+    copyCommand();
+
+    // Paste with the cursor right before "four" (insert between three and four)
+    for (i = 0; i < 2; i++)
+        moveSelectionForwardByLineCommand();
+    pasteCommand();
+
+    // Verify that the cursor is in the right place (still before four).
+    var selection = window.getSelection();
+    if (selection.baseNode.parentNode.parentNode.parentNode != document.getElementById("four") ||
+        selection.baseOffset != 0 || !selection.isCollapsed)
+        throw "Wrong selection position on before paste.";
+
+    // Make sure the styles were preserved in the copy by updating the list items.
+    var items = document.getElementsByTagName("li");
+    for (var i = 0; i < items.length; ++i) {
+        var li = items[i];
+        li.innerHTML += ": " + escapeHTML(li.innerHTML);
+    }
+
+    document.getElementById("results").innerText = "PASS";
+}
+
+</script>
+<body>
+<div contentEditable="true">
+<p>Copy/pasting list items in a list.  This test should be run with DRT for pasteboard access.</p>
+<p id="results">FAIL</p>
+<ul id="test">
+    <li><b>one</b></li>
+    <li><span style="background-color: green">two</span></li>
+    <li>three</li>
+    <li id="four"><span style="background-color: orange"><i>four</i></span></li>
+    <li>i love counting, counting to the number four</li>
+</ul>
+</div>
+
+<script>
+if (window.layoutTestController)
+    layoutTestController.dumpAsText();
+
+var elem = document.getElementById("test");
+var selection = window.getSelection();
+selection.setPosition(elem, 0);
+editingTest();
+</script>
+
+</body>
+</html>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 25d0a05..b397a7f 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,22 @@
+2010-02-17  Tony Chang  <tony at chromium.org>
+
+        Reviewed by Eric Seidel.
+
+        https://bugs.webkit.org/show_bug.cgi?id=34737
+        Copying styled list items then pasting into a list
+        should work the same as copying unstyle list items:
+        it shouldn't indent an extra level, but styles should
+        be copied.
+
+        Small cleanups to insertAsListItems to make variable names
+        more descriptive.
+
+        Test: editing/pasteboard/paste-list-003.html
+
+        * editing/ReplaceSelectionCommand.cpp:
+        (WebCore::ReplaceSelectionCommand::doApply):
+        (WebCore::ReplaceSelectionCommand::insertAsListItems):
+
 2010-02-17  Kwang Yul Seo  <skyul at company100.net>
 
         Reviewed by Eric Seidel.
diff --git a/WebCore/editing/ReplaceSelectionCommand.cpp b/WebCore/editing/ReplaceSelectionCommand.cpp
index f26757e..47c5540 100644
--- a/WebCore/editing/ReplaceSelectionCommand.cpp
+++ b/WebCore/editing/ReplaceSelectionCommand.cpp
@@ -871,7 +871,8 @@ void ReplaceSelectionCommand::doApply()
     fragment.removeNode(refNode);
 
     Node* blockStart = enclosingBlock(insertionPos.node());
-    if (isListElement(refNode.get()) && blockStart->renderer()->isListItem())
+    if ((isListElement(refNode.get()) || (isStyleSpan(refNode.get()) && isListElement(refNode->firstChild())))
+        && blockStart->renderer()->isListItem())
         refNode = insertAsListItems(refNode, blockStart, insertionPos);
     else
         insertNodeAtAndUpdateNodesInserted(refNode, insertionPos);
@@ -1122,15 +1123,15 @@ void ReplaceSelectionCommand::insertNodeBeforeAndUpdateNodesInserted(PassRefPtr<
 
 // If the user is inserting a list into an existing list, instead of nesting the list,
 // we put the list items into the existing list.
-Node* ReplaceSelectionCommand::insertAsListItems(PassRefPtr<Node> listElement, Node* insertionNode, const Position& p)
+Node* ReplaceSelectionCommand::insertAsListItems(PassRefPtr<Node> listElement, Node* insertionBlock, const Position& insertPos)
 {
     while (listElement->hasChildNodes() && isListElement(listElement->firstChild()) && listElement->childNodeCount() == 1)
         listElement = listElement->firstChild();
 
-    bool isStart = isStartOfParagraph(p);
-    bool isEnd = isEndOfParagraph(p);
+    bool isStart = isStartOfParagraph(insertPos);
+    bool isEnd = isEndOfParagraph(insertPos);
 
-    Node* lastNode = insertionNode;
+    Node* lastNode = insertionBlock;
     while (RefPtr<Node> listItem = listElement->firstChild()) {
         ExceptionCode ec = 0;
         listElement->removeChild(listItem.get(), ec);

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list