Changeset 127525 in webkit


Ignore:
Timestamp:
Sep 4, 2012 4:58:01 PM (12 years ago)
Author:
weinig@apple.com
Message:

Part 1 of removing PlatformString.h, move remaining functions to new homes
https://bugs.webkit.org/show_bug.cgi?id=95702

Reviewed by Beth Dakin.

Source/WebCore:

Move utf8Buffer() to SharedBuffer.h/cpp
Move numGraphemeClusters() and numCharactersInGraphemeClusters() to TextBreakIterator.h/cpp

  • CMakeLists.txt:
  • GNUmakefile.list.am:
  • Target.pri:
  • WebCore.gypi:
  • WebCore.vcproj/WebCore.vcproj:
  • WebCore.xcodeproj/project.pbxproj:

Update projects.

  • platform/text/TextAllInOne.cpp:

Add TextBreakIterator.cpp.

  • editing/Editor.h:

Forward declare SharedBuffer, now that PlatformString.h doesn't.

  • html/InputType.cpp:

#include TextBreakIterator.h.

  • loader/appcache/ApplicationCacheStorage.h:

Replace inclusion of PlatformString.h with WTFString.h and forward declare SharedBuffer.

  • platform/LocalizedStrings.cpp:

Replace inclusion of PlatformString.h with TextBreakIterator.h

  • platform/SharedBuffer.cpp:
  • platform/SharedBuffer.h:

Move utf8Buffer() here.

  • platform/text/PlatformString.h:

Remove everything except the #include of WTFString.h.

  • platform/text/TextBreakIterator.cpp: Renamed from Source/WebCore/platform/text/String.cpp.

(WebCore::numGraphemeClusters):
(WebCore::numCharactersInGraphemeClusters):

  • platform/text/TextBreakIterator.h:

Move numGraphemeClusters() and numCharactersInGraphemeClusters() here.

Source/WebKit2:

  • UIProcess/WebPageProxy.h:

Forward declare SharedBuffer.

Location:
trunk/Source
Files:
19 edited
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/CMakeLists.txt

    r127501 r127525  
    19891989    platform/text/RegularExpression.cpp
    19901990    platform/text/SegmentedString.cpp
    1991     platform/text/String.cpp
    19921991    platform/text/TextBoundaries.cpp
     1992    platform/text/TextBreakIterator.cpp
    19931993    platform/text/TextCodec.cpp
    19941994    platform/text/TextCodecLatin1.cpp
  • trunk/Source/WebCore/ChangeLog

    r127520 r127525  
     12012-09-03  Sam Weinig  <sam@webkit.org>
     2
     3        Part 1 of removing PlatformString.h, move remaining functions to new homes
     4        https://bugs.webkit.org/show_bug.cgi?id=95702
     5
     6        Reviewed by Beth Dakin.
     7
     8        Move utf8Buffer() to SharedBuffer.h/cpp
     9        Move numGraphemeClusters() and numCharactersInGraphemeClusters() to TextBreakIterator.h/cpp
     10
     11        * CMakeLists.txt:
     12        * GNUmakefile.list.am:
     13        * Target.pri:
     14        * WebCore.gypi:
     15        * WebCore.vcproj/WebCore.vcproj:
     16        * WebCore.xcodeproj/project.pbxproj:
     17        Update projects.
     18
     19        * platform/text/TextAllInOne.cpp:
     20        Add TextBreakIterator.cpp.
     21
     22        * editing/Editor.h:
     23        Forward declare SharedBuffer, now that PlatformString.h doesn't.
     24
     25        * html/InputType.cpp:
     26        #include TextBreakIterator.h.
     27
     28        * loader/appcache/ApplicationCacheStorage.h:
     29        Replace inclusion of PlatformString.h with WTFString.h and forward declare SharedBuffer.
     30
     31        * platform/LocalizedStrings.cpp:
     32        Replace inclusion of PlatformString.h with TextBreakIterator.h
     33 
     34        * platform/SharedBuffer.cpp:
     35        * platform/SharedBuffer.h:
     36        Move utf8Buffer() here.
     37
     38        * platform/text/PlatformString.h:
     39        Remove everything except the #include of WTFString.h.
     40
     41        * platform/text/TextBreakIterator.cpp: Renamed from Source/WebCore/platform/text/String.cpp.
     42        (WebCore::numGraphemeClusters):
     43        (WebCore::numCharactersInGraphemeClusters):
     44        * platform/text/TextBreakIterator.h:
     45        Move numGraphemeClusters() and numCharactersInGraphemeClusters() here.
     46
    1472012-09-04  Julien Chaffraix  <jchaffraix@webkit.org>
    248
  • trunk/Source/WebCore/GNUmakefile.list.am

    r127501 r127525  
    47654765        Source/WebCore/platform/text/SegmentedString.cpp \
    47664766        Source/WebCore/platform/text/SegmentedString.h \
    4767         Source/WebCore/platform/text/String.cpp \
    47684767        Source/WebCore/platform/text/StringWithDirection.h \
    47694768        Source/WebCore/platform/text/SuffixTree.h \
    47704769        Source/WebCore/platform/text/TextBoundaries.cpp \
    47714770        Source/WebCore/platform/text/TextBoundaries.h \
     4771        Source/WebCore/platform/text/TextBreakIterator.cpp \
    47724772        Source/WebCore/platform/text/TextBreakIterator.h \
    47734773        Source/WebCore/platform/text/TextCheckerClient.h \
  • trunk/Source/WebCore/Target.pri

    r127217 r127525  
    10631063    platform/sql/SQLValue.cpp \
    10641064    platform/text/SegmentedString.cpp \
    1065     platform/text/String.cpp \
    10661065    platform/text/TextBoundaries.cpp \
     1066    platform/text/TextBreakIterator.cpp \
    10671067    platform/text/TextCodec.cpp \
    10681068    platform/text/TextCodecLatin1.cpp \
  • trunk/Source/WebCore/WebCore.gypi

    r127501 r127525  
    44804480            'platform/text/RegularExpression.cpp',
    44814481            'platform/text/SegmentedString.cpp',
    4482             'platform/text/String.cpp',
    44834482            'platform/text/StringWithDirection.h',
    44844483            'platform/text/SuffixTree.h',
    44854484            'platform/text/TextBoundaries.cpp',
     4485            'platform/text/TextBreakIterator.cpp',
    44864486            'platform/text/TextBreakIteratorICU.cpp',
    44874487            'platform/text/TextCodec.cpp',
  • trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj

    r127454 r127525  
    3372333723                                </File>
    3372433724                                <File
    33725                                         RelativePath="..\platform\text\String.cpp"
    33726                                         >
    33727                                 </File>
    33728                                 <File
    3372933725                                        RelativePath="..\platform\text\StringHash.h"
    3373033726                                        >
     
    3382933825                                        RelativePath="..\platform\text\TextBreakIterator.h"
    3383033826                                        >
     33827                                </File>
     33828                                <File
     33829                                        RelativePath="..\platform\text\TextBreakIterator.cpp"
     33830                                        >
     33831                                        <FileConfiguration
     33832                                                Name="Release|Win32"
     33833                                                ExcludedFromBuild="true"
     33834                                                >
     33835                                                <Tool
     33836                                                        Name="VCCLCompilerTool"
     33837                                                />
     33838                                        </FileConfiguration>
     33839                                        <FileConfiguration
     33840                                                Name="Production|Win32"
     33841                                                ExcludedFromBuild="true"
     33842                                                >
     33843                                                <Tool
     33844                                                        Name="VCCLCompilerTool"
     33845                                                />
     33846                                        </FileConfiguration>
    3383133847                                </File>
    3383233848                                <File
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r127217 r127525  
    49214921                B2C3DA2E0D006C1D00EF6F26 /* SegmentedString.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B2C3D9FE0D006C1D00EF6F26 /* SegmentedString.cpp */; };
    49224922                B2C3DA2F0D006C1D00EF6F26 /* SegmentedString.h in Headers */ = {isa = PBXBuildFile; fileRef = B2C3D9FF0D006C1D00EF6F26 /* SegmentedString.h */; settings = {ATTRIBUTES = (Private, ); }; };
    4923                 B2C3DA300D006C1D00EF6F26 /* String.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B2C3DA000D006C1D00EF6F26 /* String.cpp */; };
    49244923                B2C3DA340D006C1D00EF6F26 /* TextBoundaries.h in Headers */ = {isa = PBXBuildFile; fileRef = B2C3DA040D006C1D00EF6F26 /* TextBoundaries.h */; settings = {ATTRIBUTES = (Private, ); }; };
    49254924                B2C3DA360D006C1D00EF6F26 /* TextBreakIterator.h in Headers */ = {isa = PBXBuildFile; fileRef = B2C3DA060D006C1D00EF6F26 /* TextBreakIterator.h */; settings = {ATTRIBUTES = (Private, ); }; };
     
    56325631                BCD41ABB0C060DE800C0E446 /* JSHTMLFrameSetElementCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCD41ABA0C060DE800C0E446 /* JSHTMLFrameSetElementCustom.cpp */; };
    56335632                BCD533640ED6848900887468 /* CachedScriptSourceProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = BCD533630ED6848900887468 /* CachedScriptSourceProvider.h */; };
     5633                BCD8A5F015F56F2C0098D071 /* TextBreakIterator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCD8A5EF15F56F2C0098D071 /* TextBreakIterator.cpp */; };
    56345634                BCD9C2620C17AA67005C90A2 /* JSDOMWindowCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCD9C25E0C17AA67005C90A2 /* JSDOMWindowCustom.cpp */; };
    56355635                BCD9C2630C17AA67005C90A2 /* JSNamedNodeMapCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCD9C25F0C17AA67005C90A2 /* JSNamedNodeMapCustom.cpp */; };
     
    1219312193                B2C3D9FE0D006C1D00EF6F26 /* SegmentedString.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = SegmentedString.cpp; sourceTree = "<group>"; };
    1219412194                B2C3D9FF0D006C1D00EF6F26 /* SegmentedString.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SegmentedString.h; sourceTree = "<group>"; };
    12195                 B2C3DA000D006C1D00EF6F26 /* String.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = String.cpp; sourceTree = "<group>"; };
    1219612195                B2C3DA040D006C1D00EF6F26 /* TextBoundaries.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = TextBoundaries.h; sourceTree = "<group>"; };
    1219712196                B2C3DA060D006C1D00EF6F26 /* TextBreakIterator.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = TextBreakIterator.h; sourceTree = "<group>"; };
     
    1293212931                BCD41ABA0C060DE800C0E446 /* JSHTMLFrameSetElementCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLFrameSetElementCustom.cpp; sourceTree = "<group>"; };
    1293312932                BCD533630ED6848900887468 /* CachedScriptSourceProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CachedScriptSourceProvider.h; sourceTree = "<group>"; };
     12933                BCD8A5EF15F56F2C0098D071 /* TextBreakIterator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TextBreakIterator.cpp; sourceTree = "<group>"; };
    1293412934                BCD9C25E0C17AA67005C90A2 /* JSDOMWindowCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSDOMWindowCustom.cpp; sourceTree = "<group>"; };
    1293512935                BCD9C25F0C17AA67005C90A2 /* JSNamedNodeMapCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSNamedNodeMapCustom.cpp; sourceTree = "<group>"; };
     
    1999119991                                B2C3D9FE0D006C1D00EF6F26 /* SegmentedString.cpp */,
    1999219992                                B2C3D9FF0D006C1D00EF6F26 /* SegmentedString.h */,
    19993                                 B2C3DA000D006C1D00EF6F26 /* String.cpp */,
    1999419993                                9B6C41521344949000085B62 /* StringWithDirection.h */,
    1999519994                                97C0784F1165D5BE003A32EF /* SuffixTree.h */,
    1999619995                                372C00C3129611F1005C9575 /* TextBoundaries.cpp */,
    1999719996                                B2C3DA040D006C1D00EF6F26 /* TextBoundaries.h */,
     19997                                BCD8A5EF15F56F2C0098D071 /* TextBreakIterator.cpp */,
    1999819998                                B2C3DA060D006C1D00EF6F26 /* TextBreakIterator.h */,
    1999919999                                B2C3DA070D006C1D00EF6F26 /* TextBreakIteratorICU.cpp */,
     
    2813128131                                511F23190DC160DA004F0032 /* StorageThread.cpp in Sources */,
    2813228132                                3AB02D2B12D4F91600FBB694 /* StorageTracker.cpp in Sources */,
    28133                                 B2C3DA300D006C1D00EF6F26 /* String.cpp in Sources */,
    2813428133                                8102C5881325BB1100DDE67A /* StringCallback.cpp in Sources */,
    2813528134                                B2B2645C0D00A77E000ACC1D /* StringCF.cpp in Sources */,
     
    2858828587                                4FB390AD15EF61F3007AD51F /* GeneratedImage.cpp in Sources */,
    2858928588                                377A3A9015EFCE9B0059F5C7 /* BitmapImageCG.cpp in Sources */,
     28589                                BCD8A5F015F56F2C0098D071 /* TextBreakIterator.cpp in Sources */,
    2859028590                        );
    2859128591                        runOnlyForDeploymentPostprocessing = 0;
  • trunk/Source/WebCore/editing/Editor.h

    r123429 r127525  
    6565class SpellCheckRequest;
    6666class AlternativeTextController;
     67class SharedBuffer;
    6768class StylePropertySet;
    6869class Text;
  • trunk/Source/WebCore/html/InputType.cpp

    r126966 r127525  
    6969#include "SubmitInputType.h"
    7070#include "TelephoneInputType.h"
     71#include "TextBreakIterator.h"
    7172#include "TextInputType.h"
    7273#include "TimeInputType.h"
  • trunk/Source/WebCore/html/shadow/DateTimeSymbolicFieldElement.cpp

    r127400 r127525  
    3232#include "RenderStyle.h"
    3333#include "StyleResolver.h"
     34#include "TextBreakIterator.h"
    3435#include "TextRun.h"
    3536#include <wtf/text/StringBuilder.h>
  • trunk/Source/WebCore/loader/appcache/ApplicationCacheStorage.h

    r95919 r127525  
    2727#define ApplicationCacheStorage_h
    2828
    29 #include "PlatformString.h"
    3029#include "SecurityOriginHash.h"
    3130#include "SQLiteDatabase.h"
     
    3332#include <wtf/HashSet.h>
    3433#include <wtf/text/StringHash.h>
     34#include <wtf/text/WTFString.h>
    3535
    3636namespace WebCore {
     
    4141class ApplicationCacheResource;
    4242class KURL;
    43 template <class T>
    44 class StorageIDJournal;
    4543class SecurityOrigin;
     44class SharedBuffer;
     45template <class T> class StorageIDJournal;
    4646
    4747class ApplicationCacheStorage {
  • trunk/Source/WebCore/platform/LocalizedStrings.cpp

    r124636 r127525  
    3030#include "IntSize.h"
    3131#include "NotImplemented.h"
    32 #include "PlatformString.h"
     32#include "TextBreakIterator.h"
    3333#include <wtf/MathExtras.h>
     34#include <wtf/UnusedParam.h>
     35#include <wtf/unicode/CharacterNames.h>
     36
    3437#if USE(CF)
    3538#include <wtf/RetainPtr.h>
    3639#endif
    37 #include <wtf/UnusedParam.h>
    38 #include <wtf/unicode/CharacterNames.h>
    3940
    4041#if PLATFORM(MAC)
  • trunk/Source/WebCore/platform/SharedBuffer.cpp

    r124884 r127525  
    3131#include "PurgeableBuffer.h"
    3232#include <wtf/PassOwnPtr.h>
     33#include <wtf/unicode/UTF8.h>
     34#include <wtf/unicode/Unicode.h>
    3335
    3436using namespace std;
     
    331333#endif
    332334
    333 }
     335PassRefPtr<SharedBuffer> utf8Buffer(const String& string)
     336{
     337    // Allocate a buffer big enough to hold all the characters.
     338    const int length = string.length();
     339    Vector<char> buffer(length * 3);
     340
     341    // Convert to runs of 8-bit characters.
     342    char* p = buffer.data();
     343    const UChar* d = string.characters();
     344    WTF::Unicode::ConversionResult result = WTF::Unicode::convertUTF16ToUTF8(&d, d + length, &p, p + buffer.size(), true);
     345    if (result != WTF::Unicode::conversionOK)
     346        return 0;
     347
     348    buffer.shrink(p - buffer.data());
     349    return SharedBuffer::adoptVector(buffer);
     350}
     351
     352} // namespace WebCore
  • trunk/Source/WebCore/platform/SharedBuffer.h

    r123716 r127525  
    149149#endif
    150150};
    151    
    152 }
     151
     152PassRefPtr<SharedBuffer> utf8Buffer(const String&);
     153
     154} // namespace WebCore
    153155
    154156#endif // SharedBuffer_h
  • trunk/Source/WebCore/platform/text/PlatformString.h

    r57904 r127525  
    2929
    3030namespace WebCore {
    31 
    32 class SharedBuffer;
    33 
    34 PassRefPtr<SharedBuffer> utf8Buffer(const String&);
    35 // Counts the number of grapheme clusters. A surrogate pair or a sequence
    36 // of a non-combining character and following combining characters is
    37 // counted as 1 grapheme cluster.
    38 unsigned numGraphemeClusters(const String& s);
    39 // Returns the number of characters which will be less than or equal to
    40 // the specified grapheme cluster length.
    41 unsigned numCharactersInGraphemeClusters(const String& s, unsigned);
    42 
    4331} // namespace WebCore
    4432
  • trunk/Source/WebCore/platform/text/TextAllInOne.cpp

    r109929 r127525  
    2727
    2828#include "TextBoundaries.cpp"
     29#include "TextBreakIterator.cpp"
    2930#include "TextBreakIteratorICU.cpp"
    3031#include "TextCodec.cpp"
  • trunk/Source/WebCore/platform/text/TextBreakIterator.cpp

    r127520 r127525  
    2121
    2222#include "config.h"
    23 #include "PlatformString.h"
    24 
    25 #include "SharedBuffer.h"
    2623#include "TextBreakIterator.h"
    27 #include <wtf/unicode/UTF8.h>
    28 #include <wtf/unicode/Unicode.h>
    29 
    30 using namespace WTF;
    31 using namespace WTF::Unicode;
    3224
    3325namespace WebCore {
    34 
    35 PassRefPtr<SharedBuffer> utf8Buffer(const String& string)
    36 {
    37     // Allocate a buffer big enough to hold all the characters.
    38     const int length = string.length();
    39     Vector<char> buffer(length * 3);
    40 
    41     // Convert to runs of 8-bit characters.
    42     char* p = buffer.data();
    43     const UChar* d = string.characters();
    44     ConversionResult result = convertUTF16ToUTF8(&d, d + length, &p, p + buffer.size(), true);
    45     if (result != conversionOK)
    46         return 0;
    47 
    48     buffer.shrink(p - buffer.data());
    49     return SharedBuffer::adoptVector(buffer);
    50 }
    5126
    5227unsigned numGraphemeClusters(const String& s)
     
    6641    NonSharedCharacterBreakIterator it(s.characters(), s.length());
    6742    if (!it)
    68         return min(s.length(), numGraphemeClusters);
     43        return std::min(s.length(), numGraphemeClusters);
    6944
    7045    for (unsigned i = 0; i < numGraphemeClusters; ++i) {
  • trunk/Source/WebCore/platform/text/TextBreakIterator.h

    r118568 r127525  
    116116};
    117117
     118// Counts the number of grapheme clusters. A surrogate pair or a sequence
     119// of a non-combining character and following combining characters is
     120// counted as 1 grapheme cluster.
     121unsigned numGraphemeClusters(const String&);
     122// Returns the number of characters which will be less than or equal to
     123// the specified grapheme cluster length.
     124unsigned numCharactersInGraphemeClusters(const String&, unsigned);
     125
    118126}
    119127
  • trunk/Source/WebKit2/ChangeLog

    r127513 r127525  
     12012-09-03  Sam Weinig  <sam@webkit.org>
     2
     3        Part 1 of removing PlatformString.h, move remaining functions to new homes
     4        https://bugs.webkit.org/show_bug.cgi?id=95702
     5
     6        Reviewed by Beth Dakin.
     7
     8        * UIProcess/WebPageProxy.h:
     9        Forward declare SharedBuffer.
     10
    1112012-09-04  Jeffrey Pfau  <jpfau@apple.com>
    212
  • trunk/Source/WebKit2/UIProcess/WebPageProxy.h

    r126343 r127525  
    100100    class IntSize;
    101101    class ProtectionSpace;
     102    class SharedBuffer;
    102103    struct FileChooserSettings;
    103104    struct TextAlternativeWithRange;
Note: See TracChangeset for help on using the changeset viewer.