Title: [205803] branches/safari-602-branch

Diff

Modified: branches/safari-602-branch/LayoutTests/ChangeLog (205802 => 205803)


--- branches/safari-602-branch/LayoutTests/ChangeLog	2016-09-12 07:54:06 UTC (rev 205802)
+++ branches/safari-602-branch/LayoutTests/ChangeLog	2016-09-12 07:54:11 UTC (rev 205803)
@@ -1,5 +1,34 @@
 2016-09-12  Babak Shafiei  <[email protected]>
 
+        Merge r205788. rdar://problem/28245097
+
+    2016-09-11  Tim Horton  <[email protected]>
+
+            Candidates that don't end in spaces shouldn't have spaces arbitrarily appended to them
+            https://bugs.webkit.org/show_bug.cgi?id=161846
+            <rdar://problem/28245097>
+
+            Reviewed by Beth Dakin.
+
+            * editing/mac/spelling/accept-candidate-replacing-multiple-words-expected.txt:
+            * editing/mac/spelling/accept-candidate-replacing-multiple-words.html:
+            * editing/mac/spelling/accept-candidate-without-crossing-editing-boundary-expected.txt:
+            * editing/mac/spelling/accept-candidate-without-crossing-editing-boundary.html:
+            Update existing tests to put spaces at the end of accepted candidates to make them
+            more similar to what the OS will return to us.
+
+            * editing/mac/spelling/accept-candidate-without-adding-space-expected.txt: Added.
+            * editing/mac/spelling/accept-candidate-without-adding-space.html: Added.
+            Add a test where the accepted candidate does *not* have a space at the end,
+            testing that we don't add one where the candidate didn't contain one.
+
+            * editing/mac/spelling/accept-candidate-allows-autocorrect-on-next-word-expected.txt: Added.
+            * editing/mac/spelling/accept-candidate-allows-autocorrect-on-next-word.html: Added.
+            Add a test ensuring that the document marker added by accepting a candidate
+            doesn't overlap the next word and prevent autocorrect from working on it.
+
+2016-09-12  Babak Shafiei  <[email protected]>
+
         Merge r205154. rdar://problem/28233330
 
     2016-08-29  Chris Dumez  <[email protected]>

Added: branches/safari-602-branch/LayoutTests/editing/mac/spelling/accept-candidate-allows-autocorrect-on-next-word-expected.txt (0 => 205803)


--- branches/safari-602-branch/LayoutTests/editing/mac/spelling/accept-candidate-allows-autocorrect-on-next-word-expected.txt	                        (rev 0)
+++ branches/safari-602-branch/LayoutTests/editing/mac/spelling/accept-candidate-allows-autocorrect-on-next-word-expected.txt	2016-09-12 07:54:11 UTC (rev 205803)
@@ -0,0 +1,98 @@
+EDITING DELEGATE: shouldBeginEditingInDOMRange:range from 0 of DIV > BODY > HTML > #document to 2 of DIV > BODY > HTML > #document
+EDITING DELEGATE: webViewDidBeginEditing:WebViewDidBeginEditingNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 0 of DIV > BODY > HTML > #document to 0 of DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV > BODY > HTML > #document to 0 of DIV > BODY > HTML > #document toDOMRange:range from 1 of #text > DIV > BODY > HTML > #document to 1 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 1 of #text > DIV > BODY > HTML > #document to 1 of #text > DIV > BODY > HTML > #document toDOMRange:range from 2 of #text > DIV > BODY > HTML > #document to 2 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 1 of #text > DIV > BODY > HTML > #document to 1 of #text > DIV > BODY > HTML > #document toDOMRange:range from 3 of #text > DIV > BODY > HTML > #document to 3 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 3 of #text > DIV > BODY > HTML > #document to 3 of #text > DIV > BODY > HTML > #document toDOMRange:range from 4 of #text > DIV > BODY > HTML > #document to 4 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 4 of #text > DIV > BODY > HTML > #document to 4 of #text > DIV > BODY > HTML > #document toDOMRange:range from 5 of #text > DIV > BODY > HTML > #document to 5 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 5 of #text > DIV > BODY > HTML > #document to 5 of #text > DIV > BODY > HTML > #document toDOMRange:range from 6 of #text > DIV > BODY > HTML > #document to 6 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 6 of #text > DIV > BODY > HTML > #document to 6 of #text > DIV > BODY > HTML > #document toDOMRange:range from 7 of #text > DIV > BODY > HTML > #document to 7 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 7 of #text > DIV > BODY > HTML > #document to 7 of #text > DIV > BODY > HTML > #document toDOMRange:range from 8 of #text > DIV > BODY > HTML > #document to 8 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 8 of #text > DIV > BODY > HTML > #document to 8 of #text > DIV > BODY > HTML > #document toDOMRange:range from 9 of #text > DIV > BODY > HTML > #document to 9 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 9 of #text > DIV > BODY > HTML > #document to 9 of #text > DIV > BODY > HTML > #document toDOMRange:range from 10 of #text > DIV > BODY > HTML > #document to 10 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 10 of #text > DIV > BODY > HTML > #document to 10 of #text > DIV > BODY > HTML > #document toDOMRange:range from 11 of #text > DIV > BODY > HTML > #document to 11 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 11 of #text > DIV > BODY > HTML > #document to 11 of #text > DIV > BODY > HTML > #document toDOMRange:range from 12 of #text > DIV > BODY > HTML > #document to 12 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 12 of #text > DIV > BODY > HTML > #document to 12 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: 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 14 of #text > DIV > BODY > HTML > #document to 14 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 14 of #text > DIV > BODY > HTML > #document to 14 of #text > DIV > BODY > HTML > #document toDOMRange:range from 15 of #text > DIV > BODY > HTML > #document to 15 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 15 of #text > DIV > BODY > HTML > #document to 15 of #text > DIV > BODY > HTML > #document toDOMRange:range from 16 of #text > DIV > BODY > HTML > #document to 16 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 15 of #text > DIV > BODY > HTML > #document to 15 of #text > DIV > BODY > HTML > #document toDOMRange:range from 17 of #text > DIV > BODY > HTML > #document to 17 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 17 of #text > DIV > BODY > HTML > #document to 17 of #text > DIV > BODY > HTML > #document toDOMRange:range from 18 of #text > DIV > BODY > HTML > #document to 18 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 18 of #text > DIV > BODY > HTML > #document to 18 of #text > DIV > BODY > HTML > #document toDOMRange:range from 19 of #text > DIV > BODY > HTML > #document to 19 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 19 of #text > DIV > BODY > HTML > #document to 19 of #text > DIV > BODY > HTML > #document toDOMRange:range from 20 of #text > DIV > BODY > HTML > #document to 20 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 20 of #text > DIV > BODY > HTML > #document to 20 of #text > DIV > BODY > HTML > #document toDOMRange:range from 21 of #text > DIV > BODY > HTML > #document to 21 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 21 of #text > DIV > BODY > HTML > #document to 21 of #text > DIV > BODY > HTML > #document toDOMRange:range from 22 of #text > DIV > BODY > HTML > #document to 22 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldInsertText:extremely long replacingDOMRange:range from 2 of #text > DIV > BODY > HTML > #document to 15 of #text > DIV > BODY > HTML > #document givenAction:WebViewInsertActionTyped
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 2 of #text > DIV > BODY > HTML > #document to 2 of #text > DIV > BODY > HTML > #document toDOMRange:range from 16 of #text > DIV > BODY > HTML > #document to 16 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 23 of #text > DIV > BODY > HTML > #document to 23 of #text > DIV > BODY > HTML > #document toDOMRange:range from 24 of #text > DIV > BODY > HTML > #document to 24 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 24 of #text > DIV > BODY > HTML > #document to 24 of #text > DIV > BODY > HTML > #document toDOMRange:range from 17 of #text > DIV > BODY > HTML > #document to 23 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: shouldInsertText:message replacingDOMRange:range from 17 of #text > DIV > BODY > HTML > #document to 23 of #text > DIV > BODY > HTML > #document givenAction:WebViewInsertActionTyped
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 24 of #text > DIV > BODY > HTML > #document to 24 of #text > DIV > BODY > HTML > #document toDOMRange:range from 17 of #text > DIV > BODY > HTML > #document to 23 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 24 of #text > DIV > BODY > HTML > #document to 24 of #text > DIV > BODY > HTML > #document toDOMRange:range from 17 of #text > DIV > BODY > HTML > #document to 23 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 17 of #text > DIV > BODY > HTML > #document to 17 of #text > DIV > BODY > HTML > #document toDOMRange:range from 24 of #text > DIV > BODY > HTML > #document to 24 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+PASS successfullyParsed is true
+
+TEST COMPLETE
+This test verifies that accepted candidates don't disable autocorrection on subsequent words. You should see the phrase "a extremely long message" The bug occurs if "mesage" was not corrected to "message".
+
+a extremely long message 

Added: branches/safari-602-branch/LayoutTests/editing/mac/spelling/accept-candidate-allows-autocorrect-on-next-word.html (0 => 205803)


--- branches/safari-602-branch/LayoutTests/editing/mac/spelling/accept-candidate-allows-autocorrect-on-next-word.html	                        (rev 0)
+++ branches/safari-602-branch/LayoutTests/editing/mac/spelling/accept-candidate-allows-autocorrect-on-next-word.html	2016-09-12 07:54:11 UTC (rev 205803)
@@ -0,0 +1,57 @@
+<html>
+<head>
+<script src="" language="_javascript_" type="text/_javascript_"></script>
+<script src=""
+<script>
+
+function editingTest() {
+    edit = document.getElementById('edit');
+    edit.focus();
+    var s = window.getSelection();
+    typeCharacterCommand('a');
+    typeCharacterCommand(' ');
+    typeCharacterCommand('e');
+    typeCharacterCommand('x');
+    typeCharacterCommand('t');
+    typeCharacterCommand('r');
+    typeCharacterCommand('e');
+    typeCharacterCommand('m');
+    typeCharacterCommand('e');
+    typeCharacterCommand('l');
+    typeCharacterCommand('y');
+    typeCharacterCommand('l');
+    typeCharacterCommand('o');
+    typeCharacterCommand('n');
+    typeCharacterCommand('g');
+    typeCharacterCommand(' ');
+    typeCharacterCommand('m');
+    typeCharacterCommand('e');
+    typeCharacterCommand('s');
+    typeCharacterCommand('a');
+    typeCharacterCommand('g');
+    typeCharacterCommand('e');
+
+    if (window.internals)
+        internals.handleAcceptedCandidate("extremely long", 2, 13);
+
+    // Accepting the candidate is going to cause the selection to move to it, but we want
+    // to type a space after 'mesage' to get it autocorrected.
+    setSelectionCommand(edit.firstChild, 23, edit.firstChild, 23);
+
+    typeCharacterCommand(' ');
+
+    if (window.testRunner)
+        testRunner.dumpAsText(true);
+}
+
+</script>
+</head>
+<body>
+<p>This test verifies that accepted candidates don't disable autocorrection on subsequent words. You should see the phrase "a extremely long message" The bug occurs if "mesage" was not corrected to "message".</p>
+<div contenteditable="true" id="edit"/>
+<script>
+runEditingTest();
+</script>
+<script src=""
+</body>
+</html>

Modified: branches/safari-602-branch/LayoutTests/editing/mac/spelling/accept-candidate-replacing-multiple-words-expected.txt (205802 => 205803)


--- branches/safari-602-branch/LayoutTests/editing/mac/spelling/accept-candidate-replacing-multiple-words-expected.txt	2016-09-12 07:54:06 UTC (rev 205802)
+++ branches/safari-602-branch/LayoutTests/editing/mac/spelling/accept-candidate-replacing-multiple-words-expected.txt	2016-09-12 07:54:11 UTC (rev 205803)
@@ -31,15 +31,11 @@
 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
 EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
-EDITING DELEGATE: shouldInsertText:good idea replacingDOMRange:range from 0 of #text > DIV > DIV > BODY > HTML > #document to 9 of #text > DIV > DIV > BODY > HTML > #document givenAction:WebViewInsertActionTyped
+EDITING DELEGATE: shouldInsertText:good idea  replacingDOMRange:range from 0 of #text > DIV > DIV > BODY > HTML > #document to 9 of #text > DIV > DIV > BODY > HTML > #document givenAction:WebViewInsertActionTyped
 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
-EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV > DIV > BODY > HTML > #document to 0 of DIV > DIV > BODY > HTML > #document toDOMRange:range from 9 of #text > DIV > DIV > BODY > HTML > #document to 9 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV > DIV > BODY > HTML > #document to 0 of DIV > DIV > BODY > HTML > #document toDOMRange:range from 10 of #text > DIV > DIV > BODY > HTML > #document to 10 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
 EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
-EDITING DELEGATE: shouldInsertText:  replacingDOMRange:range from 9 of #text > DIV > DIV > BODY > HTML > #document to 9 of #text > DIV > DIV > BODY > HTML > #document givenAction:WebViewInsertActionTyped
-EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 9 of #text > DIV > DIV > BODY > HTML > #document to 9 of #text > DIV > DIV > BODY > HTML > #document toDOMRange:range from 10 of #text > DIV > DIV > BODY > HTML > #document to 10 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
-EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
-EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: branches/safari-602-branch/LayoutTests/editing/mac/spelling/accept-candidate-replacing-multiple-words.html (205802 => 205803)


--- branches/safari-602-branch/LayoutTests/editing/mac/spelling/accept-candidate-replacing-multiple-words.html	2016-09-12 07:54:06 UTC (rev 205802)
+++ branches/safari-602-branch/LayoutTests/editing/mac/spelling/accept-candidate-replacing-multiple-words.html	2016-09-12 07:54:11 UTC (rev 205803)
@@ -18,7 +18,7 @@
     typeCharacterCommand('a');
     
     if (window.internals)
-        internals.handleAcceptedCandidate("good idea", 0, 9);
+        internals.handleAcceptedCandidate("good idea ", 0, 9);
 
     if (window.testRunner)
         testRunner.dumpAsText(true);

Copied: branches/safari-602-branch/LayoutTests/editing/mac/spelling/accept-candidate-without-adding-space-expected.txt (from rev 205802, branches/safari-602-branch/LayoutTests/editing/mac/spelling/accept-candidate-without-crossing-editing-boundary-expected.txt) (0 => 205803)


--- branches/safari-602-branch/LayoutTests/editing/mac/spelling/accept-candidate-without-adding-space-expected.txt	                        (rev 0)
+++ branches/safari-602-branch/LayoutTests/editing/mac/spelling/accept-candidate-without-adding-space-expected.txt	2016-09-12 07:54:11 UTC (rev 205803)
@@ -0,0 +1,22 @@
+EDITING DELEGATE: shouldBeginEditingInDOMRange:range from 0 of DIV > DIV > BODY > HTML > #document to 0 of DIV > DIV > BODY > HTML > #document
+EDITING DELEGATE: webViewDidBeginEditing:WebViewDidBeginEditingNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 0 of DIV > DIV > BODY > HTML > #document to 0 of DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV > DIV > BODY > HTML > #document to 0 of DIV > DIV > BODY > HTML > #document toDOMRange:range from 1 of #text > DIV > DIV > BODY > HTML > #document to 1 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 1 of #text > DIV > DIV > BODY > HTML > #document to 1 of #text > DIV > DIV > BODY > HTML > #document toDOMRange:range from 2 of #text > DIV > DIV > BODY > HTML > #document to 2 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldInsertText:is replacingDOMRange:range from 0 of #text > DIV > DIV > BODY > HTML > #document to 2 of #text > DIV > DIV > BODY > HTML > #document givenAction:WebViewInsertActionTyped
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV > DIV > BODY > HTML > #document to 0 of DIV > DIV > BODY > HTML > #document toDOMRange:range from 2 of #text > DIV > DIV > BODY > HTML > #document to 2 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+PASS successfullyParsed is true
+
+TEST COMPLETE
+This test verifies that accepted candidates that do not have spaces don't add them.
+
+is

Copied: branches/safari-602-branch/LayoutTests/editing/mac/spelling/accept-candidate-without-adding-space.html (from rev 205802, branches/safari-602-branch/LayoutTests/editing/mac/spelling/accept-candidate-without-crossing-editing-boundary.html) (0 => 205803)


--- branches/safari-602-branch/LayoutTests/editing/mac/spelling/accept-candidate-without-adding-space.html	                        (rev 0)
+++ branches/safari-602-branch/LayoutTests/editing/mac/spelling/accept-candidate-without-adding-space.html	2016-09-12 07:54:11 UTC (rev 205803)
@@ -0,0 +1,32 @@
+<html>
+<head>
+<script src=""
+<script src=""
+<script>
+
+function editingTest() {
+    edit = document.getElementById('edit');
+    edit.focus();
+    typeCharacterCommand('s');
+    typeCharacterCommand('i');
+    
+    if (window.internals)
+        internals.handleAcceptedCandidate("is", 0, 2);
+
+    if (window.testRunner)
+        testRunner.dumpAsText(true);
+}
+
+</script>
+</head>
+<body>
+<p>This test verifies that accepted candidates that do not have spaces don't add them.</p>
+<div style="border:1px solid black;">
+    <div contenteditable="true" id="edit"></div>
+</div>
+<script>
+runEditingTest();
+</script>
+<script src=""
+</body>
+</html>

Modified: branches/safari-602-branch/LayoutTests/editing/mac/spelling/accept-candidate-without-crossing-editing-boundary-expected.txt (205802 => 205803)


--- branches/safari-602-branch/LayoutTests/editing/mac/spelling/accept-candidate-without-crossing-editing-boundary-expected.txt	2016-09-12 07:54:06 UTC (rev 205802)
+++ branches/safari-602-branch/LayoutTests/editing/mac/spelling/accept-candidate-without-crossing-editing-boundary-expected.txt	2016-09-12 07:54:11 UTC (rev 205803)
@@ -9,15 +9,11 @@
 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
 EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
-EDITING DELEGATE: shouldInsertText:happy replacingDOMRange:range from 0 of #text > DIV > DIV > BODY > HTML > #document to 2 of #text > DIV > DIV > BODY > HTML > #document givenAction:WebViewInsertActionTyped
+EDITING DELEGATE: shouldInsertText:happy  replacingDOMRange:range from 0 of #text > DIV > DIV > BODY > HTML > #document to 2 of #text > DIV > DIV > BODY > HTML > #document givenAction:WebViewInsertActionTyped
 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
-EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV > DIV > BODY > HTML > #document to 0 of DIV > DIV > BODY > HTML > #document toDOMRange:range from 5 of #text > DIV > DIV > BODY > HTML > #document to 5 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV > DIV > BODY > HTML > #document to 0 of DIV > DIV > BODY > HTML > #document toDOMRange:range from 6 of #text > DIV > DIV > BODY > HTML > #document to 6 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
 EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
-EDITING DELEGATE: shouldInsertText:  replacingDOMRange:range from 5 of #text > DIV > DIV > BODY > HTML > #document to 5 of #text > DIV > DIV > BODY > HTML > #document givenAction:WebViewInsertActionTyped
-EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 5 of #text > DIV > DIV > BODY > HTML > #document to 5 of #text > DIV > DIV > BODY > HTML > #document toDOMRange:range from 6 of #text > DIV > DIV > BODY > HTML > #document to 6 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
-EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
-EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: branches/safari-602-branch/LayoutTests/editing/mac/spelling/accept-candidate-without-crossing-editing-boundary.html (205802 => 205803)


--- branches/safari-602-branch/LayoutTests/editing/mac/spelling/accept-candidate-without-crossing-editing-boundary.html	2016-09-12 07:54:06 UTC (rev 205802)
+++ branches/safari-602-branch/LayoutTests/editing/mac/spelling/accept-candidate-without-crossing-editing-boundary.html	2016-09-12 07:54:11 UTC (rev 205803)
@@ -10,7 +10,7 @@
     typeCharacterCommand('h');
     typeCharacterCommand('a');
     if (window.internals)
-        internals.handleAcceptedCandidate("happy", 0, 2);
+        internals.handleAcceptedCandidate("happy ", 0, 2);
 
     if (window.testRunner)
         testRunner.dumpAsText(true);

Modified: branches/safari-602-branch/LayoutTests/editing/mac/spelling/accept-misspelled-candidate-expected.txt (205802 => 205803)


--- branches/safari-602-branch/LayoutTests/editing/mac/spelling/accept-misspelled-candidate-expected.txt	2016-09-12 07:54:06 UTC (rev 205802)
+++ branches/safari-602-branch/LayoutTests/editing/mac/spelling/accept-misspelled-candidate-expected.txt	2016-09-12 07:54:11 UTC (rev 205803)
@@ -29,17 +29,12 @@
 EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 6 of #text > DIV > BODY > HTML > #document to 6 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: webViewDidChange:WebViewDidChangeNotification
-EDITING DELEGATE: shouldInsertText:  replacingDOMRange:range from 13 of #text > DIV > BODY > HTML > #document to 13 of #text > DIV > BODY > HTML > #document givenAction:WebViewInsertActionTyped
 EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 13 of #text > DIV > BODY > HTML > #document to 13 of #text > DIV > BODY > HTML > #document toDOMRange:range from 14 of #text > DIV > BODY > HTML > #document to 14 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
 EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
-EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
-EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 13 of #text > DIV > BODY > HTML > #document to 13 of #text > DIV > BODY > HTML > #document toDOMRange:range from 15 of #text > DIV > BODY > HTML > #document to 15 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
-EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
-EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
 PASS successfullyParsed is true
 
 TEST COMPLETE
 This test verifies that accepted candidates are not autocorrected. You should see phrase "it's a mesage." The bug occurs if "mesage" was corrected to "message."
 
-it's a mesage  
+it's a mesage 

Modified: branches/safari-602-branch/LayoutTests/platform/mac-wk2/TestExpectations (205802 => 205803)


--- branches/safari-602-branch/LayoutTests/platform/mac-wk2/TestExpectations	2016-09-12 07:54:06 UTC (rev 205802)
+++ branches/safari-602-branch/LayoutTests/platform/mac-wk2/TestExpectations	2016-09-12 07:54:11 UTC (rev 205803)
@@ -166,6 +166,7 @@
 webkit.org/b/105616 editing/mac/spelling/move-cursor-to-autocorrected-word.html [ Failure ]
 webkit.org/b/105616 editing/mac/spelling/move-cursor-to-beginning-of-autocorrected-word.html [ Failure ]
 webkit.org/b/105616 editing/mac/spelling/removing-underline-after-accepting-autocorrection-using-punctuation.html [ Failure ]
+webkit.org/b/105616 editing/mac/spelling/accept-candidate-allows-autocorrect-on-next-word.html [ Failure ]
 
 # [WK2] [Mac] Support drag in mouse events for WebKit2 EventSender
 # <https://bugs.webkit.org/show_bug.cgi?id=68552>

Modified: branches/safari-602-branch/Source/WebCore/ChangeLog (205802 => 205803)


--- branches/safari-602-branch/Source/WebCore/ChangeLog	2016-09-12 07:54:06 UTC (rev 205802)
+++ branches/safari-602-branch/Source/WebCore/ChangeLog	2016-09-12 07:54:11 UTC (rev 205803)
@@ -1,5 +1,32 @@
 2016-09-12  Babak Shafiei  <[email protected]>
 
+        Merge r205788. rdar://problem/28245097
+
+    2016-09-11  Tim Horton  <[email protected]>
+
+            Candidates that don't end in spaces shouldn't have spaces arbitrarily appended to them
+            https://bugs.webkit.org/show_bug.cgi?id=161846
+            <rdar://problem/28245097>
+
+            Reviewed by Beth Dakin.
+
+            Tests: editing/mac/spelling/accept-candidate-without-adding-space.html,
+                   editing/mac/spelling/accept-candidate-allows-autocorrect-on-next-word.html
+
+            * editing/Editor.cpp:
+            (WebCore::Editor::handleAcceptedCandidate):
+            Stop appending a space just because the candidate doesn't end in a space.
+            There are languages where that doesn't make sense, and the platform
+            guarantees that candidates will always have spaces if they need them.
+
+            Also, adjust the way we compute the AcceptedCandidate document marker range.
+            There were two problems with the existing code: it expanded outward from
+            the post-insertion cursor in *both* directions, instead of just backwards,
+            and it used the length of the replaced text, not the length of the newly
+            inserted text (more of the confusion mentioned in r205765).
+
+2016-09-12  Babak Shafiei  <[email protected]>
+
         Merge r205154. rdar://problem/28233330
 
     2016-08-29  Chris Dumez  <[email protected]>

Modified: branches/safari-602-branch/Source/WebCore/editing/Editor.cpp (205802 => 205803)


--- branches/safari-602-branch/Source/WebCore/editing/Editor.cpp	2016-09-12 07:54:06 UTC (rev 205802)
+++ branches/safari-602-branch/Source/WebCore/editing/Editor.cpp	2016-09-12 07:54:11 UTC (rev 205803)
@@ -3639,7 +3639,6 @@
 void Editor::handleAcceptedCandidate(TextCheckingResult acceptedCandidate)
 {
     const VisibleSelection& selection = m_frame.selection().selection();
-    int candidateLength = acceptedCandidate.length;
 
     m_isHandlingAcceptedCandidate = true;
 
@@ -3646,13 +3645,7 @@
     selectTextCheckingResult(acceptedCandidate);
     insertText(acceptedCandidate.replacement, 0);
 
-    // Some candidates come with a space built in, and we do not need to add another space in that case.
-    if (!acceptedCandidate.replacement.endsWith(' ')) {
-        insertText(ASCIILiteral(" "), 0);
-        ++candidateLength;
-    }
-
-    RefPtr<Range> insertedCandidateRange = rangeExpandedAroundPositionByCharacters(selection.visibleStart(), candidateLength);
+    RefPtr<Range> insertedCandidateRange = rangeExpandedByCharactersInDirectionAtWordBoundary(selection.visibleStart(), acceptedCandidate.replacement.length(), DirectionBackward);
     if (insertedCandidateRange)
         insertedCandidateRange->startContainer().document().markers().addMarker(insertedCandidateRange.get(), DocumentMarker::AcceptedCandidate, acceptedCandidate.replacement);
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to