diff options
Diffstat (limited to 'WebCore/platform/text')
-rw-r--r-- | WebCore/platform/text/BidiResolver.h | 31 | ||||
-rw-r--r-- | WebCore/platform/text/CharacterNames.h | 18 | ||||
-rw-r--r-- | WebCore/platform/text/TextBoundaries.cpp | 28 | ||||
-rw-r--r-- | WebCore/platform/text/TextBoundaries.h | 3 | ||||
-rw-r--r-- | WebCore/platform/text/TextCodecUTF16.cpp | 11 | ||||
-rw-r--r-- | WebCore/platform/text/TextEncoding.cpp | 39 | ||||
-rw-r--r-- | WebCore/platform/text/TextEncodingRegistry.cpp | 57 | ||||
-rw-r--r-- | WebCore/platform/text/TextEncodingRegistry.h | 6 | ||||
-rw-r--r-- | WebCore/platform/text/brew/StringBrew.cpp | 44 | ||||
-rw-r--r-- | WebCore/platform/text/cf/HyphenationCF.cpp | 57 | ||||
-rw-r--r-- | WebCore/platform/text/haiku/StringHaiku.cpp | 52 | ||||
-rw-r--r-- | WebCore/platform/text/wince/TextCodecWinCE.cpp | 6 | ||||
-rw-r--r-- | WebCore/platform/text/wx/StringWx.cpp | 92 |
13 files changed, 158 insertions, 286 deletions
diff --git a/WebCore/platform/text/BidiResolver.h b/WebCore/platform/text/BidiResolver.h index 6018c3f..1f87115 100644 --- a/WebCore/platform/text/BidiResolver.h +++ b/WebCore/platform/text/BidiResolver.h @@ -314,13 +314,23 @@ void BidiResolver<Iterator, Run>::checkDirectionInLowerRaiseEmbeddingLevel() using namespace WTF::Unicode; ASSERT(m_status.eor != OtherNeutral || eor.atEnd()); - ASSERT(m_status.last != NonSpacingMark - && m_status.last != BoundaryNeutral - && m_status.last != RightToLeftEmbedding - && m_status.last != LeftToRightEmbedding - && m_status.last != RightToLeftOverride - && m_status.last != LeftToRightOverride - && m_status.last != PopDirectionalFormat); + // bidi.sor ... bidi.eor ... bidi.last eor; need to append the bidi.sor-bidi.eor run or extend it through bidi.last + // Bidi control characters are included into BidiRun, so last direction + // could be one of the bidi embeddings when there are nested embeddings. + // For example: "‪‫....." + ASSERT(m_status.last == EuropeanNumberSeparator + || m_status.last == EuropeanNumberTerminator + || m_status.last == CommonNumberSeparator + || m_status.last == BoundaryNeutral + || m_status.last == BlockSeparator + || m_status.last == SegmentSeparator + || m_status.last == WhiteSpaceNeutral + || m_status.last == OtherNeutral + || m_status.last == RightToLeftEmbedding + || m_status.last == LeftToRightEmbedding + || m_status.last == RightToLeftOverride + || m_status.last == LeftToRightOverride + || m_status.last == PopDirectionalFormat); if (m_direction == OtherNeutral) m_direction = m_status.lastStrong == LeftToRight ? LeftToRight : RightToLeft; } @@ -332,7 +342,6 @@ void BidiResolver<Iterator, Run>::lowerExplicitEmbeddingLevel(WTF::Unicode::Dire if (!emptyRun && eor != last) { checkDirectionInLowerRaiseEmbeddingLevel(); - // bidi.sor ... bidi.eor ... bidi.last eor; need to append the bidi.sor-bidi.eor run or extend it through bidi.last if (from == LeftToRight) { // bidi.sor ... bidi.eor ... bidi.last L if (m_status.eor == EuropeanNumber) { @@ -368,7 +377,6 @@ void BidiResolver<Iterator, Run>::raiseExplicitEmbeddingLevel(WTF::Unicode::Dire if (!emptyRun && eor != last) { checkDirectionInLowerRaiseEmbeddingLevel(); - // bidi.sor ... bidi.eor ... bidi.last eor; need to append the bidi.sor-bidi.eor run or extend it through bidi.last if (to == LeftToRight) { // bidi.sor ... bidi.eor ... bidi.last L if (m_status.eor == EuropeanNumber) { @@ -858,11 +866,6 @@ void BidiResolver<Iterator, Run>::createBidiRunsForLine(const Iterator& end, boo break; case NonSpacingMark: case BoundaryNeutral: - case RightToLeftEmbedding: - case LeftToRightEmbedding: - case RightToLeftOverride: - case LeftToRightOverride: - case PopDirectionalFormat: // ignore these break; case EuropeanNumber: diff --git a/WebCore/platform/text/CharacterNames.h b/WebCore/platform/text/CharacterNames.h index 9f8f807..c4b496e 100644 --- a/WebCore/platform/text/CharacterNames.h +++ b/WebCore/platform/text/CharacterNames.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007, 2009 Apple Inc. All rights reserved. + * Copyright (C) 2007, 2009, 2010 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -32,13 +32,20 @@ namespace WebCore { // Names here are taken from the Unicode standard. -// Note, these are UChar constants, not UChar32, which makes them +// Most of these are UChar constants, not UChar32, which makes them // more convenient for WebCore code that mostly uses UTF-16. +const UChar32 aegeanWordSeparatorLine = 0x10100; +const UChar32 aegeanWordSeparatorDot = 0x10101; +const UChar blackCircle = 0x25CF; const UChar blackSquare = 0x25A0; +const UChar blackUpPointingTriangle = 0x25B2; const UChar bullet = 0x2022; +const UChar bullseye = 0x25CE; const UChar carriageReturn = 0x000D; const UChar ethiopicPrefaceColon = 0x1366; +const UChar ethiopicWordspace = 0x1361; +const UChar fisheye = 0x25C9; const UChar hebrewPunctuationGeresh = 0x05F3; const UChar hebrewPunctuationGershayim = 0x05F4; const UChar horizontalEllipsis = 0x2026; @@ -63,9 +70,16 @@ const UChar rightSingleQuotationMark = 0x2019; const UChar rightToLeftEmbed = 0x202B; const UChar rightToLeftMark = 0x200F; const UChar rightToLeftOverride = 0x202E; +const UChar sesameDot = 0xFE45; const UChar softHyphen = 0x00AD; const UChar space = 0x0020; +const UChar tibetanMarkIntersyllabicTsheg = 0x0F0B; +const UChar tibetanMarkDelimiterTshegBstar = 0x0F0C; +const UChar32 ugariticWordDivider = 0x1039F; const UChar whiteBullet = 0x25E6; +const UChar whiteCircle = 0x25CB; +const UChar whiteSesameDot = 0xFE46; +const UChar whiteUpPointingTriangle = 0x25B3; const UChar yenSign = 0x00A5; const UChar zeroWidthJoiner = 0x200D; const UChar zeroWidthNonJoiner = 0x200C; diff --git a/WebCore/platform/text/TextBoundaries.cpp b/WebCore/platform/text/TextBoundaries.cpp index 8eaffca..fbb261b 100644 --- a/WebCore/platform/text/TextBoundaries.cpp +++ b/WebCore/platform/text/TextBoundaries.cpp @@ -36,6 +36,32 @@ using namespace Unicode; namespace WebCore { +int endOfFirstWordBoundaryContext(const UChar* characters, int length) +{ + for (int i = 0; i < length; ) { + int first = i; + UChar32 ch; + U16_NEXT(characters, i, length, ch); + if (!requiresContextForWordBoundary(ch)) + return first; + } + return length; +} + +int startOfLastWordBoundaryContext(const UChar* characters, int length) +{ + for (int i = length; i > 0; ) { + int last = i; + UChar32 ch; + U16_PREV(characters, 0, i, ch); + if (!requiresContextForWordBoundary(ch)) + return last; + } + return 0; +} + +#if !PLATFORM(BREWMP) && !PLATFORM(MAC) && !PLATFORM(QT) + int findNextWordFromIndex(const UChar* chars, int len, int position, bool forward) { TextBreakIterator* it = wordBreakIterator(chars, len); @@ -76,4 +102,6 @@ void findWordBoundary(const UChar* chars, int len, int position, int* start, int *start = textBreakPrevious(it); } +#endif // !PLATFORM(BREWMP) && !PLATFORM(MAC) && !PLATFORM(QT) + } // namespace WebCore diff --git a/WebCore/platform/text/TextBoundaries.h b/WebCore/platform/text/TextBoundaries.h index 7eb9cab..870ab62 100644 --- a/WebCore/platform/text/TextBoundaries.h +++ b/WebCore/platform/text/TextBoundaries.h @@ -35,6 +35,9 @@ namespace WebCore { return WTF::Unicode::hasLineBreakingPropertyComplexContext(ch); } + int endOfFirstWordBoundaryContext(const UChar* characters, int length); + int startOfLastWordBoundaryContext(const UChar* characters, int length); + void findWordBoundary(const UChar*, int len, int position, int* start, int* end); int findNextWordFromIndex(const UChar*, int len, int position, bool forward); diff --git a/WebCore/platform/text/TextCodecUTF16.cpp b/WebCore/platform/text/TextCodecUTF16.cpp index 95f4dc4..e88e83b 100644 --- a/WebCore/platform/text/TextCodecUTF16.cpp +++ b/WebCore/platform/text/TextCodecUTF16.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004, 2006, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2004, 2006, 2008, 2010 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -117,8 +117,13 @@ String TextCodecUTF16::decode(const char* bytes, size_t length, bool, bool, bool CString TextCodecUTF16::encode(const UChar* characters, size_t length, UnencodableHandling) { - if (length > numeric_limits<size_t>::max() / 2) - CRASH(); + // We need to be sure we can double the length without overflowing. + // Since the passed-in length is the length of an actual existing + // character buffer, each character is two bytes, and we know + // the buffer doesn't occupy the entire address space, we can + // assert here that doubling the length does not overflow size_t + // and there's no need for a runtime check. + ASSERT(length <= numeric_limits<size_t>::max() / 2); char* bytes; CString string = CString::newUninitialized(length * 2, bytes); diff --git a/WebCore/platform/text/TextEncoding.cpp b/WebCore/platform/text/TextEncoding.cpp index 58e691f..33313a0 100644 --- a/WebCore/platform/text/TextEncoding.cpp +++ b/WebCore/platform/text/TextEncoding.cpp @@ -40,19 +40,11 @@ #include "GOwnPtr.h" #endif #include <wtf/text/CString.h> -#include <wtf/HashSet.h> #include <wtf/OwnPtr.h> #include <wtf/StdLibExtras.h> namespace WebCore { -static void addEncodingName(HashSet<const char*>& set, const char* name) -{ - const char* atomicName = atomicCanonicalTextEncodingName(name); - if (atomicName) - set.add(atomicName); -} - static const TextEncoding& UTF7Encoding() { static TextEncoding globalUTF7Encoding("UTF-7"); @@ -173,39 +165,12 @@ bool TextEncoding::usesVisualOrdering() const bool TextEncoding::isJapanese() const { - if (noExtendedTextEncodingNameUsed()) - return false; - - DEFINE_STATIC_LOCAL(HashSet<const char*>, set, ()); - if (set.isEmpty()) { - addEncodingName(set, "x-mac-japanese"); - addEncodingName(set, "cp932"); - addEncodingName(set, "JIS_X0201"); - addEncodingName(set, "JIS_X0208-1983"); - addEncodingName(set, "JIS_X0208-1990"); - addEncodingName(set, "JIS_X0212-1990"); - addEncodingName(set, "JIS_C6226-1978"); - addEncodingName(set, "Shift_JIS_X0213-2000"); - addEncodingName(set, "ISO-2022-JP"); - addEncodingName(set, "ISO-2022-JP-2"); - addEncodingName(set, "ISO-2022-JP-1"); - addEncodingName(set, "ISO-2022-JP-3"); - addEncodingName(set, "EUC-JP"); - addEncodingName(set, "Shift_JIS"); - } - return m_name && set.contains(m_name); + return isJapaneseEncoding(m_name); } UChar TextEncoding::backslashAsCurrencySymbol() const { - if (noExtendedTextEncodingNameUsed()) - return '\\'; - - // The text encodings below treat backslash as a currency symbol. - // See http://blogs.msdn.com/michkap/archive/2005/09/17/469941.aspx for more information. - static const char* const a = atomicCanonicalTextEncodingName("Shift_JIS_X0213-2000"); - static const char* const b = atomicCanonicalTextEncodingName("EUC-JP"); - return (m_name == a || m_name == b) ? 0x00A5 : '\\'; + return shouldShowBackslashAsCurrencySymbolIn(m_name) ? 0x00A5 : '\\'; } bool TextEncoding::isNonByteBasedEncoding() const diff --git a/WebCore/platform/text/TextEncodingRegistry.cpp b/WebCore/platform/text/TextEncodingRegistry.cpp index 6bf5552..c0c0255 100644 --- a/WebCore/platform/text/TextEncodingRegistry.cpp +++ b/WebCore/platform/text/TextEncodingRegistry.cpp @@ -36,6 +36,7 @@ #include <wtf/Assertions.h> #include <wtf/HashFunctions.h> #include <wtf/HashMap.h> +#include <wtf/HashSet.h> #include <wtf/StdLibExtras.h> #include <wtf/StringExtras.h> #include <wtf/Threading.h> @@ -125,6 +126,8 @@ static Mutex& encodingRegistryMutex() static TextEncodingNameMap* textEncodingNameMap; static TextCodecMap* textCodecMap; static bool didExtendTextCodecMaps; +static HashSet<const char*>* japaneseEncodings; +static HashSet<const char*>* nonBackslashEncodings; static const char* const textEncodingNameBlacklist[] = { "UTF-7" @@ -249,6 +252,59 @@ static void buildBaseTextCodecMaps() #endif } +static void addEncodingName(HashSet<const char*>* set, const char* name) +{ + // We must not use atomicCanonicalTextEncodingName() because this function is called in it. + const char* atomicName = textEncodingNameMap->get(name); + if (atomicName) + set->add(atomicName); +} + +static void buildQuirksSets() +{ + // FIXME: Having isJapaneseEncoding() and shouldShowBackslashAsCurrencySymbolIn() + // and initializing the sets for them in TextEncodingRegistry.cpp look strange. + + ASSERT(!japaneseEncodings); + ASSERT(!nonBackslashEncodings); + + japaneseEncodings = new HashSet<const char*>(); + addEncodingName(japaneseEncodings, "EUC-JP"); + addEncodingName(japaneseEncodings, "ISO-2022-JP"); + addEncodingName(japaneseEncodings, "ISO-2022-JP-1"); + addEncodingName(japaneseEncodings, "ISO-2022-JP-2"); + addEncodingName(japaneseEncodings, "ISO-2022-JP-3"); + addEncodingName(japaneseEncodings, "JIS_C6226-1978"); + addEncodingName(japaneseEncodings, "JIS_X0201"); + addEncodingName(japaneseEncodings, "JIS_X0208-1983"); + addEncodingName(japaneseEncodings, "JIS_X0208-1990"); + addEncodingName(japaneseEncodings, "JIS_X0212-1990"); + addEncodingName(japaneseEncodings, "Shift_JIS"); + addEncodingName(japaneseEncodings, "Shift_JIS_X0213-2000"); + addEncodingName(japaneseEncodings, "cp932"); + addEncodingName(japaneseEncodings, "x-mac-japanese"); + + nonBackslashEncodings = new HashSet<const char*>(); + // The text encodings below treat backslash as a currency symbol for IE compatibility. + // See http://blogs.msdn.com/michkap/archive/2005/09/17/469941.aspx for more information. + addEncodingName(nonBackslashEncodings, "x-mac-japanese"); + addEncodingName(nonBackslashEncodings, "ISO-2022-JP"); + addEncodingName(nonBackslashEncodings, "EUC-JP"); + // Shift_JIS_X0213-2000 is not the same encoding as Shift_JIS on Mac. We need to register both of them. + addEncodingName(nonBackslashEncodings, "Shift_JIS"); + addEncodingName(nonBackslashEncodings, "Shift_JIS_X0213-2000"); +} + +bool isJapaneseEncoding(const char* canonicalEncodingName) +{ + return canonicalEncodingName && japaneseEncodings && japaneseEncodings->contains(canonicalEncodingName); +} + +bool shouldShowBackslashAsCurrencySymbolIn(const char* canonicalEncodingName) +{ + return canonicalEncodingName && nonBackslashEncodings && nonBackslashEncodings->contains(canonicalEncodingName); +} + static void extendTextCodecMaps() { #if USE(ICU_UNICODE) @@ -277,6 +333,7 @@ static void extendTextCodecMaps() #endif pruneBlacklistedCodecs(); + buildQuirksSets(); } PassOwnPtr<TextCodec> newTextCodec(const TextEncoding& encoding) diff --git a/WebCore/platform/text/TextEncodingRegistry.h b/WebCore/platform/text/TextEncodingRegistry.h index 81b7c4c..16844c6 100644 --- a/WebCore/platform/text/TextEncodingRegistry.h +++ b/WebCore/platform/text/TextEncodingRegistry.h @@ -39,12 +39,12 @@ namespace WebCore { // Use TextEncoding::encode to encode, since it takes care of normalization. PassOwnPtr<TextCodec> newTextCodec(const TextEncoding&); - // Only TextEncoding should use this function directly. + // Only TextEncoding should use the following functions directly. const char* atomicCanonicalTextEncodingName(const char* alias); const char* atomicCanonicalTextEncodingName(const UChar* aliasCharacters, size_t aliasLength); - - // Only TextEncoding should use this function directly. bool noExtendedTextEncodingNameUsed(); + bool isJapaneseEncoding(const char* canonicalEncodingName); + bool shouldShowBackslashAsCurrencySymbolIn(const char* canonicalEncodingName); #ifndef NDEBUG void dumpTextEncodingNameMap(); diff --git a/WebCore/platform/text/brew/StringBrew.cpp b/WebCore/platform/text/brew/StringBrew.cpp deleted file mode 100644 index 2da81e3..0000000 --- a/WebCore/platform/text/brew/StringBrew.cpp +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (C) 2010 Company 100, 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 COMPUTER, INC. ``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 COMPUTER, INC. OR - * 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 "PlatformString.h" - -#include <AEEstd.h> - -namespace WTF { - -// String conversions -String::String(const AECHAR* string) -{ - // It is safe to cast AECHAR to UChar as both of them use 16 bits representation. - const UChar* str = reinterpret_cast<const UChar*>(string); - const size_t len = std_wstrlen(string); - - m_impl = StringImpl::create(str, len); -} - -} // namespace WebCore - diff --git a/WebCore/platform/text/cf/HyphenationCF.cpp b/WebCore/platform/text/cf/HyphenationCF.cpp index dbc11ae..3adacad 100644 --- a/WebCore/platform/text/cf/HyphenationCF.cpp +++ b/WebCore/platform/text/cf/HyphenationCF.cpp @@ -33,46 +33,16 @@ #include <wtf/ListHashSet.h> #include <wtf/RetainPtr.h> -#if PLATFORM(WIN) - -#include "SoftLinking.h" - -#ifdef DEBUG_ALL -SOFT_LINK_DEBUG_LIBRARY(CoreFoundation) -#else -SOFT_LINK_LIBRARY(CoreFoundation) -#endif - -SOFT_LINK_OPTIONAL(CoreFoundation, CFStringGetHyphenationLocationBeforeIndex, CFIndex, , (CFStringRef string, CFIndex location, CFRange limitRange, CFOptionFlags options, CFLocaleRef locale, UTF32Char *character)) -SOFT_LINK_OPTIONAL(CoreFoundation, CFStringIsHyphenationAvailableForLocale, Boolean, , (CFLocaleRef locale)) - -static CFIndex wkCFStringGetHyphenationLocationBeforeIndex(CFStringRef string, CFIndex location, CFRange limitRange, CFOptionFlags options, CFLocaleRef locale, UTF32Char *character) -{ - static CFStringGetHyphenationLocationBeforeIndexPtrType cfStringGetHyphenationLocationBeforeIndex = CFStringGetHyphenationLocationBeforeIndexPtr(); - if (!cfStringGetHyphenationLocationBeforeIndex) - return kCFNotFound; - return cfStringGetHyphenationLocationBeforeIndex(string, location, limitRange, options, locale, character); -} - -static Boolean wkCFStringIsHyphenationAvailableForLocale(CFLocaleRef locale) -{ - static CFStringIsHyphenationAvailableForLocalePtrType cfStringIsHyphenationAvailableForLocale = CFStringIsHyphenationAvailableForLocalePtr(); - return cfStringIsHyphenationAvailableForLocale && cfStringIsHyphenationAvailableForLocale(locale); -} - -#define CFStringGetHyphenationLocationBeforeIndex wkCFStringGetHyphenationLocationBeforeIndex -#define CFStringIsHyphenationAvailableForLocale wkCFStringIsHyphenationAvailableForLocale - -#endif // PLATFORM(WIN) - namespace WebCore { +#if !PLATFORM(WIN) || (defined(MAC_OS_X_VERSION_10_7) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7) + template<> RetainPtr<CFLocaleRef> AtomicStringKeyedMRUCache<RetainPtr<CFLocaleRef> >::createValueForNullKey() { - RetainPtr<CFStringRef> cfLocaleIdentifier(AdoptCF, CFStringCreateWithBytesNoCopy(kCFAllocatorDefault, reinterpret_cast<const UInt8*>(currentSearchLocaleID()), strlen(currentSearchLocaleID()), kCFStringEncodingASCII, false, kCFAllocatorNull)); - RetainPtr<CFLocaleRef> locale(AdoptCF, CFLocaleCreate(kCFAllocatorDefault, cfLocaleIdentifier.get())); - return locale; + RetainPtr<CFLocaleRef> locale(AdoptCF, CFLocaleCopyCurrent()); + + return CFStringIsHyphenationAvailableForLocale(locale.get()) ? locale : 0; } template<> @@ -80,7 +50,7 @@ RetainPtr<CFLocaleRef> AtomicStringKeyedMRUCache<RetainPtr<CFLocaleRef> >::creat { RetainPtr<CFStringRef> cfLocaleIdentifier(AdoptCF, localeIdentifier.createCFString()); RetainPtr<CFLocaleRef> locale(AdoptCF, CFLocaleCreate(kCFAllocatorDefault, cfLocaleIdentifier.get())); - + return CFStringIsHyphenationAvailableForLocale(locale.get()) ? locale : 0; } @@ -106,6 +76,21 @@ size_t lastHyphenLocation(const UChar* characters, size_t length, size_t beforeI return result == kCFNotFound ? 0 : result; } +#else + +bool canHyphenate(const AtomicString&) +{ + return false; +} + +size_t lastHyphenLocation(const UChar*, size_t, size_t, const AtomicString&) +{ + ASSERT_NOT_REACHED(); + return 0; +} + +#endif // PLATFORM(WIN) && (!defined(MAC_OS_X_VERSION_10_7) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7) + } // namespace WebCore #endif // !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) diff --git a/WebCore/platform/text/haiku/StringHaiku.cpp b/WebCore/platform/text/haiku/StringHaiku.cpp deleted file mode 100644 index 96d6676..0000000 --- a/WebCore/platform/text/haiku/StringHaiku.cpp +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (C) 2007 Ryan Leavengood <leavengood@gmail.com> - * - * 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 COMPUTER, INC. ``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 COMPUTER, INC. OR - * 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 "PlatformString.h" -#include <wtf/text/CString.h> - -#include <String.h> - -namespace WTF { - -// String conversions -String::String(const BString& string) -{ - if (string.Length()) - m_impl = String::fromUTF8(string.String(), string.Length()).impl(); - else - m_impl = StringImpl::empty(); -} - -String::operator BString() const -{ - BString string; - string.SetTo(utf8().data()); - - return string; -} - -} // namespace WebCore - diff --git a/WebCore/platform/text/wince/TextCodecWinCE.cpp b/WebCore/platform/text/wince/TextCodecWinCE.cpp index da6d5a5..3532e74 100644 --- a/WebCore/platform/text/wince/TextCodecWinCE.cpp +++ b/WebCore/platform/text/wince/TextCodecWinCE.cpp @@ -333,8 +333,7 @@ String TextCodecWinCE::decode(const char* bytes, size_t length, bool flush, bool result.append(L'?'); sawError = true; if (stopOnError) - return String(result.data(), result.size()); - + return String::adopt(result); if (left == 1) break; @@ -351,7 +350,8 @@ String TextCodecWinCE::decode(const char* bytes, size_t length, bool flush, bool } } else m_decodeBuffer.clear(); - return String(result.data(), result.size()); + + return String::adopt(result); } CString TextCodecWinCE::encode(const UChar* characters, size_t length, UnencodableHandling) diff --git a/WebCore/platform/text/wx/StringWx.cpp b/WebCore/platform/text/wx/StringWx.cpp deleted file mode 100644 index 7302edc..0000000 --- a/WebCore/platform/text/wx/StringWx.cpp +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright (C) 2007 Vaclav Slavik, Kevin Ollivier <kevino@theolliviers.com> - * - * 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 COMPUTER, INC. ``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 COMPUTER, INC. OR - * 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 "PlatformString.h" - -#include "unicode/ustring.h" -#include <wtf/text/CString.h> - -#include <wx/defs.h> -#include <wx/string.h> - -namespace WTF { - -// String conversions -String::String(const wxString& wxstr) -{ -#if !wxUSE_UNICODE - #error "This code only works in Unicode build of wxWidgets" -#endif - - // ICU's UChar is 16bit wide, UTF-16, and the code below counts on it, so - // it would break if the definition changed: - wxCOMPILE_TIME_ASSERT(sizeof(UChar) == 2, UCharSizeMustBe16Bit); - -#if SIZEOF_WCHAR_T == 2 // wchar_t==UChar - - const UChar* str = wxstr.wc_str(); - const size_t len = wxstr.length(); - -#else // SIZEOF_WCHAR_T == 4 - - // NB: we can't simply use wxstr.mb_str(wxMBConvUTF16()) here because - // the number of characters in UTF-16 encoding of the string may differ - // from the number of UTF-32 values and we can't get the length from - // returned buffer: - -#if defined(wxUSE_UNICODE_UTF8) && wxUSE_UNICODE_UTF8 - // in wx3's UTF8 mode, wc_str() returns a buffer, not raw pointer - wxWCharBuffer widestr(wxstr.wc_str()); -#else - const wxChar *widestr = wxstr.wc_str(); -#endif - const size_t widelen = wxstr.length(); - - // allocate buffer for the UTF-16 string: - wxMBConvUTF16 conv; - const size_t utf16bufLen = conv.FromWChar(NULL, 0, widestr, widelen); - wxCharBuffer utf16buf(utf16bufLen); - - // and convert wxString to UTF-16 (=UChar*): - const UChar* str = (const UChar*)utf16buf.data(); - size_t len = conv.FromWChar(utf16buf.data(), utf16bufLen, widestr, widelen) / 2; - -#endif // SIZEOF_WCHAR_T == 4 - - // conversion to UTF-16 or getting internal buffer isn't supposed to fail: - wxASSERT_MSG(str != NULL, _T("failed string conversion?")); - - m_impl = StringImpl::create(str, len); -} - -String::operator wxString() const -{ - return wxString(utf8().data(), wxConvUTF8); -} - -} - -// vim: ts=4 sw=4 et |