Title: [88890] trunk
Revision
88890
Author
commit-qu...@webkit.org
Date
2011-06-14 18:51:54 -0700 (Tue, 14 Jun 2011)

Log Message

2011-06-14  Annie Sullivan  <sulli...@chromium.org>

        Reviewed by Ryosuke Niwa.

        Span ID duplicated when pressing enter at beginning of span
        https://bugs.webkit.org/show_bug.cgi?id=62621

        Added test for span id not getting duplicated when span is cloned.

        * editing/inserting/return-key-span-start-expected.txt: Added.
        * editing/inserting/return-key-span-start.html: Added.
2011-06-14  Annie Sullivan  <sulli...@chromium.org>

        Reviewed by Ryosuke Niwa.

        Span ID duplicated when pressing enter at beginning of span
        https://bugs.webkit.org/show_bug.cgi?id=62621

        Strip id from cloned span, so that it is not duplicated.

        Test: editing/inserting/return-key-span-start.html

        * editing/InsertParagraphSeparatorCommand.cpp:
        (WebCore::InsertParagraphSeparatorCommand::cloneHierarchyUnderNewBlock):

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (88889 => 88890)


--- trunk/LayoutTests/ChangeLog	2011-06-15 01:33:56 UTC (rev 88889)
+++ trunk/LayoutTests/ChangeLog	2011-06-15 01:51:54 UTC (rev 88890)
@@ -1,3 +1,15 @@
+2011-06-14  Annie Sullivan  <sulli...@chromium.org>
+
+        Reviewed by Ryosuke Niwa.
+
+        Span ID duplicated when pressing enter at beginning of span
+        https://bugs.webkit.org/show_bug.cgi?id=62621
+
+        Added test for span id not getting duplicated when span is cloned.
+
+        * editing/inserting/return-key-span-start-expected.txt: Added.
+        * editing/inserting/return-key-span-start.html: Added.
+
 2011-06-14  Ryosuke Niwa  <rn...@webkit.org>
 
         Mac, Windows, and Chromium rebaseline for r88883.

Added: trunk/LayoutTests/editing/inserting/return-key-span-start-expected.txt (0 => 88890)


--- trunk/LayoutTests/editing/inserting/return-key-span-start-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/editing/inserting/return-key-span-start-expected.txt	2011-06-15 01:51:54 UTC (rev 88890)
@@ -0,0 +1,8 @@
+This sets the selection to the start of a span, and hits the enter key.
+Expected behavior: when the span is split, its ID should not be duplicated. See bug 62621.
+| <span>
+|   id="dupe"
+|   <div>
+|     <span>
+|       <br>
+|   "<#selection-caret>hello"

Added: trunk/LayoutTests/editing/inserting/return-key-span-start.html (0 => 88890)


--- trunk/LayoutTests/editing/inserting/return-key-span-start.html	                        (rev 0)
+++ trunk/LayoutTests/editing/inserting/return-key-span-start.html	2011-06-15 01:51:54 UTC (rev 88890)
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+<body>
+<div contenteditable id="root"><span id="dupe">hello</span></div>
+<script src=""
+<script>
+var sel = window.getSelection();
+sel.setPosition(document.getElementById("dupe"), 0);
+eventSender.keyDown("\n");
+Markup.description("This sets the selection to the start of a span, and hits the enter key.\n"
+    + "Expected behavior: when the span is split, its ID should not be duplicated. See bug 62621.");
+Markup.dump(root);
+</script>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (88889 => 88890)


--- trunk/Source/WebCore/ChangeLog	2011-06-15 01:33:56 UTC (rev 88889)
+++ trunk/Source/WebCore/ChangeLog	2011-06-15 01:51:54 UTC (rev 88890)
@@ -1,3 +1,17 @@
+2011-06-14  Annie Sullivan  <sulli...@chromium.org>
+        
+        Reviewed by Ryosuke Niwa.
+
+        Span ID duplicated when pressing enter at beginning of span
+        https://bugs.webkit.org/show_bug.cgi?id=62621
+
+        Strip id from cloned span, so that it is not duplicated.
+        
+        Test: editing/inserting/return-key-span-start.html
+        
+        * editing/InsertParagraphSeparatorCommand.cpp:
+        (WebCore::InsertParagraphSeparatorCommand::cloneHierarchyUnderNewBlock):
+
 2011-06-13  Ryosuke Niwa  <rn...@webkit.org>
 
         Reviewed by David Hyatt.

Modified: trunk/Source/WebCore/editing/InsertParagraphSeparatorCommand.cpp (88889 => 88890)


--- trunk/Source/WebCore/editing/InsertParagraphSeparatorCommand.cpp	2011-06-15 01:33:56 UTC (rev 88889)
+++ trunk/Source/WebCore/editing/InsertParagraphSeparatorCommand.cpp	2011-06-15 01:51:54 UTC (rev 88890)
@@ -136,6 +136,10 @@
     RefPtr<Element> parent = blockToInsert;
     for (size_t i = ancestors.size(); i != 0; --i) {
         RefPtr<Element> child = ancestors[i - 1]->cloneElementWithoutChildren();
+        // It should always be okay to remove id from the cloned elements, since the originals are not deleted.
+        ExceptionCode ec = 0;
+        child->removeAttribute(idAttr, ec);
+        ASSERT(!ec);
         appendNode(child, parent);
         parent = child.release();
     }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to