<!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>[161817] 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/161817">161817</a></dd>
<dt>Author</dt> <dd>weinig@apple.com</dd>
<dt>Date</dt> <dd>2014-01-12 11:24:29 -0800 (Sun, 12 Jan 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Split ICU UText providers out into their own files
https://bugs.webkit.org/show_bug.cgi?id=126834

Reviewed by Anders Carlsson.

Moves the implementation of our custom UText providers out into
their own files.
- UTextProviderLatin1.h/cpp contains the Latin-1 provider.
- UTextProviderUTF16.h/cpp contains the UTF-16 provider.
- UTextProvider.h/cpp contains code common to all the providers.

* CMakeLists.txt:
* GNUmakefile.list.am:
* PlatformGTK.cmake:
* WebCore.vcxproj/WebCoreCommon.props:
* WebCore.vcxproj/copyForwardingHeaders.cmd:
* WebCore.xcodeproj/project.pbxproj:
* platform/text/TextAllInOne.cpp:
* platform/text/TextBreakIteratorICU.cpp:
(WebCore::setUpIterator):
(WebCore::wordBreakIterator):
(WebCore::acquireLineBreakIterator):
(WebCore::sentenceBreakIterator):
(WebCore::setUpIteratorWithRules):
* platform/text/icu: Added.
* platform/text/icu/UTextProvider.cpp: Added.
(WebCore::fixPointer):
(WebCore::uTextCloneImpl):
* platform/text/icu/UTextProvider.h: Added.
(WebCore::uTextProviderContext):
(WebCore::uTextInitialize):
(WebCore::uTextAccessPinIndex):
(WebCore::uTextAccessInChunkOrOutOfRange):
* platform/text/icu/UTextProviderLatin1.cpp: Added.
* platform/text/icu/UTextProviderLatin1.h: Added.
* platform/text/icu/UTextProviderUTF16.cpp: Added.
* platform/text/icu/UTextProviderUTF16.h: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourcePlatformGNUmakefileam">trunk/Source/Platform/GNUmakefile.am</a></li>
<li><a href="#trunkSourceWebCoreCMakeListstxt">trunk/Source/WebCore/CMakeLists.txt</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreGNUmakefileam">trunk/Source/WebCore/GNUmakefile.am</a></li>
<li><a href="#trunkSourceWebCoreGNUmakefilelistam">trunk/Source/WebCore/GNUmakefile.list.am</a></li>
<li><a href="#trunkSourceWebCorePlatformGTKcmake">trunk/Source/WebCore/PlatformGTK.cmake</a></li>
<li><a href="#trunkSourceWebCoreWebCorevcxprojWebCoreCommonprops">trunk/Source/WebCore/WebCore.vcxproj/WebCoreCommon.props</a></li>
<li><a href="#trunkSourceWebCoreWebCorevcxprojcopyForwardingHeaderscmd">trunk/Source/WebCore/WebCore.vcxproj/copyForwardingHeaders.cmd</a></li>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebCoreplatformtextTextAllInOnecpp">trunk/Source/WebCore/platform/text/TextAllInOne.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformtextTextBreakIteratorICUcpp">trunk/Source/WebCore/platform/text/TextBreakIteratorICU.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li>trunk/Source/WebCore/platform/text/icu/</li>
<li><a href="#trunkSourceWebCoreplatformtexticuUTextProvidercpp">trunk/Source/WebCore/platform/text/icu/UTextProvider.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformtexticuUTextProviderh">trunk/Source/WebCore/platform/text/icu/UTextProvider.h</a></li>
<li><a href="#trunkSourceWebCoreplatformtexticuUTextProviderLatin1cpp">trunk/Source/WebCore/platform/text/icu/UTextProviderLatin1.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformtexticuUTextProviderLatin1h">trunk/Source/WebCore/platform/text/icu/UTextProviderLatin1.h</a></li>
<li><a href="#trunkSourceWebCoreplatformtexticuUTextProviderUTF16cpp">trunk/Source/WebCore/platform/text/icu/UTextProviderUTF16.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformtexticuUTextProviderUTF16h">trunk/Source/WebCore/platform/text/icu/UTextProviderUTF16.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourcePlatformGNUmakefileam"></a>
<div class="modfile"><h4>Modified: trunk/Source/Platform/GNUmakefile.am (161816 => 161817)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/Platform/GNUmakefile.am        2014-01-12 19:15:54 UTC (rev 161816)
+++ trunk/Source/Platform/GNUmakefile.am        2014-01-12 19:24:29 UTC (rev 161817)
</span><span class="lines">@@ -57,6 +57,7 @@
</span><span class="cx">         -I$(srcdir)/Source/WebCore/platform/network/gtk \
</span><span class="cx">         -I$(srcdir)/Source/WebCore/platform/network/soup \
</span><span class="cx">         -I$(srcdir)/Source/WebCore/platform/text \
</span><ins>+        -I$(srcdir)/Source/WebCore/platform/text/icu \
</ins><span class="cx">         -I$(srcdir)/Source/WebCore/platform/text/transcoder
</span><span class="cx"> 
</span><span class="cx"> noinst_LTLIBRARIES += \
</span></span></pre></div>
<a id="trunkSourceWebCoreCMakeListstxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/CMakeLists.txt (161816 => 161817)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/CMakeLists.txt        2014-01-12 19:15:54 UTC (rev 161816)
+++ trunk/Source/WebCore/CMakeLists.txt        2014-01-12 19:24:29 UTC (rev 161817)
</span><span class="lines">@@ -77,6 +77,7 @@
</span><span class="cx">     &quot;${WEBCORE_DIR}/platform/network&quot;
</span><span class="cx">     &quot;${WEBCORE_DIR}/platform/sql&quot;
</span><span class="cx">     &quot;${WEBCORE_DIR}/platform/text&quot;
</span><ins>+    &quot;${WEBCORE_DIR}/platform/text/icu&quot;
</ins><span class="cx">     &quot;${WEBCORE_DIR}/plugins&quot;
</span><span class="cx">     &quot;${WEBCORE_DIR}/rendering&quot;
</span><span class="cx">     &quot;${WEBCORE_DIR}/rendering/line&quot;
</span><span class="lines">@@ -2801,6 +2802,9 @@
</span><span class="cx"> 
</span><span class="cx"> if (WTF_USE_ICU_UNICODE)
</span><span class="cx">     list(APPEND WebCore_SOURCES
</span><ins>+        platform/text/icu/UTextProvider.cpp
+        platform/text/icu/UTextProviderLatin1.cpp
+        platform/text/icu/UTextProviderUTF16.cpp
</ins><span class="cx">         platform/text/TextBreakIteratorICU.cpp
</span><span class="cx">         platform/text/TextCodecICU.cpp
</span><span class="cx">         platform/text/TextEncodingDetectorICU.cpp
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (161816 => 161817)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-01-12 19:15:54 UTC (rev 161816)
+++ trunk/Source/WebCore/ChangeLog        2014-01-12 19:24:29 UTC (rev 161817)
</span><span class="lines">@@ -1,3 +1,43 @@
</span><ins>+2014-01-11  Sam Weinig  &lt;sam@webkit.org&gt;
+
+        Split ICU UText providers out into their own files
+        https://bugs.webkit.org/show_bug.cgi?id=126834
+
+        Reviewed by Anders Carlsson.
+
+        Moves the implementation of our custom UText providers out into
+        their own files.
+        - UTextProviderLatin1.h/cpp contains the Latin-1 provider.
+        - UTextProviderUTF16.h/cpp contains the UTF-16 provider.
+        - UTextProvider.h/cpp contains code common to all the providers.
+
+        * CMakeLists.txt:
+        * GNUmakefile.list.am:
+        * PlatformGTK.cmake:
+        * WebCore.vcxproj/WebCoreCommon.props:
+        * WebCore.vcxproj/copyForwardingHeaders.cmd:
+        * WebCore.xcodeproj/project.pbxproj:
+        * platform/text/TextAllInOne.cpp:
+        * platform/text/TextBreakIteratorICU.cpp:
+        (WebCore::setUpIterator):
+        (WebCore::wordBreakIterator):
+        (WebCore::acquireLineBreakIterator):
+        (WebCore::sentenceBreakIterator):
+        (WebCore::setUpIteratorWithRules):
+        * platform/text/icu: Added.
+        * platform/text/icu/UTextProvider.cpp: Added.
+        (WebCore::fixPointer):
+        (WebCore::uTextCloneImpl):
+        * platform/text/icu/UTextProvider.h: Added.
+        (WebCore::uTextProviderContext):
+        (WebCore::uTextInitialize):
+        (WebCore::uTextAccessPinIndex):
+        (WebCore::uTextAccessInChunkOrOutOfRange):
+        * platform/text/icu/UTextProviderLatin1.cpp: Added.
+        * platform/text/icu/UTextProviderLatin1.h: Added.
+        * platform/text/icu/UTextProviderUTF16.cpp: Added.
+        * platform/text/icu/UTextProviderUTF16.h: Added.
+
</ins><span class="cx"> 2014-01-12  Carlos Garcia Campos  &lt;cgarcia@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Unreviewed. Fix make distcheck.
</span></span></pre></div>
<a id="trunkSourceWebCoreGNUmakefileam"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/GNUmakefile.am (161816 => 161817)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/GNUmakefile.am        2014-01-12 19:15:54 UTC (rev 161816)
+++ trunk/Source/WebCore/GNUmakefile.am        2014-01-12 19:24:29 UTC (rev 161817)
</span><span class="lines">@@ -90,6 +90,7 @@
</span><span class="cx">         -I$(srcdir)/Source/WebCore/platform/network/gtk \
</span><span class="cx">         -I$(srcdir)/Source/WebCore/platform/sql \
</span><span class="cx">         -I$(srcdir)/Source/WebCore/platform/text \
</span><ins>+        -I$(srcdir)/Source/WebCore/platform/text/icu \
</ins><span class="cx">         -I$(srcdir)/Source/WebCore/platform/win \
</span><span class="cx">         -I$(srcdir)/Source/WebCore/plugins \
</span><span class="cx">         -I$(srcdir)/Source/WebCore/plugins/win \
</span></span></pre></div>
<a id="trunkSourceWebCoreGNUmakefilelistam"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/GNUmakefile.list.am (161816 => 161817)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/GNUmakefile.list.am        2014-01-12 19:15:54 UTC (rev 161816)
+++ trunk/Source/WebCore/GNUmakefile.list.am        2014-01-12 19:24:29 UTC (rev 161817)
</span><span class="lines">@@ -5978,6 +5978,12 @@
</span><span class="cx">         Source/WebCore/platform/soup/SharedBufferSoup.cpp \
</span><span class="cx">         Source/WebCore/platform/text/enchant/TextCheckerEnchant.h \
</span><span class="cx">         Source/WebCore/platform/text/enchant/TextCheckerEnchant.cpp \
</span><ins>+        Source/WebCore/platform/text/icu/UTextProvider.cpp \
+        Source/WebCore/platform/text/icu/UTextProvider.h \
+        Source/WebCore/platform/text/icu/UTextProviderLatin1.cpp \
+        Source/WebCore/platform/text/icu/UTextProviderLatin1.h \
+        Source/WebCore/platform/text/icu/UTextProviderUTF16.cpp \
+        Source/WebCore/platform/text/icu/UTextProviderUTF16.h \
</ins><span class="cx">         Source/WebCore/platform/text/BidiContext.cpp \
</span><span class="cx">         Source/WebCore/platform/text/BidiContext.h \
</span><span class="cx">         Source/WebCore/platform/text/BidiResolver.h \
</span></span></pre></div>
<a id="trunkSourceWebCorePlatformGTKcmake"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/PlatformGTK.cmake (161816 => 161817)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/PlatformGTK.cmake        2014-01-12 19:15:54 UTC (rev 161816)
+++ trunk/Source/WebCore/PlatformGTK.cmake        2014-01-12 19:24:29 UTC (rev 161817)
</span><span class="lines">@@ -20,6 +20,7 @@
</span><span class="cx">     &quot;${WEBCORE_DIR}/platform/network/gtk&quot;
</span><span class="cx">     &quot;${WEBCORE_DIR}/platform/network/soup&quot;
</span><span class="cx">     &quot;${WEBCORE_DIR}/platform/text/gtk&quot;
</span><ins>+    &quot;${WEBCORE_DIR}/platform/text/icu&quot;
</ins><span class="cx">     &quot;${WEBCORE_DIR}/plugins/gtk&quot;
</span><span class="cx"> )
</span><span class="cx"> 
</span><span class="lines">@@ -128,6 +129,9 @@
</span><span class="cx"> 
</span><span class="cx">     platform/soup/SharedBufferSoup.cpp
</span><span class="cx"> 
</span><ins>+    platform/text/icu/UTextProvider.cpp
+    platform/text/icu/UTextProviderLatin1.cpp
+    platform/text/icu/UTextProviderUTF16.cpp
</ins><span class="cx">     platform/text/LocaleICU.cpp
</span><span class="cx">     platform/text/TextBreakIteratorICU.cpp
</span><span class="cx">     platform/text/TextCodecICU.cpp
</span><span class="lines">@@ -255,6 +259,9 @@
</span><span class="cx"> 
</span><span class="cx">     platform/soup/SharedBufferSoup.cpp
</span><span class="cx"> 
</span><ins>+    platform/text/icu/UTextProvider.cpp
+    platform/text/icu/UTextProviderLatin1.cpp
+    platform/text/icu/UTextProviderUTF16.cpp
</ins><span class="cx">     platform/text/LocaleICU.cpp
</span><span class="cx">     platform/text/TextBreakIteratorICU.cpp
</span><span class="cx">     platform/text/TextCodecICU.cpp
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorevcxprojWebCoreCommonprops"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.vcxproj/WebCoreCommon.props (161816 => 161817)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.vcxproj/WebCoreCommon.props        2014-01-12 19:15:54 UTC (rev 161816)
+++ trunk/Source/WebCore/WebCore.vcxproj/WebCoreCommon.props        2014-01-12 19:24:29 UTC (rev 161817)
</span><span class="lines">@@ -7,7 +7,7 @@
</span><span class="cx">   &lt;/PropertyGroup&gt;
</span><span class="cx">   &lt;ItemDefinitionGroup&gt;
</span><span class="cx">     &lt;ClCompile&gt;
</span><del>-      &lt;AdditionalIncludeDirectories&gt;$(ProjectDir)..;$(ProjectDir)..\Modules\mediacontrols;$(ProjectDir)..\Modules\mediastream;$(ProjectDir)..\Modules\filesystem;$(ProjectDir)..\Modules\geolocation;$(ProjectDir)..\Modules\indexeddb;$(ProjectDir)..\Modules\mediasource;$(ProjectDir)..\Modules\navigatorcontentutils;$(ProjectDir)..\Modules\plugins;$(ProjectDir)..\Modules\speech;$(ProjectDir)..\Modules\proximity;$(ProjectDir)..\Modules\quota;$(ProjectDir)..\Modules\notifications;$(ProjectDir)..\Modules\webdatabase;$(ProjectDir)..\Modules\websockets;$(ProjectDir)..\accessibility;$(ProjectDir)..\accessibility\win;$(ProjectDir)..\bridge;$(ProjectDir)..\bridge\c;$(ProjectDir)..\bridge\jsc;$(ProjectDir)..\css;$(ProjectDir)..\editing;$(ProjectDir)..\fileapi;$(ProjectDir)..\rendering;$(ProjectDir)..\rendering\line;$(ProjectDir)..\rendering\mathml;$(ProjectDir)..\rendering\shapes;$(ProjectDir)..\rendering\style;$(ProjectDir)..\rendering\svg;$(ProjectDir)..\bindings;$(ProjectDir)..\bindings\generic;$(ProjectDir)..\bindings\js;$(ProjectDir)..\bindings\js\specialization;$(ProjectDir)..\dom;$(ProjectDir)..\dom\default;$(ProjectDir)..\history;$(ProjectDir)..\html;$(ProjectDir)..\html\canvas;$(ProjectDir)..\html\forms;$(ProjectDir)..\html\parser;$(ProjectDir)..\html\shadow;$(ProjectDir)..\html\track;$(ProjectDir)..\inspector;$(ProjectDir)..\loader;$(ProjectDir)..\loader\appcache;$(ProjectDir)..\loader\archive;$(ProjectDir)..\loader\archive\cf;$(ProjectDir)..\loader\cache;$(ProjectDir)..\loader\icon;$(ProjectDir)..\mathml;$(ProjectDir)..\page;$(ProjectDir)..\page\animation;$(ProjectDir)..\page\scrolling;$(ProjectDir)..\page\win;$(ProjectDir)..\platform;$(ProjectDir)..\platform\animation;$(ProjectDir)..\platform\audio;$(ProjectDir)..\platform\mock;$(ProjectDir)..\platform\sql;$(ProjectDir)..\platform\win;$(ProjectDir)..\platform\network;$(ProjectDir)..\platform\network\win;$(ProjectDir)..\platform\cf;$(ProjectDir)..\platform\graphics;$(ProjectDir)..\platform\graphics\ca;$(ProjectDir)..\platform\graphics\cpu\arm\filters;$(ProjectDir)..\platform\graphics\filters;$(ProjectDir)..\platform\graphics\filters\arm;$(ProjectDir)..\platform\graphics\opentype;$(ProjectDir)..\platform\graphics\transforms;$(ProjectDir)..\platform\text;$(ProjectDir)..\platform\text\transcoder;$(ProjectDir)..\platform\graphics\win;$(ProjectDir)..\xml;$(ProjectDir)..\xml\parser;$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\WebCore\DerivedSources;$(ProjectDir)..\plugins;$(ProjectDir)..\plugins\win;$(ProjectDir)..\svg\animation;$(ProjectDir)..\svg\graphics;$(ProjectDir)..\svg\properties;$(ProjectDir)..\svg\graphics\filters;$(ProjectDir)..\svg;$(ProjectDir)..\testing;$(ProjectDir)..\crypto;$(ProjectDir)..\crypto\keys;$(ProjectDir)..\wml;$(ProjectDir)..\storage;$(ProjectDir)..\style;$(ProjectDir)..\websockets;$(ProjectDir)..\workers;$(ConfigurationBuildDir)\include;$(ConfigurationBuildDir)\include\private;$(ConfigurationBuildDir)\include\JavaScriptCore;$(ConfigurationBuildDir)\include\private\JavaScriptCore;$(ProjectDir)..\ForwardingHeaders;$(ProjectDir)..\platform\graphics\gpu;$(ProjectDir)..\platform\graphics\egl;$(ProjectDir)..\platform\graphics\surfaces;$(ProjectDir)..\platform\graphics\surfaces\egl;$(ProjectDir)..\platform\graphics\opengl;$(WebKit_Libraries)\include;$(WebKit_Libraries)\include\private;$(WebKit_Libraries)\include\private\JavaScriptCore;$(WebKit_Libraries)\include\sqlite;$(WebKit_Libraries)\include\JavaScriptCore;$(WebKit_Libraries)\include\zlib;%(AdditionalIncludeDirectories)&lt;/AdditionalIncludeDirectories&gt;
</del><ins>+      &lt;AdditionalIncludeDirectories&gt;$(ProjectDir)..;$(ProjectDir)..\Modules\mediacontrols;$(ProjectDir)..\Modules\mediastream;$(ProjectDir)..\Modules\filesystem;$(ProjectDir)..\Modules\geolocation;$(ProjectDir)..\Modules\indexeddb;$(ProjectDir)..\Modules\mediasource;$(ProjectDir)..\Modules\navigatorcontentutils;$(ProjectDir)..\Modules\plugins;$(ProjectDir)..\Modules\speech;$(ProjectDir)..\Modules\proximity;$(ProjectDir)..\Modules\quota;$(ProjectDir)..\Modules\notifications;$(ProjectDir)..\Modules\webdatabase;$(ProjectDir)..\Modules\websockets;$(ProjectDir)..\accessibility;$(ProjectDir)..\accessibility\win;$(ProjectDir)..\bridge;$(ProjectDir)..\bridge\c;$(ProjectDir)..\bridge\jsc;$(ProjectDir)..\css;$(ProjectDir)..\editing;$(ProjectDir)..\fileapi;$(ProjectDir)..\rendering;$(ProjectDir)..\rendering\line;$(ProjectDir)..\rendering\mathml;$(ProjectDir)..\rendering\shapes;$(ProjectDir)..\rendering\style;$(ProjectDir)..\rendering\svg;$(ProjectDir)..\bindings;$(ProjectDir)..\bindings\generic;$(ProjectDir)..\bindings\js;$(ProjectDir)..\bindings\js\specialization;$(ProjectDir)..\dom;$(ProjectDir)..\dom\default;$(ProjectDir)..\history;$(ProjectDir)..\html;$(ProjectDir)..\html\canvas;$(ProjectDir)..\html\forms;$(ProjectDir)..\html\parser;$(ProjectDir)..\html\shadow;$(ProjectDir)..\html\track;$(ProjectDir)..\inspector;$(ProjectDir)..\loader;$(ProjectDir)..\loader\appcache;$(ProjectDir)..\loader\archive;$(ProjectDir)..\loader\archive\cf;$(ProjectDir)..\loader\cache;$(ProjectDir)..\loader\icon;$(ProjectDir)..\mathml;$(ProjectDir)..\page;$(ProjectDir)..\page\animation;$(ProjectDir)..\page\scrolling;$(ProjectDir)..\page\win;$(ProjectDir)..\platform;$(ProjectDir)..\platform\animation;$(ProjectDir)..\platform\audio;$(ProjectDir)..\platform\mock;$(ProjectDir)..\platform\sql;$(ProjectDir)..\platform\win;$(ProjectDir)..\platform\network;$(ProjectDir)..\platform\network\win;$(ProjectDir)..\platform\cf;$(ProjectDir)..\platform\graphics;$(ProjectDir)..\platform\graphics\ca;$(ProjectDir)..\platform\graphics\cpu\arm\filters;$(ProjectDir)..\platform\graphics\filters;$(ProjectDir)..\platform\graphics\filters\arm;$(ProjectDir)..\platform\graphics\opentype;$(ProjectDir)..\platform\graphics\transforms;$(ProjectDir)..\platform\text;$(ProjectDir)..\platform\text\icu;$(ProjectDir)..\platform\text\transcoder;$(ProjectDir)..\platform\graphics\win;$(ProjectDir)..\xml;$(ProjectDir)..\xml\parser;$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\WebCore\DerivedSources;$(ProjectDir)..\plugins;$(ProjectDir)..\plugins\win;$(ProjectDir)..\svg\animation;$(ProjectDir)..\svg\graphics;$(ProjectDir)..\svg\properties;$(ProjectDir)..\svg\graphics\filters;$(ProjectDir)..\svg;$(ProjectDir)..\testing;$(ProjectDir)..\crypto;$(ProjectDir)..\crypto\keys;$(ProjectDir)..\wml;$(ProjectDir)..\storage;$(ProjectDir)..\style;$(ProjectDir)..\websockets;$(ProjectDir)..\workers;$(ConfigurationBuildDir)\include;$(ConfigurationBuildDir)\include\private;$(ConfigurationBuildDir)\include\JavaScriptCore;$(ConfigurationBuildDir)\include\private\JavaScriptCore;$(ProjectDir)..\ForwardingHeaders;$(ProjectDir)..\platform\graphics\gpu;$(ProjectDir)..\platform\graphics\egl;$(ProjectDir)..\platform\graphics\surfaces;$(ProjectDir)..\platform\graphics\surfaces\egl;$(ProjectDir)..\platform\graphics\opengl;$(WebKit_Libraries)\include;$(WebKit_Libraries)\include\private;$(WebKit_Libraries)\include\private\JavaScriptCore;$(WebKit_Libraries)\include\sqlite;$(WebKit_Libraries)\include\JavaScriptCore;$(WebKit_Libraries)\include\zlib;%(AdditionalIncludeDirectories)&lt;/AdditionalIncludeDirectories&gt;
</ins><span class="cx">       &lt;PreprocessorDefinitions&gt;DISABLE_3D_RENDERING;WEBCORE_CONTEXT_MENUS;%(PreprocessorDefinitions)&lt;/PreprocessorDefinitions&gt;
</span><span class="cx">       &lt;PrecompiledHeader&gt;Use&lt;/PrecompiledHeader&gt;
</span><span class="cx">       &lt;PrecompiledHeaderFile&gt;WebCorePrefix.h&lt;/PrecompiledHeaderFile&gt;
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorevcxprojcopyForwardingHeaderscmd"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.vcxproj/copyForwardingHeaders.cmd (161816 => 161817)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.vcxproj/copyForwardingHeaders.cmd        2014-01-12 19:15:54 UTC (rev 161816)
+++ trunk/Source/WebCore/WebCore.vcxproj/copyForwardingHeaders.cmd        2014-01-12 19:24:29 UTC (rev 161817)
</span><span class="lines">@@ -58,6 +58,7 @@
</span><span class="cx"> xcopy /y /d &quot;%ProjectDir%..\platform\graphics\opentype\*.h&quot; &quot;%CONFIGURATIONBUILDDIR%\include\WebCore&quot;
</span><span class="cx"> xcopy /y /d &quot;%ProjectDir%..\platform\mock\*.h&quot; &quot;%CONFIGURATIONBUILDDIR%\include\WebCore&quot;
</span><span class="cx"> xcopy /y /d &quot;%ProjectDir%..\platform\text\*.h&quot; &quot;%CONFIGURATIONBUILDDIR%\include\WebCore&quot;
</span><ins>+xcopy /y /d &quot;%ProjectDir%..\platform\text\icu\*.h&quot; &quot;%CONFIGURATIONBUILDDIR%\include\WebCore&quot;
</ins><span class="cx"> xcopy /y /d &quot;%ProjectDir%..\platform\text\transcoder\*.h&quot; &quot;%CONFIGURATIONBUILDDIR%\include\WebCore&quot;
</span><span class="cx"> xcopy /y /d &quot;%ProjectDir%..\platform\win\*.h&quot; &quot;%CONFIGURATIONBUILDDIR%\include\WebCore&quot;
</span><span class="cx"> xcopy /y /d &quot;%ProjectDir%..\platform\network\*.h&quot; &quot;%CONFIGURATIONBUILDDIR%\include\WebCore&quot;
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (161816 => 161817)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2014-01-12 19:15:54 UTC (rev 161816)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2014-01-12 19:24:29 UTC (rev 161817)
</span><span class="lines">@@ -2293,6 +2293,12 @@
</span><span class="cx">                 7C522D4B15B477E8009B7C95 /* InspectorOverlay.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C522D4915B477E8009B7C95 /* InspectorOverlay.cpp */; };
</span><span class="cx">                 7C5343FC17B74B63004232F0 /* JSMediaQueryListListener.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C5343FA17B74B63004232F0 /* JSMediaQueryListListener.cpp */; };
</span><span class="cx">                 7C5343FD17B74B63004232F0 /* JSMediaQueryListListener.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C5343FB17B74B63004232F0 /* JSMediaQueryListListener.h */; };
</span><ins>+                7C74D43318823A9300E5ED57 /* UTextProviderLatin1.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C74D43118823A9300E5ED57 /* UTextProviderLatin1.cpp */; };
+                7C74D43418823A9300E5ED57 /* UTextProviderLatin1.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C74D43218823A9300E5ED57 /* UTextProviderLatin1.h */; };
+                7C74D43718823B1900E5ED57 /* UTextProvider.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C74D43518823B1900E5ED57 /* UTextProvider.cpp */; };
+                7C74D43818823B1900E5ED57 /* UTextProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C74D43618823B1900E5ED57 /* UTextProvider.h */; };
+                7C74D43B1882400400E5ED57 /* UTextProviderUTF16.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C74D4391882400400E5ED57 /* UTextProviderUTF16.cpp */; };
+                7C74D43C1882400400E5ED57 /* UTextProviderUTF16.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C74D43A1882400400E5ED57 /* UTextProviderUTF16.h */; };
</ins><span class="cx">                 7CC7E3D717208C0F003C5277 /* IDNScriptWhiteList.txt in Resources */ = {isa = PBXBuildFile; fileRef = 7CC7E3D617208C0F003C5277 /* IDNScriptWhiteList.txt */; };
</span><span class="cx">                 7CE6CBFB187F370700D46BF5 /* FormatConverter.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CE6CBFA187F370700D46BF5 /* FormatConverter.h */; };
</span><span class="cx">                 7CE6CBFD187F394900D46BF5 /* FormatConverter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CE6CBFC187F394900D46BF5 /* FormatConverter.cpp */; };
</span><span class="lines">@@ -9266,6 +9272,12 @@
</span><span class="cx">                 7C6136F71710C35200FF4A57 /* InFilesCompiler.pm */ = {isa = PBXFileReference; lastKnownFileType = text.script.perl; name = InFilesCompiler.pm; path = scripts/InFilesCompiler.pm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 7C6136F81710C35200FF4A57 /* InFilesParser.pm */ = {isa = PBXFileReference; lastKnownFileType = text.script.perl; name = InFilesParser.pm; path = scripts/InFilesParser.pm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 7C6136F91710C35200FF4A57 /* StaticString.pm */ = {isa = PBXFileReference; lastKnownFileType = text.script.perl; name = StaticString.pm; path = scripts/StaticString.pm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                7C74D43118823A9300E5ED57 /* UTextProviderLatin1.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UTextProviderLatin1.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                7C74D43218823A9300E5ED57 /* UTextProviderLatin1.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UTextProviderLatin1.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                7C74D43518823B1900E5ED57 /* UTextProvider.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UTextProvider.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                7C74D43618823B1900E5ED57 /* UTextProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UTextProvider.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                7C74D4391882400400E5ED57 /* UTextProviderUTF16.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UTextProviderUTF16.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                7C74D43A1882400400E5ED57 /* UTextProviderUTF16.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UTextProviderUTF16.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 7CC7E3D617208C0F003C5277 /* IDNScriptWhiteList.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = IDNScriptWhiteList.txt; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 7CE6CBFA187F370700D46BF5 /* FormatConverter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FormatConverter.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 7CE6CBFC187F394900D46BF5 /* FormatConverter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FormatConverter.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -16273,6 +16285,19 @@
</span><span class="cx">                         tabWidth = 4;
</span><span class="cx">                         usesTabs = 0;
</span><span class="cx">                 };
</span><ins>+                7C74D43018823A4200E5ED57 /* icu */ = {
+                        isa = PBXGroup;
+                        children = (
+                                7C74D43118823A9300E5ED57 /* UTextProviderLatin1.cpp */,
+                                7C74D43218823A9300E5ED57 /* UTextProviderLatin1.h */,
+                                7C74D4391882400400E5ED57 /* UTextProviderUTF16.cpp */,
+                                7C74D43A1882400400E5ED57 /* UTextProviderUTF16.h */,
+                                7C74D43518823B1900E5ED57 /* UTextProvider.cpp */,
+                                7C74D43618823B1900E5ED57 /* UTextProvider.h */,
+                        );
+                        path = icu;
+                        sourceTree = &quot;&lt;group&gt;&quot;;
+                };
</ins><span class="cx">                 7E474E1912494DA900235364 /* ios */ = {
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><span class="lines">@@ -20014,6 +20039,7 @@
</span><span class="cx">                                 B2B264590D00A77E000ACC1D /* cf */,
</span><span class="cx">                                 A516E8B2136E04C00076C3C0 /* ios */,
</span><span class="cx">                                 B2C3D9F90D006C1D00EF6F26 /* mac */,
</span><ins>+                                7C74D43018823A4200E5ED57 /* icu */,
</ins><span class="cx">                                 37C61F0012095C87007A3C67 /* AtomicStringKeyedMRUCache.h */,
</span><span class="cx">                                 B2C3D9F20D006C1D00EF6F26 /* BidiContext.cpp */,
</span><span class="cx">                                 B2C3D9F30D006C1D00EF6F26 /* BidiContext.h */,
</span><span class="lines">@@ -25190,10 +25216,12 @@
</span><span class="cx">                                 D0A3A7311405A39800FB8ED3 /* ResourceLoaderOptions.h in Headers */,
</span><span class="cx">                                 51AF503616F100F60095B2E8 /* ResourceLoaderTypes.h in Headers */,
</span><span class="cx">                                 973E325710883B7C005BC493 /* ResourceLoadNotifier.h in Headers */,
</span><ins>+                                7C74D43418823A9300E5ED57 /* UTextProviderLatin1.h in Headers */,
</ins><span class="cx">                                 E4295FA412B0614E00D1ACE0 /* ResourceLoadPriority.h in Headers */,
</span><span class="cx">                                 D0CE58F9125E4CC200F3F199 /* ResourceLoadScheduler.h in Headers */,
</span><span class="cx">                                 07C59B7617F7D0DB000FBCBB /* CapabilityRange.h in Headers */,
</span><span class="cx">                                 8A81BF8511DCFD9000DA2B98 /* ResourceLoadTiming.h in Headers */,
</span><ins>+                                7C74D43818823B1900E5ED57 /* UTextProvider.h in Headers */,
</ins><span class="cx">                                 7EE6846D12D26E3800E79415 /* ResourceRequest.h in Headers */,
</span><span class="cx">                                 514C767D0CE923A1007EF3CD /* ResourceRequestBase.h in Headers */,
</span><span class="cx">                                 07969DB817D14151007FF842 /* JSRTCIceCandidateEvent.h in Headers */,
</span><span class="lines">@@ -25426,6 +25454,7 @@
</span><span class="cx">                                 BCEF444A0E6745E0001C1287 /* StyleGeneratedImage.h in Headers */,
</span><span class="cx">                                 A10DC76B14747BAB005E2471 /* StyleGridData.h in Headers */,
</span><span class="cx">                                 A110DB9B14F5DF7700A03B93 /* StyleGridItemData.h in Headers */,
</span><ins>+                                7C74D43C1882400400E5ED57 /* UTextProviderUTF16.h in Headers */,
</ins><span class="cx">                                 BCEF43CF0E673DA1001C1287 /* StyleImage.h in Headers */,
</span><span class="cx">                                 BC2273040E82F1E600E7F975 /* StyleInheritedData.h in Headers */,
</span><span class="cx">                                 E47127CB163438AE00ED6F5A /* StyleInvalidationAnalysis.h in Headers */,
</span><span class="lines">@@ -26728,6 +26757,7 @@
</span><span class="cx">                                 FE16CFD5169D1DED00D3A0C7 /* DatabaseBackendSync.cpp in Sources */,
</span><span class="cx">                                 FEBC5F3116BD0CC300659BD3 /* DatabaseBase.cpp in Sources */,
</span><span class="cx">                                 97BC6A271505F081001B74AC /* DatabaseContext.cpp in Sources */,
</span><ins>+                                7C74D43318823A9300E5ED57 /* UTextProviderLatin1.cpp in Sources */,
</ins><span class="cx">                                 FE456F181677D74E005EDDF9 /* DatabaseManager.cpp in Sources */,
</span><span class="cx">                                 FEB26D28167A8F2A00FDD26B /* DatabaseServer.cpp in Sources */,
</span><span class="cx">                                 FEDEF84116797108000E444A /* DatabaseStrategy.cpp in Sources */,
</span><span class="lines">@@ -26838,6 +26868,7 @@
</span><span class="cx">                                 0783228418013ED800999E0C /* MediaStreamAudioSource.cpp in Sources */,
</span><span class="cx">                                 2D9A247315B9C2D100D34527 /* DOMDOMSecurityPolicy.mm in Sources */,
</span><span class="cx">                                 7694565C1214DB630007CBAE /* DOMDOMTokenList.mm in Sources */,
</span><ins>+                                7C74D43B1882400400E5ED57 /* UTextProviderUTF16.cpp in Sources */,
</ins><span class="cx">                                 7AABA25914BC613300AA9A11 /* DOMEditor.cpp in Sources */,
</span><span class="cx">                                 85ACA9C10A9B5FA500671E90 /* DOMElement.mm in Sources */,
</span><span class="cx">                                 85CA96B90A9621A600690CCF /* DOMEntity.mm in Sources */,
</span><span class="lines">@@ -28949,6 +28980,7 @@
</span><span class="cx">                                 078E090A17D14CEE00420AA1 /* RTCIceCandidateEvent.cpp in Sources */,
</span><span class="cx">                                 A14832C8187F673F00DA63A6 /* WebCoreThread.mm in Sources */,
</span><span class="cx">                                 B2227AC40D00BF220071B782 /* SVGTests.cpp in Sources */,
</span><ins>+                                7C74D43718823B1900E5ED57 /* UTextProvider.cpp in Sources */,
</ins><span class="cx">                                 B2227AC70D00BF220071B782 /* SVGTextContentElement.cpp in Sources */,
</span><span class="cx">                                 07969DBB17D14151007FF842 /* JSRTCSessionDescription.cpp in Sources */,
</span><span class="cx">                                 B2227ACA0D00BF220071B782 /* SVGTextElement.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformtextTextAllInOnecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/text/TextAllInOne.cpp (161816 => 161817)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/text/TextAllInOne.cpp        2014-01-12 19:15:54 UTC (rev 161816)
+++ trunk/Source/WebCore/platform/text/TextAllInOne.cpp        2014-01-12 19:24:29 UTC (rev 161817)
</span><span class="lines">@@ -38,3 +38,6 @@
</span><span class="cx"> #include &quot;TextEncodingDetectorICU.cpp&quot;
</span><span class="cx"> #include &quot;TextEncodingRegistry.cpp&quot;
</span><span class="cx"> #include &quot;TextStream.cpp&quot;
</span><ins>+#include &quot;UTextProvider.cpp&quot;
+#include &quot;UTextProviderLatin1.cpp&quot;
+#include &quot;UTextProviderUTF16.cpp&quot;
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformtextTextBreakIteratorICUcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/text/TextBreakIteratorICU.cpp (161816 => 161817)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/text/TextBreakIteratorICU.cpp        2014-01-12 19:15:54 UTC (rev 161816)
+++ trunk/Source/WebCore/platform/text/TextBreakIteratorICU.cpp        2014-01-12 19:24:29 UTC (rev 161817)
</span><span class="lines">@@ -23,6 +23,8 @@
</span><span class="cx"> #include &quot;TextBreakIterator.h&quot;
</span><span class="cx"> 
</span><span class="cx"> #include &quot;LineBreakIteratorPoolICU.h&quot;
</span><ins>+#include &quot;UTextProviderLatin1.h&quot;
+#include &quot;UTextProviderUTF16.h&quot;
</ins><span class="cx"> #include &lt;wtf/Atomics.h&gt;
</span><span class="cx"> #include &lt;wtf/text/WTFString.h&gt;
</span><span class="cx"> 
</span><span class="lines">@@ -30,8 +32,7 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-static TextBreakIterator* setUpIterator(bool&amp; createdIterator, TextBreakIterator*&amp; iterator,
-    UBreakIteratorType type, const UChar* string, int length)
</del><ins>+static TextBreakIterator* setUpIterator(bool&amp; createdIterator, TextBreakIterator*&amp; iterator, UBreakIteratorType type, const UChar* string, int length)
</ins><span class="cx"> {
</span><span class="cx">     if (!string)
</span><span class="cx">         return 0;
</span><span class="lines">@@ -53,373 +54,11 @@
</span><span class="cx">     return iterator;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-enum TextContext { NoContext, PriorContext, PrimaryContext };
-
-const int textBufferCapacity = 16;
-
-typedef struct {
-    UText text;
-    UChar buffer[textBufferCapacity];
-} UTextWithBuffer;
-
-static inline int64_t textPinIndex(int64_t&amp; index, int64_t limit)
-{
-    if (index &lt; 0)
-        index = 0;
-    else if (index &gt; limit)
-        index = limit;
-    return index;
-}
-
-static inline int64_t textNativeLength(UText* text)
-{
-    return text-&gt;a + text-&gt;b;
-}
-
-// Relocate pointer from source into destination as required.
-static void textFixPointer(const UText* source, UText* destination, const void*&amp; pointer)
-{
-    if (pointer &gt;= source-&gt;pExtra &amp;&amp; pointer &lt; static_cast&lt;char*&gt;(source-&gt;pExtra) + source-&gt;extraSize) {
-        // Pointer references source extra buffer.
-        pointer = static_cast&lt;char*&gt;(destination-&gt;pExtra) + (static_cast&lt;const char*&gt;(pointer) - static_cast&lt;const char*&gt;(source-&gt;pExtra));
-    } else if (pointer &gt;= source &amp;&amp; pointer &lt; reinterpret_cast&lt;const char*&gt;(source) + source-&gt;sizeOfStruct) {
-        // Pointer references source text structure, but not source extra buffer.
-        pointer = reinterpret_cast&lt;char*&gt;(destination) + (static_cast&lt;const char*&gt;(pointer) - reinterpret_cast&lt;const char*&gt;(source));
-    }
-}
-
-static UText* textClone(UText* destination, const UText* source, UBool deep, UErrorCode* status)
-{
-    ASSERT_UNUSED(deep, !deep);
-    if (U_FAILURE(*status))
-        return 0;
-    int32_t extraSize = source-&gt;extraSize;
-    destination = utext_setup(destination, extraSize, status);
-    if (U_FAILURE(*status))
-        return destination;
-    void* extraNew = destination-&gt;pExtra;
-    int32_t flags = destination-&gt;flags;
-    int sizeToCopy = std::min(source-&gt;sizeOfStruct, destination-&gt;sizeOfStruct);
-    memcpy(destination, source, sizeToCopy);
-    destination-&gt;pExtra = extraNew;
-    destination-&gt;flags = flags;
-    memcpy(destination-&gt;pExtra, source-&gt;pExtra, extraSize);
-    textFixPointer(source, destination, destination-&gt;context);
-    textFixPointer(source, destination, destination-&gt;p);
-    textFixPointer(source, destination, destination-&gt;q);
-    ASSERT(!destination-&gt;r);
-    const void * chunkContents = static_cast&lt;const void*&gt;(destination-&gt;chunkContents);
-    textFixPointer(source, destination, chunkContents);
-    destination-&gt;chunkContents = static_cast&lt;const UChar*&gt;(chunkContents);
-    return destination;
-}
-
-static int32_t textExtract(UText* text, int64_t start, int64_t limit, UChar* destination, int32_t destinationCapacity, UErrorCode* errorCode)
-{
-    UNUSED_PARAM(text);
-    UNUSED_PARAM(start);
-    UNUSED_PARAM(limit);
-    UNUSED_PARAM(destination);
-    UNUSED_PARAM(destinationCapacity);
-    // In the present context, this text provider is used only with ICU functions
-    // that do not perform an extract operation.
-    ASSERT_NOT_REACHED();
-    *errorCode = U_UNSUPPORTED_ERROR;
-    return 0;
-}
-
-static void textClose(UText* text)
-{
-    text-&gt;context = 0;
-}
-
-static inline TextContext textGetContext(const UText* text, int64_t nativeIndex, UBool forward)
-{
-    if (!text-&gt;b || nativeIndex &gt; text-&gt;b)
-        return PrimaryContext;
-    if (nativeIndex == text-&gt;b)
-        return forward ? PrimaryContext : PriorContext;
-    return PriorContext;
-}
-
-static inline TextContext textLatin1GetCurrentContext(const UText* text)
-{
-    if (!text-&gt;chunkContents)
-        return NoContext;
-    return text-&gt;chunkContents == text-&gt;pExtra ? PrimaryContext : PriorContext;
-}
-
-static void textLatin1MoveInPrimaryContext(UText* text, int64_t nativeIndex, int64_t nativeLength, UBool forward)
-{
-    ASSERT(text-&gt;chunkContents == text-&gt;pExtra);
-    if (forward) {
-        ASSERT(nativeIndex &gt;= text-&gt;b &amp;&amp; nativeIndex &lt; nativeLength);
-        text-&gt;chunkNativeStart = nativeIndex;
-        text-&gt;chunkNativeLimit = nativeIndex + text-&gt;extraSize / sizeof(UChar);
-        if (text-&gt;chunkNativeLimit &gt; nativeLength)
-            text-&gt;chunkNativeLimit = nativeLength;
-    } else {
-        ASSERT(nativeIndex &gt; text-&gt;b &amp;&amp; nativeIndex &lt;= nativeLength);
-        text-&gt;chunkNativeLimit = nativeIndex;
-        text-&gt;chunkNativeStart = nativeIndex - text-&gt;extraSize / sizeof(UChar);
-        if (text-&gt;chunkNativeStart &lt; text-&gt;b)
-            text-&gt;chunkNativeStart = text-&gt;b;
-    }
-    int64_t length = text-&gt;chunkNativeLimit - text-&gt;chunkNativeStart;
-    // Ensure chunk length is well defined if computed length exceeds int32_t range.
-    ASSERT(length &lt; std::numeric_limits&lt;int32_t&gt;::max());
-    text-&gt;chunkLength = length &lt; std::numeric_limits&lt;int32_t&gt;::max() ? static_cast&lt;int32_t&gt;(length) : 0;
-    text-&gt;nativeIndexingLimit = text-&gt;chunkLength;
-    text-&gt;chunkOffset = forward ? 0 : text-&gt;chunkLength;
-    StringImpl::copyChars(const_cast&lt;UChar*&gt;(text-&gt;chunkContents), static_cast&lt;const LChar*&gt;(text-&gt;p) + (text-&gt;chunkNativeStart - text-&gt;b), static_cast&lt;unsigned&gt;(text-&gt;chunkLength));
-}
-
-static void textLatin1SwitchToPrimaryContext(UText* text, int64_t nativeIndex, int64_t nativeLength, UBool forward)
-{
-    ASSERT(!text-&gt;chunkContents || text-&gt;chunkContents == text-&gt;q);
-    text-&gt;chunkContents = static_cast&lt;const UChar*&gt;(text-&gt;pExtra);
-    textLatin1MoveInPrimaryContext(text, nativeIndex, nativeLength, forward);
-}
-
-static void textLatin1MoveInPriorContext(UText* text, int64_t nativeIndex, int64_t nativeLength, UBool forward)
-{
-    ASSERT(text-&gt;chunkContents == text-&gt;q);
-    ASSERT(forward ? nativeIndex &lt; text-&gt;b : nativeIndex &lt;= text-&gt;b);
-    ASSERT_UNUSED(nativeLength, forward ? nativeIndex &lt; nativeLength : nativeIndex &lt;= nativeLength);
-    ASSERT_UNUSED(forward, forward ? nativeIndex &lt; nativeLength : nativeIndex &lt;= nativeLength);
-    text-&gt;chunkNativeStart = 0;
-    text-&gt;chunkNativeLimit = text-&gt;b;
-    text-&gt;chunkLength = text-&gt;b;
-    text-&gt;nativeIndexingLimit = text-&gt;chunkLength;
-    int64_t offset = nativeIndex - text-&gt;chunkNativeStart;
-    // Ensure chunk offset is well defined if computed offset exceeds int32_t range or chunk length.
-    ASSERT(offset &lt; std::numeric_limits&lt;int32_t&gt;::max());
-    text-&gt;chunkOffset = std::min(offset &lt; std::numeric_limits&lt;int32_t&gt;::max() ? static_cast&lt;int32_t&gt;(offset) : 0, text-&gt;chunkLength);
-}
-
-static void textLatin1SwitchToPriorContext(UText* text, int64_t nativeIndex, int64_t nativeLength, UBool forward)
-{
-    ASSERT(!text-&gt;chunkContents || text-&gt;chunkContents == text-&gt;pExtra);
-    text-&gt;chunkContents = static_cast&lt;const UChar*&gt;(text-&gt;q);
-    textLatin1MoveInPriorContext(text, nativeIndex, nativeLength, forward);
-}
-
-static inline bool textInChunkOrOutOfRange(UText* text, int64_t nativeIndex, int64_t nativeLength, UBool forward, UBool&amp; isAccessible)
-{
-    if (forward) {
-        if (nativeIndex &gt;= text-&gt;chunkNativeStart &amp;&amp; nativeIndex &lt; text-&gt;chunkNativeLimit) {
-            int64_t offset = nativeIndex - text-&gt;chunkNativeStart;
-            // Ensure chunk offset is well formed if computed offset exceeds int32_t range.
-            ASSERT(offset &lt; std::numeric_limits&lt;int32_t&gt;::max());
-            text-&gt;chunkOffset = offset &lt; std::numeric_limits&lt;int32_t&gt;::max() ? static_cast&lt;int32_t&gt;(offset) : 0;
-            isAccessible = TRUE;
-            return true;
-        }
-        if (nativeIndex &gt;= nativeLength &amp;&amp; text-&gt;chunkNativeLimit == nativeLength) {
-            text-&gt;chunkOffset = text-&gt;chunkLength;
-            isAccessible = FALSE;
-            return true;
-        }
-    } else {
-        if (nativeIndex &gt; text-&gt;chunkNativeStart &amp;&amp; nativeIndex &lt;= text-&gt;chunkNativeLimit) {
-            int64_t offset = nativeIndex - text-&gt;chunkNativeStart;
-            // Ensure chunk offset is well formed if computed offset exceeds int32_t range.
-            ASSERT(offset &lt; std::numeric_limits&lt;int32_t&gt;::max());
-            text-&gt;chunkOffset = offset &lt; std::numeric_limits&lt;int32_t&gt;::max() ? static_cast&lt;int32_t&gt;(offset) : 0;
-            isAccessible = TRUE;
-            return true;
-        }
-        if (nativeIndex &lt;= 0 &amp;&amp; !text-&gt;chunkNativeStart) {
-            text-&gt;chunkOffset = 0;
-            isAccessible = FALSE;
-            return true;
-        }
-    }
-    return false;
-}
-
-static UBool textLatin1Access(UText* text, int64_t nativeIndex, UBool forward)
-{
-    if (!text-&gt;context)
-        return FALSE;
-    int64_t nativeLength = textNativeLength(text);
-    UBool isAccessible;
-    if (textInChunkOrOutOfRange(text, nativeIndex, nativeLength, forward, isAccessible))
-        return isAccessible;
-    nativeIndex = textPinIndex(nativeIndex, nativeLength);
-    TextContext currentContext = textLatin1GetCurrentContext(text);
-    TextContext newContext = textGetContext(text, nativeIndex, forward);
-    ASSERT(newContext != NoContext);
-    if (newContext == currentContext) {
-        if (currentContext == PrimaryContext)
-            textLatin1MoveInPrimaryContext(text, nativeIndex, nativeLength, forward);
-        else
-            textLatin1MoveInPriorContext(text, nativeIndex, nativeLength, forward);
-    } else if (newContext == PrimaryContext)
-        textLatin1SwitchToPrimaryContext(text, nativeIndex, nativeLength, forward);
-    else {
-        ASSERT(newContext == PriorContext);
-        textLatin1SwitchToPriorContext(text, nativeIndex, nativeLength, forward);
-    }
-    return TRUE;
-}
-
-static const struct UTextFuncs textLatin1Funcs = {
-    sizeof(UTextFuncs),
-    0, 0, 0,
-    textClone,
-    textNativeLength,
-    textLatin1Access,
-    textExtract,
-    0, 0, 0, 0,
-    textClose,
-    0, 0, 0,
-};
-
-static void textInit(UText* text, const UTextFuncs* funcs, const void* string, unsigned length, const UChar* priorContext, int priorContextLength)
-{
-    text-&gt;pFuncs = funcs;
-    text-&gt;providerProperties = 1 &lt;&lt; UTEXT_PROVIDER_STABLE_CHUNKS;
-    text-&gt;context = string;
-    text-&gt;p = string;
-    text-&gt;a = length;
-    text-&gt;q = priorContext;
-    text-&gt;b = priorContextLength;
-}
-
-static UText* textOpenLatin1(UTextWithBuffer* utWithBuffer, const LChar* string, unsigned length, const UChar* priorContext, int priorContextLength, UErrorCode* status)
-{
-    if (U_FAILURE(*status))
-        return 0;
-    if (!string || length &gt; static_cast&lt;unsigned&gt;(std::numeric_limits&lt;int32_t&gt;::max())) {
-        *status = U_ILLEGAL_ARGUMENT_ERROR;
-        return 0;
-    }
-    UText* text = utext_setup(&amp;utWithBuffer-&gt;text, sizeof(utWithBuffer-&gt;buffer), status);
-    if (U_FAILURE(*status)) {
-        ASSERT(!text);
-        return 0;
-    }
-    textInit(text, &amp;textLatin1Funcs, string, length, priorContext, priorContextLength);
-    return text;
-}
-
-static inline TextContext textUTF16GetCurrentContext(const UText* text)
-{
-    if (!text-&gt;chunkContents)
-        return NoContext;
-    return text-&gt;chunkContents == text-&gt;p ? PrimaryContext : PriorContext;
-}
-
-static void textUTF16MoveInPrimaryContext(UText* text, int64_t nativeIndex, int64_t nativeLength, UBool forward)
-{
-    ASSERT(text-&gt;chunkContents == text-&gt;p);
-    ASSERT_UNUSED(forward, forward ? nativeIndex &gt;= text-&gt;b : nativeIndex &gt; text-&gt;b);
-    ASSERT_UNUSED(forward, forward ? nativeIndex &lt; nativeLength : nativeIndex &lt;= nativeLength);
-    text-&gt;chunkNativeStart = text-&gt;b;
-    text-&gt;chunkNativeLimit = nativeLength;
-    int64_t length = text-&gt;chunkNativeLimit - text-&gt;chunkNativeStart;
-    // Ensure chunk length is well defined if computed length exceeds int32_t range.
-    ASSERT(length &lt; std::numeric_limits&lt;int32_t&gt;::max());
-    text-&gt;chunkLength = length &lt; std::numeric_limits&lt;int32_t&gt;::max() ? static_cast&lt;int32_t&gt;(length) : 0;
-    text-&gt;nativeIndexingLimit = text-&gt;chunkLength;
-    int64_t offset = nativeIndex - text-&gt;chunkNativeStart;
-    // Ensure chunk offset is well defined if computed offset exceeds int32_t range or chunk length.
-    ASSERT(offset &lt; std::numeric_limits&lt;int32_t&gt;::max());
-    text-&gt;chunkOffset = std::min(offset &lt; std::numeric_limits&lt;int32_t&gt;::max() ? static_cast&lt;int32_t&gt;(offset) : 0, text-&gt;chunkLength);
-}
-
-static void textUTF16SwitchToPrimaryContext(UText* text, int64_t nativeIndex, int64_t nativeLength, UBool forward)
-{
-    ASSERT(!text-&gt;chunkContents || text-&gt;chunkContents == text-&gt;q);
-    text-&gt;chunkContents = static_cast&lt;const UChar*&gt;(text-&gt;p);
-    textUTF16MoveInPrimaryContext(text, nativeIndex, nativeLength, forward);
-}
-
-static void textUTF16MoveInPriorContext(UText* text, int64_t nativeIndex, int64_t nativeLength, UBool forward)
-{
-    ASSERT(text-&gt;chunkContents == text-&gt;q);
-    ASSERT(forward ? nativeIndex &lt; text-&gt;b : nativeIndex &lt;= text-&gt;b);
-    ASSERT_UNUSED(nativeLength, forward ? nativeIndex &lt; nativeLength : nativeIndex &lt;= nativeLength);
-    ASSERT_UNUSED(forward, forward ? nativeIndex &lt; nativeLength : nativeIndex &lt;= nativeLength);
-    text-&gt;chunkNativeStart = 0;
-    text-&gt;chunkNativeLimit = text-&gt;b;
-    text-&gt;chunkLength = text-&gt;b;
-    text-&gt;nativeIndexingLimit = text-&gt;chunkLength;
-    int64_t offset = nativeIndex - text-&gt;chunkNativeStart;
-    // Ensure chunk offset is well defined if computed offset exceeds int32_t range or chunk length.
-    ASSERT(offset &lt; std::numeric_limits&lt;int32_t&gt;::max());
-    text-&gt;chunkOffset = std::min(offset &lt; std::numeric_limits&lt;int32_t&gt;::max() ? static_cast&lt;int32_t&gt;(offset) : 0, text-&gt;chunkLength);
-}
-
-static void textUTF16SwitchToPriorContext(UText* text, int64_t nativeIndex, int64_t nativeLength, UBool forward)
-{
-    ASSERT(!text-&gt;chunkContents || text-&gt;chunkContents == text-&gt;p);
-    text-&gt;chunkContents = static_cast&lt;const UChar*&gt;(text-&gt;q);
-    textUTF16MoveInPriorContext(text, nativeIndex, nativeLength, forward);
-}
-
-static UBool textUTF16Access(UText* text, int64_t nativeIndex, UBool forward)
-{
-    if (!text-&gt;context)
-        return FALSE;
-    int64_t nativeLength = textNativeLength(text);
-    UBool isAccessible;
-    if (textInChunkOrOutOfRange(text, nativeIndex, nativeLength, forward, isAccessible))
-        return isAccessible;
-    nativeIndex = textPinIndex(nativeIndex, nativeLength);
-    TextContext currentContext = textUTF16GetCurrentContext(text);
-    TextContext newContext = textGetContext(text, nativeIndex, forward);
-    ASSERT(newContext != NoContext);
-    if (newContext == currentContext) {
-        if (currentContext == PrimaryContext)
-            textUTF16MoveInPrimaryContext(text, nativeIndex, nativeLength, forward);
-        else
-            textUTF16MoveInPriorContext(text, nativeIndex, nativeLength, forward);
-    } else if (newContext == PrimaryContext)
-        textUTF16SwitchToPrimaryContext(text, nativeIndex, nativeLength, forward);
-    else {
-        ASSERT(newContext == PriorContext);
-        textUTF16SwitchToPriorContext(text, nativeIndex, nativeLength, forward);
-    }
-    return TRUE;
-}
-
-static const struct UTextFuncs textUTF16Funcs = {
-    sizeof(UTextFuncs),
-    0, 0, 0,
-    textClone,
-    textNativeLength,
-    textUTF16Access,
-    textExtract,
-    0, 0, 0, 0,
-    textClose,
-    0, 0, 0,
-};
-
-static UText* textOpenUTF16(UText* text, const UChar* string, unsigned length, const UChar* priorContext, int priorContextLength, UErrorCode* status)
-{
-    if (U_FAILURE(*status))
-        return 0;
-    if (!string || length &gt; static_cast&lt;unsigned&gt;(std::numeric_limits&lt;int32_t&gt;::max())) {
-        *status = U_ILLEGAL_ARGUMENT_ERROR;
-        return 0;
-    }
-    text = utext_setup(text, 0, status);
-    if (U_FAILURE(*status)) {
-        ASSERT(!text);
-        return 0;
-    }
-    textInit(text, &amp;textUTF16Funcs, string, length, priorContext, priorContextLength);
-    return text;
-}
-
</del><span class="cx"> TextBreakIterator* wordBreakIterator(const UChar* string, int length)
</span><span class="cx"> {
</span><span class="cx">     static bool createdWordBreakIterator = false;
</span><span class="cx">     static TextBreakIterator* staticWordBreakIterator;
</span><del>-    return setUpIterator(createdWordBreakIterator,
-        staticWordBreakIterator, UBRK_WORD, string, length);
</del><ins>+    return setUpIterator(createdWordBreakIterator, staticWordBreakIterator, UBRK_WORD, string, length);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static UText emptyText = UTEXT_INITIALIZER;
</span><span class="lines">@@ -436,7 +75,7 @@
</span><span class="cx">     textLocal.text.pExtra = textLocal.buffer;
</span><span class="cx"> 
</span><span class="cx">     UErrorCode openStatus = U_ZERO_ERROR;
</span><del>-    UText* text = textOpenLatin1(&amp;textLocal, string, length, priorContext, priorContextLength, &amp;openStatus);
</del><ins>+    UText* text = uTextOpenLatin1(&amp;textLocal, string, length, priorContext, priorContextLength, &amp;openStatus);
</ins><span class="cx">     if (U_FAILURE(openStatus)) {
</span><span class="cx">         LOG_ERROR(&quot;textOpenUTF16 failed with status %d&quot;, openStatus);
</span><span class="cx">         return 0;
</span><span class="lines">@@ -463,7 +102,7 @@
</span><span class="cx">     UText textLocal = UTEXT_INITIALIZER;
</span><span class="cx"> 
</span><span class="cx">     UErrorCode openStatus = U_ZERO_ERROR;
</span><del>-    UText* text = textOpenUTF16(&amp;textLocal, string, length, priorContext, priorContextLength, &amp;openStatus);
</del><ins>+    UText* text = uTextOpenUTF16(&amp;textLocal, string, length, priorContext, priorContextLength, &amp;openStatus);
</ins><span class="cx">     if (U_FAILURE(openStatus)) {
</span><span class="cx">         LOG_ERROR(&quot;textOpenUTF16 failed with status %d&quot;, openStatus);
</span><span class="cx">         return 0;
</span><span class="lines">@@ -521,8 +160,7 @@
</span><span class="cx"> {
</span><span class="cx">     static bool createdSentenceBreakIterator = false;
</span><span class="cx">     static TextBreakIterator* staticSentenceBreakIterator;
</span><del>-    return setUpIterator(createdSentenceBreakIterator,
-        staticSentenceBreakIterator, UBRK_SENTENCE, string, length);
</del><ins>+    return setUpIterator(createdSentenceBreakIterator, staticSentenceBreakIterator, UBRK_SENTENCE, string, length);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> int textBreakFirst(TextBreakIterator* iterator)
</span><span class="lines">@@ -572,8 +210,7 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #if !PLATFORM(IOS)
</span><del>-static TextBreakIterator* setUpIteratorWithRules(bool&amp; createdIterator, TextBreakIterator*&amp; iterator,
-    const char* breakRules, const UChar* string, int length)
</del><ins>+static TextBreakIterator* setUpIteratorWithRules(bool&amp; createdIterator, TextBreakIterator*&amp; iterator, const char* breakRules, const UChar* string, int length)
</ins><span class="cx"> {
</span><span class="cx">     if (!string)
</span><span class="cx">         return 0;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformtexticuUTextProvidercpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/platform/text/icu/UTextProvider.cpp (0 => 161817)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/text/icu/UTextProvider.cpp                                (rev 0)
+++ trunk/Source/WebCore/platform/text/icu/UTextProvider.cpp        2014-01-12 19:24:29 UTC (rev 161817)
</span><span class="lines">@@ -0,0 +1,71 @@
</span><ins>+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include &quot;config.h&quot;
+#include &quot;UTextProvider.h&quot;
+
+#include &lt;string.h&gt;
+
+namespace WebCore {
+
+// Relocate pointer from source into destination as required.
+static inline void fixPointer(const UText* source, UText* destination, const void*&amp; pointer)
+{
+    if (pointer &gt;= source-&gt;pExtra &amp;&amp; pointer &lt; static_cast&lt;char*&gt;(source-&gt;pExtra) + source-&gt;extraSize) {
+        // Pointer references source extra buffer.
+        pointer = static_cast&lt;char*&gt;(destination-&gt;pExtra) + (static_cast&lt;const char*&gt;(pointer) - static_cast&lt;const char*&gt;(source-&gt;pExtra));
+    } else if (pointer &gt;= source &amp;&amp; pointer &lt; reinterpret_cast&lt;const char*&gt;(source) + source-&gt;sizeOfStruct) {
+        // Pointer references source text structure, but not source extra buffer.
+        pointer = reinterpret_cast&lt;char*&gt;(destination) + (static_cast&lt;const char*&gt;(pointer) - reinterpret_cast&lt;const char*&gt;(source));
+    }
+}
+
+UText* uTextCloneImpl(UText* destination, const UText* source, UBool deep, UErrorCode* status)
+{
+    ASSERT_UNUSED(deep, !deep);
+    if (U_FAILURE(*status))
+        return nullptr;
+    int32_t extraSize = source-&gt;extraSize;
+    destination = utext_setup(destination, extraSize, status);
+    if (U_FAILURE(*status))
+        return destination;
+    void* extraNew = destination-&gt;pExtra;
+    int32_t flags = destination-&gt;flags;
+    int sizeToCopy = std::min(source-&gt;sizeOfStruct, destination-&gt;sizeOfStruct);
+    memcpy(destination, source, sizeToCopy);
+    destination-&gt;pExtra = extraNew;
+    destination-&gt;flags = flags;
+    memcpy(destination-&gt;pExtra, source-&gt;pExtra, extraSize);
+    fixPointer(source, destination, destination-&gt;context);
+    fixPointer(source, destination, destination-&gt;p);
+    fixPointer(source, destination, destination-&gt;q);
+    ASSERT(!destination-&gt;r);
+    const void* chunkContents = static_cast&lt;const void*&gt;(destination-&gt;chunkContents);
+    fixPointer(source, destination, chunkContents);
+    destination-&gt;chunkContents = static_cast&lt;const UChar*&gt;(chunkContents);
+    return destination;
+}
+
+} // namespace WebCore
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformtexticuUTextProviderh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/platform/text/icu/UTextProvider.h (0 => 161817)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/text/icu/UTextProvider.h                                (rev 0)
+++ trunk/Source/WebCore/platform/text/icu/UTextProvider.h        2014-01-12 19:24:29 UTC (rev 161817)
</span><span class="lines">@@ -0,0 +1,112 @@
</span><ins>+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef UTextProvider_h
+#define UTextProvider_h
+
+#include &lt;unicode/utext.h&gt;
+#include &lt;wtf/unicode/Unicode.h&gt;
+
+namespace WebCore {
+
+enum class UTextProviderContext {
+    NoContext,
+    PriorContext,
+    PrimaryContext
+};
+
+inline UTextProviderContext uTextProviderContext(const UText* text, int64_t nativeIndex, UBool forward)
+{
+    if (!text-&gt;b || nativeIndex &gt; text-&gt;b)
+        return UTextProviderContext::PrimaryContext;
+    if (nativeIndex == text-&gt;b)
+        return forward ? UTextProviderContext::PrimaryContext : UTextProviderContext::PriorContext;
+    return UTextProviderContext::PriorContext;
+}
+
+inline void uTextInitialize(UText* text, const UTextFuncs* funcs, const void* string, unsigned length, const UChar* priorContext, int priorContextLength)
+{
+    text-&gt;pFuncs = funcs;
+    text-&gt;providerProperties = 1 &lt;&lt; UTEXT_PROVIDER_STABLE_CHUNKS;
+    text-&gt;context = string;
+    text-&gt;p = string;
+    text-&gt;a = length;
+    text-&gt;q = priorContext;
+    text-&gt;b = priorContextLength;
+}
+
+// Shared implementation for the UTextClone function on UTextFuncs.
+
+UText* uTextCloneImpl(UText* destination, const UText* source, UBool deep, UErrorCode* status);
+
+
+// Helpers for the UTextAccess function on UTextFuncs.
+
+inline int64_t uTextAccessPinIndex(int64_t&amp; index, int64_t limit)
+{
+    if (index &lt; 0)
+        index = 0;
+    else if (index &gt; limit)
+        index = limit;
+    return index;
+}
+
+inline bool uTextAccessInChunkOrOutOfRange(UText* text, int64_t nativeIndex, int64_t nativeLength, UBool forward, UBool&amp; isAccessible)
+{
+    if (forward) {
+        if (nativeIndex &gt;= text-&gt;chunkNativeStart &amp;&amp; nativeIndex &lt; text-&gt;chunkNativeLimit) {
+            int64_t offset = nativeIndex - text-&gt;chunkNativeStart;
+            // Ensure chunk offset is well formed if computed offset exceeds int32_t range.
+            ASSERT(offset &lt; std::numeric_limits&lt;int32_t&gt;::max());
+            text-&gt;chunkOffset = offset &lt; std::numeric_limits&lt;int32_t&gt;::max() ? static_cast&lt;int32_t&gt;(offset) : 0;
+            isAccessible = TRUE;
+            return true;
+        }
+        if (nativeIndex &gt;= nativeLength &amp;&amp; text-&gt;chunkNativeLimit == nativeLength) {
+            text-&gt;chunkOffset = text-&gt;chunkLength;
+            isAccessible = FALSE;
+            return true;
+        }
+    } else {
+        if (nativeIndex &gt; text-&gt;chunkNativeStart &amp;&amp; nativeIndex &lt;= text-&gt;chunkNativeLimit) {
+            int64_t offset = nativeIndex - text-&gt;chunkNativeStart;
+            // Ensure chunk offset is well formed if computed offset exceeds int32_t range.
+            ASSERT(offset &lt; std::numeric_limits&lt;int32_t&gt;::max());
+            text-&gt;chunkOffset = offset &lt; std::numeric_limits&lt;int32_t&gt;::max() ? static_cast&lt;int32_t&gt;(offset) : 0;
+            isAccessible = TRUE;
+            return true;
+        }
+        if (nativeIndex &lt;= 0 &amp;&amp; !text-&gt;chunkNativeStart) {
+            text-&gt;chunkOffset = 0;
+            isAccessible = FALSE;
+            return true;
+        }
+    }
+    return false;
+}
+
+} // namespace WebCore
+
+#endif // UTextProvider_h
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformtexticuUTextProviderLatin1cpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/platform/text/icu/UTextProviderLatin1.cpp (0 => 161817)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/text/icu/UTextProviderLatin1.cpp                                (rev 0)
+++ trunk/Source/WebCore/platform/text/icu/UTextProviderLatin1.cpp        2014-01-12 19:24:29 UTC (rev 161817)
</span><span class="lines">@@ -0,0 +1,185 @@
</span><ins>+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include &quot;config.h&quot;
+#include &quot;UTextProviderLatin1.h&quot;
+
+#include &quot;UTextProvider.h&quot;
+#include &lt;wtf/text/StringImpl.h&gt;
+
+namespace WebCore {
+
+static inline UTextProviderContext textLatin1GetCurrentContext(const UText* text)
+{
+    if (!text-&gt;chunkContents)
+        return UTextProviderContext::NoContext;
+    return text-&gt;chunkContents == text-&gt;pExtra ? UTextProviderContext::PrimaryContext : UTextProviderContext::PriorContext;
+}
+
+static void textLatin1MoveInPrimaryContext(UText* text, int64_t nativeIndex, int64_t nativeLength, UBool forward)
+{
+    ASSERT(text-&gt;chunkContents == text-&gt;pExtra);
+    if (forward) {
+        ASSERT(nativeIndex &gt;= text-&gt;b &amp;&amp; nativeIndex &lt; nativeLength);
+        text-&gt;chunkNativeStart = nativeIndex;
+        text-&gt;chunkNativeLimit = nativeIndex + text-&gt;extraSize / sizeof(UChar);
+        if (text-&gt;chunkNativeLimit &gt; nativeLength)
+            text-&gt;chunkNativeLimit = nativeLength;
+    } else {
+        ASSERT(nativeIndex &gt; text-&gt;b &amp;&amp; nativeIndex &lt;= nativeLength);
+        text-&gt;chunkNativeLimit = nativeIndex;
+        text-&gt;chunkNativeStart = nativeIndex - text-&gt;extraSize / sizeof(UChar);
+        if (text-&gt;chunkNativeStart &lt; text-&gt;b)
+            text-&gt;chunkNativeStart = text-&gt;b;
+    }
+    int64_t length = text-&gt;chunkNativeLimit - text-&gt;chunkNativeStart;
+    // Ensure chunk length is well defined if computed length exceeds int32_t range.
+    ASSERT(length &lt; std::numeric_limits&lt;int32_t&gt;::max());
+    text-&gt;chunkLength = length &lt; std::numeric_limits&lt;int32_t&gt;::max() ? static_cast&lt;int32_t&gt;(length) : 0;
+    text-&gt;nativeIndexingLimit = text-&gt;chunkLength;
+    text-&gt;chunkOffset = forward ? 0 : text-&gt;chunkLength;
+    StringImpl::copyChars(const_cast&lt;UChar*&gt;(text-&gt;chunkContents), static_cast&lt;const LChar*&gt;(text-&gt;p) + (text-&gt;chunkNativeStart - text-&gt;b), static_cast&lt;unsigned&gt;(text-&gt;chunkLength));
+}
+
+static void textLatin1SwitchToPrimaryContext(UText* text, int64_t nativeIndex, int64_t nativeLength, UBool forward)
+{
+    ASSERT(!text-&gt;chunkContents || text-&gt;chunkContents == text-&gt;q);
+    text-&gt;chunkContents = static_cast&lt;const UChar*&gt;(text-&gt;pExtra);
+    textLatin1MoveInPrimaryContext(text, nativeIndex, nativeLength, forward);
+}
+
+static void textLatin1MoveInPriorContext(UText* text, int64_t nativeIndex, int64_t nativeLength, UBool forward)
+{
+    ASSERT(text-&gt;chunkContents == text-&gt;q);
+    ASSERT(forward ? nativeIndex &lt; text-&gt;b : nativeIndex &lt;= text-&gt;b);
+    ASSERT_UNUSED(nativeLength, forward ? nativeIndex &lt; nativeLength : nativeIndex &lt;= nativeLength);
+    ASSERT_UNUSED(forward, forward ? nativeIndex &lt; nativeLength : nativeIndex &lt;= nativeLength);
+    text-&gt;chunkNativeStart = 0;
+    text-&gt;chunkNativeLimit = text-&gt;b;
+    text-&gt;chunkLength = text-&gt;b;
+    text-&gt;nativeIndexingLimit = text-&gt;chunkLength;
+    int64_t offset = nativeIndex - text-&gt;chunkNativeStart;
+    // Ensure chunk offset is well defined if computed offset exceeds int32_t range or chunk length.
+    ASSERT(offset &lt; std::numeric_limits&lt;int32_t&gt;::max());
+    text-&gt;chunkOffset = std::min(offset &lt; std::numeric_limits&lt;int32_t&gt;::max() ? static_cast&lt;int32_t&gt;(offset) : 0, text-&gt;chunkLength);
+}
+
+static void textLatin1SwitchToPriorContext(UText* text, int64_t nativeIndex, int64_t nativeLength, UBool forward)
+{
+    ASSERT(!text-&gt;chunkContents || text-&gt;chunkContents == text-&gt;pExtra);
+    text-&gt;chunkContents = static_cast&lt;const UChar*&gt;(text-&gt;q);
+    textLatin1MoveInPriorContext(text, nativeIndex, nativeLength, forward);
+}
+
+// -- Begin Latin-1 provider functions --
+
+static UText* uTextLatin1Clone(UText*, const UText*, UBool, UErrorCode*);
+static int64_t uTextLatin1NativeLength(UText*); 
+static UBool uTextLatin1Access(UText*, int64_t, UBool); 
+static int32_t uTextLatin1Extract(UText*, int64_t, int64_t, UChar*, int32_t, UErrorCode*); 
+static void uTextLatin1Close(UText*);
+
+static UText* uTextLatin1Clone(UText* destination, const UText* source, UBool deep, UErrorCode* status)
+{
+    return uTextCloneImpl(destination, source, deep, status);
+}
+
+static int64_t uTextLatin1NativeLength(UText* text)
+{
+    return text-&gt;a + text-&gt;b;
+}
+
+static UBool uTextLatin1Access(UText* text, int64_t nativeIndex, UBool forward)
+{
+    if (!text-&gt;context)
+        return FALSE;
+    int64_t nativeLength = uTextLatin1NativeLength(text);
+    UBool isAccessible;
+    if (uTextAccessInChunkOrOutOfRange(text, nativeIndex, nativeLength, forward, isAccessible))
+        return isAccessible;
+    nativeIndex = uTextAccessPinIndex(nativeIndex, nativeLength);
+    UTextProviderContext currentContext = textLatin1GetCurrentContext(text);
+    UTextProviderContext newContext = uTextProviderContext(text, nativeIndex, forward);
+    ASSERT(newContext != UTextProviderContext::NoContext);
+    if (newContext == currentContext) {
+        if (currentContext == UTextProviderContext::PrimaryContext)
+            textLatin1MoveInPrimaryContext(text, nativeIndex, nativeLength, forward);
+        else
+            textLatin1MoveInPriorContext(text, nativeIndex, nativeLength, forward);
+    } else if (newContext == UTextProviderContext::PrimaryContext)
+        textLatin1SwitchToPrimaryContext(text, nativeIndex, nativeLength, forward);
+    else {
+        ASSERT(newContext == UTextProviderContext::PriorContext);
+        textLatin1SwitchToPriorContext(text, nativeIndex, nativeLength, forward);
+    }
+    return TRUE;
+}
+
+static int32_t uTextLatin1Extract(UText*, int64_t, int64_t, UChar*, int32_t, UErrorCode* errorCode)
+{
+    // In the present context, this text provider is used only with ICU functions
+    // that do not perform an extract operation.
+    ASSERT_NOT_REACHED();
+    *errorCode = U_UNSUPPORTED_ERROR;
+    return 0;
+}
+
+static void uTextLatin1Close(UText* text)
+{
+    text-&gt;context = 0;
+}
+
+// -- End Latin-1 provider functions --
+
+static const struct UTextFuncs textLatin1Funcs = {
+    sizeof(UTextFuncs),
+    0, 0, 0,
+    uTextLatin1Clone,
+    uTextLatin1NativeLength,
+    uTextLatin1Access,
+    uTextLatin1Extract,
+    0, 0, 0, 0,
+    uTextLatin1Close,
+    0, 0, 0,
+};
+
+UText* uTextOpenLatin1(UTextWithBuffer* utWithBuffer, const LChar* string, unsigned length, const UChar* priorContext, int priorContextLength, UErrorCode* status)
+{
+    if (U_FAILURE(*status))
+        return 0;
+    if (!string || length &gt; static_cast&lt;unsigned&gt;(std::numeric_limits&lt;int32_t&gt;::max())) {
+        *status = U_ILLEGAL_ARGUMENT_ERROR;
+        return 0;
+    }
+    UText* text = utext_setup(&amp;utWithBuffer-&gt;text, sizeof(utWithBuffer-&gt;buffer), status);
+    if (U_FAILURE(*status)) {
+        ASSERT(!text);
+        return 0;
+    }
+    uTextInitialize(text, &amp;textLatin1Funcs, string, length, priorContext, priorContextLength);
+    return text;
+}
+
+} // namespace WebCore
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformtexticuUTextProviderLatin1h"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/platform/text/icu/UTextProviderLatin1.h (0 => 161817)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/text/icu/UTextProviderLatin1.h                                (rev 0)
+++ trunk/Source/WebCore/platform/text/icu/UTextProviderLatin1.h        2014-01-12 19:24:29 UTC (rev 161817)
</span><span class="lines">@@ -0,0 +1,45 @@
</span><ins>+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef UTextProviderLatin1_h
+#define UTextProviderLatin1_h
+
+#include &lt;unicode/utext.h&gt;
+#include &lt;wtf/unicode/Unicode.h&gt;
+
+namespace WebCore {
+
+const int UTextWithBufferInlineCapacity = 16;
+
+struct UTextWithBuffer {
+    UText text;
+    UChar buffer[UTextWithBufferInlineCapacity];
+};
+
+UText* uTextOpenLatin1(UTextWithBuffer* utWithBuffer, const LChar* string, unsigned length, const UChar* priorContext, int priorContextLength, UErrorCode* status);
+
+} // namespace WebCore
+
+#endif // UTextProviderLatin1_h
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformtexticuUTextProviderUTF16cpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/platform/text/icu/UTextProviderUTF16.cpp (0 => 161817)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/text/icu/UTextProviderUTF16.cpp                                (rev 0)
+++ trunk/Source/WebCore/platform/text/icu/UTextProviderUTF16.cpp        2014-01-12 19:24:29 UTC (rev 161817)
</span><span class="lines">@@ -0,0 +1,177 @@
</span><ins>+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include &quot;config.h&quot;
+#include &quot;UTextProviderUTF16.h&quot;
+
+#include &quot;UTextProvider.h&quot;
+
+namespace WebCore {
+
+static inline UTextProviderContext textUTF16GetCurrentContext(const UText* text)
+{
+    if (!text-&gt;chunkContents)
+        return UTextProviderContext::NoContext;
+    return text-&gt;chunkContents == text-&gt;p ? UTextProviderContext::PrimaryContext : UTextProviderContext::PriorContext;
+}
+
+static void textUTF16MoveInPrimaryContext(UText* text, int64_t nativeIndex, int64_t nativeLength, UBool forward)
+{
+    ASSERT(text-&gt;chunkContents == text-&gt;p);
+    ASSERT_UNUSED(forward, forward ? nativeIndex &gt;= text-&gt;b : nativeIndex &gt; text-&gt;b);
+    ASSERT_UNUSED(forward, forward ? nativeIndex &lt; nativeLength : nativeIndex &lt;= nativeLength);
+    text-&gt;chunkNativeStart = text-&gt;b;
+    text-&gt;chunkNativeLimit = nativeLength;
+    int64_t length = text-&gt;chunkNativeLimit - text-&gt;chunkNativeStart;
+    // Ensure chunk length is well defined if computed length exceeds int32_t range.
+    ASSERT(length &lt; std::numeric_limits&lt;int32_t&gt;::max());
+    text-&gt;chunkLength = length &lt; std::numeric_limits&lt;int32_t&gt;::max() ? static_cast&lt;int32_t&gt;(length) : 0;
+    text-&gt;nativeIndexingLimit = text-&gt;chunkLength;
+    int64_t offset = nativeIndex - text-&gt;chunkNativeStart;
+    // Ensure chunk offset is well defined if computed offset exceeds int32_t range or chunk length.
+    ASSERT(offset &lt; std::numeric_limits&lt;int32_t&gt;::max());
+    text-&gt;chunkOffset = std::min(offset &lt; std::numeric_limits&lt;int32_t&gt;::max() ? static_cast&lt;int32_t&gt;(offset) : 0, text-&gt;chunkLength);
+}
+
+static void textUTF16SwitchToPrimaryContext(UText* text, int64_t nativeIndex, int64_t nativeLength, UBool forward)
+{
+    ASSERT(!text-&gt;chunkContents || text-&gt;chunkContents == text-&gt;q);
+    text-&gt;chunkContents = static_cast&lt;const UChar*&gt;(text-&gt;p);
+    textUTF16MoveInPrimaryContext(text, nativeIndex, nativeLength, forward);
+}
+
+static void textUTF16MoveInPriorContext(UText* text, int64_t nativeIndex, int64_t nativeLength, UBool forward)
+{
+    ASSERT(text-&gt;chunkContents == text-&gt;q);
+    ASSERT(forward ? nativeIndex &lt; text-&gt;b : nativeIndex &lt;= text-&gt;b);
+    ASSERT_UNUSED(nativeLength, forward ? nativeIndex &lt; nativeLength : nativeIndex &lt;= nativeLength);
+    ASSERT_UNUSED(forward, forward ? nativeIndex &lt; nativeLength : nativeIndex &lt;= nativeLength);
+    text-&gt;chunkNativeStart = 0;
+    text-&gt;chunkNativeLimit = text-&gt;b;
+    text-&gt;chunkLength = text-&gt;b;
+    text-&gt;nativeIndexingLimit = text-&gt;chunkLength;
+    int64_t offset = nativeIndex - text-&gt;chunkNativeStart;
+    // Ensure chunk offset is well defined if computed offset exceeds int32_t range or chunk length.
+    ASSERT(offset &lt; std::numeric_limits&lt;int32_t&gt;::max());
+    text-&gt;chunkOffset = std::min(offset &lt; std::numeric_limits&lt;int32_t&gt;::max() ? static_cast&lt;int32_t&gt;(offset) : 0, text-&gt;chunkLength);
+}
+
+static void textUTF16SwitchToPriorContext(UText* text, int64_t nativeIndex, int64_t nativeLength, UBool forward)
+{
+    ASSERT(!text-&gt;chunkContents || text-&gt;chunkContents == text-&gt;p);
+    text-&gt;chunkContents = static_cast&lt;const UChar*&gt;(text-&gt;q);
+    textUTF16MoveInPriorContext(text, nativeIndex, nativeLength, forward);
+}
+
+// -- Begin UTF-16 provider functions --
+
+static UText* uTextUTF16Clone(UText*, const UText*, UBool, UErrorCode*);
+static int64_t uTextUTF16NativeLength(UText*);
+static UBool uTextUTF16Access(UText*, int64_t, UBool);
+static int32_t uTextUTF16Extract(UText*, int64_t, int64_t, UChar*, int32_t, UErrorCode*);
+static void uTextUTF16Close(UText*);
+
+static UText* uTextUTF16Clone(UText* destination, const UText* source, UBool deep, UErrorCode* status)
+{
+    return uTextCloneImpl(destination, source, deep, status);
+}
+
+static inline int64_t uTextUTF16NativeLength(UText* text)
+{
+    return text-&gt;a + text-&gt;b;
+}
+
+static UBool uTextUTF16Access(UText* text, int64_t nativeIndex, UBool forward)
+{
+    if (!text-&gt;context)
+        return FALSE;
+    int64_t nativeLength = uTextUTF16NativeLength(text);
+    UBool isAccessible;
+    if (uTextAccessInChunkOrOutOfRange(text, nativeIndex, nativeLength, forward, isAccessible))
+        return isAccessible;
+    nativeIndex = uTextAccessPinIndex(nativeIndex, nativeLength);
+    UTextProviderContext currentContext = textUTF16GetCurrentContext(text);
+    UTextProviderContext newContext = uTextProviderContext(text, nativeIndex, forward);
+    ASSERT(newContext != UTextProviderContext::NoContext);
+    if (newContext == currentContext) {
+        if (currentContext == UTextProviderContext::PrimaryContext)
+            textUTF16MoveInPrimaryContext(text, nativeIndex, nativeLength, forward);
+        else
+            textUTF16MoveInPriorContext(text, nativeIndex, nativeLength, forward);
+    } else if (newContext == UTextProviderContext::PrimaryContext)
+        textUTF16SwitchToPrimaryContext(text, nativeIndex, nativeLength, forward);
+    else {
+        ASSERT(newContext == UTextProviderContext::PriorContext);
+        textUTF16SwitchToPriorContext(text, nativeIndex, nativeLength, forward);
+    }
+    return TRUE;
+}
+
+static int32_t uTextUTF16Extract(UText*, int64_t, int64_t, UChar*, int32_t, UErrorCode* errorCode)
+{
+    // In the present context, this text provider is used only with ICU functions
+    // that do not perform an extract operation.
+    ASSERT_NOT_REACHED();
+    *errorCode = U_UNSUPPORTED_ERROR;
+    return 0;
+}
+
+static void uTextUTF16Close(UText* text)
+{
+    text-&gt;context = 0;
+}
+
+// -- End UTF-16 provider functions --
+
+static const struct UTextFuncs textUTF16Funcs = {
+    sizeof(UTextFuncs),
+    0, 0, 0,
+    uTextUTF16Clone,
+    uTextUTF16NativeLength,
+    uTextUTF16Access,
+    uTextUTF16Extract,
+    0, 0, 0, 0,
+    uTextUTF16Close,
+    0, 0, 0,
+};
+
+UText* uTextOpenUTF16(UText* text, const UChar* string, unsigned length, const UChar* priorContext, int priorContextLength, UErrorCode* status)
+{
+    if (U_FAILURE(*status))
+        return 0;
+    if (!string || length &gt; static_cast&lt;unsigned&gt;(std::numeric_limits&lt;int32_t&gt;::max())) {
+        *status = U_ILLEGAL_ARGUMENT_ERROR;
+        return 0;
+    }
+    text = utext_setup(text, 0, status);
+    if (U_FAILURE(*status)) {
+        ASSERT(!text);
+        return 0;
+    }
+    uTextInitialize(text, &amp;textUTF16Funcs, string, length, priorContext, priorContextLength);
+    return text;
+}
+
+} // namespace WebCore
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformtexticuUTextProviderUTF16h"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/platform/text/icu/UTextProviderUTF16.h (0 => 161817)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/text/icu/UTextProviderUTF16.h                                (rev 0)
+++ trunk/Source/WebCore/platform/text/icu/UTextProviderUTF16.h        2014-01-12 19:24:29 UTC (rev 161817)
</span><span class="lines">@@ -0,0 +1,38 @@
</span><ins>+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef UTextProviderUTF16_h
+#define UTextProviderUTF16_h
+
+#include &lt;unicode/utext.h&gt;
+#include &lt;wtf/unicode/Unicode.h&gt;
+
+namespace WebCore {
+
+UText* uTextOpenUTF16(UText*, const UChar*, unsigned length, const UChar* priorContext, int priorContextLength, UErrorCode*);
+
+} // namespace WebCore
+
+#endif // UTextProviderUTF16_h
</ins></span></pre>
</div>
</div>

</body>
</html>