[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

mitz at apple.com mitz at apple.com
Wed Dec 22 13:46:07 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 1f6b9f757deeb504a5c7115b91313fcfb53a3384
Author: mitz at apple.com <mitz at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Sat Sep 25 17:30:17 2010 +0000

    <rdar://problem/8478182> Make canHyphenate() return false for unsupported locales
    
    Reviewed by John Sullivan.
    
    No change in functionality, hence no new test.
    
    * platform/text/cf/HyphenationCF.cpp:
    (WebCore::::createValueForKey): Return 0 if hyphenation is not available for the locale.
    (WebCore::cfLocaleCache): Moved the definition of the cache from lastHyphenLocation() to
    this new getter to allow canHyphenate() to share it.
    (WebCore::canHyphenate): Now returns true only if hyphenation is available.
    (WebCore::lastHyphenLocation): Added an assertion.
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@68334 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 35ae252..54d6310 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,18 @@
+2010-09-25  Dan Bernstein  <mitz at apple.com>
+
+        Reviewed by John Sullivan.
+
+        <rdar://problem/8478182> Make canHyphenate() return false for unsupported locales
+
+        No change in functionality, hence no new test.
+
+        * platform/text/cf/HyphenationCF.cpp:
+        (WebCore::::createValueForKey): Return 0 if hyphenation is not available for the locale.
+        (WebCore::cfLocaleCache): Moved the definition of the cache from lastHyphenLocation() to
+        this new getter to allow canHyphenate() to share it.
+        (WebCore::canHyphenate): Now returns true only if hyphenation is available.
+        (WebCore::lastHyphenLocation): Added an assertion.
+
 2010-09-25  Andreas Kling  <andreas.kling at nokia.com>
 
         Reviewed by Kenneth Rohde Christiansen.
diff --git a/WebCore/platform/text/cf/HyphenationCF.cpp b/WebCore/platform/text/cf/HyphenationCF.cpp
index 8be537d..b265c56 100644
--- a/WebCore/platform/text/cf/HyphenationCF.cpp
+++ b/WebCore/platform/text/cf/HyphenationCF.cpp
@@ -48,20 +48,27 @@ RetainPtr<CFLocaleRef> AtomicStringKeyedMRUCache<RetainPtr<CFLocaleRef> >::creat
 {
     RetainPtr<CFStringRef> cfLocaleIdentifier(AdoptCF, localeIdentifier.createCFString());
     RetainPtr<CFLocaleRef> locale(AdoptCF, CFLocaleCreate(kCFAllocatorDefault, cfLocaleIdentifier.get()));
-    return locale;
+    
+    return CFStringIsHyphenationAvailableForLocale(locale.get()) ? locale : 0;
+}
+
+static AtomicStringKeyedMRUCache<RetainPtr<CFLocaleRef> >& cfLocaleCache()
+{
+    DEFINE_STATIC_LOCAL(AtomicStringKeyedMRUCache<RetainPtr<CFLocaleRef> >, cache, ());
+    return cache;
 }
 
-bool canHyphenate(const AtomicString& /* localeIdentifer */)
+bool canHyphenate(const AtomicString& localeIdentifier)
 {
-    return true;
+    return cfLocaleCache().get(localeIdentifier);
 }
 
 size_t lastHyphenLocation(const UChar* characters, size_t length, size_t beforeIndex, const AtomicString& localeIdentifier)
 {
     RetainPtr<CFStringRef> string(AdoptCF, CFStringCreateWithCharactersNoCopy(kCFAllocatorDefault, characters, length, kCFAllocatorNull));
 
-    DEFINE_STATIC_LOCAL(AtomicStringKeyedMRUCache<RetainPtr<CFLocaleRef> >, cfLocaleCache, ());
-    RetainPtr<CFLocaleRef> locale = cfLocaleCache.get(localeIdentifier);
+    RetainPtr<CFLocaleRef> locale = cfLocaleCache().get(localeIdentifier);
+    ASSERT(locale);
 
     CFIndex result = CFStringGetHyphenationLocationBeforeIndex(string.get(), beforeIndex, CFRangeMake(0, length), 0, locale.get(), 0);
     return result == kCFNotFound ? 0 : result;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list