Title: [163860] trunk/Source/WebKit2
Revision
163860
Author
commit-qu...@webkit.org
Date
2014-02-10 22:17:59 -0800 (Mon, 10 Feb 2014)

Log 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):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (163859 => 163860)


--- trunk/Source/WebKit2/ChangeLog	2014-02-11 05:43:48 UTC (rev 163859)
+++ trunk/Source/WebKit2/ChangeLog	2014-02-11 06:17:59 UTC (rev 163860)
@@ -1,3 +1,22 @@
+2014-02-10  Commit Queue  <commit-qu...@webkit.org>
+
+        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):
+
 2014-02-10  Brady Eidson  <beid...@apple.com>
 
         IDB: storage/indexeddb/mozilla/object-store-inline-autoincrement-key-added-on-put.html fails

Modified: trunk/Source/WebKit2/Shared/APIString.h (163859 => 163860)


--- trunk/Source/WebKit2/Shared/APIString.h	2014-02-11 05:43:48 UTC (rev 163859)
+++ trunk/Source/WebKit2/Shared/APIString.h	2014-02-11 06:17:59 UTC (rev 163860)
@@ -78,23 +78,15 @@
     size_t maximumUTF8CStringSize() const { return m_string.length() * 3 + 1; }
     size_t getUTF8CString(char* buffer, size_t bufferSize)
     {
-        if (!bufferSize || m_string.isEmpty())
+        if (!bufferSize)
             return 0;
-        char* destination = buffer;
-
-        WTF::Unicode::ConversionResult result;
-        if (m_string.is8Bit()) {
-            const LChar* source = m_string.characters8();
-            result = WTF::Unicode::convertLatin1ToUTF8(&source, source + m_string.length(), &destination, destination + bufferSize - 1);
-        } else {
-            const UChar* source = m_string.characters16();
-            result = WTF::Unicode::convertUTF16ToUTF8(&source, source + m_string.length(), &destination, destination + bufferSize - 1, /* strict */ true);
-        }
-
-        *destination++ = '\0';
+        char* p = buffer;
+        const UChar* d = m_string.deprecatedCharacters();
+        WTF::Unicode::ConversionResult result = WTF::Unicode::convertUTF16ToUTF8(&d, d + m_string.length(), &p, p + bufferSize - 1, /* strict */ true);
+        *p++ = '\0';
         if (result != WTF::Unicode::conversionOK && result != WTF::Unicode::targetExhausted)
             return 0;
-        return destination - buffer;
+        return p - buffer;
     }
 
     bool equal(String* other) { return m_string == other->m_string; }

Modified: trunk/Source/WebKit2/UIProcess/TextChecker.h (163859 => 163860)


--- trunk/Source/WebKit2/UIProcess/TextChecker.h	2014-02-11 05:43:48 UTC (rev 163859)
+++ trunk/Source/WebKit2/UIProcess/TextChecker.h	2014-02-11 06:17:59 UTC (rev 163860)
@@ -67,10 +67,10 @@
     static int64_t uniqueSpellDocumentTag(WebPageProxy*);
     static void closeSpellDocumentWithTag(int64_t);
 #if USE(UNIFIED_TEXT_CHECKING)
-    static Vector<WebCore::TextCheckingResult> checkTextOfParagraph(int64_t spellDocumentTag, StringView, uint64_t checkingTypes);
+    static Vector<WebCore::TextCheckingResult> checkTextOfParagraph(int64_t spellDocumentTag, const UChar* text, int length, uint64_t checkingTypes);
 #endif
-    static void checkSpellingOfString(int64_t spellDocumentTag, StringView, int32_t& misspellingLocation, int32_t& misspellingLength);
-    static void checkGrammarOfString(int64_t spellDocumentTag, StringView, Vector<WebCore::GrammarDetail>&, int32_t& badGrammarLocation, int32_t& badGrammarLength);
+    static void checkSpellingOfString(int64_t spellDocumentTag, const UChar* text, uint32_t length, int32_t& misspellingLocation, int32_t& misspellingLength);
+    static void checkGrammarOfString(int64_t spellDocumentTag, const UChar* text, uint32_t length, Vector<WebCore::GrammarDetail>&, int32_t& badGrammarLocation, int32_t& badGrammarLength);
     static bool spellingUIIsShowing();
     static void toggleSpellingUIIsShowing();
     static void updateSpellingUIWithMisspelledWord(int64_t spellDocumentTag, const String& misspelledWord);

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (163859 => 163860)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2014-02-11 05:43:48 UTC (rev 163859)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2014-02-11 06:17:59 UTC (rev 163860)
@@ -3433,18 +3433,18 @@
 #if USE(UNIFIED_TEXT_CHECKING)
 void WebPageProxy::checkTextOfParagraph(const String& text, uint64_t checkingTypes, Vector<TextCheckingResult>& results)
 {
-    results = TextChecker::checkTextOfParagraph(spellDocumentTag(), text, checkingTypes);
+    results = TextChecker::checkTextOfParagraph(spellDocumentTag(), text.deprecatedCharacters(), text.length(), checkingTypes);
 }
 #endif
 
 void WebPageProxy::checkSpellingOfString(const String& text, int32_t& misspellingLocation, int32_t& misspellingLength)
 {
-    TextChecker::checkSpellingOfString(spellDocumentTag(), text, misspellingLocation, misspellingLength);
+    TextChecker::checkSpellingOfString(spellDocumentTag(), text.deprecatedCharacters(), text.length(), misspellingLocation, misspellingLength);
 }
 
 void WebPageProxy::checkGrammarOfString(const String& text, Vector<GrammarDetail>& grammarDetails, int32_t& badGrammarLocation, int32_t& badGrammarLength)
 {
-    TextChecker::checkGrammarOfString(spellDocumentTag(), text, grammarDetails, badGrammarLocation, badGrammarLength);
+    TextChecker::checkGrammarOfString(spellDocumentTag(), text.deprecatedCharacters(), text.length(), grammarDetails, badGrammarLocation, badGrammarLength);
 }
 
 void WebPageProxy::spellingUIIsShowing(bool& isShowing)

Modified: trunk/Source/WebKit2/UIProcess/mac/TextCheckerMac.mm (163859 => 163860)


--- trunk/Source/WebKit2/UIProcess/mac/TextCheckerMac.mm	2014-02-11 05:43:48 UTC (rev 163859)
+++ trunk/Source/WebKit2/UIProcess/mac/TextCheckerMac.mm	2014-02-11 06:17:59 UTC (rev 163860)
@@ -28,7 +28,6 @@
 
 #import "TextCheckerState.h"
 #import <WebCore/NotImplemented.h>
-#import <wtf/text/StringView.h>
 #import <wtf/RetainPtr.h>
 
 @interface NSSpellChecker (WebNSSpellCheckerDetails)
@@ -294,13 +293,13 @@
 
 #if USE(UNIFIED_TEXT_CHECKING)
 
-Vector<TextCheckingResult> TextChecker::checkTextOfParagraph(int64_t spellDocumentTag, StringView stringView, uint64_t checkingTypes)
+Vector<TextCheckingResult> TextChecker::checkTextOfParagraph(int64_t spellDocumentTag, const UChar* text, int length, uint64_t checkingTypes)
 {
     Vector<TextCheckingResult> results;
 
-    auto textString = stringView.createNSStringWithoutCopying();
-    NSArray *incomingResults = [[NSSpellChecker sharedSpellChecker] checkString:textString.get()
-                                                                          range:NSMakeRange(0, stringView.length())
+    RetainPtr<NSString> textString = adoptNS([[NSString alloc] initWithCharactersNoCopy:const_cast<UChar*>(text) length:length freeWhenDone:NO]);
+    NSArray *incomingResults = [[NSSpellChecker sharedSpellChecker] checkString:textString .get()
+                                                                          range:NSMakeRange(0, length)
                                                                           types:checkingTypes | NSTextCheckingTypeOrthography
                                                                         options:nil
                                                          inSpellDocumentWithTag:spellDocumentTag 
@@ -383,13 +382,13 @@
 
 #endif
 
-void TextChecker::checkSpellingOfString(int64_t, StringView, int32_t&, int32_t&)
+void TextChecker::checkSpellingOfString(int64_t, const UChar*, uint32_t, int32_t&, int32_t&)
 {
     // Mac uses checkTextOfParagraph instead.
     notImplemented();
 }
 
-void TextChecker::checkGrammarOfString(int64_t, StringView, Vector<WebCore::GrammarDetail>&, int32_t&, int32_t&)
+void TextChecker::checkGrammarOfString(int64_t, const UChar*, uint32_t, Vector<WebCore::GrammarDetail>&, int32_t&, int32_t&)
 {
     // Mac uses checkTextOfParagraph instead.
     notImplemented();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to