Title: [153515] trunk/Source/WebCore
Revision
153515
Author
[email protected]
Date
2013-07-31 02:44:35 -0700 (Wed, 31 Jul 2013)

Log Message

Remove guessesVector param from isUngrammatical
https://bugs.webkit.org/show_bug.cgi?id=119241

Reviewed by Ryosuke Niwa.

TextCheckingHelper::isUngrammatical(Vector<String>& guessesVector) doesn't return
guesses for ungrammatical phrases through its parameter.
Editor::isSelectionUngrammatical() uses it to check whether the selection
is ungrammatical.

r71009 showed that isUngrammatical(Vector<String>& guessesVector) had not supported
grammar guesses.

The grammar guesses can be retrieved by guessesForMisspelledOrUngrammaticalRange
when UNIFIED_TEXT_CHECKING is on.

No new tests, this is dead code due to no WebKit port implements grammar using
legacy text checker.

* WebCore.exp.in: Removed __ZN7WebCore6Editor32guessesForUngrammaticalSelectionEv.
* editing/Editor.cpp:
(WebCore::Editor::isSelectionUngrammatical):
(WebCore::Editor::guessesForMisspelledOrUngrammatical):
* editing/Editor.h: Removed guessesForUngrammaticalSelection. Dead code.
* editing/TextCheckingHelper.cpp:
(WebCore::TextCheckingHelper::isUngrammatical):
* editing/TextCheckingHelper.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (153514 => 153515)


--- trunk/Source/WebCore/ChangeLog	2013-07-31 08:12:32 UTC (rev 153514)
+++ trunk/Source/WebCore/ChangeLog	2013-07-31 09:44:35 UTC (rev 153515)
@@ -1,5 +1,35 @@
 2013-07-31  Grzegorz Czajkowski  <[email protected]>
 
+        Remove guessesVector param from isUngrammatical
+        https://bugs.webkit.org/show_bug.cgi?id=119241
+
+        Reviewed by Ryosuke Niwa.
+
+        TextCheckingHelper::isUngrammatical(Vector<String>& guessesVector) doesn't return
+        guesses for ungrammatical phrases through its parameter.
+        Editor::isSelectionUngrammatical() uses it to check whether the selection
+        is ungrammatical.
+
+        r71009 showed that isUngrammatical(Vector<String>& guessesVector) had not supported
+        grammar guesses.
+
+        The grammar guesses can be retrieved by guessesForMisspelledOrUngrammaticalRange
+        when UNIFIED_TEXT_CHECKING is on.
+
+        No new tests, this is dead code due to no WebKit port implements grammar using
+        legacy text checker.
+
+        * WebCore.exp.in: Removed __ZN7WebCore6Editor32guessesForUngrammaticalSelectionEv.
+        * editing/Editor.cpp:
+        (WebCore::Editor::isSelectionUngrammatical):
+        (WebCore::Editor::guessesForMisspelledOrUngrammatical):
+        * editing/Editor.h: Removed guessesForUngrammaticalSelection. Dead code.
+        * editing/TextCheckingHelper.cpp:
+        (WebCore::TextCheckingHelper::isUngrammatical):
+        * editing/TextCheckingHelper.h:
+
+2013-07-31  Grzegorz Czajkowski  <[email protected]>
+
         Unnecessary const_cast<TextCheckingHelper*>(this)->findFirstBadGrammar
         https://bugs.webkit.org/show_bug.cgi?id=119244
 

Modified: trunk/Source/WebCore/WebCore.exp.in (153514 => 153515)


--- trunk/Source/WebCore/WebCore.exp.in	2013-07-31 08:12:32 UTC (rev 153514)
+++ trunk/Source/WebCore/WebCore.exp.in	2013-07-31 09:44:35 UTC (rev 153515)
@@ -984,7 +984,6 @@
 __ZN7WebCore6Editor30toggleAutomaticTextReplacementEv
 __ZN7WebCore6Editor31isAutomaticLinkDetectionEnabledEv
 __ZN7WebCore6Editor31toggleAutomaticDashSubstitutionEv
-__ZN7WebCore6Editor32guessesForUngrammaticalSelectionEv
 __ZN7WebCore6Editor32toggleAutomaticQuoteSubstitutionEv
 __ZN7WebCore6Editor33increaseSelectionListLevelOrderedEv
 __ZN7WebCore6Editor33isAutomaticTextReplacementEnabledEv

Modified: trunk/Source/WebCore/editing/Editor.cpp (153514 => 153515)


--- trunk/Source/WebCore/editing/Editor.cpp	2013-07-31 08:12:32 UTC (rev 153514)
+++ trunk/Source/WebCore/editing/Editor.cpp	2013-07-31 09:44:35 UTC (rev 153515)
@@ -1856,31 +1856,15 @@
 bool Editor::isSelectionUngrammatical()
 {
 #if USE(GRAMMAR_CHECKING)
-    Vector<String> ignoredGuesses;
     RefPtr<Range> range = frame()->selection()->toNormalizedRange();
     if (!range)
         return false;
-    return TextCheckingHelper(client(), range).isUngrammatical(ignoredGuesses);
+    return TextCheckingHelper(client(), range).isUngrammatical();
 #else
     return false;
 #endif
 }
 
-Vector<String> Editor::guessesForUngrammaticalSelection()
-{
-#if USE(GRAMMAR_CHECKING)
-    Vector<String> guesses;
-    RefPtr<Range> range = frame()->selection()->toNormalizedRange();
-    if (!range)
-        return guesses;
-    // Ignore the result of isUngrammatical; we just want the guesses, whether or not there are any
-    TextCheckingHelper(client(), range).isUngrammatical(guesses);
-    return guesses;
-#else
-    return Vector<String>();
-#endif
-}
-
 Vector<String> Editor::guessesForMisspelledWord(const String& word) const
 {
     ASSERT(word.length());
@@ -1909,16 +1893,11 @@
 
     String misspelledWord = behavior().shouldAllowSpellingSuggestionsWithoutSelection() ? misspelledWordAtCaretOrRange(m_frame->document()->focusedElement()) : misspelledSelectionString();
     misspelled = !misspelledWord.isEmpty();
+    // Only unified text checker supports guesses for ungrammatical phrases.
+    ungrammatical = false;
 
-    if (misspelled) {
-        ungrammatical = false;
+    if (misspelled)
         return guessesForMisspelledWord(misspelledWord);
-    }
-    if (isGrammarCheckingEnabled() && isSelectionUngrammatical()) {
-        ungrammatical = true;
-        return guessesForUngrammaticalSelection();
-    }
-    ungrammatical = false;
     return Vector<String>();
 }
 

Modified: trunk/Source/WebCore/editing/Editor.h (153514 => 153515)


--- trunk/Source/WebCore/editing/Editor.h	2013-07-31 08:12:32 UTC (rev 153514)
+++ trunk/Source/WebCore/editing/Editor.h	2013-07-31 09:44:35 UTC (rev 153515)
@@ -235,7 +235,6 @@
     String misspelledSelectionString() const;
     String misspelledWordAtCaretOrRange(Node* clickedNode) const;
     Vector<String> guessesForMisspelledWord(const String&) const;
-    Vector<String> guessesForUngrammaticalSelection();
     Vector<String> guessesForMisspelledOrUngrammatical(bool& misspelled, bool& ungrammatical);
     bool isSpellCheckingEnabledInFocusedNode() const;
     bool isSpellCheckingEnabledFor(Node*) const;

Modified: trunk/Source/WebCore/editing/TextCheckingHelper.cpp (153514 => 153515)


--- trunk/Source/WebCore/editing/TextCheckingHelper.cpp	2013-07-31 08:12:32 UTC (rev 153514)
+++ trunk/Source/WebCore/editing/TextCheckingHelper.cpp	2013-07-31 09:44:35 UTC (rev 153515)
@@ -510,7 +510,7 @@
 }
 
 
-bool TextCheckingHelper::isUngrammatical(Vector<String>& guessesVector) const
+bool TextCheckingHelper::isUngrammatical() const
 {
     if (!m_client)
         return false;
@@ -521,7 +521,6 @@
     // Returns true only if the passed range exactly corresponds to a bad grammar detail range. This is analogous
     // to isSelectionMisspelled. It's not good enough for there to be some bad grammar somewhere in the range,
     // or overlapping the range; the ranges must exactly match.
-    guessesVector.clear();
     int grammarPhraseOffset;
     
     GrammarDetail grammarDetail;

Modified: trunk/Source/WebCore/editing/TextCheckingHelper.h (153514 => 153515)


--- trunk/Source/WebCore/editing/TextCheckingHelper.h	2013-07-31 08:12:32 UTC (rev 153514)
+++ trunk/Source/WebCore/editing/TextCheckingHelper.h	2013-07-31 09:44:35 UTC (rev 153515)
@@ -89,7 +89,7 @@
 #if USE(GRAMMAR_CHECKING)
     String findFirstBadGrammar(GrammarDetail& outGrammarDetail, int& outGrammarPhraseOffset, bool markAll) const;
     void markAllBadGrammar();
-    bool isUngrammatical(Vector<String>& guessesVector) const;
+    bool isUngrammatical() const;
 #endif
     Vector<String> guessesForMisspelledOrUngrammaticalRange(bool checkGrammar, bool& misspelled, bool& ungrammatical) const;
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to