Commit 0f0ad610 authored by jparent@chromium.org's avatar jparent@chromium.org

WebCore:

2009-06-23  Ryosuke Niwa  <rniwa@google.com>

        Reviewed by Justin Garcia.

        Undo the changeset 21212 to fix the regression bug 14062.
        The changeset 21212 attempted to fix rdar://problem/5002441.
        The changeset 21212 modified InsertTextCommand::input so as to convert
        all spaces in text to non-breaking spaces for rdar://problem/5002441.
        However, the bug was originally caused by rebalanceWhitespaceAt
        and this workaround introduced a regression bug 14062.
        Because rebalanceWhitespaceAt appears to behave correctly now,
        the workaround introduced in 21212 is no longer needed.

        Test: editing/inserting/space-after-removeformat.html

        * editing/InsertTextCommand.cpp:
        (WebCore::InsertTextCommand::input):

LayoutTests:

2009-06-23  Ryosuke Niwa  <rniwa@google.com>

        Reviewed by Justin Garcia.

        Undo the changeset 21212 to fix the regression bug 14062.
        The changeset 21212 attempted to fix rdar://problem/5002441.
        The changeset 21212 modified InsertTextCommand::input so as to convert
        all spaces in text to non-breaking spaces for rdar://problem/5002441.
        However, the bug was originally caused by rebalanceWhitespaceAt
        and this workaround introduced a regression bug 14062.
        Because rebalanceWhitespaceAt appears to behave correctly now,
        the workaround introduced in 21212 is no longer needed.

        The following test cases are affected by this change.
        This patch removes unappropriate non-breaking spaces (&nbsp;) and
        inserts normal spaces instead.

        * editing/deleting/2610675-1-expected.txt: Replaced.
        * editing/deleting/2610675-2-expected.txt: Replaced.
        * editing/deleting/2610675-3-expected.txt: Replaced.
        * editing/inserting/insert-before-link-1-expected.txt: Replaced.
        * editing/inserting/space-after-removeformat-expected.txt: Added.
        * editing/inserting/space-after-removeformat.html: Added.
        * platform/mac/editing/execCommand/5482023-expected.checksum: Replaced.
        * platform/mac/editing/execCommand/5482023-expected.png: Replaced.
        * platform/mac/editing/execCommand/5482023-expected.txt: Replaced.
        * platform/mac/editing/input/text-input-controller-expected.txt: Replaced.
        * platform/mac/editing/inserting/editable-html-element-expected.checksum: Replaced.
        * platform/mac/editing/inserting/editable-html-element-expected.png: Replaced.
        * platform/mac/editing/inserting/editable-html-element-expected.txt: Replaced.
        * platform/mac/editing/pasteboard/4989774-expected.checksum: Replaced.
        * platform/mac/editing/pasteboard/4989774-expected.png: Replaced.
        * platform/mac/editing/pasteboard/4989774-expected.txt: Replaced.
        * platform/mac/editing/selection/4983858-expected.checksum: Replaced.
        * platform/mac/editing/selection/4983858-expected.png: Replaced.
        * platform/mac/editing/selection/4983858-expected.txt: Replaced.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@45016 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent abe8d153
2009-06-23 Ryosuke Niwa <rniwa@google.com>
Reviewed by Justin Garcia.
Undo the changeset 21212 to fix the regression bug 14062.
The changeset 21212 attempted to fix rdar://problem/5002441.
The changeset 21212 modified InsertTextCommand::input so as to convert
all spaces in text to non-breaking spaces for rdar://problem/5002441.
However, the bug was originally caused by rebalanceWhitespaceAt
and this workaround introduced a regression bug 14062.
Because rebalanceWhitespaceAt appears to behave correctly now,
the workaround introduced in 21212 is no longer needed.
The following test cases are affected by this change.
This patch removes unappropriate non-breaking spaces (&nbsp;) and
inserts normal spaces instead.
* editing/deleting/2610675-1-expected.txt: Replaced.
* editing/deleting/2610675-2-expected.txt: Replaced.
* editing/deleting/2610675-3-expected.txt: Replaced.
* editing/inserting/insert-before-link-1-expected.txt: Replaced.
* editing/inserting/space-after-removeformat-expected.txt: Added.
* editing/inserting/space-after-removeformat.html: Added.
* platform/mac/editing/execCommand/5482023-expected.checksum: Replaced.
* platform/mac/editing/execCommand/5482023-expected.png: Replaced.
* platform/mac/editing/execCommand/5482023-expected.txt: Replaced.
* platform/mac/editing/input/text-input-controller-expected.txt: Replaced.
* platform/mac/editing/inserting/editable-html-element-expected.checksum: Replaced.
* platform/mac/editing/inserting/editable-html-element-expected.png: Replaced.
* platform/mac/editing/inserting/editable-html-element-expected.txt: Replaced.
* platform/mac/editing/pasteboard/4989774-expected.checksum: Replaced.
* platform/mac/editing/pasteboard/4989774-expected.png: Replaced.
* platform/mac/editing/pasteboard/4989774-expected.txt: Replaced.
* platform/mac/editing/selection/4983858-expected.checksum: Replaced.
* platform/mac/editing/selection/4983858-expected.png: Replaced.
* platform/mac/editing/selection/4983858-expected.txt: Replaced.
2009-06-23 Beth Dakin <bdakin@apple.com>
Reviewed by Dave Hyatt.
......
......@@ -2,5 +2,5 @@ This tests to see that if the caret is in an empty quoted paragraph, that paragr
<div><br></div>
<div>On Tuesday, Justin wrote:</div>
<div>not&nbsp;quoted</div><blockquote type="cite" id="blockquote"><div style="white-space: pre;">quoted</div></blockquote>
<div>not quoted</div><blockquote type="cite" id="blockquote"><div style="white-space: pre;">quoted</div></blockquote>
......@@ -2,5 +2,5 @@ This tests to see that if the caret is in an empty quoted paragraph, and there's
<div><br></div>
<div>On Tuesday, Justin wrote:</div>
<div>not&nbsp;quoted</div><blockquote type="cite" id="blockquote">quoted<br>quoted</blockquote>
<div>not quoted</div><blockquote type="cite" id="blockquote">quoted<br>quoted</blockquote>
This tests to see that if the caret is in an empty quoted paragraph, and there's no quoted content before that paragraph, then pressing delete removes that paragraph's quoting. Below you should see just an unquoted paragraph.
not&nbsp;quoted
not quoted
This tests insertion before/after links. Text should always be inserted at the start or end of a link should be inserted outside of it.
this&nbsp;text&nbsp;should&nbsp;not&nbsp;be&nbsp;in&nbsp;a&nbsp;link<a id="link" href="http://www.google.com/">this should</a>this&nbsp;should&nbsp;not <a href="http://www.google.com/">this should</a>this&nbsp;should&nbsp;not
this text should not be in a link<a id="link" href="http://www.google.com/">this should</a>this should not <a href="http://www.google.com/">this should</a>this should not
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 0 of #text > DIV > BODY > HTML > #document to 10 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
EDITING DELEGATE: shouldBeginEditingInDOMRange:range from 0 of HTML > #document to 2 of HTML > #document
EDITING DELEGATE: webViewDidBeginEditing:WebViewDidBeginEditingNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
This is a test for execCommand("RemoveFormat"). You should see Some%20text before and after RemoveFormat is executed. This test case is due to the WebKit bug 14062, regression (r21212).
Some text.
Before: Some%20text.
After: Some%20text.
<script>
if (window.layoutTestController) {
layoutTestController.dumpEditingCallbacks();
layoutTestController.dumpAsText();
}
</script>
<p>This is a test for execCommand("RemoveFormat"). You should see Some%20text before and after RemoveFormat is executed. This test case is due to the WebKit bug 14062, regression (r21212).</p>
<div id="div"><span id="test">Some text.</span></div>
<p>Before: <span id="console1"></span></p>
<p>After: <span id="console2"></span></p>
<script>
function log(message, k) {
var console = document.getElementById("console"+k);
var text = document.createTextNode(message);
console.appendChild(text);
}
var e = document.getElementById("test");
var s = window.getSelection();
log(escape(e.innerHTML),1);
r = document.createRange();
r.selectNode(e);
s.addRange(r);
document.designMode = 'on';
document.execCommand("RemoveFormat", false, "");
log(escape(e.innerHTML),2);
</script>
72752236297a99482053d1bf0732fbfe
\ No newline at end of file
e67357e5552e5cf2f062416e2f357fa7
\ No newline at end of file
......@@ -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
......@@ -4,7 +4,8 @@ EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 0 of
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of #text > DIV > BODY > HTML > #document to 7 of #text > DIV > BODY > HTML > #document toDOMRange:range from 0 of #text > DIV > BODY > HTML > #document to 7 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
EDITING DELEGATE: shouldInsertText:to be deleted replacingDOMRange:range from 0 of #text > DIV > BODY > HTML > #document to 7 of #text > DIV > BODY > HTML > #document givenAction:WebViewInsertActionTyped
EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of #text > DIV > BODY > HTML > #document to 7 of #text > DIV > BODY > HTML > #document toDOMRange:range from 13 of #text > DIV > BODY > HTML > #document to 13 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 13 of #text > DIV > BODY > HTML > #document to 13 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 13 of #text > DIV > BODY > HTML > #document to 13 of #text > DIV > BODY > HTML > #document toDOMRange:range from 0 of #text > DIV > BODY > HTML > #document to 13 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
......
6ffcf83ddec7b9ab33553cdf3696b889
\ No newline at end of file
f17d800334a5794072abbfc30916a28c
\ No newline at end of file
......@@ -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)."
......
0e7fee5da9ff2a7fac56371042e3ff4b
\ No newline at end of file
2b8203352f8754425ebf04afdf9fc1dd
\ No newline at end of file
......@@ -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
f5b9bb0896ce67d02f59d8438dccb351
\ No newline at end of file
1ea76bed3d177e7dea634dc0a3658c6f
\ No newline at end of file
......@@ -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
......
2009-06-23 Ryosuke Niwa <rniwa@google.com>
Reviewed by Justin Garcia.
Undo the changeset 21212 to fix the regression bug 14062.
The changeset 21212 attempted to fix rdar://problem/5002441.
The changeset 21212 modified InsertTextCommand::input so as to convert
all spaces in text to non-breaking spaces for rdar://problem/5002441.
However, the bug was originally caused by rebalanceWhitespaceAt
and this workaround introduced a regression bug 14062.
Because rebalanceWhitespaceAt appears to behave correctly now,
the workaround introduced in 21212 is no longer needed.
Test: editing/inserting/space-after-removeformat.html
* editing/InsertTextCommand.cpp:
(WebCore::InsertTextCommand::input):
2009-06-23 Beth Dakin <bdakin@apple.com>
Reviewed by Dave Hyatt.
......
......@@ -106,22 +106,14 @@ bool InsertTextCommand::performTrivialReplace(const String& text, bool selectIns
return true;
}
void InsertTextCommand::input(const String& originalText, bool selectInsertedText)
void InsertTextCommand::input(const String& text, bool selectInsertedText)
{
String text = originalText;
ASSERT(text.find('\n') == -1);
if (endingSelection().isNone())
return;
if (RenderObject* renderer = endingSelection().start().node()->renderer())
if (renderer->style()->collapseWhiteSpace())
// Turn all spaces into non breaking spaces, to make sure that they are treated
// literally, and aren't collapsed after insertion. They will be rebalanced
// (turned into a sequence of regular and non breaking spaces) below.
text.replace(' ', noBreakSpace);
// Delete the current selection.
// FIXME: This delete operation blows away the typing style.
if (endingSelection().isRange()) {
......@@ -129,7 +121,7 @@ void InsertTextCommand::input(const String& originalText, bool selectInsertedTex
return;
deleteSelection(false, true, true, false);
}
Position startPosition(endingSelection().start());
Position placeholder;
......@@ -184,7 +176,7 @@ void InsertTextCommand::input(const String& originalText, bool selectInsertedTex
// 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 (originalText != " ")
if (text != " ")
rebalanceWhitespaceAt(startPosition);
m_charactersAdded += text.length();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment