Changeset 163860 in webkit
- Timestamp:
- Feb 10, 2014 10:17:59 PM (10 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r163857 r163860 1 2014-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 1 20 2014-02-10 Brady Eidson <beidson@apple.com> 2 21 -
trunk/Source/WebKit2/Shared/APIString.h
r163848 r163860 79 79 size_t getUTF8CString(char* buffer, size_t bufferSize) 80 80 { 81 if (!bufferSize || m_string.isEmpty())81 if (!bufferSize) 82 82 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'; 95 87 if (result != WTF::Unicode::conversionOK && result != WTF::Unicode::targetExhausted) 96 88 return 0; 97 return destination- buffer;89 return p - buffer; 98 90 } 99 91 -
trunk/Source/WebKit2/UIProcess/TextChecker.h
r163848 r163860 68 68 static void closeSpellDocumentWithTag(int64_t); 69 69 #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); 71 71 #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); 74 74 static bool spellingUIIsShowing(); 75 75 static void toggleSpellingUIIsShowing(); -
trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp
r163848 r163860 3434 3434 void WebPageProxy::checkTextOfParagraph(const String& text, uint64_t checkingTypes, Vector<TextCheckingResult>& results) 3435 3435 { 3436 results = TextChecker::checkTextOfParagraph(spellDocumentTag(), text , checkingTypes);3436 results = TextChecker::checkTextOfParagraph(spellDocumentTag(), text.deprecatedCharacters(), text.length(), checkingTypes); 3437 3437 } 3438 3438 #endif … … 3440 3440 void WebPageProxy::checkSpellingOfString(const String& text, int32_t& misspellingLocation, int32_t& misspellingLength) 3441 3441 { 3442 TextChecker::checkSpellingOfString(spellDocumentTag(), text , misspellingLocation, misspellingLength);3442 TextChecker::checkSpellingOfString(spellDocumentTag(), text.deprecatedCharacters(), text.length(), misspellingLocation, misspellingLength); 3443 3443 } 3444 3444 3445 3445 void WebPageProxy::checkGrammarOfString(const String& text, Vector<GrammarDetail>& grammarDetails, int32_t& badGrammarLocation, int32_t& badGrammarLength) 3446 3446 { 3447 TextChecker::checkGrammarOfString(spellDocumentTag(), text , grammarDetails, badGrammarLocation, badGrammarLength);3447 TextChecker::checkGrammarOfString(spellDocumentTag(), text.deprecatedCharacters(), text.length(), grammarDetails, badGrammarLocation, badGrammarLength); 3448 3448 } 3449 3449 -
trunk/Source/WebKit2/UIProcess/mac/TextCheckerMac.mm
r163848 r163860 29 29 #import "TextCheckerState.h" 30 30 #import <WebCore/NotImplemented.h> 31 #import <wtf/text/StringView.h>32 31 #import <wtf/RetainPtr.h> 33 32 … … 295 294 #if USE(UNIFIED_TEXT_CHECKING) 296 295 297 Vector<TextCheckingResult> TextChecker::checkTextOfParagraph(int64_t spellDocumentTag, StringView stringView, uint64_t checkingTypes)296 Vector<TextCheckingResult> TextChecker::checkTextOfParagraph(int64_t spellDocumentTag, const UChar* text, int length, uint64_t checkingTypes) 298 297 { 299 298 Vector<TextCheckingResult> results; 300 299 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) 304 303 types:checkingTypes | NSTextCheckingTypeOrthography 305 304 options:nil … … 384 383 #endif 385 384 386 void TextChecker::checkSpellingOfString(int64_t, StringView, int32_t&, int32_t&)385 void TextChecker::checkSpellingOfString(int64_t, const UChar*, uint32_t, int32_t&, int32_t&) 387 386 { 388 387 // Mac uses checkTextOfParagraph instead. … … 390 389 } 391 390 392 void TextChecker::checkGrammarOfString(int64_t, StringView, Vector<WebCore::GrammarDetail>&, int32_t&, int32_t&)391 void TextChecker::checkGrammarOfString(int64_t, const UChar*, uint32_t, Vector<WebCore::GrammarDetail>&, int32_t&, int32_t&) 393 392 { 394 393 // Mac uses checkTextOfParagraph instead.
Note: See TracChangeset
for help on using the changeset viewer.