diff options
Diffstat (limited to 'WebCore/platform/text/cf/HyphenationCF.cpp')
-rw-r--r-- | WebCore/platform/text/cf/HyphenationCF.cpp | 57 |
1 files changed, 21 insertions, 36 deletions
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) |