<!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"> "${WEBCORE_DIR}/platform/network"
</span><span class="cx"> "${WEBCORE_DIR}/platform/sql"
</span><span class="cx"> "${WEBCORE_DIR}/platform/text"
</span><ins>+ "${WEBCORE_DIR}/platform/text/icu"
</ins><span class="cx"> "${WEBCORE_DIR}/plugins"
</span><span class="cx"> "${WEBCORE_DIR}/rendering"
</span><span class="cx"> "${WEBCORE_DIR}/rendering/line"
</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 <sam@webkit.org>
+
+ 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 <cgarcia@igalia.com>
</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"> "${WEBCORE_DIR}/platform/network/gtk"
</span><span class="cx"> "${WEBCORE_DIR}/platform/network/soup"
</span><span class="cx"> "${WEBCORE_DIR}/platform/text/gtk"
</span><ins>+ "${WEBCORE_DIR}/platform/text/icu"
</ins><span class="cx"> "${WEBCORE_DIR}/plugins/gtk"
</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"> </PropertyGroup>
</span><span class="cx"> <ItemDefinitionGroup>
</span><span class="cx"> <ClCompile>
</span><del>- <AdditionalIncludeDirectories>$(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)</AdditionalIncludeDirectories>
</del><ins>+ <AdditionalIncludeDirectories>$(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)</AdditionalIncludeDirectories>
</ins><span class="cx"> <PreprocessorDefinitions>DISABLE_3D_RENDERING;WEBCORE_CONTEXT_MENUS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</span><span class="cx"> <PrecompiledHeader>Use</PrecompiledHeader>
</span><span class="cx"> <PrecompiledHeaderFile>WebCorePrefix.h</PrecompiledHeaderFile>
</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 "%ProjectDir%..\platform\graphics\opentype\*.h" "%CONFIGURATIONBUILDDIR%\include\WebCore"
</span><span class="cx"> xcopy /y /d "%ProjectDir%..\platform\mock\*.h" "%CONFIGURATIONBUILDDIR%\include\WebCore"
</span><span class="cx"> xcopy /y /d "%ProjectDir%..\platform\text\*.h" "%CONFIGURATIONBUILDDIR%\include\WebCore"
</span><ins>+xcopy /y /d "%ProjectDir%..\platform\text\icu\*.h" "%CONFIGURATIONBUILDDIR%\include\WebCore"
</ins><span class="cx"> xcopy /y /d "%ProjectDir%..\platform\text\transcoder\*.h" "%CONFIGURATIONBUILDDIR%\include\WebCore"
</span><span class="cx"> xcopy /y /d "%ProjectDir%..\platform\win\*.h" "%CONFIGURATIONBUILDDIR%\include\WebCore"
</span><span class="cx"> xcopy /y /d "%ProjectDir%..\platform\network\*.h" "%CONFIGURATIONBUILDDIR%\include\WebCore"
</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 = "<group>"; };
</span><span class="cx">                 7C6136F81710C35200FF4A57 /* InFilesParser.pm */ = {isa = PBXFileReference; lastKnownFileType = text.script.perl; name = InFilesParser.pm; path = scripts/InFilesParser.pm; sourceTree = "<group>"; };
</span><span class="cx">                 7C6136F91710C35200FF4A57 /* StaticString.pm */ = {isa = PBXFileReference; lastKnownFileType = text.script.perl; name = StaticString.pm; path = scripts/StaticString.pm; sourceTree = "<group>"; };
</span><ins>+                7C74D43118823A9300E5ED57 /* UTextProviderLatin1.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UTextProviderLatin1.cpp; sourceTree = "<group>"; };
+                7C74D43218823A9300E5ED57 /* UTextProviderLatin1.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UTextProviderLatin1.h; sourceTree = "<group>"; };
+                7C74D43518823B1900E5ED57 /* UTextProvider.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UTextProvider.cpp; sourceTree = "<group>"; };
+                7C74D43618823B1900E5ED57 /* UTextProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UTextProvider.h; sourceTree = "<group>"; };
+                7C74D4391882400400E5ED57 /* UTextProviderUTF16.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UTextProviderUTF16.cpp; sourceTree = "<group>"; };
+                7C74D43A1882400400E5ED57 /* UTextProviderUTF16.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UTextProviderUTF16.h; sourceTree = "<group>"; };
</ins><span class="cx">                 7CC7E3D617208C0F003C5277 /* IDNScriptWhiteList.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = IDNScriptWhiteList.txt; sourceTree = "<group>"; };
</span><span class="cx">                 7CE6CBFA187F370700D46BF5 /* FormatConverter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FormatConverter.h; sourceTree = "<group>"; };
</span><span class="cx">                 7CE6CBFC187F394900D46BF5 /* FormatConverter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FormatConverter.cpp; sourceTree = "<group>"; };
</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 = "<group>";
+                };
</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 "TextEncodingDetectorICU.cpp"
</span><span class="cx"> #include "TextEncodingRegistry.cpp"
</span><span class="cx"> #include "TextStream.cpp"
</span><ins>+#include "UTextProvider.cpp"
+#include "UTextProviderLatin1.cpp"
+#include "UTextProviderUTF16.cpp"
</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 "TextBreakIterator.h"
</span><span class="cx">
</span><span class="cx"> #include "LineBreakIteratorPoolICU.h"
</span><ins>+#include "UTextProviderLatin1.h"
+#include "UTextProviderUTF16.h"
</ins><span class="cx"> #include <wtf/Atomics.h>
</span><span class="cx"> #include <wtf/text/WTFString.h>
</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& createdIterator, TextBreakIterator*& iterator,
- UBreakIteratorType type, const UChar* string, int length)
</del><ins>+static TextBreakIterator* setUpIterator(bool& createdIterator, TextBreakIterator*& 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& index, int64_t limit)
-{
- if (index < 0)
- index = 0;
- else if (index > limit)
- index = limit;
- return index;
-}
-
-static inline int64_t textNativeLength(UText* text)
-{
- return text->a + text->b;
-}
-
-// Relocate pointer from source into destination as required.
-static void textFixPointer(const UText* source, UText* destination, const void*& pointer)
-{
- if (pointer >= source->pExtra && pointer < static_cast<char*>(source->pExtra) + source->extraSize) {
- // Pointer references source extra buffer.
- pointer = static_cast<char*>(destination->pExtra) + (static_cast<const char*>(pointer) - static_cast<const char*>(source->pExtra));
- } else if (pointer >= source && pointer < reinterpret_cast<const char*>(source) + source->sizeOfStruct) {
- // Pointer references source text structure, but not source extra buffer.
- pointer = reinterpret_cast<char*>(destination) + (static_cast<const char*>(pointer) - reinterpret_cast<const char*>(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->extraSize;
- destination = utext_setup(destination, extraSize, status);
- if (U_FAILURE(*status))
- return destination;
- void* extraNew = destination->pExtra;
- int32_t flags = destination->flags;
- int sizeToCopy = std::min(source->sizeOfStruct, destination->sizeOfStruct);
- memcpy(destination, source, sizeToCopy);
- destination->pExtra = extraNew;
- destination->flags = flags;
- memcpy(destination->pExtra, source->pExtra, extraSize);
- textFixPointer(source, destination, destination->context);
- textFixPointer(source, destination, destination->p);
- textFixPointer(source, destination, destination->q);
- ASSERT(!destination->r);
- const void * chunkContents = static_cast<const void*>(destination->chunkContents);
- textFixPointer(source, destination, chunkContents);
- destination->chunkContents = static_cast<const UChar*>(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->context = 0;
-}
-
-static inline TextContext textGetContext(const UText* text, int64_t nativeIndex, UBool forward)
-{
- if (!text->b || nativeIndex > text->b)
- return PrimaryContext;
- if (nativeIndex == text->b)
- return forward ? PrimaryContext : PriorContext;
- return PriorContext;
-}
-
-static inline TextContext textLatin1GetCurrentContext(const UText* text)
-{
- if (!text->chunkContents)
- return NoContext;
- return text->chunkContents == text->pExtra ? PrimaryContext : PriorContext;
-}
-
-static void textLatin1MoveInPrimaryContext(UText* text, int64_t nativeIndex, int64_t nativeLength, UBool forward)
-{
- ASSERT(text->chunkContents == text->pExtra);
- if (forward) {
- ASSERT(nativeIndex >= text->b && nativeIndex < nativeLength);
- text->chunkNativeStart = nativeIndex;
- text->chunkNativeLimit = nativeIndex + text->extraSize / sizeof(UChar);
- if (text->chunkNativeLimit > nativeLength)
- text->chunkNativeLimit = nativeLength;
- } else {
- ASSERT(nativeIndex > text->b && nativeIndex <= nativeLength);
- text->chunkNativeLimit = nativeIndex;
- text->chunkNativeStart = nativeIndex - text->extraSize / sizeof(UChar);
- if (text->chunkNativeStart < text->b)
- text->chunkNativeStart = text->b;
- }
- int64_t length = text->chunkNativeLimit - text->chunkNativeStart;
- // Ensure chunk length is well defined if computed length exceeds int32_t range.
- ASSERT(length < std::numeric_limits<int32_t>::max());
- text->chunkLength = length < std::numeric_limits<int32_t>::max() ? static_cast<int32_t>(length) : 0;
- text->nativeIndexingLimit = text->chunkLength;
- text->chunkOffset = forward ? 0 : text->chunkLength;
- StringImpl::copyChars(const_cast<UChar*>(text->chunkContents), static_cast<const LChar*>(text->p) + (text->chunkNativeStart - text->b), static_cast<unsigned>(text->chunkLength));
-}
-
-static void textLatin1SwitchToPrimaryContext(UText* text, int64_t nativeIndex, int64_t nativeLength, UBool forward)
-{
- ASSERT(!text->chunkContents || text->chunkContents == text->q);
- text->chunkContents = static_cast<const UChar*>(text->pExtra);
- textLatin1MoveInPrimaryContext(text, nativeIndex, nativeLength, forward);
-}
-
-static void textLatin1MoveInPriorContext(UText* text, int64_t nativeIndex, int64_t nativeLength, UBool forward)
-{
- ASSERT(text->chunkContents == text->q);
- ASSERT(forward ? nativeIndex < text->b : nativeIndex <= text->b);
- ASSERT_UNUSED(nativeLength, forward ? nativeIndex < nativeLength : nativeIndex <= nativeLength);
- ASSERT_UNUSED(forward, forward ? nativeIndex < nativeLength : nativeIndex <= nativeLength);
- text->chunkNativeStart = 0;
- text->chunkNativeLimit = text->b;
- text->chunkLength = text->b;
- text->nativeIndexingLimit = text->chunkLength;
- int64_t offset = nativeIndex - text->chunkNativeStart;
- // Ensure chunk offset is well defined if computed offset exceeds int32_t range or chunk length.
- ASSERT(offset < std::numeric_limits<int32_t>::max());
- text->chunkOffset = std::min(offset < std::numeric_limits<int32_t>::max() ? static_cast<int32_t>(offset) : 0, text->chunkLength);
-}
-
-static void textLatin1SwitchToPriorContext(UText* text, int64_t nativeIndex, int64_t nativeLength, UBool forward)
-{
- ASSERT(!text->chunkContents || text->chunkContents == text->pExtra);
- text->chunkContents = static_cast<const UChar*>(text->q);
- textLatin1MoveInPriorContext(text, nativeIndex, nativeLength, forward);
-}
-
-static inline bool textInChunkOrOutOfRange(UText* text, int64_t nativeIndex, int64_t nativeLength, UBool forward, UBool& isAccessible)
-{
- if (forward) {
- if (nativeIndex >= text->chunkNativeStart && nativeIndex < text->chunkNativeLimit) {
- int64_t offset = nativeIndex - text->chunkNativeStart;
- // Ensure chunk offset is well formed if computed offset exceeds int32_t range.
- ASSERT(offset < std::numeric_limits<int32_t>::max());
- text->chunkOffset = offset < std::numeric_limits<int32_t>::max() ? static_cast<int32_t>(offset) : 0;
- isAccessible = TRUE;
- return true;
- }
- if (nativeIndex >= nativeLength && text->chunkNativeLimit == nativeLength) {
- text->chunkOffset = text->chunkLength;
- isAccessible = FALSE;
- return true;
- }
- } else {
- if (nativeIndex > text->chunkNativeStart && nativeIndex <= text->chunkNativeLimit) {
- int64_t offset = nativeIndex - text->chunkNativeStart;
- // Ensure chunk offset is well formed if computed offset exceeds int32_t range.
- ASSERT(offset < std::numeric_limits<int32_t>::max());
- text->chunkOffset = offset < std::numeric_limits<int32_t>::max() ? static_cast<int32_t>(offset) : 0;
- isAccessible = TRUE;
- return true;
- }
- if (nativeIndex <= 0 && !text->chunkNativeStart) {
- text->chunkOffset = 0;
- isAccessible = FALSE;
- return true;
- }
- }
- return false;
-}
-
-static UBool textLatin1Access(UText* text, int64_t nativeIndex, UBool forward)
-{
- if (!text->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->pFuncs = funcs;
- text->providerProperties = 1 << UTEXT_PROVIDER_STABLE_CHUNKS;
- text->context = string;
- text->p = string;
- text->a = length;
- text->q = priorContext;
- text->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 > static_cast<unsigned>(std::numeric_limits<int32_t>::max())) {
- *status = U_ILLEGAL_ARGUMENT_ERROR;
- return 0;
- }
- UText* text = utext_setup(&utWithBuffer->text, sizeof(utWithBuffer->buffer), status);
- if (U_FAILURE(*status)) {
- ASSERT(!text);
- return 0;
- }
- textInit(text, &textLatin1Funcs, string, length, priorContext, priorContextLength);
- return text;
-}
-
-static inline TextContext textUTF16GetCurrentContext(const UText* text)
-{
- if (!text->chunkContents)
- return NoContext;
- return text->chunkContents == text->p ? PrimaryContext : PriorContext;
-}
-
-static void textUTF16MoveInPrimaryContext(UText* text, int64_t nativeIndex, int64_t nativeLength, UBool forward)
-{
- ASSERT(text->chunkContents == text->p);
- ASSERT_UNUSED(forward, forward ? nativeIndex >= text->b : nativeIndex > text->b);
- ASSERT_UNUSED(forward, forward ? nativeIndex < nativeLength : nativeIndex <= nativeLength);
- text->chunkNativeStart = text->b;
- text->chunkNativeLimit = nativeLength;
- int64_t length = text->chunkNativeLimit - text->chunkNativeStart;
- // Ensure chunk length is well defined if computed length exceeds int32_t range.
- ASSERT(length < std::numeric_limits<int32_t>::max());
- text->chunkLength = length < std::numeric_limits<int32_t>::max() ? static_cast<int32_t>(length) : 0;
- text->nativeIndexingLimit = text->chunkLength;
- int64_t offset = nativeIndex - text->chunkNativeStart;
- // Ensure chunk offset is well defined if computed offset exceeds int32_t range or chunk length.
- ASSERT(offset < std::numeric_limits<int32_t>::max());
- text->chunkOffset = std::min(offset < std::numeric_limits<int32_t>::max() ? static_cast<int32_t>(offset) : 0, text->chunkLength);
-}
-
-static void textUTF16SwitchToPrimaryContext(UText* text, int64_t nativeIndex, int64_t nativeLength, UBool forward)
-{
- ASSERT(!text->chunkContents || text->chunkContents == text->q);
- text->chunkContents = static_cast<const UChar*>(text->p);
- textUTF16MoveInPrimaryContext(text, nativeIndex, nativeLength, forward);
-}
-
-static void textUTF16MoveInPriorContext(UText* text, int64_t nativeIndex, int64_t nativeLength, UBool forward)
-{
- ASSERT(text->chunkContents == text->q);
- ASSERT(forward ? nativeIndex < text->b : nativeIndex <= text->b);
- ASSERT_UNUSED(nativeLength, forward ? nativeIndex < nativeLength : nativeIndex <= nativeLength);
- ASSERT_UNUSED(forward, forward ? nativeIndex < nativeLength : nativeIndex <= nativeLength);
- text->chunkNativeStart = 0;
- text->chunkNativeLimit = text->b;
- text->chunkLength = text->b;
- text->nativeIndexingLimit = text->chunkLength;
- int64_t offset = nativeIndex - text->chunkNativeStart;
- // Ensure chunk offset is well defined if computed offset exceeds int32_t range or chunk length.
- ASSERT(offset < std::numeric_limits<int32_t>::max());
- text->chunkOffset = std::min(offset < std::numeric_limits<int32_t>::max() ? static_cast<int32_t>(offset) : 0, text->chunkLength);
-}
-
-static void textUTF16SwitchToPriorContext(UText* text, int64_t nativeIndex, int64_t nativeLength, UBool forward)
-{
- ASSERT(!text->chunkContents || text->chunkContents == text->p);
- text->chunkContents = static_cast<const UChar*>(text->q);
- textUTF16MoveInPriorContext(text, nativeIndex, nativeLength, forward);
-}
-
-static UBool textUTF16Access(UText* text, int64_t nativeIndex, UBool forward)
-{
- if (!text->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 > static_cast<unsigned>(std::numeric_limits<int32_t>::max())) {
- *status = U_ILLEGAL_ARGUMENT_ERROR;
- return 0;
- }
- text = utext_setup(text, 0, status);
- if (U_FAILURE(*status)) {
- ASSERT(!text);
- return 0;
- }
- textInit(text, &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(&textLocal, string, length, priorContext, priorContextLength, &openStatus);
</del><ins>+ UText* text = uTextOpenLatin1(&textLocal, string, length, priorContext, priorContextLength, &openStatus);
</ins><span class="cx"> if (U_FAILURE(openStatus)) {
</span><span class="cx"> LOG_ERROR("textOpenUTF16 failed with status %d", 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(&textLocal, string, length, priorContext, priorContextLength, &openStatus);
</del><ins>+ UText* text = uTextOpenUTF16(&textLocal, string, length, priorContext, priorContextLength, &openStatus);
</ins><span class="cx"> if (U_FAILURE(openStatus)) {
</span><span class="cx"> LOG_ERROR("textOpenUTF16 failed with status %d", 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& createdIterator, TextBreakIterator*& iterator,
- const char* breakRules, const UChar* string, int length)
</del><ins>+static TextBreakIterator* setUpIteratorWithRules(bool& createdIterator, TextBreakIterator*& 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 "config.h"
+#include "UTextProvider.h"
+
+#include <string.h>
+
+namespace WebCore {
+
+// Relocate pointer from source into destination as required.
+static inline void fixPointer(const UText* source, UText* destination, const void*& pointer)
+{
+ if (pointer >= source->pExtra && pointer < static_cast<char*>(source->pExtra) + source->extraSize) {
+ // Pointer references source extra buffer.
+ pointer = static_cast<char*>(destination->pExtra) + (static_cast<const char*>(pointer) - static_cast<const char*>(source->pExtra));
+ } else if (pointer >= source && pointer < reinterpret_cast<const char*>(source) + source->sizeOfStruct) {
+ // Pointer references source text structure, but not source extra buffer.
+ pointer = reinterpret_cast<char*>(destination) + (static_cast<const char*>(pointer) - reinterpret_cast<const char*>(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->extraSize;
+ destination = utext_setup(destination, extraSize, status);
+ if (U_FAILURE(*status))
+ return destination;
+ void* extraNew = destination->pExtra;
+ int32_t flags = destination->flags;
+ int sizeToCopy = std::min(source->sizeOfStruct, destination->sizeOfStruct);
+ memcpy(destination, source, sizeToCopy);
+ destination->pExtra = extraNew;
+ destination->flags = flags;
+ memcpy(destination->pExtra, source->pExtra, extraSize);
+ fixPointer(source, destination, destination->context);
+ fixPointer(source, destination, destination->p);
+ fixPointer(source, destination, destination->q);
+ ASSERT(!destination->r);
+ const void* chunkContents = static_cast<const void*>(destination->chunkContents);
+ fixPointer(source, destination, chunkContents);
+ destination->chunkContents = static_cast<const UChar*>(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 <unicode/utext.h>
+#include <wtf/unicode/Unicode.h>
+
+namespace WebCore {
+
+enum class UTextProviderContext {
+ NoContext,
+ PriorContext,
+ PrimaryContext
+};
+
+inline UTextProviderContext uTextProviderContext(const UText* text, int64_t nativeIndex, UBool forward)
+{
+ if (!text->b || nativeIndex > text->b)
+ return UTextProviderContext::PrimaryContext;
+ if (nativeIndex == text->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->pFuncs = funcs;
+ text->providerProperties = 1 << UTEXT_PROVIDER_STABLE_CHUNKS;
+ text->context = string;
+ text->p = string;
+ text->a = length;
+ text->q = priorContext;
+ text->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& index, int64_t limit)
+{
+ if (index < 0)
+ index = 0;
+ else if (index > limit)
+ index = limit;
+ return index;
+}
+
+inline bool uTextAccessInChunkOrOutOfRange(UText* text, int64_t nativeIndex, int64_t nativeLength, UBool forward, UBool& isAccessible)
+{
+ if (forward) {
+ if (nativeIndex >= text->chunkNativeStart && nativeIndex < text->chunkNativeLimit) {
+ int64_t offset = nativeIndex - text->chunkNativeStart;
+ // Ensure chunk offset is well formed if computed offset exceeds int32_t range.
+ ASSERT(offset < std::numeric_limits<int32_t>::max());
+ text->chunkOffset = offset < std::numeric_limits<int32_t>::max() ? static_cast<int32_t>(offset) : 0;
+ isAccessible = TRUE;
+ return true;
+ }
+ if (nativeIndex >= nativeLength && text->chunkNativeLimit == nativeLength) {
+ text->chunkOffset = text->chunkLength;
+ isAccessible = FALSE;
+ return true;
+ }
+ } else {
+ if (nativeIndex > text->chunkNativeStart && nativeIndex <= text->chunkNativeLimit) {
+ int64_t offset = nativeIndex - text->chunkNativeStart;
+ // Ensure chunk offset is well formed if computed offset exceeds int32_t range.
+ ASSERT(offset < std::numeric_limits<int32_t>::max());
+ text->chunkOffset = offset < std::numeric_limits<int32_t>::max() ? static_cast<int32_t>(offset) : 0;
+ isAccessible = TRUE;
+ return true;
+ }
+ if (nativeIndex <= 0 && !text->chunkNativeStart) {
+ text->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 "config.h"
+#include "UTextProviderLatin1.h"
+
+#include "UTextProvider.h"
+#include <wtf/text/StringImpl.h>
+
+namespace WebCore {
+
+static inline UTextProviderContext textLatin1GetCurrentContext(const UText* text)
+{
+ if (!text->chunkContents)
+ return UTextProviderContext::NoContext;
+ return text->chunkContents == text->pExtra ? UTextProviderContext::PrimaryContext : UTextProviderContext::PriorContext;
+}
+
+static void textLatin1MoveInPrimaryContext(UText* text, int64_t nativeIndex, int64_t nativeLength, UBool forward)
+{
+ ASSERT(text->chunkContents == text->pExtra);
+ if (forward) {
+ ASSERT(nativeIndex >= text->b && nativeIndex < nativeLength);
+ text->chunkNativeStart = nativeIndex;
+ text->chunkNativeLimit = nativeIndex + text->extraSize / sizeof(UChar);
+ if (text->chunkNativeLimit > nativeLength)
+ text->chunkNativeLimit = nativeLength;
+ } else {
+ ASSERT(nativeIndex > text->b && nativeIndex <= nativeLength);
+ text->chunkNativeLimit = nativeIndex;
+ text->chunkNativeStart = nativeIndex - text->extraSize / sizeof(UChar);
+ if (text->chunkNativeStart < text->b)
+ text->chunkNativeStart = text->b;
+ }
+ int64_t length = text->chunkNativeLimit - text->chunkNativeStart;
+ // Ensure chunk length is well defined if computed length exceeds int32_t range.
+ ASSERT(length < std::numeric_limits<int32_t>::max());
+ text->chunkLength = length < std::numeric_limits<int32_t>::max() ? static_cast<int32_t>(length) : 0;
+ text->nativeIndexingLimit = text->chunkLength;
+ text->chunkOffset = forward ? 0 : text->chunkLength;
+ StringImpl::copyChars(const_cast<UChar*>(text->chunkContents), static_cast<const LChar*>(text->p) + (text->chunkNativeStart - text->b), static_cast<unsigned>(text->chunkLength));
+}
+
+static void textLatin1SwitchToPrimaryContext(UText* text, int64_t nativeIndex, int64_t nativeLength, UBool forward)
+{
+ ASSERT(!text->chunkContents || text->chunkContents == text->q);
+ text->chunkContents = static_cast<const UChar*>(text->pExtra);
+ textLatin1MoveInPrimaryContext(text, nativeIndex, nativeLength, forward);
+}
+
+static void textLatin1MoveInPriorContext(UText* text, int64_t nativeIndex, int64_t nativeLength, UBool forward)
+{
+ ASSERT(text->chunkContents == text->q);
+ ASSERT(forward ? nativeIndex < text->b : nativeIndex <= text->b);
+ ASSERT_UNUSED(nativeLength, forward ? nativeIndex < nativeLength : nativeIndex <= nativeLength);
+ ASSERT_UNUSED(forward, forward ? nativeIndex < nativeLength : nativeIndex <= nativeLength);
+ text->chunkNativeStart = 0;
+ text->chunkNativeLimit = text->b;
+ text->chunkLength = text->b;
+ text->nativeIndexingLimit = text->chunkLength;
+ int64_t offset = nativeIndex - text->chunkNativeStart;
+ // Ensure chunk offset is well defined if computed offset exceeds int32_t range or chunk length.
+ ASSERT(offset < std::numeric_limits<int32_t>::max());
+ text->chunkOffset = std::min(offset < std::numeric_limits<int32_t>::max() ? static_cast<int32_t>(offset) : 0, text->chunkLength);
+}
+
+static void textLatin1SwitchToPriorContext(UText* text, int64_t nativeIndex, int64_t nativeLength, UBool forward)
+{
+ ASSERT(!text->chunkContents || text->chunkContents == text->pExtra);
+ text->chunkContents = static_cast<const UChar*>(text->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->a + text->b;
+}
+
+static UBool uTextLatin1Access(UText* text, int64_t nativeIndex, UBool forward)
+{
+ if (!text->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->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 > static_cast<unsigned>(std::numeric_limits<int32_t>::max())) {
+ *status = U_ILLEGAL_ARGUMENT_ERROR;
+ return 0;
+ }
+ UText* text = utext_setup(&utWithBuffer->text, sizeof(utWithBuffer->buffer), status);
+ if (U_FAILURE(*status)) {
+ ASSERT(!text);
+ return 0;
+ }
+ uTextInitialize(text, &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 <unicode/utext.h>
+#include <wtf/unicode/Unicode.h>
+
+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 "config.h"
+#include "UTextProviderUTF16.h"
+
+#include "UTextProvider.h"
+
+namespace WebCore {
+
+static inline UTextProviderContext textUTF16GetCurrentContext(const UText* text)
+{
+ if (!text->chunkContents)
+ return UTextProviderContext::NoContext;
+ return text->chunkContents == text->p ? UTextProviderContext::PrimaryContext : UTextProviderContext::PriorContext;
+}
+
+static void textUTF16MoveInPrimaryContext(UText* text, int64_t nativeIndex, int64_t nativeLength, UBool forward)
+{
+ ASSERT(text->chunkContents == text->p);
+ ASSERT_UNUSED(forward, forward ? nativeIndex >= text->b : nativeIndex > text->b);
+ ASSERT_UNUSED(forward, forward ? nativeIndex < nativeLength : nativeIndex <= nativeLength);
+ text->chunkNativeStart = text->b;
+ text->chunkNativeLimit = nativeLength;
+ int64_t length = text->chunkNativeLimit - text->chunkNativeStart;
+ // Ensure chunk length is well defined if computed length exceeds int32_t range.
+ ASSERT(length < std::numeric_limits<int32_t>::max());
+ text->chunkLength = length < std::numeric_limits<int32_t>::max() ? static_cast<int32_t>(length) : 0;
+ text->nativeIndexingLimit = text->chunkLength;
+ int64_t offset = nativeIndex - text->chunkNativeStart;
+ // Ensure chunk offset is well defined if computed offset exceeds int32_t range or chunk length.
+ ASSERT(offset < std::numeric_limits<int32_t>::max());
+ text->chunkOffset = std::min(offset < std::numeric_limits<int32_t>::max() ? static_cast<int32_t>(offset) : 0, text->chunkLength);
+}
+
+static void textUTF16SwitchToPrimaryContext(UText* text, int64_t nativeIndex, int64_t nativeLength, UBool forward)
+{
+ ASSERT(!text->chunkContents || text->chunkContents == text->q);
+ text->chunkContents = static_cast<const UChar*>(text->p);
+ textUTF16MoveInPrimaryContext(text, nativeIndex, nativeLength, forward);
+}
+
+static void textUTF16MoveInPriorContext(UText* text, int64_t nativeIndex, int64_t nativeLength, UBool forward)
+{
+ ASSERT(text->chunkContents == text->q);
+ ASSERT(forward ? nativeIndex < text->b : nativeIndex <= text->b);
+ ASSERT_UNUSED(nativeLength, forward ? nativeIndex < nativeLength : nativeIndex <= nativeLength);
+ ASSERT_UNUSED(forward, forward ? nativeIndex < nativeLength : nativeIndex <= nativeLength);
+ text->chunkNativeStart = 0;
+ text->chunkNativeLimit = text->b;
+ text->chunkLength = text->b;
+ text->nativeIndexingLimit = text->chunkLength;
+ int64_t offset = nativeIndex - text->chunkNativeStart;
+ // Ensure chunk offset is well defined if computed offset exceeds int32_t range or chunk length.
+ ASSERT(offset < std::numeric_limits<int32_t>::max());
+ text->chunkOffset = std::min(offset < std::numeric_limits<int32_t>::max() ? static_cast<int32_t>(offset) : 0, text->chunkLength);
+}
+
+static void textUTF16SwitchToPriorContext(UText* text, int64_t nativeIndex, int64_t nativeLength, UBool forward)
+{
+ ASSERT(!text->chunkContents || text->chunkContents == text->p);
+ text->chunkContents = static_cast<const UChar*>(text->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->a + text->b;
+}
+
+static UBool uTextUTF16Access(UText* text, int64_t nativeIndex, UBool forward)
+{
+ if (!text->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->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 > static_cast<unsigned>(std::numeric_limits<int32_t>::max())) {
+ *status = U_ILLEGAL_ARGUMENT_ERROR;
+ return 0;
+ }
+ text = utext_setup(text, 0, status);
+ if (U_FAILURE(*status)) {
+ ASSERT(!text);
+ return 0;
+ }
+ uTextInitialize(text, &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 <unicode/utext.h>
+#include <wtf/unicode/Unicode.h>
+
+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>