Changeset 163860 in webkit


Ignore:
Timestamp:
Feb 10, 2014 10:17:59 PM (10 years ago)
Author:
commit-queue@webkit.org
Message:

Unreviewed, rolling out r163848.
http://trac.webkit.org/changeset/163848
https://bugs.webkit.org/show_bug.cgi?id=128580

Caused a lot of crashes on tests (Requested by ap on #webkit).

  • Shared/APIString.h:
  • UIProcess/TextChecker.h:
  • UIProcess/WebPageProxy.cpp:

(WebKit::WebPageProxy::checkTextOfParagraph):
(WebKit::WebPageProxy::checkSpellingOfString):
(WebKit::WebPageProxy::checkGrammarOfString):

  • UIProcess/mac/TextCheckerMac.mm:

(WebKit::TextChecker::checkTextOfParagraph):
(WebKit::TextChecker::checkSpellingOfString):
(WebKit::TextChecker::checkGrammarOfString):

Location:
trunk/Source/WebKit2
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r163857 r163860  
     12014-02-10  Commit Queue  <commit-queue@webkit.org>
     2
     3        Unreviewed, rolling out r163848.
     4        http://trac.webkit.org/changeset/163848
     5        https://bugs.webkit.org/show_bug.cgi?id=128580
     6
     7        Caused a lot of crashes on tests (Requested by ap on #webkit).
     8
     9        * Shared/APIString.h:
     10        * UIProcess/TextChecker.h:
     11        * UIProcess/WebPageProxy.cpp:
     12        (WebKit::WebPageProxy::checkTextOfParagraph):
     13        (WebKit::WebPageProxy::checkSpellingOfString):
     14        (WebKit::WebPageProxy::checkGrammarOfString):
     15        * UIProcess/mac/TextCheckerMac.mm:
     16        (WebKit::TextChecker::checkTextOfParagraph):
     17        (WebKit::TextChecker::checkSpellingOfString):
     18        (WebKit::TextChecker::checkGrammarOfString):
     19
    1202014-02-10  Brady Eidson  <beidson@apple.com>
    221
  • trunk/Source/WebKit2/Shared/APIString.h

    r163848 r163860  
    7979    size_t getUTF8CString(char* buffer, size_t bufferSize)
    8080    {
    81         if (!bufferSize || m_string.isEmpty())
     81        if (!bufferSize)
    8282            return 0;
    83         char* destination = buffer;
    84 
    85         WTF::Unicode::ConversionResult result;
    86         if (m_string.is8Bit()) {
    87             const LChar* source = m_string.characters8();
    88             result = WTF::Unicode::convertLatin1ToUTF8(&source, source + m_string.length(), &destination, destination + bufferSize - 1);
    89         } else {
    90             const UChar* source = m_string.characters16();
    91             result = WTF::Unicode::convertUTF16ToUTF8(&source, source + m_string.length(), &destination, destination + bufferSize - 1, /* strict */ true);
    92         }
    93 
    94         *destination++ = '\0';
     83        char* p = buffer;
     84        const UChar* d = m_string.deprecatedCharacters();
     85        WTF::Unicode::ConversionResult result = WTF::Unicode::convertUTF16ToUTF8(&d, d + m_string.length(), &p, p + bufferSize - 1, /* strict */ true);
     86        *p++ = '\0';
    9587        if (result != WTF::Unicode::conversionOK && result != WTF::Unicode::targetExhausted)
    9688            return 0;
    97         return destination - buffer;
     89        return p - buffer;
    9890    }
    9991
  • trunk/Source/WebKit2/UIProcess/TextChecker.h

    r163848 r163860  
    6868    static void closeSpellDocumentWithTag(int64_t);
    6969#if USE(UNIFIED_TEXT_CHECKING)
    70     static Vector<WebCore::TextCheckingResult> checkTextOfParagraph(int64_t spellDocumentTag, StringView, uint64_t checkingTypes);
     70    static Vector<WebCore::TextCheckingResult> checkTextOfParagraph(int64_t spellDocumentTag, const UChar* text, int length, uint64_t checkingTypes);
    7171#endif
    72     static void checkSpellingOfString(int64_t spellDocumentTag, StringView, int32_t& misspellingLocation, int32_t& misspellingLength);
    73     static void checkGrammarOfString(int64_t spellDocumentTag, StringView, Vector<WebCore::GrammarDetail>&, int32_t& badGrammarLocation, int32_t& badGrammarLength);
     72    static void checkSpellingOfString(int64_t spellDocumentTag, const UChar* text, uint32_t length, int32_t& misspellingLocation, int32_t& misspellingLength);
     73    static void checkGrammarOfString(int64_t spellDocumentTag, const UChar* text, uint32_t length, Vector<WebCore::GrammarDetail>&, int32_t& badGrammarLocation, int32_t& badGrammarLength);
    7474    static bool spellingUIIsShowing();
    7575    static void toggleSpellingUIIsShowing();
  • trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp

    r163848 r163860  
    34343434void WebPageProxy::checkTextOfParagraph(const String& text, uint64_t checkingTypes, Vector<TextCheckingResult>& results)
    34353435{
    3436     results = TextChecker::checkTextOfParagraph(spellDocumentTag(), text, checkingTypes);
     3436    results = TextChecker::checkTextOfParagraph(spellDocumentTag(), text.deprecatedCharacters(), text.length(), checkingTypes);
    34373437}
    34383438#endif
     
    34403440void WebPageProxy::checkSpellingOfString(const String& text, int32_t& misspellingLocation, int32_t& misspellingLength)
    34413441{
    3442     TextChecker::checkSpellingOfString(spellDocumentTag(), text, misspellingLocation, misspellingLength);
     3442    TextChecker::checkSpellingOfString(spellDocumentTag(), text.deprecatedCharacters(), text.length(), misspellingLocation, misspellingLength);
    34433443}
    34443444
    34453445void WebPageProxy::checkGrammarOfString(const String& text, Vector<GrammarDetail>& grammarDetails, int32_t& badGrammarLocation, int32_t& badGrammarLength)
    34463446{
    3447     TextChecker::checkGrammarOfString(spellDocumentTag(), text, grammarDetails, badGrammarLocation, badGrammarLength);
     3447    TextChecker::checkGrammarOfString(spellDocumentTag(), text.deprecatedCharacters(), text.length(), grammarDetails, badGrammarLocation, badGrammarLength);
    34483448}
    34493449
  • trunk/Source/WebKit2/UIProcess/mac/TextCheckerMac.mm

    r163848 r163860  
    2929#import "TextCheckerState.h"
    3030#import <WebCore/NotImplemented.h>
    31 #import <wtf/text/StringView.h>
    3231#import <wtf/RetainPtr.h>
    3332
     
    295294#if USE(UNIFIED_TEXT_CHECKING)
    296295
    297 Vector<TextCheckingResult> TextChecker::checkTextOfParagraph(int64_t spellDocumentTag, StringView stringView, uint64_t checkingTypes)
     296Vector<TextCheckingResult> TextChecker::checkTextOfParagraph(int64_t spellDocumentTag, const UChar* text, int length, uint64_t checkingTypes)
    298297{
    299298    Vector<TextCheckingResult> results;
    300299
    301     auto textString = stringView.createNSStringWithoutCopying();
    302     NSArray *incomingResults = [[NSSpellChecker sharedSpellChecker] checkString:textString.get()
    303                                                                           range:NSMakeRange(0, stringView.length())
     300    RetainPtr<NSString> textString = adoptNS([[NSString alloc] initWithCharactersNoCopy:const_cast<UChar*>(text) length:length freeWhenDone:NO]);
     301    NSArray *incomingResults = [[NSSpellChecker sharedSpellChecker] checkString:textString .get()
     302                                                                          range:NSMakeRange(0, length)
    304303                                                                          types:checkingTypes | NSTextCheckingTypeOrthography
    305304                                                                        options:nil
     
    384383#endif
    385384
    386 void TextChecker::checkSpellingOfString(int64_t, StringView, int32_t&, int32_t&)
     385void TextChecker::checkSpellingOfString(int64_t, const UChar*, uint32_t, int32_t&, int32_t&)
    387386{
    388387    // Mac uses checkTextOfParagraph instead.
     
    390389}
    391390
    392 void TextChecker::checkGrammarOfString(int64_t, StringView, Vector<WebCore::GrammarDetail>&, int32_t&, int32_t&)
     391void TextChecker::checkGrammarOfString(int64_t, const UChar*, uint32_t, Vector<WebCore::GrammarDetail>&, int32_t&, int32_t&)
    393392{
    394393    // Mac uses checkTextOfParagraph instead.
Note: See TracChangeset for help on using the changeset viewer.