<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[163860] trunk/Source/WebKit2</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/163860">163860</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2014-02-10 22:17:59 -0800 (Mon, 10 Feb 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Unreviewed, rolling out <a href="http://trac.webkit.org/projects/webkit/changeset/163848">r163848</a>.
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):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2SharedAPIStringh">trunk/Source/WebKit2/Shared/APIString.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessTextCheckerh">trunk/Source/WebKit2/UIProcess/TextChecker.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebPageProxycpp">trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessmacTextCheckerMacmm">trunk/Source/WebKit2/UIProcess/mac/TextCheckerMac.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (163859 => 163860)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1,3 +1,22 @@
</span><ins>+2014-02-10  Commit Queue  &lt;commit-queue@webkit.org&gt;
+
+        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):
+
</ins><span class="cx"> 2014-02-10  Brady Eidson  &lt;beidson@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         IDB: storage/indexeddb/mozilla/object-store-inline-autoincrement-key-added-on-put.html fails
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedAPIStringh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/APIString.h (163859 => 163860)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -78,23 +78,15 @@
</span><span class="cx">     size_t maximumUTF8CStringSize() const { return m_string.length() * 3 + 1; }
</span><span class="cx">     size_t getUTF8CString(char* buffer, size_t bufferSize)
</span><span class="cx">     {
</span><del>-        if (!bufferSize || m_string.isEmpty())
</del><ins>+        if (!bufferSize)
</ins><span class="cx">             return 0;
</span><del>-        char* destination = buffer;
-
-        WTF::Unicode::ConversionResult result;
-        if (m_string.is8Bit()) {
-            const LChar* source = m_string.characters8();
-            result = WTF::Unicode::convertLatin1ToUTF8(&amp;source, source + m_string.length(), &amp;destination, destination + bufferSize - 1);
-        } else {
-            const UChar* source = m_string.characters16();
-            result = WTF::Unicode::convertUTF16ToUTF8(&amp;source, source + m_string.length(), &amp;destination, destination + bufferSize - 1, /* strict */ true);
-        }
-
-        *destination++ = '\0';
</del><ins>+        char* p = buffer;
+        const UChar* d = m_string.deprecatedCharacters();
+        WTF::Unicode::ConversionResult result = WTF::Unicode::convertUTF16ToUTF8(&amp;d, d + m_string.length(), &amp;p, p + bufferSize - 1, /* strict */ true);
+        *p++ = '\0';
</ins><span class="cx">         if (result != WTF::Unicode::conversionOK &amp;&amp; result != WTF::Unicode::targetExhausted)
</span><span class="cx">             return 0;
</span><del>-        return destination - buffer;
</del><ins>+        return p - buffer;
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     bool equal(String* other) { return m_string == other-&gt;m_string; }
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessTextCheckerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/TextChecker.h (163859 => 163860)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -67,10 +67,10 @@
</span><span class="cx">     static int64_t uniqueSpellDocumentTag(WebPageProxy*);
</span><span class="cx">     static void closeSpellDocumentWithTag(int64_t);
</span><span class="cx"> #if USE(UNIFIED_TEXT_CHECKING)
</span><del>-    static Vector&lt;WebCore::TextCheckingResult&gt; checkTextOfParagraph(int64_t spellDocumentTag, StringView, uint64_t checkingTypes);
</del><ins>+    static Vector&lt;WebCore::TextCheckingResult&gt; checkTextOfParagraph(int64_t spellDocumentTag, const UChar* text, int length, uint64_t checkingTypes);
</ins><span class="cx"> #endif
</span><del>-    static void checkSpellingOfString(int64_t spellDocumentTag, StringView, int32_t&amp; misspellingLocation, int32_t&amp; misspellingLength);
-    static void checkGrammarOfString(int64_t spellDocumentTag, StringView, Vector&lt;WebCore::GrammarDetail&gt;&amp;, int32_t&amp; badGrammarLocation, int32_t&amp; badGrammarLength);
</del><ins>+    static void checkSpellingOfString(int64_t spellDocumentTag, const UChar* text, uint32_t length, int32_t&amp; misspellingLocation, int32_t&amp; misspellingLength);
+    static void checkGrammarOfString(int64_t spellDocumentTag, const UChar* text, uint32_t length, Vector&lt;WebCore::GrammarDetail&gt;&amp;, int32_t&amp; badGrammarLocation, int32_t&amp; badGrammarLength);
</ins><span class="cx">     static bool spellingUIIsShowing();
</span><span class="cx">     static void toggleSpellingUIIsShowing();
</span><span class="cx">     static void updateSpellingUIWithMisspelledWord(int64_t spellDocumentTag, const String&amp; misspelledWord);
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebPageProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (163859 => 163860)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -3433,18 +3433,18 @@
</span><span class="cx"> #if USE(UNIFIED_TEXT_CHECKING)
</span><span class="cx"> void WebPageProxy::checkTextOfParagraph(const String&amp; text, uint64_t checkingTypes, Vector&lt;TextCheckingResult&gt;&amp; results)
</span><span class="cx"> {
</span><del>-    results = TextChecker::checkTextOfParagraph(spellDocumentTag(), text, checkingTypes);
</del><ins>+    results = TextChecker::checkTextOfParagraph(spellDocumentTag(), text.deprecatedCharacters(), text.length(), checkingTypes);
</ins><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> void WebPageProxy::checkSpellingOfString(const String&amp; text, int32_t&amp; misspellingLocation, int32_t&amp; misspellingLength)
</span><span class="cx"> {
</span><del>-    TextChecker::checkSpellingOfString(spellDocumentTag(), text, misspellingLocation, misspellingLength);
</del><ins>+    TextChecker::checkSpellingOfString(spellDocumentTag(), text.deprecatedCharacters(), text.length(), misspellingLocation, misspellingLength);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebPageProxy::checkGrammarOfString(const String&amp; text, Vector&lt;GrammarDetail&gt;&amp; grammarDetails, int32_t&amp; badGrammarLocation, int32_t&amp; badGrammarLength)
</span><span class="cx"> {
</span><del>-    TextChecker::checkGrammarOfString(spellDocumentTag(), text, grammarDetails, badGrammarLocation, badGrammarLength);
</del><ins>+    TextChecker::checkGrammarOfString(spellDocumentTag(), text.deprecatedCharacters(), text.length(), grammarDetails, badGrammarLocation, badGrammarLength);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebPageProxy::spellingUIIsShowing(bool&amp; isShowing)
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessmacTextCheckerMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/mac/TextCheckerMac.mm (163859 => 163860)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -28,7 +28,6 @@
</span><span class="cx"> 
</span><span class="cx"> #import &quot;TextCheckerState.h&quot;
</span><span class="cx"> #import &lt;WebCore/NotImplemented.h&gt;
</span><del>-#import &lt;wtf/text/StringView.h&gt;
</del><span class="cx"> #import &lt;wtf/RetainPtr.h&gt;
</span><span class="cx"> 
</span><span class="cx"> @interface NSSpellChecker (WebNSSpellCheckerDetails)
</span><span class="lines">@@ -294,13 +293,13 @@
</span><span class="cx"> 
</span><span class="cx"> #if USE(UNIFIED_TEXT_CHECKING)
</span><span class="cx"> 
</span><del>-Vector&lt;TextCheckingResult&gt; TextChecker::checkTextOfParagraph(int64_t spellDocumentTag, StringView stringView, uint64_t checkingTypes)
</del><ins>+Vector&lt;TextCheckingResult&gt; TextChecker::checkTextOfParagraph(int64_t spellDocumentTag, const UChar* text, int length, uint64_t checkingTypes)
</ins><span class="cx"> {
</span><span class="cx">     Vector&lt;TextCheckingResult&gt; results;
</span><span class="cx"> 
</span><del>-    auto textString = stringView.createNSStringWithoutCopying();
-    NSArray *incomingResults = [[NSSpellChecker sharedSpellChecker] checkString:textString.get()
-                                                                          range:NSMakeRange(0, stringView.length())
</del><ins>+    RetainPtr&lt;NSString&gt; textString = adoptNS([[NSString alloc] initWithCharactersNoCopy:const_cast&lt;UChar*&gt;(text) length:length freeWhenDone:NO]);
+    NSArray *incomingResults = [[NSSpellChecker sharedSpellChecker] checkString:textString .get()
+                                                                          range:NSMakeRange(0, length)
</ins><span class="cx">                                                                           types:checkingTypes | NSTextCheckingTypeOrthography
</span><span class="cx">                                                                         options:nil
</span><span class="cx">                                                          inSpellDocumentWithTag:spellDocumentTag 
</span><span class="lines">@@ -383,13 +382,13 @@
</span><span class="cx"> 
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-void TextChecker::checkSpellingOfString(int64_t, StringView, int32_t&amp;, int32_t&amp;)
</del><ins>+void TextChecker::checkSpellingOfString(int64_t, const UChar*, uint32_t, int32_t&amp;, int32_t&amp;)
</ins><span class="cx"> {
</span><span class="cx">     // Mac uses checkTextOfParagraph instead.
</span><span class="cx">     notImplemented();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void TextChecker::checkGrammarOfString(int64_t, StringView, Vector&lt;WebCore::GrammarDetail&gt;&amp;, int32_t&amp;, int32_t&amp;)
</del><ins>+void TextChecker::checkGrammarOfString(int64_t, const UChar*, uint32_t, Vector&lt;WebCore::GrammarDetail&gt;&amp;, int32_t&amp;, int32_t&amp;)
</ins><span class="cx"> {
</span><span class="cx">     // Mac uses checkTextOfParagraph instead.
</span><span class="cx">     notImplemented();
</span></span></pre>
</div>
</div>

</body>
</html>