<!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>[165692] trunk/Source</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/165692">165692</a></dd>
<dt>Author</dt> <dd>darin@apple.com</dd>
<dt>Date</dt> <dd>2014-03-15 23:22:02 -0700 (Sat, 15 Mar 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>Remove all uses of deprecatedCharacters from WebKit2
https://bugs.webkit.org/show_bug.cgi?id=130197
Reviewed by Andreas Kling.
Source/WebKit2:
* Shared/APIString.h: Rewrote getCharacters to use StringView,
substring, and getCharactersWithUpconvert. Added an 8-bit case
to getUTF8CString.
* Shared/Plugins/Netscape/x11/NetscapePluginModuleX11.cpp:
(WebKit::writeByte): Added.
(WebKit::writeCharacter): Added.
(WebKit::writeLine): Added. Uses operator[] instead of characters16 to get
the UTF-16 characters out of the string.
(WebKit::NetscapePluginModule::scanPlugin): Replaced code that writes out
text to stdout with much simpler version using the functions above.
* UIProcess/TextChecker.h: Changed text arguments to use StringView instead
of UChar/int pairs.
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::internalShowContextMenu): Updated to pass StringView.
* UIProcess/efl/TextCheckerEfl.cpp:
(WebKit::nextWordOffset): Changed function to use StringView and unsigned.
(WebKit::TextChecker::checkTextOfParagraph): Changed to use StringView and
substring.
(WebKit::TextChecker::checkSpellingOfString): Ditto.
(WebKit::TextChecker::checkGrammarOfString): Ditto.
(WebKit::TextChecker::requestCheckingOfString): Pass in a StringView, so no
need to call deprecatedCharacters.
* UIProcess/ios/TextCheckerIOS.mm:
(WebKit::TextChecker::checkTextOfParagraph): Changed to take StringView.
(WebKit::TextChecker::checkSpellingOfString): Ditto.
(WebKit::TextChecker::checkGrammarOfString): Ditto.
* UIProcess/mac/TextCheckerMac.mm:
(WebKit::TextChecker::checkTextOfParagraph): Changed to take StringView and
use StringView::createNSStringWithoutCopying.
(WebKit::TextChecker::checkSpellingOfString): CHanged to take StringView.
(WebKit::TextChecker::checkGrammarOfString): Ditto.
* WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm:
(WebKit::convertStringToKeyCodes): Changed to take StringView and use
upconvertedCharacters instead of deprecatedCharacters. Also use move instead
of swap.
(WebKit::NetscapePlugin::sendComplexTextInput): Updated to new style for loop.
* WebProcess/WebPage/EncoderAdapter.cpp:
(WebKit::EncoderAdapter::encodeString): Use StringView::upconvertedCharacters
instead of String::deprecatedCharacters.
Source/WTF:
* wtf/text/StringView.h: Added new getCharactersWithUpconvert and upconvertedCharacters
functions. These are useful for callers that need UTF-16.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWTFChangeLog">trunk/Source/WTF/ChangeLog</a></li>
<li><a href="#trunkSourceWTFwtftextStringViewh">trunk/Source/WTF/wtf/text/StringView.h</a></li>
<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="#trunkSourceWebKit2SharedPluginsNetscapex11NetscapePluginModuleX11cpp">trunk/Source/WebKit2/Shared/Plugins/Netscape/x11/NetscapePluginModuleX11.cpp</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="#trunkSourceWebKit2UIProcesseflTextCheckerEflcpp">trunk/Source/WebKit2/UIProcess/efl/TextCheckerEfl.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessiosTextCheckerIOSmm">trunk/Source/WebKit2/UIProcess/ios/TextCheckerIOS.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessmacTextCheckerMacmm">trunk/Source/WebKit2/UIProcess/mac/TextCheckerMac.mm</a></li>
<li><a href="#trunkSourceWebKit2WebProcessPluginsNetscapemacNetscapePluginMacmm">trunk/Source/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageEncoderAdaptercpp">trunk/Source/WebKit2/WebProcess/WebPage/EncoderAdapter.cpp</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWTFChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/ChangeLog (165691 => 165692)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/ChangeLog        2014-03-16 06:06:03 UTC (rev 165691)
+++ trunk/Source/WTF/ChangeLog        2014-03-16 06:22:02 UTC (rev 165692)
</span><span class="lines">@@ -1,5 +1,15 @@
</span><span class="cx"> 2014-03-15 Darin Adler <darin@apple.com>
</span><span class="cx">
</span><ins>+ Remove all uses of deprecatedCharacters from WebKit2
+ https://bugs.webkit.org/show_bug.cgi?id=130197
+
+ Reviewed by Andreas Kling.
+
+ * wtf/text/StringView.h: Added new getCharactersWithUpconvert and upconvertedCharacters
+ functions. These are useful for callers that need UTF-16.
+
+2014-03-15 Darin Adler <darin@apple.com>
+
</ins><span class="cx"> Try to fix EFL build.
</span><span class="cx">
</span><span class="cx"> * wtf/ThreadingPthreads.cpp: (WTF::changeThreadPriority): Code in this function
</span></span></pre></div>
<a id="trunkSourceWTFwtftextStringViewh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/text/StringView.h (165691 => 165692)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/text/StringView.h        2014-03-16 06:06:03 UTC (rev 165691)
+++ trunk/Source/WTF/wtf/text/StringView.h        2014-03-16 06:22:02 UTC (rev 165692)
</span><span class="lines">@@ -85,6 +85,20 @@
</span><span class="cx"> return static_cast<const UChar*>(m_characters);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ void getCharactersWithUpconvert(LChar*) const;
+ void getCharactersWithUpconvert(UChar*) const;
+
+ class UpconvertedCharacters {
+ public:
+ explicit UpconvertedCharacters(const StringView&);
+ operator const UChar*() const { return m_characters; }
+ const UChar* get() const { return m_characters; }
+ private:
+ Vector<UChar, 32> m_upconvertedCharacters;
+ const UChar* m_characters;
+ };
+ UpconvertedCharacters upconvertedCharacters() const { return UpconvertedCharacters(*this); }
+
</ins><span class="cx"> bool isNull() const { return !m_characters; }
</span><span class="cx"> bool isEmpty() const { return !length(); }
</span><span class="cx"> unsigned length() const { return m_length & ~is16BitStringFlag; }
</span><span class="lines">@@ -176,6 +190,38 @@
</span><span class="cx"> unsigned m_length;
</span><span class="cx"> };
</span><span class="cx">
</span><ins>+inline void StringView::getCharactersWithUpconvert(LChar* destination) const
+{
+ ASSERT(is8Bit());
+ memcpy(destination, characters8(), length());
+}
+
+inline void StringView::getCharactersWithUpconvert(UChar* destination) const
+{
+ if (is8Bit()) {
+ const LChar* characters8 = this->characters8();
+ unsigned length = this->length();
+ for (unsigned i = 0; i < length; ++i)
+ destination[i] = characters8[i];
+ return;
+ }
+ memcpy(destination, characters16(), length() * sizeof(UChar));
+}
+
+inline StringView::UpconvertedCharacters::UpconvertedCharacters(const StringView& string)
+{
+ if (!string.is8Bit()) {
+ m_characters = string.characters16();
+ return;
+ }
+ const LChar* characters8 = string.characters8();
+ unsigned length = string.length();
+ m_upconvertedCharacters.reserveInitialCapacity(length);
+ for (unsigned i = 0; i < length; ++i)
+ m_upconvertedCharacters.uncheckedAppend(characters8[i]);
+ m_characters = m_upconvertedCharacters.data();
+}
+
</ins><span class="cx"> } // namespace WTF
</span><span class="cx">
</span><span class="cx"> using WTF::StringView;
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (165691 => 165692)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-03-16 06:06:03 UTC (rev 165691)
+++ trunk/Source/WebKit2/ChangeLog        2014-03-16 06:22:02 UTC (rev 165692)
</span><span class="lines">@@ -1,3 +1,58 @@
</span><ins>+2014-03-15 Darin Adler <darin@apple.com>
+
+ Remove all uses of deprecatedCharacters from WebKit2
+ https://bugs.webkit.org/show_bug.cgi?id=130197
+
+ Reviewed by Andreas Kling.
+
+ * Shared/APIString.h: Rewrote getCharacters to use StringView,
+ substring, and getCharactersWithUpconvert. Added an 8-bit case
+ to getUTF8CString.
+
+ * Shared/Plugins/Netscape/x11/NetscapePluginModuleX11.cpp:
+ (WebKit::writeByte): Added.
+ (WebKit::writeCharacter): Added.
+ (WebKit::writeLine): Added. Uses operator[] instead of characters16 to get
+ the UTF-16 characters out of the string.
+ (WebKit::NetscapePluginModule::scanPlugin): Replaced code that writes out
+ text to stdout with much simpler version using the functions above.
+
+ * UIProcess/TextChecker.h: Changed text arguments to use StringView instead
+ of UChar/int pairs.
+
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::internalShowContextMenu): Updated to pass StringView.
+
+ * UIProcess/efl/TextCheckerEfl.cpp:
+ (WebKit::nextWordOffset): Changed function to use StringView and unsigned.
+ (WebKit::TextChecker::checkTextOfParagraph): Changed to use StringView and
+ substring.
+ (WebKit::TextChecker::checkSpellingOfString): Ditto.
+ (WebKit::TextChecker::checkGrammarOfString): Ditto.
+ (WebKit::TextChecker::requestCheckingOfString): Pass in a StringView, so no
+ need to call deprecatedCharacters.
+
+ * UIProcess/ios/TextCheckerIOS.mm:
+ (WebKit::TextChecker::checkTextOfParagraph): Changed to take StringView.
+ (WebKit::TextChecker::checkSpellingOfString): Ditto.
+ (WebKit::TextChecker::checkGrammarOfString): Ditto.
+
+ * UIProcess/mac/TextCheckerMac.mm:
+ (WebKit::TextChecker::checkTextOfParagraph): Changed to take StringView and
+ use StringView::createNSStringWithoutCopying.
+ (WebKit::TextChecker::checkSpellingOfString): CHanged to take StringView.
+ (WebKit::TextChecker::checkGrammarOfString): Ditto.
+
+ * WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm:
+ (WebKit::convertStringToKeyCodes): Changed to take StringView and use
+ upconvertedCharacters instead of deprecatedCharacters. Also use move instead
+ of swap.
+ (WebKit::NetscapePlugin::sendComplexTextInput): Updated to new style for loop.
+
+ * WebProcess/WebPage/EncoderAdapter.cpp:
+ (WebKit::EncoderAdapter::encodeString): Use StringView::upconvertedCharacters
+ instead of String::deprecatedCharacters.
+
</ins><span class="cx"> 2014-03-15 David Kilzer <ddkilzer@apple.com>
</span><span class="cx">
</span><span class="cx"> [iOS] Define SYSTEM_VERSION_PREFIX consistently
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedAPIStringh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/APIString.h (165691 => 165692)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/APIString.h        2014-03-16 06:06:03 UTC (rev 165691)
+++ trunk/Source/WebKit2/Shared/APIString.h        2014-03-16 06:22:02 UTC (rev 165692)
</span><span class="lines">@@ -31,6 +31,7 @@
</span><span class="cx"> #include <JavaScriptCore/JSStringRef.h>
</span><span class="cx"> #include <JavaScriptCore/OpaqueJSString.h>
</span><span class="cx"> #include <wtf/PassRefPtr.h>
</span><ins>+#include <wtf/text/StringView.h>
</ins><span class="cx"> #include <wtf/text/WTFString.h>
</span><span class="cx"> #include <wtf/unicode/UTF8.h>
</span><span class="cx">
</span><span class="lines">@@ -68,11 +69,10 @@
</span><span class="cx"> size_t length() const { return m_string.length(); }
</span><span class="cx"> size_t getCharacters(UChar* buffer, size_t bufferLength) const
</span><span class="cx"> {
</span><del>- if (!bufferLength)
- return 0;
- bufferLength = std::min(bufferLength, static_cast<size_t>(m_string.length()));
- memcpy(buffer, m_string.deprecatedCharacters(), bufferLength * sizeof(UChar));
- return bufferLength;
</del><ins>+ unsigned unsignedBufferLength = std::min<size_t>(bufferLength, std::numeric_limits<unsigned>::max());
+ StringView substring = StringView(m_string).substring(0, unsignedBufferLength);
+ substring.getCharactersWithUpconvert(buffer);
+ return substring.length();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> size_t maximumUTF8CStringSize() const { return m_string.length() * 3 + 1; }
</span><span class="lines">@@ -81,11 +81,17 @@
</span><span class="cx"> if (!bufferSize)
</span><span class="cx"> return 0;
</span><span class="cx"> char* p = buffer;
</span><del>- 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';
</del><ins>+ WTF::Unicode::ConversionResult result;
+ if (m_string.is8Bit()) {
+ const LChar* characters = m_string.characters8();
+ result = WTF::Unicode::convertLatin1ToUTF8(&characters, characters + m_string.length(), &p, p + bufferSize - 1);
+ } else {
+ const UChar* characters = m_string.characters16();
+ result = WTF::Unicode::convertUTF16ToUTF8(&characters, characters + m_string.length(), &p, p + bufferSize - 1, /* strict */ true);
+ }
</ins><span class="cx"> if (result != WTF::Unicode::conversionOK && result != WTF::Unicode::targetExhausted)
</span><span class="cx"> return 0;
</span><ins>+ *p++ = '\0';
</ins><span class="cx"> return p - buffer;
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedPluginsNetscapex11NetscapePluginModuleX11cpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/Plugins/Netscape/x11/NetscapePluginModuleX11.cpp (165691 => 165692)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/Plugins/Netscape/x11/NetscapePluginModuleX11.cpp        2014-03-16 06:06:03 UTC (rev 165691)
+++ trunk/Source/WebKit2/Shared/Plugins/Netscape/x11/NetscapePluginModuleX11.cpp        2014-03-16 06:22:02 UTC (rev 165692)
</span><span class="lines">@@ -185,23 +185,28 @@
</span><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx">
</span><del>-static String truncateToSingleLine(const String& string)
</del><ins>+static void writeByte(char byte)
</ins><span class="cx"> {
</span><del>- unsigned oldLength = string.length();
- UChar* buffer;
- String stringBuffer(StringImpl::createUninitialized(oldLength + 1, buffer));
</del><ins>+ int result;
+ while ((result = fputc(byte, stdout)) == EOF && errno == EINTR) { }
+ ASSERT(result != EOF);
+}
</ins><span class="cx">
</span><del>- unsigned newLength = 0;
- const UChar* start = string.deprecatedCharacters();
- for (const UChar* c = start; c < start + oldLength; ++c) {
- if (*c != UChar('\n'))
- buffer[newLength++] = *c;
- }
- buffer[newLength++] = UChar('\n');
</del><ins>+static void writeCharacter(UChar character)
+{
+ writeByte(reinterpret_cast<const char*>(&character)[0]);
+ writeByte(reinterpret_cast<const char*>(&character)[1]);
+}
</ins><span class="cx">
</span><del>- String result = (newLength == oldLength + 1) ? stringBuffer : String(stringBuffer.characters16(), newLength);
- ASSERT(result.endsWith(UChar('\n')));
- return result;
</del><ins>+static void writeLine(const String& line)
+{
+ unsigned length = line.length();
+ for (unsigned i = 0; i < length; ++i) {
+ UChar character = line[i];
+ if (character != '\n')
+ writeCharacter(character);
+ }
+ writeCharacter('\n');
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool NetscapePluginModule::scanPlugin(const String& pluginPath)
</span><span class="lines">@@ -227,22 +232,9 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // Write data to standard output for the UI process.
</span><del>- String output[3] = {
- truncateToSingleLine(metaData.name),
- truncateToSingleLine(metaData.description),
- truncateToSingleLine(metaData.mimeDescription)
- };
- for (unsigned i = 0; i < 3; ++i) {
- const String& line = output[i];
- const char* current = reinterpret_cast<const char*>(line.characters16());
- const char* end = reinterpret_cast<const char*>(line.characters16()) + (line.length() * sizeof(UChar));
- while (current < end) {
- int result;
- while ((result = fputc(*current, stdout)) == EOF && errno == EINTR) { }
- ASSERT(result != EOF);
- ++current;
- }
- }
</del><ins>+ writeLine(metaData.name);
+ writeLine(metaData.description);
+ writeLine(metaData.mimeDescription);
</ins><span class="cx">
</span><span class="cx"> fflush(stdout);
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessTextCheckerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/TextChecker.h (165691 => 165692)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/TextChecker.h        2014-03-16 06:06:03 UTC (rev 165691)
+++ trunk/Source/WebKit2/UIProcess/TextChecker.h        2014-03-16 06:22:02 UTC (rev 165692)
</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<WebCore::TextCheckingResult> checkTextOfParagraph(int64_t spellDocumentTag, const UChar* text, int length, uint64_t checkingTypes);
</del><ins>+ static Vector<WebCore::TextCheckingResult> checkTextOfParagraph(int64_t spellDocumentTag, StringView text, uint64_t checkingTypes);
</ins><span class="cx"> #endif
</span><del>- 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);
</del><ins>+ static void checkSpellingOfString(int64_t spellDocumentTag, StringView text, int32_t& misspellingLocation, int32_t& misspellingLength);
+ static void checkGrammarOfString(int64_t spellDocumentTag, StringView text, Vector<WebCore::GrammarDetail>&, int32_t& badGrammarLocation, int32_t& 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& misspelledWord);
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebPageProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (165691 => 165692)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp        2014-03-16 06:06:03 UTC (rev 165691)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp        2014-03-16 06:22:02 UTC (rev 165692)
</span><span class="lines">@@ -3469,18 +3469,18 @@
</span><span class="cx"> #if USE(UNIFIED_TEXT_CHECKING)
</span><span class="cx"> void WebPageProxy::checkTextOfParagraph(const String& text, uint64_t checkingTypes, Vector<TextCheckingResult>& results)
</span><span class="cx"> {
</span><del>- results = TextChecker::checkTextOfParagraph(spellDocumentTag(), text.deprecatedCharacters(), text.length(), checkingTypes);
</del><ins>+ results = TextChecker::checkTextOfParagraph(spellDocumentTag(), text, checkingTypes);
</ins><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> void WebPageProxy::checkSpellingOfString(const String& text, int32_t& misspellingLocation, int32_t& misspellingLength)
</span><span class="cx"> {
</span><del>- TextChecker::checkSpellingOfString(spellDocumentTag(), text.deprecatedCharacters(), text.length(), misspellingLocation, misspellingLength);
</del><ins>+ TextChecker::checkSpellingOfString(spellDocumentTag(), text, misspellingLocation, misspellingLength);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void WebPageProxy::checkGrammarOfString(const String& text, Vector<GrammarDetail>& grammarDetails, int32_t& badGrammarLocation, int32_t& badGrammarLength)
</span><span class="cx"> {
</span><del>- TextChecker::checkGrammarOfString(spellDocumentTag(), text.deprecatedCharacters(), text.length(), grammarDetails, badGrammarLocation, badGrammarLength);
</del><ins>+ TextChecker::checkGrammarOfString(spellDocumentTag(), text, grammarDetails, badGrammarLocation, badGrammarLength);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void WebPageProxy::spellingUIIsShowing(bool& isShowing)
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcesseflTextCheckerEflcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/efl/TextCheckerEfl.cpp (165691 => 165692)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/efl/TextCheckerEfl.cpp        2014-03-16 06:06:03 UTC (rev 165691)
+++ trunk/Source/WebKit2/UIProcess/efl/TextCheckerEfl.cpp        2014-03-16 06:22:02 UTC (rev 165692)
</span><span class="lines">@@ -120,19 +120,19 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> #if ENABLE(SPELLCHECK)
</span><del>-static int nextWordOffset(const UChar* text, int length, int currentOffset)
</del><ins>+static unsigned nextWordOffset(StringView text, unsigned currentOffset)
</ins><span class="cx"> {
</span><span class="cx"> // FIXME: avoid creating textIterator object here, it could be passed as a parameter.
</span><span class="cx"> // isTextBreak() leaves the iterator pointing to the first boundary position at
</span><span class="cx"> // or after "offset" (ubrk_isBoundary side effect).
</span><span class="cx"> // For many word separators, the method doesn't properly determine the boundaries
</span><span class="cx"> // without resetting the iterator.
</span><del>- TextBreakIterator* textIterator = wordBreakIterator(StringView(text, length));
</del><ins>+ TextBreakIterator* textIterator = wordBreakIterator(text);
</ins><span class="cx"> if (!textIterator)
</span><span class="cx"> return currentOffset;
</span><span class="cx">
</span><del>- int wordOffset = currentOffset;
- while (wordOffset < length && isTextBreak(textIterator, wordOffset))
</del><ins>+ unsigned wordOffset = currentOffset;
+ while (wordOffset < text.length() && isTextBreak(textIterator, wordOffset))
</ins><span class="cx"> ++wordOffset;
</span><span class="cx">
</span><span class="cx"> // Do not treat the word's boundary as a separator.
</span><span class="lines">@@ -148,26 +148,26 @@
</span><span class="cx"> #endif // ENABLE(SPELLCHECK)
</span><span class="cx">
</span><span class="cx"> #if USE(UNIFIED_TEXT_CHECKING)
</span><del>-Vector<TextCheckingResult> TextChecker::checkTextOfParagraph(int64_t spellDocumentTag, const UChar* text, int length, uint64_t checkingTypes)
</del><ins>+Vector<TextCheckingResult> TextChecker::checkTextOfParagraph(int64_t spellDocumentTag, StringView text, uint64_t checkingTypes)
</ins><span class="cx"> {
</span><span class="cx"> Vector<TextCheckingResult> paragraphCheckingResult;
</span><span class="cx"> #if ENABLE(SPELLCHECK)
</span><span class="cx"> if (checkingTypes & TextCheckingTypeSpelling) {
</span><del>- TextBreakIterator* textIterator = wordBreakIterator(StringView(text, length));
</del><ins>+ TextBreakIterator* textIterator = wordBreakIterator(text);
</ins><span class="cx"> if (!textIterator)
</span><span class="cx"> return paragraphCheckingResult;
</span><span class="cx">
</span><span class="cx"> // Omit the word separators at the beginning/end of the text to don't unnecessarily
</span><span class="cx"> // involve the client to check spelling for them.
</span><del>- int offset = nextWordOffset(text, length, 0);
- int lengthStrip = length;
</del><ins>+ unsigned offset = nextWordOffset(text, 0);
+ unsigned lengthStrip = text.length();
</ins><span class="cx"> while (lengthStrip > 0 && isTextBreak(textIterator, lengthStrip - 1))
</span><span class="cx"> --lengthStrip;
</span><span class="cx">
</span><del>- while (offset >= 0 && offset < lengthStrip) {
</del><ins>+ while (offset < lengthStrip) {
</ins><span class="cx"> int32_t misspellingLocation = -1;
</span><span class="cx"> int32_t misspellingLength = 0;
</span><del>- checkSpellingOfString(spellDocumentTag, text + offset, lengthStrip - offset, misspellingLocation, misspellingLength);
</del><ins>+ checkSpellingOfString(spellDocumentTag, text.substring(offset, lengthStrip - offset), misspellingLocation, misspellingLength);
</ins><span class="cx"> if (!misspellingLength)
</span><span class="cx"> break;
</span><span class="cx">
</span><span class="lines">@@ -178,7 +178,7 @@
</span><span class="cx"> paragraphCheckingResult.append(misspellingResult);
</span><span class="cx"> offset += misspellingLocation + misspellingLength;
</span><span class="cx"> // Generally, we end up checking at the word separator, move to the adjacent word.
</span><del>- offset = nextWordOffset(text, lengthStrip, offset);
</del><ins>+ offset = nextWordOffset(text.substring(0, lengthStrip), offset);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> #else
</span><span class="lines">@@ -191,10 +191,10 @@
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx">
</span><del>-void TextChecker::checkSpellingOfString(int64_t spellDocumentTag, const UChar* text, uint32_t length, int32_t& misspellingLocation, int32_t& misspellingLength)
</del><ins>+void TextChecker::checkSpellingOfString(int64_t spellDocumentTag, StringView text, int32_t& misspellingLocation, int32_t& misspellingLength)
</ins><span class="cx"> {
</span><span class="cx"> #if ENABLE(SPELLCHECK)
</span><del>- WebTextChecker::shared()->client().checkSpellingOfString(spellDocumentTag, String(text, length), misspellingLocation, misspellingLength);
</del><ins>+ WebTextChecker::shared()->client().checkSpellingOfString(spellDocumentTag, text.toStringWithoutCopying(), misspellingLocation, misspellingLength);
</ins><span class="cx"> #else
</span><span class="cx"> UNUSED_PARAM(spellDocumentTag);
</span><span class="cx"> UNUSED_PARAM(text);
</span><span class="lines">@@ -204,7 +204,7 @@
</span><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void TextChecker::checkGrammarOfString(int64_t, const UChar*, uint32_t, Vector<GrammarDetail>&, int32_t&, int32_t&)
</del><ins>+void TextChecker::checkGrammarOfString(int64_t, StringView, Vector<GrammarDetail>&, int32_t&, int32_t&)
</ins><span class="cx"> {
</span><span class="cx"> notImplemented();
</span><span class="cx"> }
</span><span class="lines">@@ -271,10 +271,7 @@
</span><span class="cx"> ASSERT(request.sequence() != unrequestedTextCheckingSequence);
</span><span class="cx"> ASSERT(request.mask() != TextCheckingTypeNone);
</span><span class="cx">
</span><del>- String text = request.text();
- Vector<TextCheckingResult> result = checkTextOfParagraph(completion->spellDocumentTag(), text.deprecatedCharacters(), text.length(), request.mask());
-
- completion->didFinishCheckingText(result);
</del><ins>+ completion->didFinishCheckingText(checkTextOfParagraph(completion->spellDocumentTag(), request.text(), request.mask()));
</ins><span class="cx"> #else
</span><span class="cx"> UNUSED_PARAM(completion);
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessiosTextCheckerIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/ios/TextCheckerIOS.mm (165691 => 165692)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ios/TextCheckerIOS.mm        2014-03-16 06:06:03 UTC (rev 165691)
+++ trunk/Source/WebKit2/UIProcess/ios/TextCheckerIOS.mm        2014-03-16 06:22:02 UTC (rev 165692)
</span><span class="lines">@@ -30,6 +30,7 @@
</span><span class="cx">
</span><span class="cx"> #import "TextCheckerState.h"
</span><span class="cx"> #import <WebCore/NotImplemented.h>
</span><ins>+#import <wtf/text/StringView.h>
</ins><span class="cx">
</span><span class="cx"> using namespace WebCore;
</span><span class="cx">
</span><span class="lines">@@ -131,7 +132,7 @@
</span><span class="cx">
</span><span class="cx"> #if USE(UNIFIED_TEXT_CHECKING)
</span><span class="cx">
</span><del>-Vector<TextCheckingResult> TextChecker::checkTextOfParagraph(int64_t, const UChar*, int, uint64_t)
</del><ins>+Vector<TextCheckingResult> TextChecker::checkTextOfParagraph(int64_t, StringView, uint64_t)
</ins><span class="cx"> {
</span><span class="cx"> notImplemented();
</span><span class="cx"> return Vector<TextCheckingResult>();
</span><span class="lines">@@ -139,15 +140,13 @@
</span><span class="cx">
</span><span class="cx"> #endif
</span><span class="cx">
</span><del>-void TextChecker::checkSpellingOfString(int64_t, const UChar*, uint32_t, int32_t&, int32_t&)
</del><ins>+void TextChecker::checkSpellingOfString(int64_t, StringView, int32_t&, int32_t&)
</ins><span class="cx"> {
</span><del>- // Mac uses checkTextOfParagraph instead.
</del><span class="cx"> notImplemented();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void TextChecker::checkGrammarOfString(int64_t, const UChar*, uint32_t, Vector<WebCore::GrammarDetail>&, int32_t&, int32_t&)
</del><ins>+void TextChecker::checkGrammarOfString(int64_t, StringView, Vector<WebCore::GrammarDetail>&, int32_t&, int32_t&)
</ins><span class="cx"> {
</span><del>- // Mac uses checkTextOfParagraph instead.
</del><span class="cx"> notImplemented();
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessmacTextCheckerMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/mac/TextCheckerMac.mm (165691 => 165692)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/mac/TextCheckerMac.mm        2014-03-16 06:06:03 UTC (rev 165691)
+++ trunk/Source/WebKit2/UIProcess/mac/TextCheckerMac.mm        2014-03-16 06:22:02 UTC (rev 165692)
</span><span class="lines">@@ -31,6 +31,7 @@
</span><span class="cx"> #import "TextCheckerState.h"
</span><span class="cx"> #import <WebCore/NotImplemented.h>
</span><span class="cx"> #import <wtf/RetainPtr.h>
</span><ins>+#import <wtf/text/StringView.h>
</ins><span class="cx">
</span><span class="cx"> @interface NSSpellChecker (WebNSSpellCheckerDetails)
</span><span class="cx"> - (NSString *)languageForWordRange:(NSRange)range inString:(NSString *)string orthography:(NSOrthography *)orthography;
</span><span class="lines">@@ -295,13 +296,13 @@
</span><span class="cx">
</span><span class="cx"> #if USE(UNIFIED_TEXT_CHECKING)
</span><span class="cx">
</span><del>-Vector<TextCheckingResult> TextChecker::checkTextOfParagraph(int64_t spellDocumentTag, const UChar* text, int length, uint64_t checkingTypes)
</del><ins>+Vector<TextCheckingResult> TextChecker::checkTextOfParagraph(int64_t spellDocumentTag, StringView text, uint64_t checkingTypes)
</ins><span class="cx"> {
</span><span class="cx"> Vector<TextCheckingResult> results;
</span><span class="cx">
</span><del>- 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)
</del><ins>+ RetainPtr<NSString> textString = text.createNSStringWithoutCopying();
+ NSArray *incomingResults = [[NSSpellChecker sharedSpellChecker] checkString:textString.get()
+ range:NSMakeRange(0, text.length())
</ins><span class="cx"> types:checkingTypes | NSTextCheckingTypeOrthography
</span><span class="cx"> options:nil
</span><span class="cx"> inSpellDocumentWithTag:spellDocumentTag
</span><span class="lines">@@ -384,13 +385,13 @@
</span><span class="cx">
</span><span class="cx"> #endif
</span><span class="cx">
</span><del>-void TextChecker::checkSpellingOfString(int64_t, const UChar*, uint32_t, int32_t&, int32_t&)
</del><ins>+void TextChecker::checkSpellingOfString(int64_t, StringView, int32_t&, int32_t&)
</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, const UChar*, uint32_t, Vector<WebCore::GrammarDetail>&, int32_t&, int32_t&)
</del><ins>+void TextChecker::checkGrammarOfString(int64_t, StringView, Vector<WebCore::GrammarDetail>&, int32_t&, int32_t&)
</ins><span class="cx"> {
</span><span class="cx"> // Mac uses checkTextOfParagraph instead.
</span><span class="cx"> notImplemented();
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessPluginsNetscapemacNetscapePluginMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm (165691 => 165692)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm        2014-03-16 06:06:03 UTC (rev 165691)
+++ trunk/Source/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm        2014-03-16 06:22:02 UTC (rev 165692)
</span><span class="lines">@@ -963,7 +963,7 @@
</span><span class="cx">
</span><span class="cx">
</span><span class="cx"> #ifndef NP_NO_CARBON
</span><del>-static bool convertStringToKeyCodes(const String& string, ScriptCode scriptCode, Vector<UInt8>& keyCodes)
</del><ins>+static bool convertStringToKeyCodes(StringView string, ScriptCode scriptCode, Vector<UInt8>& keyCodes)
</ins><span class="cx"> {
</span><span class="cx"> // Create the mapping.
</span><span class="cx"> UnicodeMapping mapping;
</span><span class="lines">@@ -973,27 +973,27 @@
</span><span class="cx">
</span><span class="cx"> mapping.unicodeEncoding = CreateTextEncoding(kTextEncodingUnicodeDefault, kTextEncodingDefaultVariant, kTextEncodingDefaultFormat);
</span><span class="cx"> mapping.mappingVersion = kUnicodeUseLatestMapping;
</span><del>-
</del><ins>+
</ins><span class="cx"> // Create the converter
</span><span class="cx"> UnicodeToTextInfo textInfo;
</span><del>-
</del><ins>+
</ins><span class="cx"> if (CreateUnicodeToTextInfo(&mapping, &textInfo) != noErr)
</span><span class="cx"> return false;
</span><del>-
</del><ins>+
</ins><span class="cx"> ByteCount inputLength = string.length() * sizeof(UniChar);
</span><span class="cx"> ByteCount inputRead;
</span><span class="cx"> ByteCount outputLength;
</span><span class="cx"> ByteCount maxOutputLength = string.length() * sizeof(UniChar);
</span><span class="cx">
</span><span class="cx"> Vector<UInt8> outputData(maxOutputLength);
</span><del>- OSStatus status = ConvertFromUnicodeToText(textInfo, inputLength, string.deprecatedCharacters(), kNilOptions, 0, 0, 0, 0, maxOutputLength, &inputRead, &outputLength, outputData.data());
</del><ins>+ OSStatus status = ConvertFromUnicodeToText(textInfo, inputLength, string.upconvertedCharacters(), kNilOptions, 0, 0, 0, 0, maxOutputLength, &inputRead, &outputLength, outputData.data());
</ins><span class="cx">
</span><span class="cx"> DisposeUnicodeToTextInfo(&textInfo);
</span><span class="cx">
</span><span class="cx"> if (status != noErr)
</span><span class="cx"> return false;
</span><span class="cx">
</span><del>- outputData.swap(keyCodes);
</del><ins>+ keyCodes = std::move(outputData);
</ins><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="lines">@@ -1034,8 +1034,8 @@
</span><span class="cx"> EventRecord event = initializeEventRecord(keyDown);
</span><span class="cx"> event.modifiers = 0;
</span><span class="cx">
</span><del>- for (size_t i = 0; i < keyCodes.size(); i++) {
- event.message = keyCodes[i];
</del><ins>+ for (auto& keyCode : keyCodes) {
+ event.message = keyCode;
</ins><span class="cx"> NPP_HandleEvent(&event);
</span><span class="cx"> }
</span><span class="cx"> break;
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageEncoderAdaptercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/EncoderAdapter.cpp (165691 => 165692)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/EncoderAdapter.cpp        2014-03-16 06:06:03 UTC (rev 165691)
+++ trunk/Source/WebKit2/WebProcess/WebPage/EncoderAdapter.cpp        2014-03-16 06:22:02 UTC (rev 165692)
</span><span class="lines">@@ -28,7 +28,7 @@
</span><span class="cx">
</span><span class="cx"> #include "DataReference.h"
</span><span class="cx"> #include "WebCoreArgumentCoders.h"
</span><del>-#include <wtf/text/WTFString.h>
</del><ins>+#include <wtf/text/StringView.h>
</ins><span class="cx">
</span><span class="cx"> namespace WebKit {
</span><span class="cx">
</span><span class="lines">@@ -108,7 +108,7 @@
</span><span class="cx">
</span><span class="cx"> uint64_t lengthInBytes = length * sizeof(UChar);
</span><span class="cx"> m_encoder << lengthInBytes;
</span><del>- m_encoder.encodeFixedLengthData(reinterpret_cast<const uint8_t*>(value.deprecatedCharacters()), length * sizeof(UChar), alignof(UChar));
</del><ins>+ m_encoder.encodeFixedLengthData(reinterpret_cast<const uint8_t*>(StringView(value).upconvertedCharacters().get()), length * sizeof(UChar), alignof(UChar));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> }
</span></span></pre>
</div>
</div>
</body>
</html>