Title: [292534] trunk/Source
Revision
292534
Author
cdu...@apple.com
Date
2022-04-07 07:40:11 -0700 (Thu, 07 Apr 2022)

Log Message

Drop unused EditorClient::getAutoCorrectSuggestionForMisspelledWord()
https://bugs.webkit.org/show_bug.cgi?id=238897

Reviewed by Wenson Hsieh.

Source/WebCore:

* editing/Editor.cpp:
(WebCore::Editor::markMisspellingsAfterTypingToWord):
* editing/TextCheckingHelper.cpp:
(WebCore::findMisspellings):
* loader/EmptyClients.cpp:
* platform/text/TextCheckerClient.h:

Source/WebKit:

* WebProcess/WebCoreSupport/WebEditorClient.cpp:
(WebKit::WebEditorClient::getAutoCorrectSuggestionForMisspelledWord): Deleted.
* WebProcess/WebCoreSupport/WebEditorClient.h:

Source/WebKitLegacy/mac:

* WebCoreSupport/WebEditorClient.h:
(WebEditorClient::getAutoCorrectSuggestionForMisspelledWord): Deleted.
* WebCoreSupport/WebEditorClient.mm:
(WebEditorClient::getAutoCorrectSuggestionForMisspelledWord): Deleted.

Source/WebKitLegacy/win:

* WebCoreSupport/WebEditorClient.cpp:
(WebEditorClient::getAutoCorrectSuggestionForMisspelledWord): Deleted.
* WebCoreSupport/WebEditorClient.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (292533 => 292534)


--- trunk/Source/WebCore/ChangeLog	2022-04-07 13:34:59 UTC (rev 292533)
+++ trunk/Source/WebCore/ChangeLog	2022-04-07 14:40:11 UTC (rev 292534)
@@ -1,3 +1,17 @@
+2022-04-07  Chris Dumez  <cdu...@apple.com>
+
+        Drop unused EditorClient::getAutoCorrectSuggestionForMisspelledWord()
+        https://bugs.webkit.org/show_bug.cgi?id=238897
+
+        Reviewed by Wenson Hsieh.
+
+        * editing/Editor.cpp:
+        (WebCore::Editor::markMisspellingsAfterTypingToWord):
+        * editing/TextCheckingHelper.cpp:
+        (WebCore::findMisspellings):
+        * loader/EmptyClients.cpp:
+        * platform/text/TextCheckerClient.h:
+
 2022-04-07  Alan Bujtas  <za...@apple.com>
 
         A float avoider should never take a vertical position where a float is present even when its used width is zero

Modified: trunk/Source/WebCore/editing/Editor.cpp (292533 => 292534)


--- trunk/Source/WebCore/editing/Editor.cpp	2022-04-07 13:34:59 UTC (rev 292533)
+++ trunk/Source/WebCore/editing/Editor.cpp	2022-04-07 14:40:11 UTC (rev 292534)
@@ -2642,28 +2642,7 @@
     // Autocorrect the misspelled word.
     if (!misspellingRange)
         return;
-    
-    // Get the misspelled word.
-    String autocorrectedString = textChecker()->getAutoCorrectSuggestionForMisspelledWord(plainText(*misspellingRange));
 
-    // If autocorrected word is non empty, replace the misspelled word by this word.
-    if (!autocorrectedString.isEmpty()) {
-        VisibleSelection newSelection(*misspellingRange);
-        if (newSelection != m_document.selection().selection()) {
-            if (!m_document.selection().shouldChangeSelection(newSelection))
-                return;
-            m_document.selection().setSelection(newSelection);
-        }
-
-        if (!m_document.editor().shouldInsertText(autocorrectedString, misspellingRange, EditorInsertAction::Typed))
-            return;
-        m_document.editor().replaceSelectionWithText(autocorrectedString, SelectReplacement::No, SmartReplace::No, EditAction::Insert);
-
-        // Reset the charet one character further.
-        m_document.selection().moveTo(m_document.selection().selection().end());
-        m_document.selection().modify(FrameSelection::AlterationMove, SelectionDirection::Forward, TextGranularity::CharacterGranularity);
-    }
-
     if (!isGrammarCheckingEnabled())
         return;
     

Modified: trunk/Source/WebCore/editing/TextCheckingHelper.cpp (292533 => 292534)


--- trunk/Source/WebCore/editing/TextCheckingHelper.cpp	2022-04-07 13:34:59 UTC (rev 292533)
+++ trunk/Source/WebCore/editing/TextCheckingHelper.cpp	2022-04-07 14:40:11 UTC (rev 292534)
@@ -94,7 +94,6 @@
             TextCheckingResult misspelling;
             misspelling.type = TextCheckingType::Spelling;
             misspelling.range = CharacterRange(wordStart + misspellingLocation, misspellingLength);
-            misspelling.replacement = client.getAutoCorrectSuggestionForMisspelledWord(text.substring(misspelling.range.location, misspelling.range.length).toStringWithoutCopying());
             results.append(misspelling);
         }
 

Modified: trunk/Source/WebCore/loader/EmptyClients.cpp (292533 => 292534)


--- trunk/Source/WebCore/loader/EmptyClients.cpp	2022-04-07 13:34:59 UTC (rev 292533)
+++ trunk/Source/WebCore/loader/EmptyClients.cpp	2022-04-07 14:40:11 UTC (rev 292534)
@@ -374,7 +374,6 @@
         void ignoreWordInSpellDocument(const String&) final { }
         void learnWord(const String&) final { }
         void checkSpellingOfString(StringView, int*, int*) final { }
-        String getAutoCorrectSuggestionForMisspelledWord(const String&) final { return { }; }
         void checkGrammarOfString(StringView, Vector<GrammarDetail>&, int*, int*) final { }
 
 #if USE(UNIFIED_TEXT_CHECKING)

Modified: trunk/Source/WebCore/platform/text/TextCheckerClient.h (292533 => 292534)


--- trunk/Source/WebCore/platform/text/TextCheckerClient.h	2022-04-07 13:34:59 UTC (rev 292533)
+++ trunk/Source/WebCore/platform/text/TextCheckerClient.h	2022-04-07 14:40:11 UTC (rev 292534)
@@ -41,7 +41,6 @@
     virtual void ignoreWordInSpellDocument(const String&) = 0;
     virtual void learnWord(const String&) = 0;
     virtual void checkSpellingOfString(StringView, int* misspellingLocation, int* misspellingLength) = 0;
-    virtual String getAutoCorrectSuggestionForMisspelledWord(const String& misspelledWord) = 0;
     virtual void checkGrammarOfString(StringView, Vector<GrammarDetail>&, int* badGrammarLocation, int* badGrammarLength) = 0;
 
 #if USE(UNIFIED_TEXT_CHECKING)

Modified: trunk/Source/WebKit/ChangeLog (292533 => 292534)


--- trunk/Source/WebKit/ChangeLog	2022-04-07 13:34:59 UTC (rev 292533)
+++ trunk/Source/WebKit/ChangeLog	2022-04-07 14:40:11 UTC (rev 292534)
@@ -1,3 +1,14 @@
+2022-04-07  Chris Dumez  <cdu...@apple.com>
+
+        Drop unused EditorClient::getAutoCorrectSuggestionForMisspelledWord()
+        https://bugs.webkit.org/show_bug.cgi?id=238897
+
+        Reviewed by Wenson Hsieh.
+
+        * WebProcess/WebCoreSupport/WebEditorClient.cpp:
+        (WebKit::WebEditorClient::getAutoCorrectSuggestionForMisspelledWord): Deleted.
+        * WebProcess/WebCoreSupport/WebEditorClient.h:
+
 2022-04-07  Kimmo Kinnunen  <kkinnu...@apple.com>
 
         IPC::Connection should support diverting all messages to a message queue in other thread

Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebEditorClient.cpp (292533 => 292534)


--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebEditorClient.cpp	2022-04-07 13:34:59 UTC (rev 292533)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebEditorClient.cpp	2022-04-07 14:40:11 UTC (rev 292534)
@@ -512,12 +512,6 @@
     *misspellingLength = resultLength;
 }
 
-String WebEditorClient::getAutoCorrectSuggestionForMisspelledWord(const String&)
-{
-    notImplemented();
-    return String();
-}
-
 void WebEditorClient::checkGrammarOfString(StringView text, Vector<WebCore::GrammarDetail>& grammarDetails, int* badGrammarLocation, int* badGrammarLength)
 {
     int32_t resultLocation = -1;

Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebEditorClient.h (292533 => 292534)


--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebEditorClient.h	2022-04-07 13:34:59 UTC (rev 292533)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebEditorClient.h	2022-04-07 14:40:11 UTC (rev 292534)
@@ -155,7 +155,6 @@
     void ignoreWordInSpellDocument(const String&) final;
     void learnWord(const String&) final;
     void checkSpellingOfString(StringView, int* misspellingLocation, int* misspellingLength) final;
-    String getAutoCorrectSuggestionForMisspelledWord(const String& misspelledWord) final;
     void checkGrammarOfString(StringView, Vector<WebCore::GrammarDetail>&, int* badGrammarLocation, int* badGrammarLength) final;
 
 #if USE(UNIFIED_TEXT_CHECKING)

Modified: trunk/Source/WebKitLegacy/mac/ChangeLog (292533 => 292534)


--- trunk/Source/WebKitLegacy/mac/ChangeLog	2022-04-07 13:34:59 UTC (rev 292533)
+++ trunk/Source/WebKitLegacy/mac/ChangeLog	2022-04-07 14:40:11 UTC (rev 292534)
@@ -1,3 +1,15 @@
+2022-04-07  Chris Dumez  <cdu...@apple.com>
+
+        Drop unused EditorClient::getAutoCorrectSuggestionForMisspelledWord()
+        https://bugs.webkit.org/show_bug.cgi?id=238897
+
+        Reviewed by Wenson Hsieh.
+
+        * WebCoreSupport/WebEditorClient.h:
+        (WebEditorClient::getAutoCorrectSuggestionForMisspelledWord): Deleted.
+        * WebCoreSupport/WebEditorClient.mm:
+        (WebEditorClient::getAutoCorrectSuggestionForMisspelledWord): Deleted.
+
 2022-04-06  Chris Dumez  <cdu...@apple.com>
 
         Drop unnecessary ExceptionOr<> return types

Modified: trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebEditorClient.h (292533 => 292534)


--- trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebEditorClient.h	2022-04-07 13:34:59 UTC (rev 292533)
+++ trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebEditorClient.h	2022-04-07 14:40:11 UTC (rev 292534)
@@ -159,7 +159,6 @@
     void ignoreWordInSpellDocument(const String&) final;
     void learnWord(const String&) final;
     void checkSpellingOfString(StringView, int* misspellingLocation, int* misspellingLength) final;
-    String getAutoCorrectSuggestionForMisspelledWord(const String&) final;
     void checkGrammarOfString(StringView, Vector<WebCore::GrammarDetail>&, int* badGrammarLocation, int* badGrammarLength) final;
     Vector<WebCore::TextCheckingResult> checkTextOfParagraph(StringView, OptionSet<WebCore::TextCheckingType> checkingTypes, const WebCore::VisibleSelection& currentSelection) final;
     void updateSpellingUIWithGrammarString(const String&, const WebCore::GrammarDetail&) final;
@@ -273,11 +272,6 @@
 {
 }
 
-inline String WebEditorClient::getAutoCorrectSuggestionForMisspelledWord(const String&)
-{
-    return emptyString();
-}
-
 inline void WebEditorClient::checkGrammarOfString(StringView, Vector<WebCore::GrammarDetail>&, int* badGrammarLocation, int* badGrammarLength)
 {
 }

Modified: trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebEditorClient.mm (292533 => 292534)


--- trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebEditorClient.mm	2022-04-07 13:34:59 UTC (rev 292533)
+++ trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebEditorClient.mm	2022-04-07 14:40:11 UTC (rev 292534)
@@ -917,13 +917,6 @@
         *misspellingLength = range.length;
 }
 
-String WebEditorClient::getAutoCorrectSuggestionForMisspelledWord(const String& inputWord)
-{
-    // This method can be implemented using customized algorithms for the particular browser.
-    // Currently, it computes an empty string.
-    return String();
-}
-
 void WebEditorClient::checkGrammarOfString(StringView text, Vector<GrammarDetail>& details, int* badGrammarLocation, int* badGrammarLength)
 {
     NSArray *grammarDetails;

Modified: trunk/Source/WebKitLegacy/win/ChangeLog (292533 => 292534)


--- trunk/Source/WebKitLegacy/win/ChangeLog	2022-04-07 13:34:59 UTC (rev 292533)
+++ trunk/Source/WebKitLegacy/win/ChangeLog	2022-04-07 14:40:11 UTC (rev 292534)
@@ -1,3 +1,14 @@
+2022-04-07  Chris Dumez  <cdu...@apple.com>
+
+        Drop unused EditorClient::getAutoCorrectSuggestionForMisspelledWord()
+        https://bugs.webkit.org/show_bug.cgi?id=238897
+
+        Reviewed by Wenson Hsieh.
+
+        * WebCoreSupport/WebEditorClient.cpp:
+        (WebEditorClient::getAutoCorrectSuggestionForMisspelledWord): Deleted.
+        * WebCoreSupport/WebEditorClient.h:
+
 2022-04-06  Chris Dumez  <cdu...@apple.com>
 
         Reduce number of conversions from StringView to String

Modified: trunk/Source/WebKitLegacy/win/WebCoreSupport/WebEditorClient.cpp (292533 => 292534)


--- trunk/Source/WebKitLegacy/win/WebCoreSupport/WebEditorClient.cpp	2022-04-07 13:34:59 UTC (rev 292533)
+++ trunk/Source/WebKitLegacy/win/WebCoreSupport/WebEditorClient.cpp	2022-04-07 14:40:11 UTC (rev 292534)
@@ -762,13 +762,6 @@
     ed->checkSpellingOfString(m_webView, wcharFrom(text.upconvertedCharacters()), text.length(), misspellingLocation, misspellingLength);
 }
 
-String WebEditorClient::getAutoCorrectSuggestionForMisspelledWord(const String& inputWord)
-{
-    // This method can be implemented using customized algorithms for the particular browser.
-    // Currently, it computes an empty string.
-    return String();
-}
-
 void WebEditorClient::checkGrammarOfString(StringView text, Vector<GrammarDetail>& details, int* badGrammarLocation, int* badGrammarLength)
 {
     details.clear();

Modified: trunk/Source/WebKitLegacy/win/WebCoreSupport/WebEditorClient.h (292533 => 292534)


--- trunk/Source/WebKitLegacy/win/WebCoreSupport/WebEditorClient.h	2022-04-07 13:34:59 UTC (rev 292533)
+++ trunk/Source/WebKitLegacy/win/WebCoreSupport/WebEditorClient.h	2022-04-07 14:40:11 UTC (rev 292534)
@@ -104,7 +104,6 @@
     void ignoreWordInSpellDocument(const WTF::String&) final;
     void learnWord(const WTF::String&) final;
     void checkSpellingOfString(StringView, int* misspellingLocation, int* misspellingLength) final;
-    WTF::String getAutoCorrectSuggestionForMisspelledWord(const WTF::String&) final;
     void checkGrammarOfString(StringView, Vector<WebCore::GrammarDetail>&, int* badGrammarLocation, int* badGrammarLength) final;
     void updateSpellingUIWithGrammarString(const WTF::String&, const WebCore::GrammarDetail&) final;
     void updateSpellingUIWithMisspelledWord(const WTF::String&) final;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to