<!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>[166063] trunk/Source/WebCore</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/166063">166063</a></dd>
<dt>Author</dt> <dd>darin@apple.com</dd>
<dt>Date</dt> <dd>2014-03-21 08:22:45 -0700 (Fri, 21 Mar 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Stop using deprecatedCharacters in WebCore/platform/win
https://bugs.webkit.org/show_bug.cgi?id=130515

Reviewed by Brent Fulgham.

* platform/graphics/TextRun.h:
(WebCore::TextRun::TextRun): Add a constructor that takes a StringView.
Later, we might want to exclusively use the StringView version and remove
some of the others.
(WebCore::TextRun::setText): Add a version of this function that takes a StringView.

* platform/graphics/win/FontCacheWin.cpp:
(WebCore::FontCache::systemFallbackForCharacters): Use StringView::getCharactersWithUpconvert.
(WebCore::createGDIFont): Ditto.
(WebCore::FontCache::getTraitsInFamily): Ditto.
* platform/win/BString.cpp:
(WebCore::BString::BString): Use StringView::upconvertedCharacters.
* platform/win/ClipboardUtilitiesWin.cpp:
(WebCore::createGlobalData): Use StringView::getCharactersWithUpconvert.
* platform/win/FileSystemWin.cpp:
(WebCore::pathByAppendingComponent): Use StringBuilder and StringView::getCharactersWithUpconvert.
(WebCore::fileSystemRepresentation): Use StringView::upconvertedCharacters.
* platform/win/PasteboardWin.cpp:
(WebCore::filesystemPathFromUrlOrTitle): Use StringView::getCharactersWithUpconvert.
(WebCore::Pasteboard::writeURLToDataObject): Ditto.
(WebCore::createGlobalImageFileDescriptor): Ditto.

* platform/win/PopupMenuWin.cpp:
(WebCore::PopupMenuWin::calculatePositionAndSize): Use the new TextRun constructor.
* platform/win/WebCoreTextRenderer.cpp:
(WebCore::doDrawTextAtPoint): Ditto.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsTextRunh">trunk/Source/WebCore/platform/graphics/TextRun.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicswinFontCacheWincpp">trunk/Source/WebCore/platform/graphics/win/FontCacheWin.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformwinBStringcpp">trunk/Source/WebCore/platform/win/BString.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformwinClipboardUtilitiesWincpp">trunk/Source/WebCore/platform/win/ClipboardUtilitiesWin.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformwinFileSystemWincpp">trunk/Source/WebCore/platform/win/FileSystemWin.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformwinPasteboardWincpp">trunk/Source/WebCore/platform/win/PasteboardWin.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformwinPopupMenuWincpp">trunk/Source/WebCore/platform/win/PopupMenuWin.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformwinWebCoreTextRenderercpp">trunk/Source/WebCore/platform/win/WebCoreTextRenderer.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (166062 => 166063)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-03-21 14:49:34 UTC (rev 166062)
+++ trunk/Source/WebCore/ChangeLog        2014-03-21 15:22:45 UTC (rev 166063)
</span><span class="lines">@@ -1,3 +1,37 @@
</span><ins>+2014-03-21  Darin Adler  &lt;darin@apple.com&gt;
+
+        Stop using deprecatedCharacters in WebCore/platform/win
+        https://bugs.webkit.org/show_bug.cgi?id=130515
+
+        Reviewed by Brent Fulgham.
+
+        * platform/graphics/TextRun.h:
+        (WebCore::TextRun::TextRun): Add a constructor that takes a StringView.
+        Later, we might want to exclusively use the StringView version and remove
+        some of the others.
+        (WebCore::TextRun::setText): Add a version of this function that takes a StringView.
+
+        * platform/graphics/win/FontCacheWin.cpp:
+        (WebCore::FontCache::systemFallbackForCharacters): Use StringView::getCharactersWithUpconvert.
+        (WebCore::createGDIFont): Ditto.
+        (WebCore::FontCache::getTraitsInFamily): Ditto.
+        * platform/win/BString.cpp:
+        (WebCore::BString::BString): Use StringView::upconvertedCharacters.
+        * platform/win/ClipboardUtilitiesWin.cpp:
+        (WebCore::createGlobalData): Use StringView::getCharactersWithUpconvert.
+        * platform/win/FileSystemWin.cpp:
+        (WebCore::pathByAppendingComponent): Use StringBuilder and StringView::getCharactersWithUpconvert.
+        (WebCore::fileSystemRepresentation): Use StringView::upconvertedCharacters.
+        * platform/win/PasteboardWin.cpp:
+        (WebCore::filesystemPathFromUrlOrTitle): Use StringView::getCharactersWithUpconvert.
+        (WebCore::Pasteboard::writeURLToDataObject): Ditto.
+        (WebCore::createGlobalImageFileDescriptor): Ditto.
+
+        * platform/win/PopupMenuWin.cpp:
+        (WebCore::PopupMenuWin::calculatePositionAndSize): Use the new TextRun constructor.
+        * platform/win/WebCoreTextRenderer.cpp:
+        (WebCore::doDrawTextAtPoint): Ditto.
+
</ins><span class="cx"> 2014-03-21  Zalan Bujtas  &lt;zalan@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Subpixel rendering: RenderBox is positioned off by one when non-compositing transform is present.
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsTextRunh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/TextRun.h (166062 => 166063)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/TextRun.h        2014-03-21 14:49:34 UTC (rev 166062)
+++ trunk/Source/WebCore/platform/graphics/TextRun.h        2014-03-21 15:22:45 UTC (rev 166063)
</span><span class="lines">@@ -26,7 +26,7 @@
</span><span class="cx"> 
</span><span class="cx"> #include &quot;TextDirection.h&quot;
</span><span class="cx"> #include &lt;wtf/RefCounted.h&gt;
</span><del>-#include &lt;wtf/text/WTFString.h&gt;
</del><ins>+#include &lt;wtf/text/StringView.h&gt;
</ins><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="lines">@@ -37,6 +37,7 @@
</span><span class="cx"> class GlyphBuffer;
</span><span class="cx"> class GlyphToPathTranslator;
</span><span class="cx"> class SimpleFontData;
</span><ins>+
</ins><span class="cx"> struct GlyphData;
</span><span class="cx"> struct WidthIterator;
</span><span class="cx"> 
</span><span class="lines">@@ -125,6 +126,29 @@
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    TextRun(StringView s, float xpos = 0, float expansion = 0, ExpansionBehavior expansionBehavior = AllowTrailingExpansion | ForbidLeadingExpansion, TextDirection direction = LTR, bool directionalOverride = false, bool characterScanForCodePath = true, RoundingHacks roundingHacks = RunRounding | WordRounding)
+        : m_charactersLength(s.length())
+        , m_len(s.length())
+        , m_xpos(xpos)
+        , m_horizontalGlyphStretch(1)
+        , m_expansion(expansion)
+        , m_expansionBehavior(expansionBehavior)
+        , m_is8Bit(s.is8Bit())
+        , m_allowTabs(false)
+        , m_direction(direction)
+        , m_directionalOverride(directionalOverride)
+        , m_characterScanForCodePath(characterScanForCodePath)
+        , m_applyRunRounding((roundingHacks &amp; RunRounding) &amp;&amp; s_allowsRoundingHacks)
+        , m_applyWordRounding((roundingHacks &amp; WordRounding) &amp;&amp; s_allowsRoundingHacks)
+        , m_disableSpacing(false)
+        , m_tabSize(0)
+    {
+        if (s.is8Bit())
+            m_data.characters8 = s.characters8();
+        else
+            m_data.characters16 = s.characters16();
+    }
+
</ins><span class="cx">     TextRun subRun(unsigned startOffset, unsigned length) const
</span><span class="cx">     {
</span><span class="cx">         ASSERT_WITH_SECURITY_IMPLICATION(startOffset &lt; m_len);
</span><span class="lines">@@ -158,6 +182,7 @@
</span><span class="cx"> 
</span><span class="cx">     void setText(const LChar* c, unsigned len) { m_data.characters8 = c; m_len = len; m_is8Bit = true;}
</span><span class="cx">     void setText(const UChar* c, unsigned len) { m_data.characters16 = c; m_len = len; m_is8Bit = false;}
</span><ins>+    void setText(StringView);
</ins><span class="cx">     void setCharactersLength(unsigned charactersLength) { m_charactersLength = charactersLength; }
</span><span class="cx"> 
</span><span class="cx">     float horizontalGlyphStretch() const { return m_horizontalGlyphStretch; }
</span><span class="lines">@@ -242,6 +267,16 @@
</span><span class="cx">     m_tabSize = size;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+inline void TextRun::setText(StringView string)
+{
+    m_len = string.length();
+    m_is8Bit = string.is8Bit();
+    if (string.is8Bit())
+        m_data.characters8 = string.characters8();
+    else
+        m_data.characters16 = string.characters16();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+}
+
</ins><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicswinFontCacheWincpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/win/FontCacheWin.cpp (166062 => 166063)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/win/FontCacheWin.cpp        2014-03-21 14:49:34 UTC (rev 166062)
+++ trunk/Source/WebCore/platform/graphics/win/FontCacheWin.cpp        2014-03-21 15:22:45 UTC (rev 166063)
</span><span class="lines">@@ -36,7 +36,9 @@
</span><span class="cx"> #include &lt;windows.h&gt;
</span><span class="cx"> #include &lt;wtf/StdLibExtras.h&gt;
</span><span class="cx"> #include &lt;wtf/text/StringHash.h&gt;
</span><ins>+#include &lt;wtf/text/StringView.h&gt;
</ins><span class="cx"> #include &lt;wtf/win/GDIObject.h&gt;
</span><ins>+
</ins><span class="cx"> #if USE(CG)
</span><span class="cx"> #include &lt;ApplicationServices/ApplicationServices.h&gt;
</span><span class="cx"> #include &lt;WebKitSystemInterface/WebKitSystemInterface.h&gt;
</span><span class="lines">@@ -276,7 +278,7 @@
</span><span class="cx"> 
</span><span class="cx">         LOGFONT logFont;
</span><span class="cx">         logFont.lfCharSet = DEFAULT_CHARSET;
</span><del>-        memcpy(logFont.lfFaceName, linkedFonts-&gt;at(linkedFontIndex).deprecatedCharacters(), linkedFonts-&gt;at(linkedFontIndex).length() * sizeof(WCHAR));
</del><ins>+        StringView(linkedFonts-&gt;at(linkedFontIndex)).getCharactersWithUpconvert(logFont.lfFaceName);
</ins><span class="cx">         logFont.lfFaceName[linkedFonts-&gt;at(linkedFontIndex).length()] = 0;
</span><span class="cx">         EnumFontFamiliesEx(hdc, &amp;logFont, linkedFontEnumProc, reinterpret_cast&lt;LPARAM&gt;(&amp;hfont), 0);
</span><span class="cx">         linkedFontIndex++;
</span><span class="lines">@@ -446,9 +448,9 @@
</span><span class="cx"> 
</span><span class="cx">     LOGFONT logFont;
</span><span class="cx">     logFont.lfCharSet = DEFAULT_CHARSET;
</span><del>-    unsigned familyLength = min(family.length(), static_cast&lt;unsigned&gt;(LF_FACESIZE - 1));
-    memcpy(logFont.lfFaceName, family.string().deprecatedCharacters(), familyLength * sizeof(UChar));
-    logFont.lfFaceName[familyLength] = 0;
</del><ins>+    StringView truncatedFamily = StringView(family).substring(0, static_cast&lt;unsigned&gt;(LF_FACESIZE - 1));
+    truncatedFamily.getCharactersWithUpconvert(logFont.lfFaceName);
+    logFont.lfFaceName[truncatedFamily.length()] = 0;
</ins><span class="cx">     logFont.lfPitchAndFamily = 0;
</span><span class="cx"> 
</span><span class="cx">     MatchImprovingProcData matchData(desiredWeight, desiredItalic);
</span><span class="lines">@@ -528,9 +530,9 @@
</span><span class="cx"> 
</span><span class="cx">     LOGFONT logFont;
</span><span class="cx">     logFont.lfCharSet = DEFAULT_CHARSET;
</span><del>-    unsigned familyLength = min(familyName.length(), static_cast&lt;unsigned&gt;(LF_FACESIZE - 1));
-    memcpy(logFont.lfFaceName, familyName.string().deprecatedCharacters(), familyLength * sizeof(UChar));
-    logFont.lfFaceName[familyLength] = 0;
</del><ins>+    StringView truncatedFamily = StringView(familyName).substring(0, static_cast&lt;unsigned&gt;(LF_FACESIZE - 1));
+    truncatedFamily.getCharactersWithUpconvert(logFont.lfFaceName);
+    logFont.lfFaceName[truncatedFamily.length()] = 0;
</ins><span class="cx">     logFont.lfPitchAndFamily = 0;
</span><span class="cx"> 
</span><span class="cx">     TraitsInFamilyProcData procData(familyName);
</span><span class="lines">@@ -587,4 +589,3 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> }
</span><del>-
</del></span></pre></div>
<a id="trunkSourceWebCoreplatformwinBStringcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/win/BString.cpp (166062 => 166063)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/win/BString.cpp        2014-03-21 14:49:34 UTC (rev 166062)
+++ trunk/Source/WebCore/platform/win/BString.cpp        2014-03-21 15:22:45 UTC (rev 166063)
</span><span class="lines">@@ -29,7 +29,7 @@
</span><span class="cx"> #include &quot;URL.h&quot;
</span><span class="cx"> #include &lt;windows.h&gt;
</span><span class="cx"> #include &lt;wtf/text/AtomicString.h&gt;
</span><del>-#include &lt;wtf/text/WTFString.h&gt;
</del><ins>+#include &lt;wtf/text/StringView.h&gt;
</ins><span class="cx"> 
</span><span class="cx"> #if USE(CF)
</span><span class="cx"> #include &lt;CoreFoundation/CoreFoundation.h&gt;
</span><span class="lines">@@ -65,7 +65,7 @@
</span><span class="cx">     if (s.isNull())
</span><span class="cx">         m_bstr = 0;
</span><span class="cx">     else
</span><del>-        m_bstr = SysAllocStringLen(s.deprecatedCharacters(), s.length());
</del><ins>+        m_bstr = SysAllocStringLen(StringView(s).upconvertedCharacters(), s.length());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> BString::BString(const URL&amp; url)
</span><span class="lines">@@ -73,7 +73,7 @@
</span><span class="cx">     if (url.isNull())
</span><span class="cx">         m_bstr = 0;
</span><span class="cx">     else
</span><del>-        m_bstr = SysAllocStringLen(url.string().deprecatedCharacters(), url.string().length());
</del><ins>+        m_bstr = SysAllocStringLen(StringView(url.string()).upconvertedCharacters(), url.string().length());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> BString::BString(const AtomicString&amp; s)
</span><span class="lines">@@ -81,7 +81,7 @@
</span><span class="cx">     if (s.isNull())
</span><span class="cx">         m_bstr = 0;
</span><span class="cx">     else
</span><del>-        m_bstr = SysAllocStringLen(s.string().deprecatedCharacters(), s.length());
</del><ins>+        m_bstr = SysAllocStringLen(StringView(s.string()).upconvertedCharacters(), s.length());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #if USE(CF)
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformwinClipboardUtilitiesWincpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/win/ClipboardUtilitiesWin.cpp (166062 => 166063)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/win/ClipboardUtilitiesWin.cpp        2014-03-21 14:49:34 UTC (rev 166062)
+++ trunk/Source/WebCore/platform/win/ClipboardUtilitiesWin.cpp        2014-03-21 15:22:45 UTC (rev 166063)
</span><span class="lines">@@ -35,7 +35,6 @@
</span><span class="cx"> #include &lt;wtf/StringExtras.h&gt;
</span><span class="cx"> #include &lt;wtf/text/CString.h&gt;
</span><span class="cx"> #include &lt;wtf/text/StringBuilder.h&gt;
</span><del>-#include &lt;wtf/text/WTFString.h&gt;
</del><span class="cx"> 
</span><span class="cx"> #if !OS(WINCE)
</span><span class="cx"> #include &lt;shlwapi.h&gt;
</span><span class="lines">@@ -194,7 +193,7 @@
</span><span class="cx">     if (!vm)
</span><span class="cx">         return 0;
</span><span class="cx">     UChar* buffer = static_cast&lt;UChar*&gt;(GlobalLock(vm));
</span><del>-    memcpy(buffer, str.deprecatedCharacters(), str.length() * sizeof(UChar));
</del><ins>+    StringView(str).getCharactersWithUpconvert(buffer);
</ins><span class="cx">     buffer[str.length()] = 0;
</span><span class="cx">     GlobalUnlock(vm);
</span><span class="cx">     return vm;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformwinFileSystemWincpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/win/FileSystemWin.cpp (166062 => 166063)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/win/FileSystemWin.cpp        2014-03-21 14:49:34 UTC (rev 166062)
+++ trunk/Source/WebCore/platform/win/FileSystemWin.cpp        2014-03-21 15:22:45 UTC (rev 166063)
</span><span class="lines">@@ -36,7 +36,7 @@
</span><span class="cx"> #include &lt;wtf/CryptographicallyRandomNumber.h&gt;
</span><span class="cx"> #include &lt;wtf/HashMap.h&gt;
</span><span class="cx"> #include &lt;wtf/text/CString.h&gt;
</span><del>-#include &lt;wtf/text/WTFString.h&gt;
</del><ins>+#include &lt;wtf/text/StringBuilder.h&gt;
</ins><span class="cx"> 
</span><span class="cx"> #include &lt;windows.h&gt;
</span><span class="cx"> #include &lt;shlobj.h&gt;
</span><span class="lines">@@ -156,39 +156,43 @@
</span><span class="cx"> 
</span><span class="cx"> String pathByAppendingComponent(const String&amp; path, const String&amp; component)
</span><span class="cx"> {
</span><del>-    Vector&lt;UChar&gt; buffer(MAX_PATH);
-
</del><span class="cx"> #if OS(WINCE)
</span><del>-    buffer.append(path.deprecatedCharacters(), path.length());
</del><ins>+    StringBuilder builder;
</ins><span class="cx"> 
</span><ins>+    builder.append(path);
+
</ins><span class="cx">     UChar lastPathCharacter = path[path.length() - 1];
</span><span class="cx">     if (lastPathCharacter != L'\\' &amp;&amp; lastPathCharacter != L'/' &amp;&amp; component[0] != L'\\' &amp;&amp; component[0] != L'/')
</span><del>-        buffer.append(PlatformFilePathSeparator);
</del><ins>+        builder.append(PlatformFilePathSeparator);
</ins><span class="cx"> 
</span><del>-    buffer.append(component.deprecatedCharacters(), component.length());
-    buffer.shrinkToFit();
</del><ins>+    builder.append(component);
+
+    return builder.toString();
</ins><span class="cx"> #else
</span><ins>+    Vector&lt;UChar&gt; buffer(MAX_PATH);
+
</ins><span class="cx">     if (path.length() + 1 &gt; buffer.size())
</span><span class="cx">         return String();
</span><span class="cx"> 
</span><del>-    memcpy(buffer.data(), path.deprecatedCharacters(), path.length() * sizeof(UChar));
</del><ins>+    StringView(path).getCharactersWithUpconvert(buffer.data());
</ins><span class="cx">     buffer[path.length()] = '\0';
</span><span class="cx"> 
</span><del>-    String componentCopy = component;
-    if (!PathAppendW(buffer.data(), componentCopy.charactersWithNullTermination().data()))
</del><ins>+    if (!PathAppendW(buffer.data(), component.charactersWithNullTermination().data()))
</ins><span class="cx">         return String();
</span><span class="cx"> 
</span><del>-    buffer.resize(wcslen(buffer.data()));
-#endif
</del><ins>+    buffer.shrink(wcslen(buffer.data()));
</ins><span class="cx"> 
</span><span class="cx">     return String::adopt(buffer);
</span><ins>+#endif
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #if !USE(CF)
</span><span class="cx"> 
</span><span class="cx"> CString fileSystemRepresentation(const String&amp; path)
</span><span class="cx"> {
</span><del>-    const UChar* characters = path.deprecatedCharacters();
</del><ins>+    auto upconvertedCharacters = path.upconvertedCharacters();
+
+    const UChar* characters = upconvertedCharacters;
</ins><span class="cx">     int size = WideCharToMultiByte(CP_ACP, 0, characters, path.length(), 0, 0, 0, 0) - 1;
</span><span class="cx"> 
</span><span class="cx">     char* buffer;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformwinPasteboardWincpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/win/PasteboardWin.cpp (166062 => 166063)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/win/PasteboardWin.cpp        2014-03-21 14:49:34 UTC (rev 166062)
+++ trunk/Source/WebCore/platform/win/PasteboardWin.cpp        2014-03-21 15:22:45 UTC (rev 166063)
</span><span class="lines">@@ -51,6 +51,7 @@
</span><span class="cx"> #include &quot;markup.h&quot;
</span><span class="cx"> #include &lt;wtf/WindowsExtras.h&gt;
</span><span class="cx"> #include &lt;wtf/text/CString.h&gt;
</span><ins>+#include &lt;wtf/text/StringView.h&gt;
</ins><span class="cx"> #include &lt;wtf/win/GDIObject.h&gt;
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="lines">@@ -558,7 +559,7 @@
</span><span class="cx"> 
</span><span class="cx">     if (!title.isEmpty()) {
</span><span class="cx">         size_t len = std::min&lt;size_t&gt;(title.length(), fsPathMaxLengthExcludingExtension);
</span><del>-        CopyMemory(fsPathBuffer, title.deprecatedCharacters(), len * sizeof(UChar));
</del><ins>+        StringView(title).substring(0, len).getCharactersWithUpconvert(fsPathBuffer);
</ins><span class="cx">         fsPathBuffer[len] = 0;
</span><span class="cx">         pathRemoveBadFSCharacters(fsPathBuffer, len);
</span><span class="cx">     }
</span><span class="lines">@@ -573,10 +574,10 @@
</span><span class="cx">         String lastComponent = kurl.lastPathComponent();
</span><span class="cx">         if (kurl.isLocalFile() || (!isLink &amp;&amp; !lastComponent.isEmpty())) {
</span><span class="cx">             len = std::min&lt;DWORD&gt;(fsPathMaxLengthExcludingExtension, lastComponent.length());
</span><del>-            CopyMemory(fsPathBuffer, lastComponent.deprecatedCharacters(), len * sizeof(UChar));
</del><ins>+            StringView(lastComponent).substring(0, len).getCharactersWithUpconvert(fsPathBuffer);
</ins><span class="cx">         } else {
</span><span class="cx">             len = std::min&lt;DWORD&gt;(fsPathMaxLengthExcludingExtension, url.length());
</span><del>-            CopyMemory(fsPathBuffer, url.deprecatedCharacters(), len * sizeof(UChar));
</del><ins>+            StringView(url).substring(0, len).getCharactersWithUpconvert(fsPathBuffer);
</ins><span class="cx">         }
</span><span class="cx">         fsPathBuffer[len] = 0;
</span><span class="cx">         pathRemoveBadFSCharacters(fsPathBuffer, len);
</span><span class="lines">@@ -672,7 +673,7 @@
</span><span class="cx">     fgd-&gt;fgd[0].nFileSizeLow = content.length();
</span><span class="cx"> 
</span><span class="cx">     unsigned maxSize = std::min&lt;unsigned&gt;(fsPath.length(), WTF_ARRAY_LENGTH(fgd-&gt;fgd[0].cFileName));
</span><del>-    CopyMemory(fgd-&gt;fgd[0].cFileName, fsPath.deprecatedCharacters(), maxSize * sizeof(UChar));
</del><ins>+    StringView(fsPath).substring(0, maxSize).getCharactersWithUpconvert(fgd-&gt;fgd[0].cFileName);
</ins><span class="cx">     GlobalUnlock(urlFileDescriptor);
</span><span class="cx"> 
</span><span class="cx">     char* fileContents = static_cast&lt;char*&gt;(GlobalLock(urlFileContent));
</span><span class="lines">@@ -907,7 +908,7 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     int maxSize = std::min&lt;int&gt;(fsPath.length(), WTF_ARRAY_LENGTH(fgd-&gt;fgd[0].cFileName));
</span><del>-    CopyMemory(fgd-&gt;fgd[0].cFileName, (LPCWSTR)fsPath.deprecatedCharacters(), maxSize * sizeof(UChar));
</del><ins>+    StringView(fsPath).substring(0, maxSize).getCharactersWithUpconvert(fgd-&gt;fgd[0].cFileName);
</ins><span class="cx">     GlobalUnlock(memObj);
</span><span class="cx"> 
</span><span class="cx">     return memObj;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformwinPopupMenuWincpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/win/PopupMenuWin.cpp (166062 => 166063)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/win/PopupMenuWin.cpp        2014-03-21 14:49:34 UTC (rev 166062)
+++ trunk/Source/WebCore/platform/win/PopupMenuWin.cpp        2014-03-21 15:22:45 UTC (rev 166063)
</span><span class="lines">@@ -351,7 +351,7 @@
</span><span class="cx">             itemFont.update(m_popupClient-&gt;fontSelector());
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        popupWidth = std::max(popupWidth, static_cast&lt;int&gt;(ceilf(itemFont.width(TextRun(text.deprecatedCharacters(), text.length())))));
</del><ins>+        popupWidth = std::max(popupWidth, static_cast&lt;int&gt;(ceilf(itemFont.width(TextRun(text)))));
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if (naturalHeight &gt; maxPopupHeight)
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformwinWebCoreTextRenderercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/win/WebCoreTextRenderer.cpp (166062 => 166063)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/win/WebCoreTextRenderer.cpp        2014-03-21 14:49:34 UTC (rev 166062)
+++ trunk/Source/WebCore/platform/win/WebCoreTextRenderer.cpp        2014-03-21 15:22:45 UTC (rev 166063)
</span><span class="lines">@@ -50,7 +50,7 @@
</span><span class="cx"> {
</span><span class="cx">     FontCachePurgePreventer fontCachePurgePreventer;
</span><span class="cx"> 
</span><del>-    TextRun run(text.deprecatedCharacters(), text.length());
</del><ins>+    TextRun run(text);
</ins><span class="cx"> 
</span><span class="cx">     context.setFillColor(color, ColorSpaceDeviceRGB);
</span><span class="cx">     if (isOneLeftToRightRun(run))
</span><span class="lines">@@ -63,12 +63,12 @@
</span><span class="cx"> 
</span><span class="cx">         int beforeWidth;
</span><span class="cx">         if (underlinedIndex &gt; 0) {
</span><del>-            TextRun beforeRun(text.deprecatedCharacters(), underlinedIndex);
</del><ins>+            TextRun beforeRun(StringView(text).substring(0, underlinedIndex));
</ins><span class="cx">             beforeWidth = font.width(beforeRun);
</span><span class="cx">         } else
</span><span class="cx">             beforeWidth = 0;
</span><span class="cx"> 
</span><del>-        TextRun underlinedRun(text.deprecatedCharacters() + underlinedIndex, 1);
</del><ins>+        TextRun underlinedRun(StringView(text).substring(underlinedIndex, 1));
</ins><span class="cx">         int underlinedWidth = font.width(underlinedRun);
</span><span class="cx"> 
</span><span class="cx">         IntPoint underlinePoint(point);
</span></span></pre>
</div>
</div>

</body>
</html>