LayoutTests:
authorjusting <justing@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 15 Jun 2006 22:26:52 +0000 (22:26 +0000)
committerjusting <justing@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 15 Jun 2006 22:26:52 +0000 (22:26 +0000)
        Reviewed by harrison

        * editing/deleting/pruning-after-merge-2-expected.checksum: Added.
        * editing/deleting/pruning-after-merge-2-expected.png: Added.
        * editing/deleting/pruning-after-merge-2-expected.txt: Added.
        * editing/deleting/pruning-after-merge-2.html: Added.

WebCore:

        Reviewed by harrison

        * editing/CompositeEditCommand.cpp:
        (WebCore::hasARenderedDescendant):
        (WebCore::CompositeEditCommand::prune): Ascend using the DOM
        (WebCore::CompositeEditCommand::moveParagraphs): Placeholder insertion
        during deletion is fixed, removing the fall back.

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

LayoutTests/ChangeLog
LayoutTests/editing/deleting/pruning-after-merge-2-expected.checksum [new file with mode: 0644]
LayoutTests/editing/deleting/pruning-after-merge-2-expected.png [new file with mode: 0644]
LayoutTests/editing/deleting/pruning-after-merge-2-expected.txt [new file with mode: 0644]
LayoutTests/editing/deleting/pruning-after-merge-2.html [new file with mode: 0644]
WebCore/ChangeLog
WebCore/editing/CompositeEditCommand.cpp

index 35dd4d4f01bd9b1aaac79a0bc52a1b53bc494850..93e734c2bcafb43b2b5ef1465ab723acd90c6149 100644 (file)
@@ -1,3 +1,12 @@
+2006-06-15  Justin Garcia  <justin.garcia@apple.com>
+
+        Reviewed by harrison
+
+        * editing/deleting/pruning-after-merge-2-expected.checksum: Added.
+        * editing/deleting/pruning-after-merge-2-expected.png: Added.
+        * editing/deleting/pruning-after-merge-2-expected.txt: Added.
+        * editing/deleting/pruning-after-merge-2.html: Added.
+
 2006-06-15  Nicholas Shanks  <contact@nickshanks.com>
 
         Reviewed by Hyatt, landed by Joost de Valk.
diff --git a/LayoutTests/editing/deleting/pruning-after-merge-2-expected.checksum b/LayoutTests/editing/deleting/pruning-after-merge-2-expected.checksum
new file mode 100644 (file)
index 0000000..e22c8ab
--- /dev/null
@@ -0,0 +1 @@
+fc3737f3b1c21c4e45b07fbc66a09b98
\ No newline at end of file
diff --git a/LayoutTests/editing/deleting/pruning-after-merge-2-expected.png b/LayoutTests/editing/deleting/pruning-after-merge-2-expected.png
new file mode 100644 (file)
index 0000000..78cee3f
Binary files /dev/null and b/LayoutTests/editing/deleting/pruning-after-merge-2-expected.png differ
diff --git a/LayoutTests/editing/deleting/pruning-after-merge-2-expected.txt b/LayoutTests/editing/deleting/pruning-after-merge-2-expected.txt
new file mode 100644 (file)
index 0000000..fe19644
--- /dev/null
@@ -0,0 +1,30 @@
+EDITING DELEGATE: shouldBeginEditingInDOMRange:range from 0 of DIV > BODY > HTML > #document to 2 of DIV > BODY > HTML > #document
+EDITING DELEGATE: webViewDidBeginEditing:WebViewDidBeginEditingNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 3 of #text > DIV > DIV > BODY > HTML > #document to 3 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (8,8) size 784x584
+      RenderBlock {P} at (0,0) size 784x36
+        RenderText {#text} at (0,0) size 760x36
+          text run at (0,0) width 662: "This tests to see if deletion correctly prunes the containers of the paragraph being moved during a merge. "
+          text run at (662,0) width 98: "You should see"
+          text run at (0,18) width 24: "'foo"
+        RenderInline {B} at (0,0) size 24x18
+          RenderText {#text} at (24,18) size 24x18
+            text run at (24,18) width 24: "bar"
+        RenderText {#text} at (48,18) size 50x18
+          text run at (48,18) width 50: "' below."
+      RenderBlock {DIV} at (0,52) size 784x18
+        RenderBlock {DIV} at (0,0) size 784x18
+          RenderText {#text} at (0,0) size 21x18
+            text run at (0,0) width 21: "foo"
+          RenderInline {B} at (0,0) size 24x18
+            RenderText {#text} at (21,0) size 24x18
+              text run at (21,0) width 24: "bar"
+caret: position 3 of child 0 {#text} of child 0 {DIV} of child 2 {DIV} of child 0 {BODY} of child 0 {HTML} of document
diff --git a/LayoutTests/editing/deleting/pruning-after-merge-2.html b/LayoutTests/editing/deleting/pruning-after-merge-2.html
new file mode 100644 (file)
index 0000000..cd1d9c1
--- /dev/null
@@ -0,0 +1,13 @@
+<p>This tests to see if deletion correctly prunes the containers of the paragraph being moved during a merge.  You should see 'foo<b>bar</b>' below.</p>
+
+<div id="test" contenteditable="true"><div>foo</div><div style="border: 1px solid blue; padding: 5px"><b><div style="border: 1px solid red; padding: 5px">bar</div></b></div></div>
+
+<script>
+var e = document.getElementById("test");
+var s = window.getSelection();
+s.setPosition(e, 0);
+s.modify("move", "forward", "line");
+
+document.execCommand("Delete");
+
+</script>
\ No newline at end of file
index df51becf5d9658853d07bca3936c548917880a57..4aa3703e55ae8ba5ae254b0bb97056879f2b6a0c 100644 (file)
@@ -1,3 +1,13 @@
+2006-06-15  Justin Garcia  <justin.garcia@apple.com>
+
+        Reviewed by harrison
+        
+        * editing/CompositeEditCommand.cpp:
+        (WebCore::hasARenderedDescendant):
+        (WebCore::CompositeEditCommand::prune): Ascend using the DOM
+        (WebCore::CompositeEditCommand::moveParagraphs): Placeholder insertion
+        during deletion is fixed, removing the fall back.
+
 2006-06-15  Nicholas Shanks  <contact@nickshanks.com>
 
         Reviewed by Hyatt, landed by Joost de Valk.
index 5c65c85eaf33834551a4766517407a4692a6d5e7..ebe0e25bfa3d5fb65c7f09e09d1ecb9afeaf561d 100644 (file)
@@ -217,13 +217,12 @@ void CompositeEditCommand::removeNodeAndPruneAncestors(Node* node)
 
 bool hasARenderedDescendant(Node* node)
 {
-    Node* n = node->traverseNextNode(node);
+    Node* n = node->firstChild();
     while (n) {
         if (n->renderer())
             return true;
         n = n->traverseNextNode(node);
     }
-    
     return false;
 }
 
@@ -236,17 +235,6 @@ void CompositeEditCommand::prune(PassRefPtr<Node> node)
             return;
             
         RefPtr<Node> next = node->parentNode();
-        
-        if (renderer) {
-            RenderObject* p = renderer->parent();
-            while (p && !p->element())
-                p = p->parent();
-            ASSERT(p);
-            if (!p)
-                return;
-            next = p->element();        
-        }
-
         removeNode(node.get());
         node = next;
     }
@@ -699,12 +687,12 @@ void CompositeEditCommand::moveParagraphs(const VisiblePosition& startOfParagrap
     
     // Deleting a paragraph leaves a placeholder (it always does when a whole paragraph is deleted).
     // We remove it and prune its parents since we want to remove all traces of the paragraph we're moving.
-    Node* placeholder = endingSelection().end().node();
-    if (placeholder->hasTagName(brTag))
+    Node* placeholder = endingSelection().end().downstream().node();
+    ASSERT(placeholder->hasTagName(brTag));
+    // There are bugs in deletion when it removes a fully selected table/list.  It expands and removes the entire table/list, but will let content
+    // before and after the table/list collapse onto one line.
+    if (placeholder->hasTagName(brTag) && isStartOfParagraph(endingSelection().visibleStart()) && isEndOfParagraph(endingSelection().visibleStart()))
         removeNodeAndPruneAncestors(placeholder);
-    // FIXME: Deletion has bugs and it doesn't always add a placeholder.  If it fails, still do pruning.
-    else
-        prune(placeholder);
 
     // Add a br if pruning an empty block level element caused a collapse.  For example:
     // foo^