[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

ossy at webkit.org ossy at webkit.org
Thu Apr 8 01:59:51 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit 713375e0107a329d5fd369e27c21966ea078da77
Author: ossy at webkit.org <ossy at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Feb 26 08:39:22 2010 +0000

    Unreviewed. Roll-out r55263 because it broke fast/forms/textarea-type-spaces-pretty-diff.html.
    https://bugs.webkit.org/show_bug.cgi?id=30946
    
    WebCore:
    
    * editing/CompositeEditCommand.cpp:
    (WebCore::isWhitespace):
    (WebCore::CompositeEditCommand::rebalanceWhitespaceAt):
    * editing/InsertTextCommand.cpp:
    (WebCore::InsertTextCommand::input):
    * editing/InsertTextCommand.h:
    * editing/htmlediting.cpp:
    * editing/htmlediting.h:
    
    LayoutTests:
    
    * editing/execCommand/5142012-3-expected.txt:
    * editing/inserting/rebalance-whitespace-1-expected.txt: Removed.
    * editing/inserting/rebalance-whitespace-1.html: Removed.
    * editing/pasteboard/5521237-expected.txt:
    * platform/mac/editing/execCommand/5482023-expected.checksum:
    * platform/mac/editing/execCommand/5482023-expected.png: Added.
    * platform/mac/editing/execCommand/5482023-expected.txt:
    * platform/mac/editing/execCommand/remove-formatting-2-expected.checksum:
    * platform/mac/editing/execCommand/remove-formatting-2-expected.png: Added.
    * platform/mac/editing/execCommand/remove-formatting-expected.checksum:
    * platform/mac/editing/execCommand/remove-formatting-expected.png: Added.
    * platform/mac/editing/execCommand/remove-formatting-expected.txt:
    * platform/mac/editing/inserting/editable-html-element-expected.checksum:
    * platform/mac/editing/inserting/editable-html-element-expected.png: Added.
    * platform/mac/editing/inserting/editable-html-element-expected.txt:
    * platform/mac/editing/pasteboard/4989774-expected.checksum:
    * platform/mac/editing/pasteboard/4989774-expected.png: Added.
    * platform/mac/editing/pasteboard/4989774-expected.txt:
    * platform/mac/editing/selection/4983858-expected.checksum:
    * platform/mac/editing/selection/4983858-expected.png: Added.
    * platform/mac/editing/selection/4983858-expected.txt:
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@55271 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 7e5e3d8..3f7e3f4 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,30 @@
+2010-02-26  Csaba Osztrogonác  <ossy at webkit.org>
+
+        Unreviewed. Roll-out r55263 because it broke fast/forms/textarea-type-spaces-pretty-diff.html.
+        https://bugs.webkit.org/show_bug.cgi?id=30946
+
+        * editing/execCommand/5142012-3-expected.txt:
+        * editing/inserting/rebalance-whitespace-1-expected.txt: Removed.
+        * editing/inserting/rebalance-whitespace-1.html: Removed.
+        * editing/pasteboard/5521237-expected.txt:
+        * platform/mac/editing/execCommand/5482023-expected.checksum:
+        * platform/mac/editing/execCommand/5482023-expected.png: Added.
+        * platform/mac/editing/execCommand/5482023-expected.txt:
+        * platform/mac/editing/execCommand/remove-formatting-2-expected.checksum:
+        * platform/mac/editing/execCommand/remove-formatting-2-expected.png: Added.
+        * platform/mac/editing/execCommand/remove-formatting-expected.checksum:
+        * platform/mac/editing/execCommand/remove-formatting-expected.png: Added.
+        * platform/mac/editing/execCommand/remove-formatting-expected.txt:
+        * platform/mac/editing/inserting/editable-html-element-expected.checksum:
+        * platform/mac/editing/inserting/editable-html-element-expected.png: Added.
+        * platform/mac/editing/inserting/editable-html-element-expected.txt:
+        * platform/mac/editing/pasteboard/4989774-expected.checksum:
+        * platform/mac/editing/pasteboard/4989774-expected.png: Added.
+        * platform/mac/editing/pasteboard/4989774-expected.txt:
+        * platform/mac/editing/selection/4983858-expected.checksum:
+        * platform/mac/editing/selection/4983858-expected.png: Added.
+        * platform/mac/editing/selection/4983858-expected.txt:
+
 2010-02-25  Dirk Pranke  <dpranke at chromium.org>
 
         Reviewed by Eric Seidel.
diff --git a/LayoutTests/editing/execCommand/5142012-3-expected.txt b/LayoutTests/editing/execCommand/5142012-3-expected.txt
index 39f76d8..cd1ef06 100644
--- a/LayoutTests/editing/execCommand/5142012-3-expected.txt
+++ b/LayoutTests/editing/execCommand/5142012-3-expected.txt
@@ -1,5 +1,5 @@
 This tests for a bug when inserting after a link at the end of the document. Like TextEdit, we insert content outside of the link, but inserting outside of the link shouldn't cause the content to be inserted in the wrong paragraph.
 
 This paragraph should not contains links.
-This sentence should be a link. This sentence should not.
-<a href="#">This sentence should be a link.</a> This sentence should not.
+This sentence should be a link. This sentence should not.
+<a href="#">This sentence should be a link.</a>&nbsp;This sentence should not.
diff --git a/LayoutTests/editing/inserting/rebalance-whitespace-1-expected.txt b/LayoutTests/editing/inserting/rebalance-whitespace-1-expected.txt
deleted file mode 100644
index 66ccfb2..0000000
--- a/LayoutTests/editing/inserting/rebalance-whitespace-1-expected.txt
+++ /dev/null
@@ -1,12 +0,0 @@
-This tests whitespace rebalancing when inserting characters in and around already balanced sequences. In each div below, 2 or more adjacent whitespace characters should be alternate between regular whitespace and non-breaking spaces (note that editable regions use -webkit-nbsp-mode:space).
-
-hellox world
-hellox  world
-hellox   world
-hello x world
-hello  x world
-hello  x  world
-hello  x   world
-hello   x  world
-hello   x   world
-
diff --git a/LayoutTests/editing/inserting/rebalance-whitespace-1.html b/LayoutTests/editing/inserting/rebalance-whitespace-1.html
deleted file mode 100644
index 047448f..0000000
--- a/LayoutTests/editing/inserting/rebalance-whitespace-1.html
+++ /dev/null
@@ -1,123 +0,0 @@
-<script>
-if (window.layoutTestController)
-    window.layoutTestController.dumpAsText();
-</script>
-
-<div contentEditable="true" id="test1">hello world</div>
-<script>
-// Test rebalancing a single space on one side.
-test = document.getElementById("test1");
-text = test.firstChild;
-window.getSelection().setPosition(text, 5);
-document.execCommand("InsertText", false, "x");
-</script>
-
-<div contentEditable="true" id="test2">hello world</div>
-<script>
-// Test rebalancing two spaces on one side.
-test = document.getElementById("test2");
-text = test.firstChild;
-window.getSelection().setPosition(text, 5);
-document.execCommand("InsertText", false, " ");
-window.getSelection().setPosition(text, 5);
-document.execCommand("InsertText", false, "x");
-</script>
-
-<div contentEditable="true" id="test3">hello world</div>
-<script>
-// Test rebalancing three spaces on one side.
-test = document.getElementById("test3");
-text = test.firstChild;
-window.getSelection().setPosition(text, 5);
-document.execCommand("InsertText", false, " ");
-document.execCommand("InsertText", false, " ");
-window.getSelection().setPosition(text, 5);
-document.execCommand("InsertText", false, "x");
-</script>
-
-<div contentEditable="true" id="test4">hello world</div>
-<script>
-// Test rebalancing one space on either side of the insertion.
-test = document.getElementById("test4");
-text = test.firstChild;
-window.getSelection().setPosition(text, 5);
-document.execCommand("InsertText", false, " ");
-window.getSelection().setPosition(text, 6);
-document.execCommand("InsertText", false, "x");
-</script>
-
-<div contentEditable="true" id="test5">hello world</div>
-<script>
-// Test rebalancing two spaces on one side and one space on the other side of the insertion.
-test = document.getElementById("test5");
-text = test.firstChild;
-window.getSelection().setPosition(text, 5);
-document.execCommand("InsertText", false, " ");
-document.execCommand("InsertText", false, " ");
-window.getSelection().setPosition(text, 7);
-document.execCommand("InsertText", false, "x");
-</script>
-
-<div contentEditable="true" id="test6">hello world</div>
-<script>
-// Test rebalancing two spaces on either side of the insertion.
-test = document.getElementById("test6");
-text = test.firstChild;
-window.getSelection().setPosition(text, 5);
-document.execCommand("InsertText", false, " ");
-document.execCommand("InsertText", false, " ");
-document.execCommand("InsertText", false, " ");
-window.getSelection().setPosition(text, 7);
-document.execCommand("InsertText", false, "x");
-</script>
-
-<div contentEditable="true" id="test7">hello world</div>
-<script>
-// Test rebalancing two spaces on either side of the insertion.
-test = document.getElementById("test7");
-text = test.firstChild;
-window.getSelection().setPosition(text, 5);
-document.execCommand("InsertText", false, " ");
-document.execCommand("InsertText", false, " ");
-document.execCommand("InsertText", false, " ");
-document.execCommand("InsertText", false, " ");
-window.getSelection().setPosition(text, 7);
-document.execCommand("InsertText", false, "x");
-</script>
-
-<div contentEditable="true" id="test8">hello world</div>
-<script>
-// Test rebalancing three spaces on one side and two on the other side of the insertion.
-test = document.getElementById("test8");
-text = test.firstChild;
-window.getSelection().setPosition(text, 5);
-document.execCommand("InsertText", false, " ");
-document.execCommand("InsertText", false, " ");
-document.execCommand("InsertText", false, " ");
-document.execCommand("InsertText", false, " ");
-window.getSelection().setPosition(text, 8);
-document.execCommand("InsertText", false, "x");
-</script>
-
-<div contentEditable="true" id="test9">hello world</div>
-<script>
-// Test rebalancing three spaces on either side of the insertion.
-test = document.getElementById("test9");
-text = test.firstChild;
-window.getSelection().setPosition(text, 5);
-document.execCommand("InsertText", false, " ");
-document.execCommand("InsertText", false, " ");
-document.execCommand("InsertText", false, " ");
-document.execCommand("InsertText", false, " ");
-document.execCommand("InsertText", false, " ");
-window.getSelection().setPosition(text, 8);
-document.execCommand("InsertText", false, "x");
-</script>
-
-<script>
-divs = document.getElementsByTagName("div");
-var output = "This tests whitespace rebalancing when inserting characters in and around already balanced sequences. In each div below, 2 or more adjacent whitespace characters should be alternate between regular whitespace and non-breaking spaces (note that editable regions use -webkit-nbsp-mode:space).\n\n";
-for (i = 0; i < divs.length; i++)
-    output += divs[i].innerText + "\n";
-document.body.innerText = output;
-</script>
diff --git a/LayoutTests/editing/pasteboard/5521237-expected.txt b/LayoutTests/editing/pasteboard/5521237-expected.txt
index 13d76ca..41b2ff9 100644
--- a/LayoutTests/editing/pasteboard/5521237-expected.txt
+++ b/LayoutTests/editing/pasteboard/5521237-expected.txt
@@ -1,3 +1,3 @@
 This tests for a bug when pasting a word copied from TextEdit after a regular, breaking space.
 
-Everything in this editable region should be in one paragraph.
+Everything in this editable region should be in one paragraph.
diff --git a/LayoutTests/platform/mac/editing/execCommand/5482023-expected.checksum b/LayoutTests/platform/mac/editing/execCommand/5482023-expected.checksum
index 54b515b..b22dc85 100644
--- a/LayoutTests/platform/mac/editing/execCommand/5482023-expected.checksum
+++ b/LayoutTests/platform/mac/editing/execCommand/5482023-expected.checksum
@@ -1 +1 @@
-72752236297a99482053d1bf0732fbfe
\ No newline at end of file
+e67357e5552e5cf2f062416e2f357fa7
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/editing/execCommand/5482023-expected.png b/LayoutTests/platform/mac/editing/execCommand/5482023-expected.png
new file mode 100644
index 0000000..bb306c2
Binary files /dev/null and b/LayoutTests/platform/mac/editing/execCommand/5482023-expected.png differ
diff --git a/LayoutTests/platform/mac/editing/execCommand/5482023-expected.txt b/LayoutTests/platform/mac/editing/execCommand/5482023-expected.txt
index b667214..eaf8cec 100644
--- a/LayoutTests/platform/mac/editing/execCommand/5482023-expected.txt
+++ b/LayoutTests/platform/mac/editing/execCommand/5482023-expected.txt
@@ -4,10 +4,11 @@ layer at (0,0) size 800x600
   RenderBlock {HTML} at (0,0) size 800x600
     RenderBody {BODY} at (8,8) size 784x571
       RenderBlock {H1} at (0,0) size 784x111
-        RenderText {#text} at (0,0) size 784x111
+        RenderText {#text} at (0,0) size 779x111
           text run at (0,0) width 721: "This tests for a bug when performing a FormatBlock"
           text run at (721,0) width 8: " "
-          text run at (0,37) width 779: "inside a body with no visible content.  This text should be"
-          text run at (779,37) width 5: " "
+          text run at (0,37) width 512: "inside a body with no visible content. "
+          text run at (512,37) width 259: "This text should be"
+          text run at (771,37) width 8: " "
           text run at (0,74) width 287: "inside an h1 element."
 caret: position 132 of child 0 {#text} of child 0 {H1} of child 1 {BODY} of child 0 {HTML} of document
diff --git a/LayoutTests/platform/mac/editing/execCommand/remove-formatting-2-expected.checksum b/LayoutTests/platform/mac/editing/execCommand/remove-formatting-2-expected.checksum
index f619319..70f6e8b 100644
--- a/LayoutTests/platform/mac/editing/execCommand/remove-formatting-2-expected.checksum
+++ b/LayoutTests/platform/mac/editing/execCommand/remove-formatting-2-expected.checksum
@@ -1 +1 @@
-1f30e9cf361c234b16900a0459474544
\ No newline at end of file
+13c97dae5ae20ea4fbf38b5855f386b0
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/editing/execCommand/remove-formatting-2-expected.png b/LayoutTests/platform/mac/editing/execCommand/remove-formatting-2-expected.png
new file mode 100644
index 0000000..83fa881
Binary files /dev/null and b/LayoutTests/platform/mac/editing/execCommand/remove-formatting-2-expected.png differ
diff --git a/LayoutTests/platform/mac/editing/execCommand/remove-formatting-expected.checksum b/LayoutTests/platform/mac/editing/execCommand/remove-formatting-expected.checksum
index f38ae7c..b0fd569 100644
--- a/LayoutTests/platform/mac/editing/execCommand/remove-formatting-expected.checksum
+++ b/LayoutTests/platform/mac/editing/execCommand/remove-formatting-expected.checksum
@@ -1 +1 @@
-cd6a356e264bbdbc23d6826d314ae259
\ No newline at end of file
+a0e53bd03cecb9392c13f0f16e18cb15
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/editing/execCommand/remove-formatting-expected.png b/LayoutTests/platform/mac/editing/execCommand/remove-formatting-expected.png
new file mode 100644
index 0000000..7cfa298
Binary files /dev/null and b/LayoutTests/platform/mac/editing/execCommand/remove-formatting-expected.png differ
diff --git a/LayoutTests/platform/mac/editing/execCommand/remove-formatting-expected.txt b/LayoutTests/platform/mac/editing/execCommand/remove-formatting-expected.txt
index 3721ea1..0316daf 100644
--- a/LayoutTests/platform/mac/editing/execCommand/remove-formatting-expected.txt
+++ b/LayoutTests/platform/mac/editing/execCommand/remove-formatting-expected.txt
@@ -24,7 +24,7 @@ layer at (0,0) size 800x600
           text run at (0,0) width 63: "foobarbaz"
         RenderBR {BR} at (63,14) size 0x0
         RenderText {#text} at (0,18) size 71x18
-          text run at (0,18) width 71: "foo bar baz"
+          text run at (0,18) width 71: "foo\x{9}bar\x{9}baz"
         RenderBR {BR} at (71,32) size 0x0
         RenderText {#text} at (0,36) size 63x18
           text run at (0,36) width 63: "foobarbaz"
diff --git a/LayoutTests/platform/mac/editing/inserting/editable-html-element-expected.checksum b/LayoutTests/platform/mac/editing/inserting/editable-html-element-expected.checksum
index 6ea2b18..fa6239b 100644
--- a/LayoutTests/platform/mac/editing/inserting/editable-html-element-expected.checksum
+++ b/LayoutTests/platform/mac/editing/inserting/editable-html-element-expected.checksum
@@ -1 +1 @@
-68690c967f7f6a8300ff78621ef29e5f
\ No newline at end of file
+f17d800334a5794072abbfc30916a28c
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/editing/inserting/editable-html-element-expected.png b/LayoutTests/platform/mac/editing/inserting/editable-html-element-expected.png
new file mode 100644
index 0000000..c1dfaa1
Binary files /dev/null and b/LayoutTests/platform/mac/editing/inserting/editable-html-element-expected.png differ
diff --git a/LayoutTests/platform/mac/editing/inserting/editable-html-element-expected.txt b/LayoutTests/platform/mac/editing/inserting/editable-html-element-expected.txt
index 0c17df5..a0478dd 100644
--- a/LayoutTests/platform/mac/editing/inserting/editable-html-element-expected.txt
+++ b/LayoutTests/platform/mac/editing/inserting/editable-html-element-expected.txt
@@ -17,9 +17,10 @@ layer at (0,0) size 800x600
   RenderBlock {HTML} at (0,0) size 800x600
     RenderBody {BODY} at (8,8) size 784x584
       RenderBlock (anonymous) at (0,0) size 784x54
-        RenderText {#text} at (0,0) size 784x54
-          text run at (0,0) width 783: "This tests to make sure that when the enclosing block is the body element, and when the html element is editable,  inserting a"
-          text run at (783,0) width 1: " "
+        RenderText {#text} at (0,0) size 783x54
+          text run at (0,0) width 714: "This tests to make sure that when the enclosing block is the body element, and when the html element is editable, "
+          text run at (714,0) width 65: "inserting a"
+          text run at (779,0) width 4: " "
           text run at (0,18) width 751: "paragraph separator doesn't split the body (inserting a paragraph separator usually splits/clones the enclosing block flow"
           text run at (751,18) width 4: " "
           text run at (0,36) width 58: "element)."
diff --git a/LayoutTests/platform/mac/editing/pasteboard/4989774-expected.checksum b/LayoutTests/platform/mac/editing/pasteboard/4989774-expected.checksum
index 8d0b5c7..9872d29 100644
--- a/LayoutTests/platform/mac/editing/pasteboard/4989774-expected.checksum
+++ b/LayoutTests/platform/mac/editing/pasteboard/4989774-expected.checksum
@@ -1 +1 @@
-2af51840dfd0e575314da7c6befff2d6
\ No newline at end of file
+2b8203352f8754425ebf04afdf9fc1dd
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/editing/pasteboard/4989774-expected.png b/LayoutTests/platform/mac/editing/pasteboard/4989774-expected.png
new file mode 100644
index 0000000..c075358
Binary files /dev/null and b/LayoutTests/platform/mac/editing/pasteboard/4989774-expected.png differ
diff --git a/LayoutTests/platform/mac/editing/pasteboard/4989774-expected.txt b/LayoutTests/platform/mac/editing/pasteboard/4989774-expected.txt
index a84e66e..3fecc9e 100644
--- a/LayoutTests/platform/mac/editing/pasteboard/4989774-expected.txt
+++ b/LayoutTests/platform/mac/editing/pasteboard/4989774-expected.txt
@@ -7,10 +7,11 @@ layer at (0,0) size 800x600
       RenderImage {IMG} at (76,0) size 76x103
       RenderImage {IMG} at (152,0) size 76x103
       RenderBR {BR} at (228,103) size 0x0
-      RenderText {#text} at (0,103) size 739x36
-        text run at (0,103) width 735: "This tests for a bug where an images pasted on the same line would appear on different lines.  You should see"
-        text run at (735,103) width 4: " "
-        text run at (0,121) width 358: "several pictures above all in the same line/paragraph."
+      RenderText {#text} at (0,103) size 784x36
+        text run at (0,103) width 629: "This tests for a bug where an images pasted on the same line would appear on different lines. "
+        text run at (629,103) width 153: "You should see several"
+        text run at (782,103) width 2: " "
+        text run at (0,121) width 307: "pictures above all in the same line/paragraph."
       RenderText {#text} at (0,0) size 0x0
       RenderText {#text} at (0,0) size 0x0
 caret: position 164 of child 4 {#text} of child 1 {BODY} of child 0 {HTML} of document
diff --git a/LayoutTests/platform/mac/editing/selection/4983858-expected.checksum b/LayoutTests/platform/mac/editing/selection/4983858-expected.checksum
index e489240..581d9ad 100644
--- a/LayoutTests/platform/mac/editing/selection/4983858-expected.checksum
+++ b/LayoutTests/platform/mac/editing/selection/4983858-expected.checksum
@@ -1 +1 @@
-e23b4757a2355938acae1fffcfb07362
\ No newline at end of file
+1ea76bed3d177e7dea634dc0a3658c6f
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/editing/selection/4983858-expected.png b/LayoutTests/platform/mac/editing/selection/4983858-expected.png
new file mode 100644
index 0000000..6baf5ef
Binary files /dev/null and b/LayoutTests/platform/mac/editing/selection/4983858-expected.png differ
diff --git a/LayoutTests/platform/mac/editing/selection/4983858-expected.txt b/LayoutTests/platform/mac/editing/selection/4983858-expected.txt
index f658a53..53160a5 100644
--- a/LayoutTests/platform/mac/editing/selection/4983858-expected.txt
+++ b/LayoutTests/platform/mac/editing/selection/4983858-expected.txt
@@ -4,9 +4,11 @@ layer at (0,0) size 800x600
   RenderBlock {HTML} at (0,0) size 800x600
     RenderBody {BODY} at (8,8) size 784x584
       RenderBlock (anonymous) at (0,0) size 784x36
-        RenderText {#text} at (0,0) size 780x36
-          text run at (0,0) width 776: "This tests for a bug where selecting a word would select the line break and word before it.  Only the word in the  paragraph"
-          text run at (776,0) width 4: " "
+        RenderText {#text} at (0,0) size 772x36
+          text run at (0,0) width 570: "This tests for a bug where selecting a word would select the line break and word before it. "
+          text run at (570,0) width 135: "Only the word in the "
+          text run at (705,0) width 63: "paragraph"
+          text run at (768,0) width 4: " "
           text run at (0,18) width 162: "below should be selected:"
         RenderText {#text} at (0,0) size 0x0
       RenderBlock {DIV} at (0,36) size 784x18
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 537736c..841287d 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,17 @@
+2010-02-26  Csaba Osztrogonác  <ossy at webkit.org>
+
+        Unreviewed. Roll-out r55263 because it broke fast/forms/textarea-type-spaces-pretty-diff.html.
+        https://bugs.webkit.org/show_bug.cgi?id=30946
+
+        * editing/CompositeEditCommand.cpp:
+        (WebCore::isWhitespace):
+        (WebCore::CompositeEditCommand::rebalanceWhitespaceAt):
+        * editing/InsertTextCommand.cpp:
+        (WebCore::InsertTextCommand::input):
+        * editing/InsertTextCommand.h:
+        * editing/htmlediting.cpp:
+        * editing/htmlediting.h:
+
 2010-02-25  Mark Rowe  <mrowe at apple.com>
 
         Reviewed by Brady Eidson.
diff --git a/WebCore/editing/CompositeEditCommand.cpp b/WebCore/editing/CompositeEditCommand.cpp
index 4c4088a..e9b6971 100644
--- a/WebCore/editing/CompositeEditCommand.cpp
+++ b/WebCore/editing/CompositeEditCommand.cpp
@@ -385,6 +385,11 @@ void CompositeEditCommand::setNodeAttribute(PassRefPtr<Element> element, const Q
     applyCommandToComposite(SetNodeAttributeCommand::create(element, attribute, value));
 }
 
+static inline bool isWhitespace(UChar c)
+{
+    return c == noBreakSpace || c == ' ' || c == '\n' || c == '\t';
+}
+
 // FIXME: Doesn't go into text nodes that contribute adjacent text (siblings, cousins, etc).
 void CompositeEditCommand::rebalanceWhitespaceAt(const Position& position)
 {
@@ -393,14 +398,34 @@ void CompositeEditCommand::rebalanceWhitespaceAt(const Position& position)
         return;
     Text* textNode = static_cast<Text*>(node);
     
+    if (textNode->length() == 0)
+        return;
+    RenderObject* renderer = textNode->renderer();
+    if (renderer && !renderer->style()->collapseWhiteSpace())
+        return;
+        
     String text = textNode->data();
+    ASSERT(!text.isEmpty());
+
+    int offset = position.deprecatedEditingOffset();
+    // If neither text[offset] nor text[offset - 1] are some form of whitespace, do nothing.
+    if (!isWhitespace(text[offset])) {
+        offset--;
+        if (offset < 0 || !isWhitespace(text[offset]))
+            return;
+    }
     
-    unsigned upstream, downstream;
-    if (!extentOfWhitespaceForRebalancingAt(textNode, position.deprecatedEditingOffset(), upstream, downstream))
-        return;
+    // Set upstream and downstream to define the extent of the whitespace surrounding text[offset].
+    int upstream = offset;
+    while (upstream > 0 && isWhitespace(text[upstream - 1]))
+        upstream--;
+    
+    int downstream = offset;
+    while ((unsigned)downstream + 1 < text.length() && isWhitespace(text[downstream + 1]))
+        downstream++;
     
-    ASSERT(downstream > upstream);
-    int length = downstream - upstream;
+    int length = downstream - upstream + 1;
+    ASSERT(length > 0);
     
     VisiblePosition visibleUpstreamPos(Position(position.node(), upstream));
     VisiblePosition visibleDownstreamPos(Position(position.node(), downstream + 1));
diff --git a/WebCore/editing/InsertTextCommand.cpp b/WebCore/editing/InsertTextCommand.cpp
index 5f7c672..f10d71b 100644
--- a/WebCore/editing/InsertTextCommand.cpp
+++ b/WebCore/editing/InsertTextCommand.cpp
@@ -106,33 +106,9 @@ bool InsertTextCommand::performTrivialReplace(const String& text, bool selectIns
     return true;
 }
 
-void InsertTextCommand::insertTextIntoNodeAndRebalanceWhitespace(const String& textToInsert, Text* node, unsigned offset)
-{
-    unsigned whitespaceStart, whitespaceEnd;
-    if (!extentOfWhitespaceForRebalancingAt(node, offset, whitespaceStart, whitespaceEnd)) {
-        VisiblePosition visiblePosition(Position(node, offset));
-        String rebalancedText = stringWithRebalancedWhitespace(textToInsert, isStartOfParagraph(visiblePosition), isEndOfParagraph(visiblePosition));
-        insertTextIntoNode(node, offset, rebalancedText);
-        return;
-    }
-    
-    ASSERT(whitespaceEnd > whitespaceStart);
-    unsigned length = whitespaceEnd - whitespaceStart;
-    String string = node->data().substring(whitespaceStart, length);
-    
-    // Insert textToInsert into the whitespace we found.
-    string.insert(textToInsert, offset - whitespaceStart);
-    
-    VisiblePosition visibleStart(Position(node, whitespaceStart));
-    VisiblePosition visibleEnd(Position(node, whitespaceEnd + textToInsert.length()));
-    
-    String rebalancedString = stringWithRebalancedWhitespace(string, isStartOfParagraph(visibleStart), isEndOfParagraph(visibleEnd));
-                                                             
-    replaceTextInNode(node, whitespaceStart, length, rebalancedString);
-}
-
 void InsertTextCommand::input(const String& text, bool selectInsertedText)
 {
+    
     ASSERT(text.find('\n') == -1);
 
     if (endingSelection().isNone())
@@ -194,9 +170,14 @@ void InsertTextCommand::input(const String& text, bool selectInsertedText)
         Text *textNode = static_cast<Text *>(startPosition.node());
         int offset = startPosition.deprecatedEditingOffset();
 
-        insertTextIntoNodeAndRebalanceWhitespace(text, textNode, offset);
-        
+        insertTextIntoNode(textNode, offset, text);
         endPosition = Position(textNode, offset + text.length());
+
+        // The insertion may require adjusting adjacent whitespace, if it is present.
+        rebalanceWhitespaceAt(endPosition);
+        // Rebalancing on both sides isn't necessary if we've inserted a space.
+        if (text != " ") 
+            rebalanceWhitespaceAt(startPosition);
             
         m_charactersAdded += text.length();
     }
diff --git a/WebCore/editing/InsertTextCommand.h b/WebCore/editing/InsertTextCommand.h
index 5d9fb2a..650ca65 100644
--- a/WebCore/editing/InsertTextCommand.h
+++ b/WebCore/editing/InsertTextCommand.h
@@ -52,8 +52,6 @@ private:
     Position insertTab(const Position&);
     
     bool performTrivialReplace(const String&, bool selectInsertedText);
-    
-    void insertTextIntoNodeAndRebalanceWhitespace(const String& text, Text* node, unsigned offset);
 
     unsigned m_charactersAdded;
 };
diff --git a/WebCore/editing/htmlediting.cpp b/WebCore/editing/htmlediting.cpp
index a0b85a7..c0a9b63 100644
--- a/WebCore/editing/htmlediting.cpp
+++ b/WebCore/editing/htmlediting.cpp
@@ -425,43 +425,6 @@ String stringWithRebalancedWhitespace(const String& string, bool startIsStartOfP
     return rebalancedString;
 }
 
-// FIXME: Move this into PlatformString.h or StringImpl.h and rename it to distinguish it from similar functions.
-static inline bool isWhitespace(UChar c)
-{
-    return c == noBreakSpace || c == ' ' || c == '\n' || c == '\t';
-}
-
-// Find the extent of whitespace around a particular offset.  If whitespace characters (' ') are preserved, then we don't
-// do whitespace rebalancing and this function returns false.
-bool extentOfWhitespaceForRebalancingAt(PassRefPtr<Text> node, unsigned offset, unsigned& start, unsigned& end)
-{
-    RenderObject* renderer = node->renderer();
-    if (renderer && !renderer->style()->collapseWhiteSpace())
-        return false;
-    
-    String text = node->data();
-    
-    start = offset;
-    end = offset;
-    if (offset == text.length() || !isWhitespace(text[offset])) {
-        if (!offset || !isWhitespace(text[offset - 1]))
-            // If neither text[offset] nor text[offset - 1] are some form of whitespace, no rebalancing is necessary.
-            return false;
-            
-        // text[offset] is not whitespace, but text[offset - 1] is, adjust start and end offsets.
-        start = offset - 1;
-        end = offset;
-    }
-    
-    while (start > 0 && isWhitespace(text[start - 1]))
-        start--;
-        
-    while (end < text.length() && isWhitespace(text[end]))
-        end++;
-    
-    return true;
-}
-
 bool isTableStructureNode(const Node *node)
 {
     RenderObject *r = node->renderer();
diff --git a/WebCore/editing/htmlediting.h b/WebCore/editing/htmlediting.h
index 0651f3b..1559fa5 100644
--- a/WebCore/editing/htmlediting.h
+++ b/WebCore/editing/htmlediting.h
@@ -40,7 +40,6 @@ class Node;
 class Position;
 class Range;
 class String;
-class Text;
 class VisiblePosition;
 class VisibleSelection;
 
@@ -230,7 +229,6 @@ VisibleSelection selectionForParagraphIteration(const VisibleSelection&);
 // Miscellaneous functions on String
     
 String stringWithRebalancedWhitespace(const String&, bool, bool);
-bool extentOfWhitespaceForRebalancingAt(PassRefPtr<Text> node, unsigned offset, unsigned& start, unsigned& end);
 const String& nonBreakingSpaceString();
 bool validBlockTag(const AtomicString&);
     

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list