[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.15.1-1414-gc69ee75

eric at webkit.org eric at webkit.org
Thu Oct 29 20:42:38 UTC 2009


The following commit has been merged in the webkit-1.1 branch:
commit bdccb1c7dad6d5fc8bc16630586aaea04e487273
Author: eric at webkit.org <eric at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Oct 9 22:01:07 2009 +0000

    2009-10-09  Enrica Casucci  <enrica at apple.com>
    
            Reviewed by Adele Peterson.
    
            Undoing a indent removes text instead of it's formatting.
            <rdar://problem/7169206>
            https://bugs.webkit.org/show_bug.cgi?id=28722
            Added test case for https://bugs.webkit.org/show_bug.cgi?id=23995
    
            * editing/execCommand/19653-1-expected.txt: Re-baselined.
            * editing/execCommand/indent-div-inside-list-expected.txt: Re-baselined.
            * editing/execCommand/indent-nested-blockquotes-expected.txt: Re-baselined.
            * editing/execCommand/indent-nested-div-expected.txt: Re-baselined.
            * editing/execCommand/indent-second-paragraph-in-blockquote-expected.txt: Re-baselined.
            * editing/execCommand/indent-with-style-expected.txt: Added.
            * editing/execCommand/indent-with-style.html: Added.
            * editing/undo/undo-indent-expected.txt: Added.
            * editing/undo/undo-indent.html: Added.
            * platform/mac/editing/execCommand/4641880-2-expected.txt: Re-baselined.
            * platform/mac/editing/execCommand/4916541-expected.txt: Re-baselined.
            * platform/mac/editing/execCommand/5138441-expected.txt: Re-baselined.
            * platform/mac/editing/execCommand/5481523-expected.txt: Re-baselined.
            * platform/mac/editing/execCommand/indent-selection-expected.txt: Re-baselined.
    2009-10-09  Enrica Casucci  <enrica at apple.com>
    
            Reviewed by Adele Peterson.
    
            Undoing a indent removes text instead of it's formatting.
            <rdar://problem/7169206>
            https://bugs.webkit.org/show_bug.cgi?id=28722
            Restored the behavior prior to http://trac.webkit.org/changeset/46143. This change implemented the
            indent command making simple DOM operation, without using moveParagraph which cause undo to be broken.
    
            Added editing/undo/undo-indent.html test.
    
            * editing/IndentOutdentCommand.cpp:
            (WebCore::IndentOutdentCommand::prepareBlockquoteLevelForInsertion): Restored.
            (WebCore::IndentOutdentCommand::tryIndentingAsListItem): Merged changes.
            (WebCore::IndentOutdentCommand::indentIntoBlockquote): Restored.
            (WebCore::IndentOutdentCommand::indentRegion): Restored and added call to updateLayout to
            ensure TextIterator could correctly calculate the position starting from the index.
            * editing/IndentOutdentCommand.h: Restored.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@49405 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 42fa6d8..11e4fd8 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,27 @@
+2009-10-09  Enrica Casucci  <enrica at apple.com>
+
+        Reviewed by Adele Peterson.
+
+        Undoing a indent removes text instead of it's formatting.
+        <rdar://problem/7169206>
+        https://bugs.webkit.org/show_bug.cgi?id=28722
+        Added test case for https://bugs.webkit.org/show_bug.cgi?id=23995
+
+        * editing/execCommand/19653-1-expected.txt: Re-baselined.
+        * editing/execCommand/indent-div-inside-list-expected.txt: Re-baselined.
+        * editing/execCommand/indent-nested-blockquotes-expected.txt: Re-baselined.
+        * editing/execCommand/indent-nested-div-expected.txt: Re-baselined.
+        * editing/execCommand/indent-second-paragraph-in-blockquote-expected.txt: Re-baselined.
+        * editing/execCommand/indent-with-style-expected.txt: Added.
+        * editing/execCommand/indent-with-style.html: Added.
+        * editing/undo/undo-indent-expected.txt: Added.
+        * editing/undo/undo-indent.html: Added.
+        * platform/mac/editing/execCommand/4641880-2-expected.txt: Re-baselined.
+        * platform/mac/editing/execCommand/4916541-expected.txt: Re-baselined.
+        * platform/mac/editing/execCommand/5138441-expected.txt: Re-baselined.
+        * platform/mac/editing/execCommand/5481523-expected.txt: Re-baselined.
+        * platform/mac/editing/execCommand/indent-selection-expected.txt: Re-baselined.
+
 2009-10-09  Dirk Schulze  <krit at webkit.org>
 
         Reviewed by Oliver Hunt.
diff --git a/LayoutTests/editing/execCommand/19653-1-expected.txt b/LayoutTests/editing/execCommand/19653-1-expected.txt
index e9867fc..c983683 100644
--- a/LayoutTests/editing/execCommand/19653-1-expected.txt
+++ b/LayoutTests/editing/execCommand/19653-1-expected.txt
@@ -5,7 +5,7 @@ This tests creating a list from an empty paragraph when the typing style was Bol
 <ul><li><b>Bold</b></li></ul>
 
 This tests indenting an empty paragraph with bold already applied to it. The word below should be bold.
-<blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"><div><b>Bold</b></div></blockquote>
+<blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"><b>Bold</b></blockquote>
 
 This tests indenting an empty paragraph when the typing style was Bold. The word below should be bold.
 <blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"><b>Bold</b></blockquote>
diff --git a/LayoutTests/editing/execCommand/indent-div-inside-list-expected.txt b/LayoutTests/editing/execCommand/indent-div-inside-list-expected.txt
index 20bffb2..368ecb2 100644
--- a/LayoutTests/editing/execCommand/indent-div-inside-list-expected.txt
+++ b/LayoutTests/editing/execCommand/indent-div-inside-list-expected.txt
@@ -4,4 +4,4 @@ a
 hello
 world
 b
-a <ul> <li>hello<blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"><div id="test"> world </div></blockquote></li></ul> b
+a <ul> <li>hello</li></ul><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;">world</blockquote> b
diff --git a/LayoutTests/editing/execCommand/indent-nested-blockquotes-expected.txt b/LayoutTests/editing/execCommand/indent-nested-blockquotes-expected.txt
index 121c561..847d021 100644
--- a/LayoutTests/editing/execCommand/indent-nested-blockquotes-expected.txt
+++ b/LayoutTests/editing/execCommand/indent-nested-blockquotes-expected.txt
@@ -4,4 +4,4 @@ hello
 world
 webkit
 is great
-<blockquote id="outer"> hello <blockquote id="inner"> world<br><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"> webkit </blockquote></blockquote> is great </blockquote>
+<blockquote id="outer"> hello <blockquote id="inner"> world<br></blockquote></blockquote><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;">webkit</blockquote></blockquote></blockquote><blockquote id="outer"> is great </blockquote>
diff --git a/LayoutTests/editing/execCommand/indent-nested-div-expected.txt b/LayoutTests/editing/execCommand/indent-nested-div-expected.txt
index 20f5e13..89e572b 100644
--- a/LayoutTests/editing/execCommand/indent-nested-div-expected.txt
+++ b/LayoutTests/editing/execCommand/indent-nested-div-expected.txt
@@ -1,4 +1,4 @@
 This tests indenting nested divs. By indenting "hello", we should be able to enclose all three blocks 1 through 3 by a blockquote
 
 hello
-<blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"><div id="block1"><div id="block2"><div id="block3">hello</div></div></div></blockquote>
+<blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;">hello</blockquote>
diff --git a/LayoutTests/editing/execCommand/indent-second-paragraph-in-blockquote-expected.txt b/LayoutTests/editing/execCommand/indent-second-paragraph-in-blockquote-expected.txt
index 2d15475..2a4a5af 100644
--- a/LayoutTests/editing/execCommand/indent-second-paragraph-in-blockquote-expected.txt
+++ b/LayoutTests/editing/execCommand/indent-second-paragraph-in-blockquote-expected.txt
@@ -2,4 +2,4 @@ This tests indenting the second paragraph in a blockquote. By indenting "world",
 
 hello
 world
-<blockquote id="test"> hello<br><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"> world </blockquote></blockquote>
+<blockquote id="test"> hello<br></blockquote><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;">world</blockquote></blockquote>
diff --git a/LayoutTests/editing/execCommand/indent-with-style-expected.txt b/LayoutTests/editing/execCommand/indent-with-style-expected.txt
new file mode 100644
index 0000000..c774fae
--- /dev/null
+++ b/LayoutTests/editing/execCommand/indent-with-style-expected.txt
@@ -0,0 +1,17 @@
+EDITING DELEGATE: shouldBeginEditingInDOMRange:range from 0 of DIV > BODY > HTML > #document to 9 of DIV > BODY > HTML > #document
+EDITING DELEGATE: webViewDidBeginEditing:WebViewDidBeginEditingNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 0 of #text > SPAN > BLOCKQUOTE > DIV > BODY > HTML > #document to 5 of #text > SPAN > BLOCKQUOTE > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+This tests indenting two and three. You should see two and three indented and with the same background color as one and four.
+Bug 23995
+
+one
+two
+three
+four
+
+Before ordered list: <div><span class="Apple-style-span" style="background-color: rgb(255, 0, 0);">one</span></div> <div id="test1"><span class="Apple-style-span" style="background-color: rgb(255, 0, 0);">two</span></div> <div id="test2"><span class="Apple-style-span" style="background-color: rgb(255, 0, 0);">three</span></div> <div><span class="Apple-style-span" style="background-color: rgb(255, 0, 0);">four</span></div>
+After ordered: <div><span class="Apple-style-span" style="background-color: rgb(255, 0, 0);">one</span></div> <blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"><span class="Apple-style-span" style="background-color: rgb(255, 0, 0); ">two</span><br><span class="Apple-style-span" style="background-color: rgb(255, 0, 0); ">three</span></blockquote> <div><span class="Apple-style-span" style="background-color: rgb(255, 0, 0);">four</span></div>
diff --git a/LayoutTests/editing/execCommand/indent-with-style.html b/LayoutTests/editing/execCommand/indent-with-style.html
new file mode 100644
index 0000000..fb6b9b4
--- /dev/null
+++ b/LayoutTests/editing/execCommand/indent-with-style.html
@@ -0,0 +1,39 @@
+<html>
+<body>
+This tests indenting two and three. You should see two and three indented and with the same background color as one and four.
+<p>
+<a href="https://bugs.webkit.org/show_bug.cgi?id=23995">Bug 23995</a>
+</p>
+<div id="e" contenteditable="true">
+    <div><span class="Apple-style-span" style="background-color: rgb(255, 0, 0);">one</span></div>
+    <div id="test1"><span class="Apple-style-span" style="background-color: rgb(255, 0, 0);">two</span></div>
+    <div id="test2"><span class="Apple-style-span" style="background-color: rgb(255, 0, 0);">three</span></div>
+    <div><span class="Apple-style-span" style="background-color: rgb(255, 0, 0);">four</span></div>
+</div>
+<br>
+<ul>
+<li>Before ordered list:<span id="c1"></span></li>
+<li>After ordered:<span id="c2"></span></li>
+</ul>
+
+<script type="text/javascript">
+
+if (window.layoutTestController) {
+    layoutTestController.dumpEditingCallbacks();
+    layoutTestController.dumpAsText();
+}
+
+var e = document.getElementById('e');
+var t1 = document.getElementById("test1");
+var t2 = document.getElementById("test2");
+var s = window.getSelection();
+var r = document.createRange();
+
+r.setStart(t1,0);
+r.setEnd(t2,1);
+s.removeAllRanges();
+s.addRange(r);
+document.getElementById('c1').appendChild(document.createTextNode(e.innerHTML));
+document.execCommand("Indent", false, "");
+document.getElementById('c2').appendChild(document.createTextNode(e.innerHTML));
+</script>
diff --git a/LayoutTests/editing/undo/undo-indent-expected.txt b/LayoutTests/editing/undo/undo-indent-expected.txt
new file mode 100644
index 0000000..659100c
--- /dev/null
+++ b/LayoutTests/editing/undo/undo-indent-expected.txt
@@ -0,0 +1,23 @@
+EDITING DELEGATE: shouldBeginEditingInDOMRange:range from 0 of OL > DIV > BODY > HTML > #document to 9 of OL > DIV > BODY > HTML > #document
+EDITING DELEGATE: webViewDidBeginEditing:WebViewDidBeginEditingNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 0 of #text > LI > OL > OL > DIV > BODY > HTML > #document to 5 of #text > LI > OL > OL > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 0 of #text > LI > OL > DIV > BODY > HTML > #document to 0 of LI > OL > OL > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+This tests indenting "three" then undoing the indent. You should see one, two and three numbered 1 through 3 then four as a sublist with number 1.
+Bugzilla bug 
+Radar bug
+
+one
+two
+three
+four
+Before indent: <li>one</li> <li>two</li> <li id="test">three</li> <ol><li>four</li></ol>
+After indent: <li>one</li> <li>two</li> <ol><li id="test">three</li><li>four</li></ol>
+After undoing: <li>one</li> <li>two</li> <li id="test">three</li> <ol><li>four</li></ol>
+The test passed
diff --git a/LayoutTests/editing/undo/undo-indent.html b/LayoutTests/editing/undo/undo-indent.html
new file mode 100644
index 0000000..ae1fe19
--- /dev/null
+++ b/LayoutTests/editing/undo/undo-indent.html
@@ -0,0 +1,50 @@
+<html>
+<body>
+<div>
+This tests indenting "three" then undoing the indent. You should see one, two and three numbered 1 through 3 then four as a sublist with number 1.
+<p>
+<a href="https://bugs.webkit.org/show_bug.cgi?id=28722">Bugzilla bug</a>
+<br>
+<a href="rdar://problem/7169206">Radar bug</a>
+</p>
+<ol id="e" contenteditable="true">
+<li>one</li>
+<li>two</li>
+<li id="test">three</li>
+<ol><li>four</li></ol>
+</ol>
+</div>
+
+<ul>
+<li>Before indent:<span id="c1"></span></li>
+<li>After indent:<span id="c2"></span></li>
+<li>After undoing:<span id="c3"></span></li>
+</ul>
+
+<script type="text/javascript">
+
+if (window.layoutTestController) {
+    layoutTestController.dumpEditingCallbacks();
+    layoutTestController.dumpAsText();
+}
+
+var e = document.getElementById('e');
+
+document.getElementById('c1').appendChild(document.createTextNode(e.innerHTML));
+
+var s = window.getSelection();
+var r = document.createRange();
+r.selectNode(document.getElementById('test'));
+s.removeAllRanges();
+s.addRange(r);
+document.execCommand("Indent", false, "");
+document.getElementById('c2').appendChild(document.createTextNode(e.innerHTML));
+
+document.execCommand("Undo");
+document.getElementById('c3').appendChild(document.createTextNode(e.innerHTML));
+
+if (document.getElementById('c1').innerHTML == document.getElementById('c3').innerHTML)
+    document.write("The test passed");
+else
+    document.write("The test failed.");
+</script>
diff --git a/LayoutTests/platform/mac/editing/execCommand/4641880-2-expected.txt b/LayoutTests/platform/mac/editing/execCommand/4641880-2-expected.txt
index 6d229ff..3f85c54 100644
--- a/LayoutTests/platform/mac/editing/execCommand/4641880-2-expected.txt
+++ b/LayoutTests/platform/mac/editing/execCommand/4641880-2-expected.txt
@@ -3,7 +3,7 @@ EDITING DELEGATE: webViewDidBeginEditing:WebViewDidBeginEditingNotification
 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
-EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 1 of #text > BLOCKQUOTE > DIV > BODY > HTML > #document to 35 of #text > BLOCKQUOTE > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 0 of #text > BLOCKQUOTE > DIV > BODY > HTML > #document to 34 of #text > BLOCKQUOTE > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
 EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
 layer at (0,0) size 800x600
@@ -24,5 +24,5 @@ layer at (0,0) size 800x600
           RenderText {#text} at (0,0) size 246x18
             text run at (0,0) width 246: "This paragraph should not be indented."
           RenderBR {BR} at (246,14) size 0x0
-selection start: position 1 of child 0 {#text} of child 0 {BLOCKQUOTE} of child 2 {DIV} of child 1 {BODY} of child 0 {HTML} of document
-selection end:   position 35 of child 0 {#text} of child 0 {BLOCKQUOTE} of child 2 {DIV} of child 1 {BODY} of child 0 {HTML} of document
+selection start: position 0 of child 0 {#text} of child 0 {BLOCKQUOTE} of child 2 {DIV} of child 1 {BODY} of child 0 {HTML} of document
+selection end:   position 34 of child 0 {#text} of child 0 {BLOCKQUOTE} of child 2 {DIV} of child 1 {BODY} of child 0 {HTML} of document
diff --git a/LayoutTests/platform/mac/editing/execCommand/4916541-expected.txt b/LayoutTests/platform/mac/editing/execCommand/4916541-expected.txt
index cb53b38..64a6293 100644
--- a/LayoutTests/platform/mac/editing/execCommand/4916541-expected.txt
+++ b/LayoutTests/platform/mac/editing/execCommand/4916541-expected.txt
@@ -10,13 +10,11 @@ layer at (0,0) size 800x600
           text run at (0,18) width 320: "'foo' and 'bar' before and after the indent operation."
       RenderBlock {DIV} at (0,52) size 784x36
         RenderBlock {BLOCKQUOTE} at (40,0) size 744x36
-          RenderInline {SPAN} at (0,0) size 21x18
-            RenderText {#text} at (0,0) size 21x18
-              text run at (0,0) width 21: "foo"
+          RenderText {#text} at (0,0) size 21x18
+            text run at (0,0) width 21: "foo"
           RenderBR {BR} at (21,14) size 0x0
-          RenderInline {SPAN} at (0,0) size 20x18
-            RenderText {#text} at (0,18) size 20x18
-              text run at (0,18) width 20: "bar"
+          RenderText {#text} at (0,18) size 20x18
+            text run at (0,18) width 20: "bar"
         RenderBlock (anonymous) at (0,36) size 784x0
-selection start: position 1 of child 0 {#text} of child 0 {SPAN} of child 0 {BLOCKQUOTE} of child 2 {DIV} of child 1 {BODY} of child 0 {HTML} of document
-selection end:   position 2 of child 0 {#text} of child 2 {SPAN} of child 0 {BLOCKQUOTE} of child 2 {DIV} of child 1 {BODY} of child 0 {HTML} of document
+selection start: position 1 of child 0 {#text} of child 0 {BLOCKQUOTE} of child 2 {DIV} of child 1 {BODY} of child 0 {HTML} of document
+selection end:   position 2 of child 2 {#text} of child 0 {BLOCKQUOTE} of child 2 {DIV} of child 1 {BODY} of child 0 {HTML} of document
diff --git a/LayoutTests/platform/mac/editing/execCommand/5138441-expected.txt b/LayoutTests/platform/mac/editing/execCommand/5138441-expected.txt
index bbaf529..5cc3798 100644
--- a/LayoutTests/platform/mac/editing/execCommand/5138441-expected.txt
+++ b/LayoutTests/platform/mac/editing/execCommand/5138441-expected.txt
@@ -10,12 +10,10 @@ layer at (0,0) size 800x600
           text run at (0,18) width 776: "FormatBlock to implement a \"Quote Text\" feature, and style rules for blockquotes appeared on the blockquotes that we use"
           text run at (0,36) width 149: "to implement indenting."
       RenderBlock {DIV} at (0,70) size 784x62
-        RenderBlock {DIV} at (0,0) size 784x18
-          RenderBlock {BLOCKQUOTE} at (40,0) size 744x18
-            RenderText {#text} at (0,0) size 230x18
-              text run at (0,0) width 230: "This should be indented, not quoted."
-          RenderBlock (anonymous) at (0,18) size 784x0
+        RenderBlock {BLOCKQUOTE} at (40,0) size 744x18
+          RenderText {#text} at (0,0) size 230x18
+            text run at (0,0) width 230: "This should be indented, not quoted."
         RenderBlock {BLOCKQUOTE} at (8,26) size 768x36 [border: (1px dashed #AAAAAA)]
           RenderText {#text} at (9,9) size 175x18
             text run at (9,9) width 175: "This text should be Quoted."
-caret: position 0 of child 0 {#text} of child 0 {BLOCKQUOTE} of child 1 {DIV} of child 3 {DIV} of child 1 {BODY} of child 0 {HTML} of document
+caret: position 0 of child 0 {#text} of child 1 {BLOCKQUOTE} of child 3 {DIV} of child 1 {BODY} of child 0 {HTML} of document
diff --git a/LayoutTests/platform/mac/editing/execCommand/5481523-expected.txt b/LayoutTests/platform/mac/editing/execCommand/5481523-expected.txt
index cc23f90..0d6de44 100644
--- a/LayoutTests/platform/mac/editing/execCommand/5481523-expected.txt
+++ b/LayoutTests/platform/mac/editing/execCommand/5481523-expected.txt
@@ -27,5 +27,7 @@ layer at (0,0) size 800x600
                   RenderTableCell {TD} at (45,26) size 34x22 [border: (1px inset #808080)] [r=1 c=1 rs=1 cs=1]
                     RenderText {#text} at (2,2) size 30x18
                       text run at (2,2) width 30: "Four"
+            RenderBlock (anonymous) at (0,52) size 704x0
+        RenderBlock (anonymous) at (0,52) size 784x0
 selection start: position 0 of child 0 {TABLE} of child 0 {BLOCKQUOTE} of child 1 {BLOCKQUOTE} of child 2 {DIV} of child 1 {BODY} of child 0 {HTML} of document
-selection end:   position 2 of child 0 {TABLE} of child 0 {BLOCKQUOTE} of child 1 {BLOCKQUOTE} of child 2 {DIV} of child 1 {BODY} of child 0 {HTML} of document
+selection end:   position 1 of child 0 {TABLE} of child 0 {BLOCKQUOTE} of child 1 {BLOCKQUOTE} of child 2 {DIV} of child 1 {BODY} of child 0 {HTML} of document
diff --git a/LayoutTests/platform/mac/editing/execCommand/indent-selection-expected.txt b/LayoutTests/platform/mac/editing/execCommand/indent-selection-expected.txt
index c3536fb..9c32795 100644
--- a/LayoutTests/platform/mac/editing/execCommand/indent-selection-expected.txt
+++ b/LayoutTests/platform/mac/editing/execCommand/indent-selection-expected.txt
@@ -3,7 +3,7 @@ EDITING DELEGATE: webViewDidBeginEditing:WebViewDidBeginEditingNotification
 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
-EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 0 of #text > SPAN > BLOCKQUOTE > DIV > BODY > HTML > #document to 5 of #text > SPAN > BLOCKQUOTE > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 0 of #text > BLOCKQUOTE > DIV > BODY > HTML > #document to 5 of #text > BLOCKQUOTE > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
 EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
 layer at (0,0) size 800x600
@@ -17,43 +17,42 @@ layer at (0,0) size 800x600
       RenderBlock (anonymous) at (0,18) size 784x18
         RenderBR {BR} at (0,0) size 0x18
       RenderBlock {DIV} at (0,36) size 784x194
-        RenderBlock {BLOCKQUOTE} at (40,0) size 744x194
+        RenderBlock {BLOCKQUOTE} at (40,0) size 744x54
           RenderBlock (anonymous) at (0,0) size 744x36
-            RenderInline {SPAN} at (0,0) size 42x18
-              RenderText {#text} at (0,0) size 42x18
-                text run at (0,0) width 42: "Lorem"
+            RenderText {#text} at (0,0) size 42x18
+              text run at (0,0) width 42: "Lorem"
             RenderBR {BR} at (42,14) size 0x0
             RenderText {#text} at (0,18) size 83x18
               text run at (0,18) width 83: "more Lorem!"
-          RenderBlock {BLOCKQUOTE} at (40,36) size 704x122
-            RenderBlock (anonymous) at (0,0) size 704x18
-              RenderText {#text} at (0,0) size 38x18
-                text run at (0,0) width 38: "ipsum"
-              RenderBR {BR} at (38,14) size 0x0
-            RenderBlock {UL} at (0,34) size 704x54
+          RenderBlock {BLOCKQUOTE} at (40,36) size 704x18
+            RenderText {#text} at (0,0) size 38x18
+              text run at (0,0) width 38: "ipsum"
+        RenderBlock (anonymous) at (0,54) size 784x0
+        RenderBlock {BLOCKQUOTE} at (40,70) size 744x54
+          RenderBlock {UL} at (0,0) size 744x54
+            RenderBlock {UL} at (40,0) size 704x54
               RenderListItem {LI} at (40,0) size 664x18
-                RenderListMarker at (-17,0) size 7x18: bullet
+                RenderListMarker at (-17,0) size 7x18: white bullet
                 RenderText {#text} at (0,0) size 25x18
                   text run at (0,0) width 25: "Foo"
               RenderListItem {LI} at (40,18) size 664x18
-                RenderListMarker at (-17,0) size 7x18: bullet
+                RenderListMarker at (-17,0) size 7x18: white bullet
                 RenderText {#text} at (0,0) size 23x18
                   text run at (0,0) width 23: "Bar"
               RenderListItem {LI} at (40,36) size 664x18
-                RenderListMarker at (-17,0) size 7x18: bullet
+                RenderListMarker at (-17,0) size 7x18: white bullet
                 RenderText {#text} at (0,0) size 25x18
                   text run at (0,0) width 25: "Baz"
-            RenderBlock (anonymous) at (0,104) size 704x18
-              RenderText {#text} at (0,0) size 37x18
-                text run at (0,0) width 37: "Dolor"
-          RenderBlock (anonymous) at (0,158) size 744x36
+        RenderBlock {BLOCKQUOTE} at (40,140) size 744x54
+          RenderBlock {BLOCKQUOTE} at (40,0) size 704x18
+            RenderText {#text} at (0,0) size 37x18
+              text run at (0,0) width 37: "Dolor"
+          RenderBlock (anonymous) at (0,18) size 744x36
             RenderText {#text} at (0,0) size 34x18
               text run at (0,0) width 34: "Sum!"
             RenderBR {BR} at (34,14) size 0x0
-            RenderInline {SPAN} at (0,0) size 38x18
-              RenderText {#text} at (0,18) size 38x18
-                text run at (0,18) width 38: "Thing"
+            RenderText {#text} at (0,18) size 38x18
+              text run at (0,18) width 38: "Thing"
         RenderBlock (anonymous) at (0,194) size 784x0
-          RenderText {#text} at (0,0) size 0x0
-selection start: position 0 of child 0 {#text} of child 0 {SPAN} of child 1 {BLOCKQUOTE} of child 4 {DIV} of child 1 {BODY} of child 0 {HTML} of document
-selection end:   position 5 of child 0 {#text} of child 6 {SPAN} of child 1 {BLOCKQUOTE} of child 4 {DIV} of child 1 {BODY} of child 0 {HTML} of document
+selection start: position 0 of child 0 {#text} of child 1 {BLOCKQUOTE} of child 4 {DIV} of child 1 {BODY} of child 0 {HTML} of document
+selection end:   position 5 of child 3 {#text} of child 3 {BLOCKQUOTE} of child 4 {DIV} of child 1 {BODY} of child 0 {HTML} of document
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index b4fdd65..d5adf45 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,23 @@
+2009-10-09  Enrica Casucci  <enrica at apple.com>
+
+        Reviewed by Adele Peterson.
+
+        Undoing a indent removes text instead of it's formatting.
+        <rdar://problem/7169206>
+        https://bugs.webkit.org/show_bug.cgi?id=28722
+        Restored the behavior prior to http://trac.webkit.org/changeset/46143. This change implemented the
+        indent command making simple DOM operation, without using moveParagraph which cause undo to be broken.
+        
+        Added editing/undo/undo-indent.html test.
+
+        * editing/IndentOutdentCommand.cpp:
+        (WebCore::IndentOutdentCommand::prepareBlockquoteLevelForInsertion): Restored. 
+        (WebCore::IndentOutdentCommand::tryIndentingAsListItem): Merged changes.
+        (WebCore::IndentOutdentCommand::indentIntoBlockquote): Restored.
+        (WebCore::IndentOutdentCommand::indentRegion): Restored and added call to updateLayout to
+        ensure TextIterator could correctly calculate the position starting from the index.
+        * editing/IndentOutdentCommand.h: Restored.
+
 2009-10-09  Jens Alfke  <snej at chromium.org>
 
         Reviewed by Darin Adler.
diff --git a/WebCore/editing/IndentOutdentCommand.cpp b/WebCore/editing/IndentOutdentCommand.cpp
index 308ba74..84fa147 100644
--- a/WebCore/editing/IndentOutdentCommand.cpp
+++ b/WebCore/editing/IndentOutdentCommand.cpp
@@ -33,7 +33,6 @@
 #include "InsertLineBreakCommand.h"
 #include "InsertListCommand.h"
 #include "Range.h"
-#include "DocumentFragment.h"
 #include "SplitElementCommand.h"
 #include "TextIterator.h"
 #include "htmlediting.h"
@@ -68,6 +67,37 @@ IndentOutdentCommand::IndentOutdentCommand(Document* document, EIndentType typeO
 {
 }
 
+// This function is a workaround for moveParagraph's tendency to strip blockquotes. It updates lastBlockquote to point to the
+// correct level for the current paragraph, and returns a pointer to a placeholder br where the insertion should be performed.
+PassRefPtr<Element> IndentOutdentCommand::prepareBlockquoteLevelForInsertion(const VisiblePosition& currentParagraph, RefPtr<Element>& lastBlockquote)
+{
+    int currentBlockquoteLevel = 0;
+    int lastBlockquoteLevel = 0;
+    Node* node = currentParagraph.deepEquivalent().node();
+    while ((node = enclosingNodeWithTag(Position(node->parentNode(), 0), blockquoteTag)))
+        currentBlockquoteLevel++;
+    node = lastBlockquote.get();
+    while ((node = enclosingNodeWithTag(Position(node->parentNode(), 0), blockquoteTag)))
+        lastBlockquoteLevel++;
+    while (currentBlockquoteLevel > lastBlockquoteLevel) {
+        RefPtr<Element> newBlockquote = createIndentBlockquoteElement(document());
+        appendNode(newBlockquote, lastBlockquote);
+        lastBlockquote = newBlockquote;
+        lastBlockquoteLevel++;
+    }
+    while (currentBlockquoteLevel < lastBlockquoteLevel) {
+        lastBlockquote = static_cast<Element*>(enclosingNodeWithTag(Position(lastBlockquote->parentNode(), 0), blockquoteTag));
+        lastBlockquoteLevel--;
+    }
+    RefPtr<Element> placeholder = createBreakElement(document());
+    appendNode(placeholder, lastBlockquote);
+    // Add another br before the placeholder if it collapsed.
+    VisiblePosition visiblePos(Position(placeholder.get(), 0));
+    if (!isStartOfParagraph(visiblePos))
+        insertNodeBefore(createBreakElement(document()), placeholder);
+    return placeholder.release();
+}
+
 bool IndentOutdentCommand::tryIndentingAsListItem(const VisiblePosition& endOfCurrentParagraph)
 {
     // If our selection is not inside a list, bail out.
@@ -81,14 +111,19 @@ bool IndentOutdentCommand::tryIndentingAsListItem(const VisiblePosition& endOfCu
     // FIXME: we need to deal with the case where there is no li (malformed HTML)
     if (!selectedListItem->hasTagName(liTag))
         return false;
-
+    
     // FIXME: previousElementSibling does not ignore non-rendered content like <span></span>.  Should we?
     Element* previousList = selectedListItem->previousElementSibling();
     Element* nextList = selectedListItem->nextElementSibling();
 
     RefPtr<Element> newList = document()->createElement(listNode->tagQName(), false);
+    RefPtr<Element> newListItem = selectedListItem->cloneElementWithoutChildren();
+    RefPtr<Element> placeholder = createBreakElement(document());
     insertNodeBefore(newList, selectedListItem);
-    appendParagraphIntoNode(visiblePositionBeforeNode(selectedListItem), visiblePositionAfterNode(selectedListItem), newList.get());
+    appendNode(newListItem, newList);
+    appendNode(placeholder, newListItem);
+
+    moveParagraph(startOfParagraph(endOfCurrentParagraph), endOfCurrentParagraph, VisiblePosition(Position(placeholder, 0)), true);
 
     if (canMergeLists(previousList, newList.get()))
         mergeIdenticalElements(previousList, newList);
@@ -98,79 +133,29 @@ bool IndentOutdentCommand::tryIndentingAsListItem(const VisiblePosition& endOfCu
     return true;
 }
     
-void IndentOutdentCommand::indentIntoBlockquote(const VisiblePosition& startOfCurrentParagraph, const VisiblePosition& endOfCurrentParagraph, RefPtr<Element>& targetBlockquote, Node* nodeToSplitTo)
+void IndentOutdentCommand::indentIntoBlockquote(const VisiblePosition& endOfCurrentParagraph, const VisiblePosition& endOfNextParagraph, RefPtr<Element>& targetBlockquote)
 {
     Node* enclosingCell = 0;
 
     if (!targetBlockquote) {
-        // Create a new blockquote and insert it as a child of the enclosing block element. We accomplish
+        // Create a new blockquote and insert it as a child of the root editable element. We accomplish
         // this by splitting all parents of the current paragraph up to that point.
         targetBlockquote = createIndentBlockquoteElement(document());
-        if (isTableCell(nodeToSplitTo))
-            enclosingCell = nodeToSplitTo;
-        RefPtr<Node> startOfNewBlock = splitTreeToNode(startOfCurrentParagraph.deepEquivalent().node(), nodeToSplitTo);
+        Position start = startOfParagraph(endOfCurrentParagraph).deepEquivalent();
+        enclosingCell = enclosingNodeOfType(start, &isTableCell);
+        Node* nodeToSplitTo = enclosingCell ? enclosingCell : editableRootForPosition(start);
+        RefPtr<Node> startOfNewBlock = splitTreeToNode(start.node(), nodeToSplitTo);
         insertNodeBefore(targetBlockquote, startOfNewBlock);
     }
 
-    VisiblePosition endOfNextParagraph = endOfParagraph(endOfCurrentParagraph.next());
-    appendParagraphIntoNode(startOfCurrentParagraph, endOfCurrentParagraph, targetBlockquote.get());
+    RefPtr<Element> insertionPoint = prepareBlockquoteLevelForInsertion(endOfCurrentParagraph, targetBlockquote);
 
     // Don't put the next paragraph in the blockquote we just created for this paragraph unless 
     // the next paragraph is in the same cell.
     if (enclosingCell && enclosingCell != enclosingNodeOfType(endOfNextParagraph.deepEquivalent(), &isTableCell))
         targetBlockquote = 0;
-}
-
-// Enclose all nodes between start and end by newParent, which is a sibling node of nodes between start and end
-// FIXME: moveParagraph is overly complicated.  We need to clean up moveParagraph so that it uses appendParagraphIntoNode
-// or prepare more specialized functions and delete moveParagraph
-void IndentOutdentCommand::appendParagraphIntoNode(const VisiblePosition& start, const VisiblePosition& end, Node* newParent)
-{
-    ASSERT(newParent);
-    ASSERT(newParent->isContentEditable());
-    ASSERT(isStartOfParagraph(start) && isEndOfParagraph(end));
-
-    Position endOfParagraph = end.deepEquivalent().downstream();
-    Node* insertionPoint = newParent->lastChild();// Remember the place to put br later
-    // Look for the beginning of the last paragraph in newParent
-    Node* startOfLastParagraph = startOfParagraph(Position(newParent, newParent->childNodeCount())).deepEquivalent().node();
-    if (startOfLastParagraph && !startOfLastParagraph->isDescendantOf(newParent))
-        startOfLastParagraph = 0;
-
-    // Extend the range so that we can append wrapping nodes as well if they're containd within the paragraph
-    ExceptionCode ec = 0;
-    RefPtr<Range> selectedRange = createRange(document(), start, end, ec);
-    RefPtr<Range> extendedRange = extendRangeToWrappingNodes(selectedRange, selectedRange.get(), newParent->parentNode());
-    newParent->appendChild(extendedRange->extractContents(ec), ec);
-
-    // If the start of paragraph didn't change by appending nodes, we should insert br to seperate the paragraphs.
-    Node* startOfNewParagraph = startOfParagraph(Position(newParent, newParent->childNodeCount())).deepEquivalent().node();
-    if (startOfNewParagraph == startOfLastParagraph) {
-        if (insertionPoint)
-            newParent->insertBefore(createBreakElement(document()), insertionPoint->nextSibling(), ec);
-        else
-            newParent->appendChild(createBreakElement(document()), ec);
-    }
-
-    // Remove unnecessary br from the place where we moved the paragraph from
-    removeUnnecessaryLineBreakAt(endOfParagraph);
-}
-
-void IndentOutdentCommand::removeUnnecessaryLineBreakAt(const Position& endOfParagraph)
-{
-    // If there is something in this paragraph, then don't remove br.
-    if (!isStartOfParagraph(endOfParagraph) || !isEndOfParagraph(endOfParagraph))
-        return;
-
-    // We only care about br at the end of paragraph
-    Node* br = endOfParagraph.node();
-    Node* parentNode = br->parentNode();
-
-    // If the node isn't br or the parent node is empty, then don't remove.
-    if (!br->hasTagName(brTag) || isVisiblyAdjacent(positionInParentBeforeNode(parentNode), positionInParentAfterNode(parentNode)))
-        return;
 
-    removeNodeAndPruneAncestors(br);
+    moveParagraph(startOfParagraph(endOfCurrentParagraph), endOfCurrentParagraph, VisiblePosition(Position(insertionPoint, 0)), true);
 }
 
 void IndentOutdentCommand::indentRegion()
@@ -178,7 +163,8 @@ void IndentOutdentCommand::indentRegion()
     VisibleSelection selection = selectionForParagraphIteration(endingSelection());
     VisiblePosition startOfSelection = selection.visibleStart();
     VisiblePosition endOfSelection = selection.visibleEnd();
-    RefPtr<Range> selectedRange = selection.firstRange();
+    int startIndex = indexForVisiblePosition(startOfSelection);
+    int endIndex = indexForVisiblePosition(endOfSelection);
 
     ASSERT(!startOfSelection.isNull());
     ASSERT(!endOfSelection.isNull());
@@ -203,24 +189,10 @@ void IndentOutdentCommand::indentRegion()
         VisiblePosition endOfNextParagraph = endOfParagraph(endOfCurrentParagraph.next());
         if (tryIndentingAsListItem(endOfCurrentParagraph))
             blockquoteForNextIndent = 0;
-        else {
-            VisiblePosition startOfCurrentParagraph = startOfParagraph(endOfCurrentParagraph);
-            Node* blockNode = enclosingBlock(endOfCurrentParagraph.deepEquivalent().node()->parentNode());
-            // extend the region so that it contains all the ancestor blocks within the selection
-            ExceptionCode ec;
-            Element* unsplittableNode = unsplittableElementForPosition(endOfCurrentParagraph.deepEquivalent());
-            RefPtr<Range> originalRange = createRange(document(), endOfCurrentParagraph, endOfCurrentParagraph, ec);
-            RefPtr<Range> extendedRange = extendRangeToWrappingNodes(originalRange, selectedRange.get(), unsplittableNode);
-            if (originalRange != extendedRange) {
-                ExceptionCode ec = 0;
-                endOfCurrentParagraph = endOfParagraph(extendedRange->endPosition().previous());
-                blockNode = enclosingBlock(extendedRange->commonAncestorContainer(ec));
-            }
-
-            endOfNextParagraph = endOfParagraph(endOfCurrentParagraph.next());
-            indentIntoBlockquote(startOfCurrentParagraph, endOfCurrentParagraph, blockquoteForNextIndent, blockNode);
-            // blockquoteForNextIndent will be updated in the function
-        }
+        else
+            indentIntoBlockquote(endOfCurrentParagraph, endOfNextParagraph, blockquoteForNextIndent);
+            // blockquoteForNextIndent maybe updated
+            // this is due to the way prepareBlockquoteLevelForInsertion was designed.
         // Sanity check: Make sure our moveParagraph calls didn't remove endOfNextParagraph.deepEquivalent().node()
         // If somehow we did, return to prevent crashes.
         if (endOfNextParagraph.isNotNull() && !endOfNextParagraph.deepEquivalent().node()->inDocument()) {
@@ -229,7 +201,13 @@ void IndentOutdentCommand::indentRegion()
         }
         endOfCurrentParagraph = endOfNextParagraph;
     }
-
+    
+    updateLayout();
+    
+    RefPtr<Range> startRange = TextIterator::rangeFromLocationAndLength(document()->documentElement(), startIndex, 0, true);
+    RefPtr<Range> endRange = TextIterator::rangeFromLocationAndLength(document()->documentElement(), endIndex, 0, true);
+    if (startRange && endRange)
+        setEndingSelection(VisibleSelection(startRange->startPosition(), endRange->startPosition(), DOWNSTREAM));
 }
 
 void IndentOutdentCommand::outdentParagraph()
diff --git a/WebCore/editing/IndentOutdentCommand.h b/WebCore/editing/IndentOutdentCommand.h
index d83128e..419f832 100644
--- a/WebCore/editing/IndentOutdentCommand.h
+++ b/WebCore/editing/IndentOutdentCommand.h
@@ -46,14 +46,12 @@ private:
     virtual void doApply();
     virtual EditAction editingAction() const { return m_typeOfAction == Indent ? EditActionIndent : EditActionOutdent; }
 
-    void appendParagraphIntoNode(const VisiblePosition& start, const VisiblePosition& end, Node* newParent);
-    void removeUnnecessaryLineBreakAt(const Position& endOfParagraph);
-
     void indentRegion();
     void outdentRegion();
     void outdentParagraph();
+    PassRefPtr<Element> prepareBlockquoteLevelForInsertion(const VisiblePosition&, RefPtr<Element>&);
     bool tryIndentingAsListItem(const VisiblePosition&);
-    void indentIntoBlockquote(const VisiblePosition&, const VisiblePosition&, RefPtr<Element>& targetBlockquote, Node* nodeToSplitTo);
+    void indentIntoBlockquote(const VisiblePosition&, const VisiblePosition&, RefPtr<Element>&);
 
     EIndentType m_typeOfAction;
     int m_marginInPixels;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list