2011-04-11 Jia Pu <jpu@apple.com>
Reviewed by Adele Peterson.
Shouldn't carry out autocorrection when start typing a new word
https://bugs.webkit.org/show_bug.cgi?id=58241
<rdar://problem/9264736>
See WebCore/ChangeLog for detail.
* platform/mac-leopard/Skipped:
* platform/mac-snowleopard/Skipped:
* platform/mac-tiger/Skipped:
* platform/mac/editing/spelling/autocorrection-at-beginning-of-word-1-expected.checksum: Added.
* platform/mac/editing/spelling/autocorrection-at-beginning-of-word-1-expected.png: Added.
* platform/mac/editing/spelling/autocorrection-at-beginning-of-word-1-expected.txt: Added.
* platform/mac/editing/spelling/autocorrection-at-beginning-of-word-1.html: Added.
* platform/mac/editing/spelling/autocorrection-at-beginning-of-word-2-expected.checksum: Added.
* platform/mac/editing/spelling/autocorrection-at-beginning-of-word-2-expected.png: Added.
* platform/mac/editing/spelling/autocorrection-at-beginning-of-word-2-expected.txt: Added.
* platform/mac/editing/spelling/autocorrection-at-beginning-of-word-2.html: Added.
2011-04-11 Jia Pu <jpu@apple.com>
Reviewed by Adele Peterson.
Shouldn't carry out autocorrection when start typing a new word
https://bugs.webkit.org/show_bug.cgi?id=58241
<rdar://problem/9264736>
Tests: platform/mac/editing/spelling/autocorrection-at-beginning-of-word-1.html
platform/mac/editing/spelling/autocorrection-at-beginning-of-word-2.html
In TypingCommand::markMisspellingsAfterTyping(), we want to call Editor::markMisspellingsAfterTypingToWord()
only when the typing command is an insertion command, and preceding word contains at least one non-whitespace
character.
* editing/Editor.cpp:
(WebCore::Editor::markMisspellingsAfterTypingToWord):
* editing/Editor.h:
* editing/TypingCommand.cpp:
(WebCore::TypingCommand::markMisspellingsAfterTyping):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@83492 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index eb64d40..5121282 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,25 @@
+2011-04-11 Jia Pu <jpu@apple.com>
+
+ Reviewed by Adele Peterson.
+
+ Shouldn't carry out autocorrection when start typing a new word
+ https://bugs.webkit.org/show_bug.cgi?id=58241
+ <rdar://problem/9264736>
+
+ See WebCore/ChangeLog for detail.
+
+ * platform/mac-leopard/Skipped:
+ * platform/mac-snowleopard/Skipped:
+ * platform/mac-tiger/Skipped:
+ * platform/mac/editing/spelling/autocorrection-at-beginning-of-word-1-expected.checksum: Added.
+ * platform/mac/editing/spelling/autocorrection-at-beginning-of-word-1-expected.png: Added.
+ * platform/mac/editing/spelling/autocorrection-at-beginning-of-word-1-expected.txt: Added.
+ * platform/mac/editing/spelling/autocorrection-at-beginning-of-word-1.html: Added.
+ * platform/mac/editing/spelling/autocorrection-at-beginning-of-word-2-expected.checksum: Added.
+ * platform/mac/editing/spelling/autocorrection-at-beginning-of-word-2-expected.png: Added.
+ * platform/mac/editing/spelling/autocorrection-at-beginning-of-word-2-expected.txt: Added.
+ * platform/mac/editing/spelling/autocorrection-at-beginning-of-word-2.html: Added.
+
2011-04-11 Ryosuke Niwa <rniwa@webkit.org>
Reviewed by Antti Koivisto.
diff --git a/LayoutTests/platform/mac-leopard/Skipped b/LayoutTests/platform/mac-leopard/Skipped
index af8beae..c343b12 100644
--- a/LayoutTests/platform/mac-leopard/Skipped
+++ b/LayoutTests/platform/mac-leopard/Skipped
@@ -109,6 +109,8 @@
media/video-played-reset.html
# Disable spelling tests for autocorrection panel
+platform/mac/editing/spelling/autocorrection-at-beginning-of-word-1.html
+platform/mac/editing/spelling/autocorrection-at-beginning-of-word-2.html
platform/mac/editing/spelling/autocorrection-contraction.html
platform/mac/editing/spelling/autocorrection-delete.html
platform/mac/editing/spelling/autocorrection-removing-underline-after-paste.html
diff --git a/LayoutTests/platform/mac-snowleopard/Skipped b/LayoutTests/platform/mac-snowleopard/Skipped
index 289d34e..91c20b0 100644
--- a/LayoutTests/platform/mac-snowleopard/Skipped
+++ b/LayoutTests/platform/mac-snowleopard/Skipped
@@ -131,6 +131,8 @@
canvas/philip/tests/2d.gradient.interpolate.overlap2.html
# Disable spelling tests for autocorrection panel
+platform/mac/editing/spelling/autocorrection-at-beginning-of-word-1.html
+platform/mac/editing/spelling/autocorrection-at-beginning-of-word-2.html
platform/mac/editing/spelling/autocorrection-contraction.html
platform/mac/editing/spelling/autocorrection-delete.html
platform/mac/editing/spelling/autocorrection-removing-underline-after-paste.html
diff --git a/LayoutTests/platform/mac-tiger/Skipped b/LayoutTests/platform/mac-tiger/Skipped
index abd7267..29f2abd 100644
--- a/LayoutTests/platform/mac-tiger/Skipped
+++ b/LayoutTests/platform/mac-tiger/Skipped
@@ -213,6 +213,8 @@
editing/spelling/spellcheck-paste.html
# Disable spelling tests for autocorrection panel
+platform/mac/editing/spelling/autocorrection-at-beginning-of-word-1.html
+platform/mac/editing/spelling/autocorrection-at-beginning-of-word-2.html
platform/mac/editing/spelling/autocorrection-contraction.html
platform/mac/editing/spelling/autocorrection-delete.html
platform/mac/editing/spelling/autocorrection-removing-underline-after-paste.html
diff --git a/LayoutTests/platform/mac/editing/spelling/autocorrection-at-beginning-of-word-1-expected.checksum b/LayoutTests/platform/mac/editing/spelling/autocorrection-at-beginning-of-word-1-expected.checksum
new file mode 100644
index 0000000..2c00a70
--- /dev/null
+++ b/LayoutTests/platform/mac/editing/spelling/autocorrection-at-beginning-of-word-1-expected.checksum
@@ -0,0 +1 @@
+080f086a8a277772877fae200aabe86e
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/editing/spelling/autocorrection-at-beginning-of-word-1-expected.png b/LayoutTests/platform/mac/editing/spelling/autocorrection-at-beginning-of-word-1-expected.png
new file mode 100644
index 0000000..d55690e
--- /dev/null
+++ b/LayoutTests/platform/mac/editing/spelling/autocorrection-at-beginning-of-word-1-expected.png
Binary files differ
diff --git a/LayoutTests/platform/mac/editing/spelling/autocorrection-at-beginning-of-word-1-expected.txt b/LayoutTests/platform/mac/editing/spelling/autocorrection-at-beginning-of-word-1-expected.txt
new file mode 100644
index 0000000..65fa0e7
--- /dev/null
+++ b/LayoutTests/platform/mac/editing/spelling/autocorrection-at-beginning-of-word-1-expected.txt
@@ -0,0 +1,38 @@
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV to 0 of DIV toDOMRange:range from 1 of #text > DIV to 1 of #text > DIV affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of #text > DIV to 6 of #text > DIV toDOMRange:range from 6 of #text > DIV to 6 of #text > DIV affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 7 of #text > DIV to 8 of #text > DIV toDOMRange:range from 8 of #text > DIV to 8 of #text > DIV affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+layer at (0,0) size 800x600
+ RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+ RenderBlock {HTML} at (0,0) size 800x600
+ RenderBody {BODY} at (8,8) size 784x584
+ RenderBlock {DIV} at (0,0) size 784x36
+ RenderText {#text} at (0,0) size 771x36
+ text run at (0,0) width 771: "The test verified that autocorrection does not occur when user starts typing a word. You should see the phrase \"mesage m\""
+ text run at (0,18) width 200: "with red underline on \"mesage\""
+ RenderBlock {P} at (0,52) size 784x54 [color=#008000]
+ RenderText {#text} at (0,0) size 783x54
+ text run at (0,0) width 766: "Note, this test can fail due to user specific spell checking data. If the user has previously dismissed 'message' as the correct"
+ text run at (0,18) width 783: "spelling of 'mesage' several times, the spell checker will not provide 'notational' as a suggestion anymore. To fix this, remove"
+ text run at (0,36) width 185: "all files in ~/Library/Spelling."
+ RenderBlock (anonymous) at (0,122) size 784x140
+ RenderText {#text} at (0,0) size 0x0
+ RenderText {#text} at (0,0) size 0x0
+layer at (10,132) size 581x136 clip at (11,133) size 579x134
+ RenderTextControl {TEXTAREA} at (2,2) size 581x136 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
+ RenderBlock {DIV} at (3,3) size 575x13
+ RenderText {#text} at (0,0) size 55x13
+ text run at (0,0) width 55: "mesage m"
+caret: position 8 of child 0 {#text} of child 0 {DIV} of child 5 {TEXTAREA} of body
diff --git a/LayoutTests/platform/mac/editing/spelling/autocorrection-at-beginning-of-word-1.html b/LayoutTests/platform/mac/editing/spelling/autocorrection-at-beginning-of-word-1.html
new file mode 100644
index 0000000..18fe231
--- /dev/null
+++ b/LayoutTests/platform/mac/editing/spelling/autocorrection-at-beginning-of-word-1.html
@@ -0,0 +1,41 @@
+<html>
+<head>
+
+<style>
+.editing {
+ border: 2px solid red;
+ padding: 12px;
+ font-size: 24px;
+}
+</style>
+<script src=../../../../editing/editing.js language="JavaScript" type="text/JavaScript" ></script>
+
+<script>
+
+function editingTest() {
+ textarea = document.getElementById('test');
+ textarea.focus();
+ document.execCommand("InsertText", false, " ");
+ textarea.setSelectionRange(0, 0);
+ document.execCommand("InsertText", false, "mesage");
+ textarea.setSelectionRange(7, 7);
+ typeCharacterCommand('m');
+}
+
+</script>
+
+<title>Autocorrection at Beginning of Word Test 1</title>
+</head>
+<body>
+<div>The test verified that autocorrection does not occur when user starts typing a word. You should see the phrase "mesage m" with red underline on "mesage"</div>
+<p style="color:green">Note, this test can fail due to user specific spell checking data. If the user has previously dismissed 'message' as the correct spelling of 'mesage' several times, the spell checker will not provide 'notational' as a suggestion anymore. To fix this, remove all files in ~/Library/Spelling.</p>
+<textarea id="test" cols="80" rows="10"></textarea>
+</div>
+
+
+<script>
+runEditingTest();
+</script>
+
+</body>
+</html>
diff --git a/LayoutTests/platform/mac/editing/spelling/autocorrection-at-beginning-of-word-2-expected.checksum b/LayoutTests/platform/mac/editing/spelling/autocorrection-at-beginning-of-word-2-expected.checksum
new file mode 100644
index 0000000..8d21b44
--- /dev/null
+++ b/LayoutTests/platform/mac/editing/spelling/autocorrection-at-beginning-of-word-2-expected.checksum
@@ -0,0 +1 @@
+d356118735b137e62153a6eb4a720cc1
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/editing/spelling/autocorrection-at-beginning-of-word-2-expected.png b/LayoutTests/platform/mac/editing/spelling/autocorrection-at-beginning-of-word-2-expected.png
new file mode 100644
index 0000000..ed6e5af
--- /dev/null
+++ b/LayoutTests/platform/mac/editing/spelling/autocorrection-at-beginning-of-word-2-expected.png
Binary files differ
diff --git a/LayoutTests/platform/mac/editing/spelling/autocorrection-at-beginning-of-word-2-expected.txt b/LayoutTests/platform/mac/editing/spelling/autocorrection-at-beginning-of-word-2-expected.txt
new file mode 100644
index 0000000..8ceb4cb
--- /dev/null
+++ b/LayoutTests/platform/mac/editing/spelling/autocorrection-at-beginning-of-word-2-expected.txt
@@ -0,0 +1,41 @@
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV to 0 of DIV toDOMRange:range from 1 of #text > DIV to 1 of #text > DIV affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of #text > DIV to 6 of #text > DIV toDOMRange:range from 6 of #text > DIV to 6 of #text > DIV affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 7 of #text > DIV to 7 of #text > DIV toDOMRange:range from 1 of #text > DIV to 1 of #text > DIV affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+layer at (0,0) size 800x600
+ RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+ RenderBlock {HTML} at (0,0) size 800x600
+ RenderBody {BODY} at (8,8) size 784x584
+ RenderBlock {DIV} at (0,0) size 784x36
+ RenderText {#text} at (0,0) size 771x36
+ text run at (0,0) width 771: "The test verified that autocorrection does not occur when user starts typing a word. You should see the phrase \"mesage \\n\""
+ text run at (0,18) width 200: "with red underline on \"mesage\""
+ RenderBlock {P} at (0,52) size 784x54 [color=#008000]
+ RenderText {#text} at (0,0) size 783x54
+ text run at (0,0) width 766: "Note, this test can fail due to user specific spell checking data. If the user has previously dismissed 'message' as the correct"
+ text run at (0,18) width 783: "spelling of 'mesage' several times, the spell checker will not provide 'notational' as a suggestion anymore. To fix this, remove"
+ text run at (0,36) width 185: "all files in ~/Library/Spelling."
+ RenderBlock (anonymous) at (0,122) size 784x140
+ RenderText {#text} at (0,0) size 0x0
+ RenderText {#text} at (0,0) size 0x0
+layer at (10,132) size 581x136 clip at (11,133) size 579x134
+ RenderTextControl {TEXTAREA} at (2,2) size 581x136 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
+ RenderBlock {DIV} at (3,3) size 575x26
+ RenderText {#text} at (0,0) size 45x13
+ text run at (0,0) width 45: "mesage "
+ RenderText {#text} at (44,0) size 1x13
+ text run at (44,0) width 1: " "
+ RenderText {#text} at (0,13) size 0x13
+ text run at (0,13) width 0: " "
+caret: position 0 of child 2 {#text} of child 0 {DIV} of child 5 {TEXTAREA} of body
diff --git a/LayoutTests/platform/mac/editing/spelling/autocorrection-at-beginning-of-word-2.html b/LayoutTests/platform/mac/editing/spelling/autocorrection-at-beginning-of-word-2.html
new file mode 100644
index 0000000..05b8158
--- /dev/null
+++ b/LayoutTests/platform/mac/editing/spelling/autocorrection-at-beginning-of-word-2.html
@@ -0,0 +1,41 @@
+<html>
+<head>
+
+<style>
+.editing {
+ border: 2px solid red;
+ padding: 12px;
+ font-size: 24px;
+}
+</style>
+<script src=../../../../editing/editing.js language="JavaScript" type="text/JavaScript" ></script>
+
+<script>
+
+function editingTest() {
+ textarea = document.getElementById('test');
+ textarea.focus();
+ document.execCommand("InsertText", false, " ");
+ textarea.setSelectionRange(0, 0);
+ document.execCommand("InsertText", false, "mesage");
+ textarea.setSelectionRange(7, 7);
+ typeCharacterCommand('\n');
+}
+
+</script>
+
+<title>Autocorrection at Beginning of Word Test 1</title>
+</head>
+<body>
+<div>The test verified that autocorrection does not occur when user starts typing a word. You should see the phrase "mesage \n" with red underline on "mesage"</div>
+<p style="color:green">Note, this test can fail due to user specific spell checking data. If the user has previously dismissed 'message' as the correct spelling of 'mesage' several times, the spell checker will not provide 'notational' as a suggestion anymore. To fix this, remove all files in ~/Library/Spelling.</p>
+<textarea id="test" cols="80" rows="10"></textarea>
+</div>
+
+
+<script>
+runEditingTest();
+</script>
+
+</body>
+</html>
\ No newline at end of file
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index ec6d862..09072b3 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,24 @@
+2011-04-11 Jia Pu <jpu@apple.com>
+
+ Reviewed by Adele Peterson.
+
+ Shouldn't carry out autocorrection when start typing a new word
+ https://bugs.webkit.org/show_bug.cgi?id=58241
+ <rdar://problem/9264736>
+
+ Tests: platform/mac/editing/spelling/autocorrection-at-beginning-of-word-1.html
+ platform/mac/editing/spelling/autocorrection-at-beginning-of-word-2.html
+
+ In TypingCommand::markMisspellingsAfterTyping(), we want to call Editor::markMisspellingsAfterTypingToWord()
+ only when the typing command is an insertion command, and preceding word contains at least one non-whitespace
+ character.
+
+ * editing/Editor.cpp:
+ (WebCore::Editor::markMisspellingsAfterTypingToWord):
+ * editing/Editor.h:
+ * editing/TypingCommand.cpp:
+ (WebCore::TypingCommand::markMisspellingsAfterTyping):
+
2011-04-11 Vsevolod Vlasov <vsevik@chromium.org>
Reviewed by Pavel Feldman.
diff --git a/Source/WebCore/editing/Editor.cpp b/Source/WebCore/editing/Editor.cpp
index 3dc1dae..1f7ce33 100644
--- a/Source/WebCore/editing/Editor.cpp
+++ b/Source/WebCore/editing/Editor.cpp
@@ -1969,7 +1969,7 @@
markBadGrammar(movingSelection);
}
-void Editor::markMisspellingsAfterTypingToWord(const VisiblePosition &wordStart, const VisibleSelection& selectionAfterTyping)
+void Editor::markMisspellingsAfterTypingToWord(const VisiblePosition &wordStart, const VisibleSelection& selectionAfterTyping, bool doReplacement)
{
#if USE(UNIFIED_TEXT_CHECKING)
m_spellingCorrector->applyPendingCorrection(selectionAfterTyping);
@@ -1979,11 +1979,12 @@
textCheckingOptions |= MarkSpelling;
#if USE(AUTOMATIC_TEXT_REPLACEMENT)
- if (isAutomaticQuoteSubstitutionEnabled()
- || isAutomaticLinkDetectionEnabled()
- || isAutomaticDashSubstitutionEnabled()
- || isAutomaticTextReplacementEnabled()
- || ((textCheckingOptions & MarkSpelling) && isAutomaticSpellingCorrectionEnabled()))
+ if (doReplacement
+ && (isAutomaticQuoteSubstitutionEnabled()
+ || isAutomaticLinkDetectionEnabled()
+ || isAutomaticDashSubstitutionEnabled()
+ || isAutomaticTextReplacementEnabled()
+ || ((textCheckingOptions & MarkSpelling) && isAutomaticSpellingCorrectionEnabled())))
textCheckingOptions |= PerformReplacement;
#endif
if (!textCheckingOptions & (MarkSpelling | PerformReplacement))
diff --git a/Source/WebCore/editing/Editor.h b/Source/WebCore/editing/Editor.h
index 8b91153..1105ce9 100644
--- a/Source/WebCore/editing/Editor.h
+++ b/Source/WebCore/editing/Editor.h
@@ -219,7 +219,7 @@
Vector<String> guessesForMisspelledOrUngrammaticalSelection(bool& misspelled, bool& ungrammatical);
bool isSpellCheckingEnabledInFocusedNode() const;
bool isSpellCheckingEnabledFor(Node*) const;
- void markMisspellingsAfterTypingToWord(const VisiblePosition &wordStart, const VisibleSelection& selectionAfterTyping);
+ void markMisspellingsAfterTypingToWord(const VisiblePosition &wordStart, const VisibleSelection& selectionAfterTyping, bool doReplacement);
void markMisspellings(const VisibleSelection&, RefPtr<Range>& firstMisspellingRange);
void markBadGrammar(const VisibleSelection&);
void markMisspellingsAndBadGrammar(const VisibleSelection& spellingSelection, bool markGrammar, const VisibleSelection& grammarSelection);
diff --git a/Source/WebCore/editing/TypingCommand.cpp b/Source/WebCore/editing/TypingCommand.cpp
index 3f95d0d..da93fab 100644
--- a/Source/WebCore/editing/TypingCommand.cpp
+++ b/Source/WebCore/editing/TypingCommand.cpp
@@ -39,6 +39,7 @@
#include "InsertTextCommand.h"
#include "RenderObject.h"
#include "SelectionController.h"
+#include "TextIterator.h"
#include "VisiblePosition.h"
#include "htmlediting.h"
#include "visible_units.h"
@@ -340,9 +341,13 @@
if (previous.isNotNull()) {
VisiblePosition p1 = startOfWord(previous, LeftWordIfOnBoundary);
VisiblePosition p2 = startOfWord(start, LeftWordIfOnBoundary);
- if (p1 != p2)
- document()->frame()->editor()->markMisspellingsAfterTypingToWord(p1, endingSelection());
- else if (commandType == TypingCommand::InsertText)
+ if (p1 != p2) {
+ RefPtr<Range> range = makeRange(p1, p2);
+ String strippedPreviousWord;
+ if (range && (commandType == TypingCommand::InsertText || commandType == TypingCommand::InsertLineBreak || commandType == TypingCommand::InsertParagraphSeparator || commandType == TypingCommand::InsertParagraphSeparatorInQuotedContent))
+ strippedPreviousWord = plainText(range.get()).stripWhiteSpace();
+ document()->frame()->editor()->markMisspellingsAfterTypingToWord(p1, endingSelection(), !strippedPreviousWord.isEmpty());
+ } else if (commandType == TypingCommand::InsertText)
document()->frame()->editor()->startCorrectionPanelTimer();
}
}