Changeset 161817 in webkit


Ignore:
Timestamp:
Jan 12, 2014 11:24:29 AM (10 years ago)
Author:
weinig@apple.com
Message:

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.
Location:
trunk/Source
Files:
7 added
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/Platform/GNUmakefile.am

    r160444 r161817  
    5858        -I$(srcdir)/Source/WebCore/platform/network/soup \
    5959        -I$(srcdir)/Source/WebCore/platform/text \
     60        -I$(srcdir)/Source/WebCore/platform/text/icu \
    6061        -I$(srcdir)/Source/WebCore/platform/text/transcoder
    6162
  • trunk/Source/WebCore/CMakeLists.txt

    r161783 r161817  
    7878    "${WEBCORE_DIR}/platform/sql"
    7979    "${WEBCORE_DIR}/platform/text"
     80    "${WEBCORE_DIR}/platform/text/icu"
    8081    "${WEBCORE_DIR}/plugins"
    8182    "${WEBCORE_DIR}/rendering"
     
    28022803if (WTF_USE_ICU_UNICODE)
    28032804    list(APPEND WebCore_SOURCES
     2805        platform/text/icu/UTextProvider.cpp
     2806        platform/text/icu/UTextProviderLatin1.cpp
     2807        platform/text/icu/UTextProviderUTF16.cpp
    28042808        platform/text/TextBreakIteratorICU.cpp
    28052809        platform/text/TextCodecICU.cpp
  • trunk/Source/WebCore/ChangeLog

    r161816 r161817  
     12014-01-11  Sam Weinig  <sam@webkit.org>
     2
     3        Split ICU UText providers out into their own files
     4        https://bugs.webkit.org/show_bug.cgi?id=126834
     5
     6        Reviewed by Anders Carlsson.
     7
     8        Moves the implementation of our custom UText providers out into
     9        their own files.
     10        - UTextProviderLatin1.h/cpp contains the Latin-1 provider.
     11        - UTextProviderUTF16.h/cpp contains the UTF-16 provider.
     12        - UTextProvider.h/cpp contains code common to all the providers.
     13
     14        * CMakeLists.txt:
     15        * GNUmakefile.list.am:
     16        * PlatformGTK.cmake:
     17        * WebCore.vcxproj/WebCoreCommon.props:
     18        * WebCore.vcxproj/copyForwardingHeaders.cmd:
     19        * WebCore.xcodeproj/project.pbxproj:
     20        * platform/text/TextAllInOne.cpp:
     21        * platform/text/TextBreakIteratorICU.cpp:
     22        (WebCore::setUpIterator):
     23        (WebCore::wordBreakIterator):
     24        (WebCore::acquireLineBreakIterator):
     25        (WebCore::sentenceBreakIterator):
     26        (WebCore::setUpIteratorWithRules):
     27        * platform/text/icu: Added.
     28        * platform/text/icu/UTextProvider.cpp: Added.
     29        (WebCore::fixPointer):
     30        (WebCore::uTextCloneImpl):
     31        * platform/text/icu/UTextProvider.h: Added.
     32        (WebCore::uTextProviderContext):
     33        (WebCore::uTextInitialize):
     34        (WebCore::uTextAccessPinIndex):
     35        (WebCore::uTextAccessInChunkOrOutOfRange):
     36        * platform/text/icu/UTextProviderLatin1.cpp: Added.
     37        * platform/text/icu/UTextProviderLatin1.h: Added.
     38        * platform/text/icu/UTextProviderUTF16.cpp: Added.
     39        * platform/text/icu/UTextProviderUTF16.h: Added.
     40
    1412014-01-12  Carlos Garcia Campos  <cgarcia@igalia.com>
    242
  • trunk/Source/WebCore/GNUmakefile.am

    r161808 r161817  
    9191        -I$(srcdir)/Source/WebCore/platform/sql \
    9292        -I$(srcdir)/Source/WebCore/platform/text \
     93        -I$(srcdir)/Source/WebCore/platform/text/icu \
    9394        -I$(srcdir)/Source/WebCore/platform/win \
    9495        -I$(srcdir)/Source/WebCore/plugins \
  • trunk/Source/WebCore/GNUmakefile.list.am

    r161816 r161817  
    59795979        Source/WebCore/platform/text/enchant/TextCheckerEnchant.h \
    59805980        Source/WebCore/platform/text/enchant/TextCheckerEnchant.cpp \
     5981        Source/WebCore/platform/text/icu/UTextProvider.cpp \
     5982        Source/WebCore/platform/text/icu/UTextProvider.h \
     5983        Source/WebCore/platform/text/icu/UTextProviderLatin1.cpp \
     5984        Source/WebCore/platform/text/icu/UTextProviderLatin1.h \
     5985        Source/WebCore/platform/text/icu/UTextProviderUTF16.cpp \
     5986        Source/WebCore/platform/text/icu/UTextProviderUTF16.h \
    59815987        Source/WebCore/platform/text/BidiContext.cpp \
    59825988        Source/WebCore/platform/text/BidiContext.h \
  • trunk/Source/WebCore/PlatformGTK.cmake

    r161389 r161817  
    2121    "${WEBCORE_DIR}/platform/network/soup"
    2222    "${WEBCORE_DIR}/platform/text/gtk"
     23    "${WEBCORE_DIR}/platform/text/icu"
    2324    "${WEBCORE_DIR}/plugins/gtk"
    2425)
     
    129130    platform/soup/SharedBufferSoup.cpp
    130131
     132    platform/text/icu/UTextProvider.cpp
     133    platform/text/icu/UTextProviderLatin1.cpp
     134    platform/text/icu/UTextProviderUTF16.cpp
    131135    platform/text/LocaleICU.cpp
    132136    platform/text/TextBreakIteratorICU.cpp
     
    256260    platform/soup/SharedBufferSoup.cpp
    257261
     262    platform/text/icu/UTextProvider.cpp
     263    platform/text/icu/UTextProviderLatin1.cpp
     264    platform/text/icu/UTextProviderUTF16.cpp
    258265    platform/text/LocaleICU.cpp
    259266    platform/text/TextBreakIteratorICU.cpp
  • trunk/Source/WebCore/WebCore.vcxproj/WebCoreCommon.props

    r161108 r161817  
    88  <ItemDefinitionGroup>
    99    <ClCompile>
    10       <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>
     10      <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>
    1111      <PreprocessorDefinitions>DISABLE_3D_RENDERING;WEBCORE_CONTEXT_MENUS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
    1212      <PrecompiledHeader>Use</PrecompiledHeader>
  • trunk/Source/WebCore/WebCore.vcxproj/copyForwardingHeaders.cmd

    r161506 r161817  
    5959xcopy /y /d "%ProjectDir%..\platform\mock\*.h" "%CONFIGURATIONBUILDDIR%\include\WebCore"
    6060xcopy /y /d "%ProjectDir%..\platform\text\*.h" "%CONFIGURATIONBUILDDIR%\include\WebCore"
     61xcopy /y /d "%ProjectDir%..\platform\text\icu\*.h" "%CONFIGURATIONBUILDDIR%\include\WebCore"
    6162xcopy /y /d "%ProjectDir%..\platform\text\transcoder\*.h" "%CONFIGURATIONBUILDDIR%\include\WebCore"
    6263xcopy /y /d "%ProjectDir%..\platform\win\*.h" "%CONFIGURATIONBUILDDIR%\include\WebCore"
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r161813 r161817  
    22942294                7C5343FC17B74B63004232F0 /* JSMediaQueryListListener.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C5343FA17B74B63004232F0 /* JSMediaQueryListListener.cpp */; };
    22952295                7C5343FD17B74B63004232F0 /* JSMediaQueryListListener.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C5343FB17B74B63004232F0 /* JSMediaQueryListListener.h */; };
     2296                7C74D43318823A9300E5ED57 /* UTextProviderLatin1.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C74D43118823A9300E5ED57 /* UTextProviderLatin1.cpp */; };
     2297                7C74D43418823A9300E5ED57 /* UTextProviderLatin1.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C74D43218823A9300E5ED57 /* UTextProviderLatin1.h */; };
     2298                7C74D43718823B1900E5ED57 /* UTextProvider.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C74D43518823B1900E5ED57 /* UTextProvider.cpp */; };
     2299                7C74D43818823B1900E5ED57 /* UTextProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C74D43618823B1900E5ED57 /* UTextProvider.h */; };
     2300                7C74D43B1882400400E5ED57 /* UTextProviderUTF16.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C74D4391882400400E5ED57 /* UTextProviderUTF16.cpp */; };
     2301                7C74D43C1882400400E5ED57 /* UTextProviderUTF16.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C74D43A1882400400E5ED57 /* UTextProviderUTF16.h */; };
    22962302                7CC7E3D717208C0F003C5277 /* IDNScriptWhiteList.txt in Resources */ = {isa = PBXBuildFile; fileRef = 7CC7E3D617208C0F003C5277 /* IDNScriptWhiteList.txt */; };
    22972303                7CE6CBFB187F370700D46BF5 /* FormatConverter.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CE6CBFA187F370700D46BF5 /* FormatConverter.h */; };
     
    92679273                7C6136F81710C35200FF4A57 /* InFilesParser.pm */ = {isa = PBXFileReference; lastKnownFileType = text.script.perl; name = InFilesParser.pm; path = scripts/InFilesParser.pm; sourceTree = "<group>"; };
    92689274                7C6136F91710C35200FF4A57 /* StaticString.pm */ = {isa = PBXFileReference; lastKnownFileType = text.script.perl; name = StaticString.pm; path = scripts/StaticString.pm; sourceTree = "<group>"; };
     9275                7C74D43118823A9300E5ED57 /* UTextProviderLatin1.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UTextProviderLatin1.cpp; sourceTree = "<group>"; };
     9276                7C74D43218823A9300E5ED57 /* UTextProviderLatin1.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UTextProviderLatin1.h; sourceTree = "<group>"; };
     9277                7C74D43518823B1900E5ED57 /* UTextProvider.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UTextProvider.cpp; sourceTree = "<group>"; };
     9278                7C74D43618823B1900E5ED57 /* UTextProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UTextProvider.h; sourceTree = "<group>"; };
     9279                7C74D4391882400400E5ED57 /* UTextProviderUTF16.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UTextProviderUTF16.cpp; sourceTree = "<group>"; };
     9280                7C74D43A1882400400E5ED57 /* UTextProviderUTF16.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UTextProviderUTF16.h; sourceTree = "<group>"; };
    92699281                7CC7E3D617208C0F003C5277 /* IDNScriptWhiteList.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = IDNScriptWhiteList.txt; sourceTree = "<group>"; };
    92709282                7CE6CBFA187F370700D46BF5 /* FormatConverter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FormatConverter.h; sourceTree = "<group>"; };
     
    1627416286                        usesTabs = 0;
    1627516287                };
     16288                7C74D43018823A4200E5ED57 /* icu */ = {
     16289                        isa = PBXGroup;
     16290                        children = (
     16291                                7C74D43118823A9300E5ED57 /* UTextProviderLatin1.cpp */,
     16292                                7C74D43218823A9300E5ED57 /* UTextProviderLatin1.h */,
     16293                                7C74D4391882400400E5ED57 /* UTextProviderUTF16.cpp */,
     16294                                7C74D43A1882400400E5ED57 /* UTextProviderUTF16.h */,
     16295                                7C74D43518823B1900E5ED57 /* UTextProvider.cpp */,
     16296                                7C74D43618823B1900E5ED57 /* UTextProvider.h */,
     16297                        );
     16298                        path = icu;
     16299                        sourceTree = "<group>";
     16300                };
    1627616301                7E474E1912494DA900235364 /* ios */ = {
    1627716302                        isa = PBXGroup;
     
    2001520040                                A516E8B2136E04C00076C3C0 /* ios */,
    2001620041                                B2C3D9F90D006C1D00EF6F26 /* mac */,
     20042                                7C74D43018823A4200E5ED57 /* icu */,
    2001720043                                37C61F0012095C87007A3C67 /* AtomicStringKeyedMRUCache.h */,
    2001820044                                B2C3D9F20D006C1D00EF6F26 /* BidiContext.cpp */,
     
    2519125217                                51AF503616F100F60095B2E8 /* ResourceLoaderTypes.h in Headers */,
    2519225218                                973E325710883B7C005BC493 /* ResourceLoadNotifier.h in Headers */,
     25219                                7C74D43418823A9300E5ED57 /* UTextProviderLatin1.h in Headers */,
    2519325220                                E4295FA412B0614E00D1ACE0 /* ResourceLoadPriority.h in Headers */,
    2519425221                                D0CE58F9125E4CC200F3F199 /* ResourceLoadScheduler.h in Headers */,
    2519525222                                07C59B7617F7D0DB000FBCBB /* CapabilityRange.h in Headers */,
    2519625223                                8A81BF8511DCFD9000DA2B98 /* ResourceLoadTiming.h in Headers */,
     25224                                7C74D43818823B1900E5ED57 /* UTextProvider.h in Headers */,
    2519725225                                7EE6846D12D26E3800E79415 /* ResourceRequest.h in Headers */,
    2519825226                                514C767D0CE923A1007EF3CD /* ResourceRequestBase.h in Headers */,
     
    2542725455                                A10DC76B14747BAB005E2471 /* StyleGridData.h in Headers */,
    2542825456                                A110DB9B14F5DF7700A03B93 /* StyleGridItemData.h in Headers */,
     25457                                7C74D43C1882400400E5ED57 /* UTextProviderUTF16.h in Headers */,
    2542925458                                BCEF43CF0E673DA1001C1287 /* StyleImage.h in Headers */,
    2543025459                                BC2273040E82F1E600E7F975 /* StyleInheritedData.h in Headers */,
     
    2672926758                                FEBC5F3116BD0CC300659BD3 /* DatabaseBase.cpp in Sources */,
    2673026759                                97BC6A271505F081001B74AC /* DatabaseContext.cpp in Sources */,
     26760                                7C74D43318823A9300E5ED57 /* UTextProviderLatin1.cpp in Sources */,
    2673126761                                FE456F181677D74E005EDDF9 /* DatabaseManager.cpp in Sources */,
    2673226762                                FEB26D28167A8F2A00FDD26B /* DatabaseServer.cpp in Sources */,
     
    2683926869                                2D9A247315B9C2D100D34527 /* DOMDOMSecurityPolicy.mm in Sources */,
    2684026870                                7694565C1214DB630007CBAE /* DOMDOMTokenList.mm in Sources */,
     26871                                7C74D43B1882400400E5ED57 /* UTextProviderUTF16.cpp in Sources */,
    2684126872                                7AABA25914BC613300AA9A11 /* DOMEditor.cpp in Sources */,
    2684226873                                85ACA9C10A9B5FA500671E90 /* DOMElement.mm in Sources */,
     
    2895028981                                A14832C8187F673F00DA63A6 /* WebCoreThread.mm in Sources */,
    2895128982                                B2227AC40D00BF220071B782 /* SVGTests.cpp in Sources */,
     28983                                7C74D43718823B1900E5ED57 /* UTextProvider.cpp in Sources */,
    2895228984                                B2227AC70D00BF220071B782 /* SVGTextContentElement.cpp in Sources */,
    2895328985                                07969DBB17D14151007FF842 /* JSRTCSessionDescription.cpp in Sources */,
  • trunk/Source/WebCore/platform/text/TextAllInOne.cpp

    r127525 r161817  
    3939#include "TextEncodingRegistry.cpp"
    4040#include "TextStream.cpp"
     41#include "UTextProvider.cpp"
     42#include "UTextProviderLatin1.cpp"
     43#include "UTextProviderUTF16.cpp"
  • trunk/Source/WebCore/platform/text/TextBreakIteratorICU.cpp

    r161589 r161817  
    2424
    2525#include "LineBreakIteratorPoolICU.h"
     26#include "UTextProviderLatin1.h"
     27#include "UTextProviderUTF16.h"
    2628#include <wtf/Atomics.h>
    2729#include <wtf/text/WTFString.h>
     
    3133namespace WebCore {
    3234
    33 static TextBreakIterator* setUpIterator(bool& createdIterator, TextBreakIterator*& iterator,
    34     UBreakIteratorType type, const UChar* string, int length)
     35static TextBreakIterator* setUpIterator(bool& createdIterator, TextBreakIterator*& iterator, UBreakIteratorType type, const UChar* string, int length)
    3536{
    3637    if (!string)
     
    5455}
    5556
    56 enum TextContext { NoContext, PriorContext, PrimaryContext };
    57 
    58 const int textBufferCapacity = 16;
    59 
    60 typedef struct {
    61     UText text;
    62     UChar buffer[textBufferCapacity];
    63 } UTextWithBuffer;
    64 
    65 static inline int64_t textPinIndex(int64_t& index, int64_t limit)
    66 {
    67     if (index < 0)
    68         index = 0;
    69     else if (index > limit)
    70         index = limit;
    71     return index;
    72 }
    73 
    74 static inline int64_t textNativeLength(UText* text)
    75 {
    76     return text->a + text->b;
    77 }
    78 
    79 // Relocate pointer from source into destination as required.
    80 static void textFixPointer(const UText* source, UText* destination, const void*& pointer)
    81 {
    82     if (pointer >= source->pExtra && pointer < static_cast<char*>(source->pExtra) + source->extraSize) {
    83         // Pointer references source extra buffer.
    84         pointer = static_cast<char*>(destination->pExtra) + (static_cast<const char*>(pointer) - static_cast<const char*>(source->pExtra));
    85     } else if (pointer >= source && pointer < reinterpret_cast<const char*>(source) + source->sizeOfStruct) {
    86         // Pointer references source text structure, but not source extra buffer.
    87         pointer = reinterpret_cast<char*>(destination) + (static_cast<const char*>(pointer) - reinterpret_cast<const char*>(source));
    88     }
    89 }
    90 
    91 static UText* textClone(UText* destination, const UText* source, UBool deep, UErrorCode* status)
    92 {
    93     ASSERT_UNUSED(deep, !deep);
    94     if (U_FAILURE(*status))
    95         return 0;
    96     int32_t extraSize = source->extraSize;
    97     destination = utext_setup(destination, extraSize, status);
    98     if (U_FAILURE(*status))
    99         return destination;
    100     void* extraNew = destination->pExtra;
    101     int32_t flags = destination->flags;
    102     int sizeToCopy = std::min(source->sizeOfStruct, destination->sizeOfStruct);
    103     memcpy(destination, source, sizeToCopy);
    104     destination->pExtra = extraNew;
    105     destination->flags = flags;
    106     memcpy(destination->pExtra, source->pExtra, extraSize);
    107     textFixPointer(source, destination, destination->context);
    108     textFixPointer(source, destination, destination->p);
    109     textFixPointer(source, destination, destination->q);
    110     ASSERT(!destination->r);
    111     const void * chunkContents = static_cast<const void*>(destination->chunkContents);
    112     textFixPointer(source, destination, chunkContents);
    113     destination->chunkContents = static_cast<const UChar*>(chunkContents);
    114     return destination;
    115 }
    116 
    117 static int32_t textExtract(UText* text, int64_t start, int64_t limit, UChar* destination, int32_t destinationCapacity, UErrorCode* errorCode)
    118 {
    119     UNUSED_PARAM(text);
    120     UNUSED_PARAM(start);
    121     UNUSED_PARAM(limit);
    122     UNUSED_PARAM(destination);
    123     UNUSED_PARAM(destinationCapacity);
    124     // In the present context, this text provider is used only with ICU functions
    125     // that do not perform an extract operation.
    126     ASSERT_NOT_REACHED();
    127     *errorCode = U_UNSUPPORTED_ERROR;
    128     return 0;
    129 }
    130 
    131 static void textClose(UText* text)
    132 {
    133     text->context = 0;
    134 }
    135 
    136 static inline TextContext textGetContext(const UText* text, int64_t nativeIndex, UBool forward)
    137 {
    138     if (!text->b || nativeIndex > text->b)
    139         return PrimaryContext;
    140     if (nativeIndex == text->b)
    141         return forward ? PrimaryContext : PriorContext;
    142     return PriorContext;
    143 }
    144 
    145 static inline TextContext textLatin1GetCurrentContext(const UText* text)
    146 {
    147     if (!text->chunkContents)
    148         return NoContext;
    149     return text->chunkContents == text->pExtra ? PrimaryContext : PriorContext;
    150 }
    151 
    152 static void textLatin1MoveInPrimaryContext(UText* text, int64_t nativeIndex, int64_t nativeLength, UBool forward)
    153 {
    154     ASSERT(text->chunkContents == text->pExtra);
    155     if (forward) {
    156         ASSERT(nativeIndex >= text->b && nativeIndex < nativeLength);
    157         text->chunkNativeStart = nativeIndex;
    158         text->chunkNativeLimit = nativeIndex + text->extraSize / sizeof(UChar);
    159         if (text->chunkNativeLimit > nativeLength)
    160             text->chunkNativeLimit = nativeLength;
    161     } else {
    162         ASSERT(nativeIndex > text->b && nativeIndex <= nativeLength);
    163         text->chunkNativeLimit = nativeIndex;
    164         text->chunkNativeStart = nativeIndex - text->extraSize / sizeof(UChar);
    165         if (text->chunkNativeStart < text->b)
    166             text->chunkNativeStart = text->b;
    167     }
    168     int64_t length = text->chunkNativeLimit - text->chunkNativeStart;
    169     // Ensure chunk length is well defined if computed length exceeds int32_t range.
    170     ASSERT(length < std::numeric_limits<int32_t>::max());
    171     text->chunkLength = length < std::numeric_limits<int32_t>::max() ? static_cast<int32_t>(length) : 0;
    172     text->nativeIndexingLimit = text->chunkLength;
    173     text->chunkOffset = forward ? 0 : text->chunkLength;
    174     StringImpl::copyChars(const_cast<UChar*>(text->chunkContents), static_cast<const LChar*>(text->p) + (text->chunkNativeStart - text->b), static_cast<unsigned>(text->chunkLength));
    175 }
    176 
    177 static void textLatin1SwitchToPrimaryContext(UText* text, int64_t nativeIndex, int64_t nativeLength, UBool forward)
    178 {
    179     ASSERT(!text->chunkContents || text->chunkContents == text->q);
    180     text->chunkContents = static_cast<const UChar*>(text->pExtra);
    181     textLatin1MoveInPrimaryContext(text, nativeIndex, nativeLength, forward);
    182 }
    183 
    184 static void textLatin1MoveInPriorContext(UText* text, int64_t nativeIndex, int64_t nativeLength, UBool forward)
    185 {
    186     ASSERT(text->chunkContents == text->q);
    187     ASSERT(forward ? nativeIndex < text->b : nativeIndex <= text->b);
    188     ASSERT_UNUSED(nativeLength, forward ? nativeIndex < nativeLength : nativeIndex <= nativeLength);
    189     ASSERT_UNUSED(forward, forward ? nativeIndex < nativeLength : nativeIndex <= nativeLength);
    190     text->chunkNativeStart = 0;
    191     text->chunkNativeLimit = text->b;
    192     text->chunkLength = text->b;
    193     text->nativeIndexingLimit = text->chunkLength;
    194     int64_t offset = nativeIndex - text->chunkNativeStart;
    195     // Ensure chunk offset is well defined if computed offset exceeds int32_t range or chunk length.
    196     ASSERT(offset < std::numeric_limits<int32_t>::max());
    197     text->chunkOffset = std::min(offset < std::numeric_limits<int32_t>::max() ? static_cast<int32_t>(offset) : 0, text->chunkLength);
    198 }
    199 
    200 static void textLatin1SwitchToPriorContext(UText* text, int64_t nativeIndex, int64_t nativeLength, UBool forward)
    201 {
    202     ASSERT(!text->chunkContents || text->chunkContents == text->pExtra);
    203     text->chunkContents = static_cast<const UChar*>(text->q);
    204     textLatin1MoveInPriorContext(text, nativeIndex, nativeLength, forward);
    205 }
    206 
    207 static inline bool textInChunkOrOutOfRange(UText* text, int64_t nativeIndex, int64_t nativeLength, UBool forward, UBool& isAccessible)
    208 {
    209     if (forward) {
    210         if (nativeIndex >= text->chunkNativeStart && nativeIndex < text->chunkNativeLimit) {
    211             int64_t offset = nativeIndex - text->chunkNativeStart;
    212             // Ensure chunk offset is well formed if computed offset exceeds int32_t range.
    213             ASSERT(offset < std::numeric_limits<int32_t>::max());
    214             text->chunkOffset = offset < std::numeric_limits<int32_t>::max() ? static_cast<int32_t>(offset) : 0;
    215             isAccessible = TRUE;
    216             return true;
    217         }
    218         if (nativeIndex >= nativeLength && text->chunkNativeLimit == nativeLength) {
    219             text->chunkOffset = text->chunkLength;
    220             isAccessible = FALSE;
    221             return true;
    222         }
    223     } else {
    224         if (nativeIndex > text->chunkNativeStart && nativeIndex <= text->chunkNativeLimit) {
    225             int64_t offset = nativeIndex - text->chunkNativeStart;
    226             // Ensure chunk offset is well formed if computed offset exceeds int32_t range.
    227             ASSERT(offset < std::numeric_limits<int32_t>::max());
    228             text->chunkOffset = offset < std::numeric_limits<int32_t>::max() ? static_cast<int32_t>(offset) : 0;
    229             isAccessible = TRUE;
    230             return true;
    231         }
    232         if (nativeIndex <= 0 && !text->chunkNativeStart) {
    233             text->chunkOffset = 0;
    234             isAccessible = FALSE;
    235             return true;
    236         }
    237     }
    238     return false;
    239 }
    240 
    241 static UBool textLatin1Access(UText* text, int64_t nativeIndex, UBool forward)
    242 {
    243     if (!text->context)
    244         return FALSE;
    245     int64_t nativeLength = textNativeLength(text);
    246     UBool isAccessible;
    247     if (textInChunkOrOutOfRange(text, nativeIndex, nativeLength, forward, isAccessible))
    248         return isAccessible;
    249     nativeIndex = textPinIndex(nativeIndex, nativeLength);
    250     TextContext currentContext = textLatin1GetCurrentContext(text);
    251     TextContext newContext = textGetContext(text, nativeIndex, forward);
    252     ASSERT(newContext != NoContext);
    253     if (newContext == currentContext) {
    254         if (currentContext == PrimaryContext)
    255             textLatin1MoveInPrimaryContext(text, nativeIndex, nativeLength, forward);
    256         else
    257             textLatin1MoveInPriorContext(text, nativeIndex, nativeLength, forward);
    258     } else if (newContext == PrimaryContext)
    259         textLatin1SwitchToPrimaryContext(text, nativeIndex, nativeLength, forward);
    260     else {
    261         ASSERT(newContext == PriorContext);
    262         textLatin1SwitchToPriorContext(text, nativeIndex, nativeLength, forward);
    263     }
    264     return TRUE;
    265 }
    266 
    267 static const struct UTextFuncs textLatin1Funcs = {
    268     sizeof(UTextFuncs),
    269     0, 0, 0,
    270     textClone,
    271     textNativeLength,
    272     textLatin1Access,
    273     textExtract,
    274     0, 0, 0, 0,
    275     textClose,
    276     0, 0, 0,
    277 };
    278 
    279 static void textInit(UText* text, const UTextFuncs* funcs, const void* string, unsigned length, const UChar* priorContext, int priorContextLength)
    280 {
    281     text->pFuncs = funcs;
    282     text->providerProperties = 1 << UTEXT_PROVIDER_STABLE_CHUNKS;
    283     text->context = string;
    284     text->p = string;
    285     text->a = length;
    286     text->q = priorContext;
    287     text->b = priorContextLength;
    288 }
    289 
    290 static UText* textOpenLatin1(UTextWithBuffer* utWithBuffer, const LChar* string, unsigned length, const UChar* priorContext, int priorContextLength, UErrorCode* status)
    291 {
    292     if (U_FAILURE(*status))
    293         return 0;
    294     if (!string || length > static_cast<unsigned>(std::numeric_limits<int32_t>::max())) {
    295         *status = U_ILLEGAL_ARGUMENT_ERROR;
    296         return 0;
    297     }
    298     UText* text = utext_setup(&utWithBuffer->text, sizeof(utWithBuffer->buffer), status);
    299     if (U_FAILURE(*status)) {
    300         ASSERT(!text);
    301         return 0;
    302     }
    303     textInit(text, &textLatin1Funcs, string, length, priorContext, priorContextLength);
    304     return text;
    305 }
    306 
    307 static inline TextContext textUTF16GetCurrentContext(const UText* text)
    308 {
    309     if (!text->chunkContents)
    310         return NoContext;
    311     return text->chunkContents == text->p ? PrimaryContext : PriorContext;
    312 }
    313 
    314 static void textUTF16MoveInPrimaryContext(UText* text, int64_t nativeIndex, int64_t nativeLength, UBool forward)
    315 {
    316     ASSERT(text->chunkContents == text->p);
    317     ASSERT_UNUSED(forward, forward ? nativeIndex >= text->b : nativeIndex > text->b);
    318     ASSERT_UNUSED(forward, forward ? nativeIndex < nativeLength : nativeIndex <= nativeLength);
    319     text->chunkNativeStart = text->b;
    320     text->chunkNativeLimit = nativeLength;
    321     int64_t length = text->chunkNativeLimit - text->chunkNativeStart;
    322     // Ensure chunk length is well defined if computed length exceeds int32_t range.
    323     ASSERT(length < std::numeric_limits<int32_t>::max());
    324     text->chunkLength = length < std::numeric_limits<int32_t>::max() ? static_cast<int32_t>(length) : 0;
    325     text->nativeIndexingLimit = text->chunkLength;
    326     int64_t offset = nativeIndex - text->chunkNativeStart;
    327     // Ensure chunk offset is well defined if computed offset exceeds int32_t range or chunk length.
    328     ASSERT(offset < std::numeric_limits<int32_t>::max());
    329     text->chunkOffset = std::min(offset < std::numeric_limits<int32_t>::max() ? static_cast<int32_t>(offset) : 0, text->chunkLength);
    330 }
    331 
    332 static void textUTF16SwitchToPrimaryContext(UText* text, int64_t nativeIndex, int64_t nativeLength, UBool forward)
    333 {
    334     ASSERT(!text->chunkContents || text->chunkContents == text->q);
    335     text->chunkContents = static_cast<const UChar*>(text->p);
    336     textUTF16MoveInPrimaryContext(text, nativeIndex, nativeLength, forward);
    337 }
    338 
    339 static void textUTF16MoveInPriorContext(UText* text, int64_t nativeIndex, int64_t nativeLength, UBool forward)
    340 {
    341     ASSERT(text->chunkContents == text->q);
    342     ASSERT(forward ? nativeIndex < text->b : nativeIndex <= text->b);
    343     ASSERT_UNUSED(nativeLength, forward ? nativeIndex < nativeLength : nativeIndex <= nativeLength);
    344     ASSERT_UNUSED(forward, forward ? nativeIndex < nativeLength : nativeIndex <= nativeLength);
    345     text->chunkNativeStart = 0;
    346     text->chunkNativeLimit = text->b;
    347     text->chunkLength = text->b;
    348     text->nativeIndexingLimit = text->chunkLength;
    349     int64_t offset = nativeIndex - text->chunkNativeStart;
    350     // Ensure chunk offset is well defined if computed offset exceeds int32_t range or chunk length.
    351     ASSERT(offset < std::numeric_limits<int32_t>::max());
    352     text->chunkOffset = std::min(offset < std::numeric_limits<int32_t>::max() ? static_cast<int32_t>(offset) : 0, text->chunkLength);
    353 }
    354 
    355 static void textUTF16SwitchToPriorContext(UText* text, int64_t nativeIndex, int64_t nativeLength, UBool forward)
    356 {
    357     ASSERT(!text->chunkContents || text->chunkContents == text->p);
    358     text->chunkContents = static_cast<const UChar*>(text->q);
    359     textUTF16MoveInPriorContext(text, nativeIndex, nativeLength, forward);
    360 }
    361 
    362 static UBool textUTF16Access(UText* text, int64_t nativeIndex, UBool forward)
    363 {
    364     if (!text->context)
    365         return FALSE;
    366     int64_t nativeLength = textNativeLength(text);
    367     UBool isAccessible;
    368     if (textInChunkOrOutOfRange(text, nativeIndex, nativeLength, forward, isAccessible))
    369         return isAccessible;
    370     nativeIndex = textPinIndex(nativeIndex, nativeLength);
    371     TextContext currentContext = textUTF16GetCurrentContext(text);
    372     TextContext newContext = textGetContext(text, nativeIndex, forward);
    373     ASSERT(newContext != NoContext);
    374     if (newContext == currentContext) {
    375         if (currentContext == PrimaryContext)
    376             textUTF16MoveInPrimaryContext(text, nativeIndex, nativeLength, forward);
    377         else
    378             textUTF16MoveInPriorContext(text, nativeIndex, nativeLength, forward);
    379     } else if (newContext == PrimaryContext)
    380         textUTF16SwitchToPrimaryContext(text, nativeIndex, nativeLength, forward);
    381     else {
    382         ASSERT(newContext == PriorContext);
    383         textUTF16SwitchToPriorContext(text, nativeIndex, nativeLength, forward);
    384     }
    385     return TRUE;
    386 }
    387 
    388 static const struct UTextFuncs textUTF16Funcs = {
    389     sizeof(UTextFuncs),
    390     0, 0, 0,
    391     textClone,
    392     textNativeLength,
    393     textUTF16Access,
    394     textExtract,
    395     0, 0, 0, 0,
    396     textClose,
    397     0, 0, 0,
    398 };
    399 
    400 static UText* textOpenUTF16(UText* text, const UChar* string, unsigned length, const UChar* priorContext, int priorContextLength, UErrorCode* status)
    401 {
    402     if (U_FAILURE(*status))
    403         return 0;
    404     if (!string || length > static_cast<unsigned>(std::numeric_limits<int32_t>::max())) {
    405         *status = U_ILLEGAL_ARGUMENT_ERROR;
    406         return 0;
    407     }
    408     text = utext_setup(text, 0, status);
    409     if (U_FAILURE(*status)) {
    410         ASSERT(!text);
    411         return 0;
    412     }
    413     textInit(text, &textUTF16Funcs, string, length, priorContext, priorContextLength);
    414     return text;
    415 }
    416 
    41757TextBreakIterator* wordBreakIterator(const UChar* string, int length)
    41858{
    41959    static bool createdWordBreakIterator = false;
    42060    static TextBreakIterator* staticWordBreakIterator;
    421     return setUpIterator(createdWordBreakIterator,
    422         staticWordBreakIterator, UBRK_WORD, string, length);
     61    return setUpIterator(createdWordBreakIterator, staticWordBreakIterator, UBRK_WORD, string, length);
    42362}
    42463
     
    43776
    43877    UErrorCode openStatus = U_ZERO_ERROR;
    439     UText* text = textOpenLatin1(&textLocal, string, length, priorContext, priorContextLength, &openStatus);
     78    UText* text = uTextOpenLatin1(&textLocal, string, length, priorContext, priorContextLength, &openStatus);
    44079    if (U_FAILURE(openStatus)) {
    44180        LOG_ERROR("textOpenUTF16 failed with status %d", openStatus);
     
    464103
    465104    UErrorCode openStatus = U_ZERO_ERROR;
    466     UText* text = textOpenUTF16(&textLocal, string, length, priorContext, priorContextLength, &openStatus);
     105    UText* text = uTextOpenUTF16(&textLocal, string, length, priorContext, priorContextLength, &openStatus);
    467106    if (U_FAILURE(openStatus)) {
    468107        LOG_ERROR("textOpenUTF16 failed with status %d", openStatus);
     
    522161    static bool createdSentenceBreakIterator = false;
    523162    static TextBreakIterator* staticSentenceBreakIterator;
    524     return setUpIterator(createdSentenceBreakIterator,
    525         staticSentenceBreakIterator, UBRK_SENTENCE, string, length);
     163    return setUpIterator(createdSentenceBreakIterator, staticSentenceBreakIterator, UBRK_SENTENCE, string, length);
    526164}
    527165
     
    573211
    574212#if !PLATFORM(IOS)
    575 static TextBreakIterator* setUpIteratorWithRules(bool& createdIterator, TextBreakIterator*& iterator,
    576     const char* breakRules, const UChar* string, int length)
     213static TextBreakIterator* setUpIteratorWithRules(bool& createdIterator, TextBreakIterator*& iterator, const char* breakRules, const UChar* string, int length)
    577214{
    578215    if (!string)
Note: See TracChangeset for help on using the changeset viewer.