Title: [115409] trunk
Revision
115409
Author
[email protected]
Date
2012-04-26 23:45:25 -0700 (Thu, 26 Apr 2012)

Log Message

REGRESSION (r94497): Pressing Command+A when inline (Marked Text) is not empty will clean whole content
https://bugs.webkit.org/show_bug.cgi?id=84501

Reviewed by Alexey Proskuryakov.

Source/WebCore: 

The bug was caused by setComposition, which is called by cancelComposition, deleting the contents when
the passed text is empty. Fixed it by not deleting text when canceling compositions. This is okay because
as the comment above the line suggests, this particular call to TypingCommand::deleteSelection is only useful
when the confirmed text is empty and the composition text had previously been non-empty.

Test: editing/input/select-all-clear-input-method.html

* editing/Editor.cpp:
(WebCore::Editor::setComposition):

LayoutTests: 

Add a regression test for selecting all when there is a composition text.

* editing/input/select-all-clear-input-method-expected.txt: Added.
* editing/input/select-all-clear-input-method.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (115408 => 115409)


--- trunk/LayoutTests/ChangeLog	2012-04-27 06:11:04 UTC (rev 115408)
+++ trunk/LayoutTests/ChangeLog	2012-04-27 06:45:25 UTC (rev 115409)
@@ -1,3 +1,15 @@
+2012-04-26  Ryosuke Niwa  <[email protected]>
+
+        REGRESSION (r94497): Pressing Command+A when inline (Marked Text) is not empty will clean whole content
+        https://bugs.webkit.org/show_bug.cgi?id=84501
+
+        Reviewed by Alexey Proskuryakov.
+
+        Add a regression test for selecting all when there is a composition text.
+
+        * editing/input/select-all-clear-input-method-expected.txt: Added.
+        * editing/input/select-all-clear-input-method.html: Added.
+
 2012-04-26  Csaba Osztrogonác  <[email protected]>
 
         [Qt] Unreviewed morning gardening, skip a new failing test.

Added: trunk/LayoutTests/editing/input/select-all-clear-input-method-expected.txt (0 => 115409)


--- trunk/LayoutTests/editing/input/select-all-clear-input-method-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/editing/input/select-all-clear-input-method-expected.txt	2012-04-27 06:45:25 UTC (rev 115409)
@@ -0,0 +1,6 @@
+This tests selecting all with an open input method composition.
+To manually test, type some letter in the editable region below and then select all.
+WebKit should not delete contents.
+| <div>
+|   contenteditable=""
+|   "<#selection-anchor>PASS<#selection-focus>"

Added: trunk/LayoutTests/editing/input/select-all-clear-input-method.html (0 => 115409)


--- trunk/LayoutTests/editing/input/select-all-clear-input-method.html	                        (rev 0)
+++ trunk/LayoutTests/editing/input/select-all-clear-input-method.html	2012-04-27 06:45:25 UTC (rev 115409)
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<html>
+<body>
+<p>This tests selecting all with an open input method composition.
+To manually test, type some letter in the editable region below and then select all.
+WebKit should not delete contents.</p>
+<div id="container"><div contenteditable>PAS</div></div>
+<script src=""
+<script>
+
+if (window.layoutTestController) {
+    var container = document.getElementById('container');
+    container.firstChild.focus();
+    getSelection().setPosition(container.firstChild.firstChild, 5);
+    if (window.textInputController) {
+        Markup.description(document.getElementsByTagName('p')[0].textContent);
+
+        textInputController.setMarkedText("S", 0, 1);
+        document.execCommand('selectAll', false, null);
+
+        Markup.dump(container);
+    } else
+        Markup.description('FAIL - This test requires textInputController');
+}
+
+</script>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (115408 => 115409)


--- trunk/Source/WebCore/ChangeLog	2012-04-27 06:11:04 UTC (rev 115408)
+++ trunk/Source/WebCore/ChangeLog	2012-04-27 06:45:25 UTC (rev 115409)
@@ -1,3 +1,20 @@
+2012-04-26  Ryosuke Niwa  <[email protected]>
+
+        REGRESSION (r94497): Pressing Command+A when inline (Marked Text) is not empty will clean whole content
+        https://bugs.webkit.org/show_bug.cgi?id=84501
+
+        Reviewed by Alexey Proskuryakov.
+
+        The bug was caused by setComposition, which is called by cancelComposition, deleting the contents when
+        the passed text is empty. Fixed it by not deleting text when canceling compositions. This is okay because
+        as the comment above the line suggests, this particular call to TypingCommand::deleteSelection is only useful
+        when the confirmed text is empty and the composition text had previously been non-empty.
+
+        Test: editing/input/select-all-clear-input-method.html
+
+        * editing/Editor.cpp:
+        (WebCore::Editor::setComposition):
+
 2012-04-26  Keishi Hattori  <[email protected]>
 
         datalist: Form control in a <datalist> should be barred from constraint validation

Modified: trunk/Source/WebCore/editing/Editor.cpp (115408 => 115409)


--- trunk/Source/WebCore/editing/Editor.cpp	2012-04-27 06:11:04 UTC (rev 115408)
+++ trunk/Source/WebCore/editing/Editor.cpp	2012-04-27 06:45:25 UTC (rev 115409)
@@ -1359,7 +1359,7 @@
 
     // If text is empty, then delete the old composition here.  If text is non-empty, InsertTextCommand::input
     // will delete the old composition with an optimized replace operation.
-    if (text.isEmpty())
+    if (text.isEmpty() && mode != CancelComposition)
         TypingCommand::deleteSelection(m_frame->document(), 0);
 
     m_compositionNode = 0;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to