Changeset 96568 in webkit


Ignore:
Timestamp:
Oct 3, 2011 8:10:54 PM (13 years ago)
Author:
commit-queue@webkit.org
Message:

Should call checkTextOfParagraph() indirectly to make unifying spell-checking code path easy.
https://bugs.webkit.org/show_bug.cgi?id=69241

Patch by Shinya Kawanaka <shinyak@google.com> on 2011-10-03
Reviewed by Ryosuke Niwa.

WebCore has two different code paths for spell-checking:

1) checkTextOfParagraph() for Snow Leopard or later
2) checkSpellingOfString() for checkGrammarOfString() for other platforms.

At the first step, this patch introduces an indirect wrapper to call
checkTextOfParagraph() in Snow Leopard or later. This is intended to make it easy to
introduce a function for mimicing checkTextOfParagraph() in Chromium platform or
other non-SL or non-Lion platform.

No new tests because this patch does not change a behavior.

  • accessibility/AccessibilityObject.cpp:

(WebCore::AccessibilityObject::hasMisspelling): Calling checkTextOfParagraph() indirectly.

  • accessibility/mac/WebAccessibilityObjectWrapper.mm:

(AXAttributeStringSetSpelling): ditto.

  • editing/Editor.cpp:

(WebCore::Editor::markAllMisspellingsAndBadGrammarInRanges): ditto.

  • editing/TextCheckingHelper.cpp:

(WebCore::TextCheckingHelper::findFirstMisspellingOrBadGrammar): ditto.
(WebCore::TextCheckingHelper::guessesForMisspelledOrUngrammaticalRange): ditto.
(WebCore::checkTextOfParagraph): Added.

  • editing/TextCheckingHelper.h:
Location:
trunk/Source/WebCore
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r96566 r96568  
     12011-10-03  Shinya Kawanaka  <shinyak@google.com>
     2
     3        Should call checkTextOfParagraph() indirectly to make unifying spell-checking code path easy.
     4        https://bugs.webkit.org/show_bug.cgi?id=69241
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        WebCore has two different code paths for spell-checking:
     9          1) checkTextOfParagraph() for Snow Leopard or later
     10          2) checkSpellingOfString() for checkGrammarOfString() for other platforms.
     11
     12        At the first step, this patch introduces an indirect wrapper to call
     13        checkTextOfParagraph() in Snow Leopard or later. This is intended to make it easy to
     14        introduce a function for mimicing checkTextOfParagraph() in Chromium platform or
     15        other non-SL or non-Lion platform.
     16
     17        No new tests because this patch does not change a behavior.
     18
     19        * accessibility/AccessibilityObject.cpp:
     20        (WebCore::AccessibilityObject::hasMisspelling): Calling checkTextOfParagraph() indirectly.
     21        * accessibility/mac/WebAccessibilityObjectWrapper.mm:
     22        (AXAttributeStringSetSpelling): ditto.
     23        * editing/Editor.cpp:
     24        (WebCore::Editor::markAllMisspellingsAndBadGrammarInRanges): ditto.
     25        * editing/TextCheckingHelper.cpp:
     26        (WebCore::TextCheckingHelper::findFirstMisspellingOrBadGrammar): ditto.
     27        (WebCore::TextCheckingHelper::guessesForMisspelledOrUngrammaticalRange): ditto.
     28        (WebCore::checkTextOfParagraph): Added.
     29        * editing/TextCheckingHelper.h:
     30
    1312011-10-03  Darin Adler  <darin@apple.com>
    232
  • trunk/Source/WebCore/accessibility/AccessibilityObject.cpp

    r96520 r96568  
    292292#if USE(UNIFIED_TEXT_CHECKING)
    293293    Vector<TextCheckingResult> results;
    294     textChecker->checkTextOfParagraph(chars, charsLength, TextCheckingTypeSpelling, results);
     294    checkTextOfParagraph(textChecker, chars, charsLength, TextCheckingTypeSpelling, results);
    295295    if (!results.isEmpty())
    296296        isMisspelled = true;
  • trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapper.mm

    r95906 r96568  
    695695    // checkTextOfParagraph is the only spelling/grammar checker implemented in WK1 and WK2
    696696    Vector<TextCheckingResult> results;
    697     checker->checkTextOfParagraph(chars, charLength, TextCheckingTypeSpelling, results);
     697    checkTextOfParagraph(checker, chars, charLength, TextCheckingTypeSpelling, results);
    698698   
    699699    size_t size = results.size();
  • trunk/Source/WebCore/editing/Editor.cpp

    r95244 r96568  
    21432143    Vector<TextCheckingResult> results;
    21442144    if (shouldMarkGrammar)
    2145         textChecker()->checkTextOfParagraph(grammarParagraph.textCharacters(), grammarParagraph.textLength(),
     2145        checkTextOfParagraph(textChecker(), grammarParagraph.textCharacters(), grammarParagraph.textLength(),
    21462146                                            resolveTextCheckingTypeMask(textCheckingOptions), results);
    21472147    else
    2148         textChecker()->checkTextOfParagraph(spellingParagraph.textCharacters(), spellingParagraph.textLength(),
     2148        checkTextOfParagraph(textChecker(), spellingParagraph.textCharacters(), spellingParagraph.textLength(),
    21492149                                            resolveTextCheckingTypeMask(textCheckingOptions), results);
    21502150       
  • trunk/Source/WebCore/editing/TextCheckingHelper.cpp

    r95901 r96568  
    277277                Vector<TextCheckingResult> results;
    278278                TextCheckingTypeMask checkingTypes = checkGrammar ? (TextCheckingTypeSpelling | TextCheckingTypeGrammar) : TextCheckingTypeSpelling;
    279                 m_client->textChecker()->checkTextOfParagraph(paragraphString.characters(), paragraphString.length(), checkingTypes, results);
     279                checkTextOfParagraph(m_client->textChecker(), paragraphString.characters(), paragraphString.length(), checkingTypes, results);
    280280               
    281281                for (unsigned i = 0; i < results.size(); i++) {
     
    527527    Vector<TextCheckingResult> results;
    528528    TextCheckingTypeMask checkingTypes = checkGrammar ? (TextCheckingTypeSpelling | TextCheckingTypeGrammar) : TextCheckingTypeSpelling;
    529     m_client->textChecker()->checkTextOfParagraph(paragraph.textCharacters(), paragraph.textLength(), checkingTypes, results);
     529    checkTextOfParagraph(m_client->textChecker(), paragraph.textCharacters(), paragraph.textLength(), checkingTypes, results);
    530530   
    531531    for (unsigned i = 0; i < results.size(); i++) {
     
    591591}
    592592
    593 }
     593void checkTextOfParagraph(TextCheckerClient* client, const UChar* text, int length,
     594                          TextCheckingTypeMask checkingTypes, Vector<TextCheckingResult>& results)
     595{
     596#if USE(UNIFIED_TEXT_CHECKING)
     597    client->checkTextOfParagraph(text, length, checkingTypes, results);
     598#else
     599    // Should implement later to unify unified spell-checking code path and
     600    // legacy spell-checking code path.
     601    ASSERT_NOT_REACHED();
     602    UNUSED_PARAM(client);
     603    UNUSED_PARAM(text);
     604    UNUSED_PARAM(length);
     605    UNUSED_PARAM(checkingTypes);
     606    UNUSED_PARAM(results);
     607#endif
     608}
     609
     610}
  • trunk/Source/WebCore/editing/TextCheckingHelper.h

    r95901 r96568  
    9393};
    9494
     95void checkTextOfParagraph(TextCheckerClient*, const UChar* text, int length,
     96    TextCheckingTypeMask checkingTypes, Vector<TextCheckingResult>& results);
     97
    9598} // namespace WebCore
    9699
Note: See TracChangeset for help on using the changeset viewer.