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

commit-queue at webkit.org commit-queue at webkit.org
Wed Dec 22 15:36:05 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 457f1a25df12445776e67522ac0f0893a8600c6d
Author: commit-queue at webkit.org <commit-queue at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Nov 9 01:53:55 2010 +0000

    2010-11-08  Ned Holbrook  <nholbrook at apple.com>
    
            Reviewed by Adam Barth.
    
            Avoid CFAttributedString creation in ComplexTextController by adopting UniChar provider SPI.
            https://bugs.webkit.org/show_bug.cgi?id=48886
    
            * WebCore.exp.in:
            * platform/graphics/mac/ComplexTextControllerCoreText.cpp:
            (WebCore::provideStringAndAttributes):
            (WebCore::ComplexTextController::collectComplexTextRunsForCharactersCoreText):
            * platform/mac/WebCoreSystemInterface.h:
            * platform/mac/WebCoreSystemInterface.mm:
    2010-11-08  Ned Holbrook  <nholbrook at apple.com>
    
            Reviewed by Adam Barth.
    
            Avoid CFAttributedString creation in ComplexTextController by adopting UniChar provider SPI.
            https://bugs.webkit.org/show_bug.cgi?id=48886
    
            * WebCoreSupport/WebSystemInterface.mm:
            (InitWebCoreSystemInterface):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@71590 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index c7f86b8..661c2fb 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,17 @@
+2010-11-08  Ned Holbrook  <nholbrook at apple.com>
+
+        Reviewed by Adam Barth.
+
+        Avoid CFAttributedString creation in ComplexTextController by adopting UniChar provider SPI.
+        https://bugs.webkit.org/show_bug.cgi?id=48886
+
+        * WebCore.exp.in:
+        * platform/graphics/mac/ComplexTextControllerCoreText.cpp:
+        (WebCore::provideStringAndAttributes):
+        (WebCore::ComplexTextController::collectComplexTextRunsForCharactersCoreText):
+        * platform/mac/WebCoreSystemInterface.h:
+        * platform/mac/WebCoreSystemInterface.mm:
+
 2010-11-08  David Hyatt  <hyatt at apple.com>
 
         Reviewed by Simon Fraser.
diff --git a/WebCore/WebCore.exp.in b/WebCore/WebCore.exp.in
index 89bf768..7ac3035 100644
--- a/WebCore/WebCore.exp.in
+++ b/WebCore/WebCore.exp.in
@@ -1158,6 +1158,7 @@ _wkCGContextGetShouldSmoothFonts
 _wkCopyCFLocalizationPreferredName
 _wkCopyCONNECTProxyResponse
 _wkCopyNSURLResponseStatusLine
+_wkCreateCTLineWithUniCharProvider
 _wkCreateCustomCFReadStream
 _wkCreateNSURLConnectionDelegateProxy
 _wkCreateURLNPasteboardFlavorTypeName
@@ -1213,6 +1214,10 @@ _wkSignalCFReadStreamEnd
 _wkSignalCFReadStreamError
 _wkSignalCFReadStreamHasBytes
 
+#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+_wkCreateCTTypesetterWithUniCharProviderAndOptions
+#endif
+
 #if ENABLE(3D_RENDERING)
 _WebCoreHas3DRendering
 #endif
diff --git a/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.cpp b/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.cpp
index 744e6d4..0346d56 100644
--- a/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.cpp
+++ b/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.cpp
@@ -24,6 +24,7 @@
 
 #include "config.h"
 #include "ComplexTextController.h"
+#include "WebCoreSystemInterface.h"
 
 #if USE(CORE_TEXT)
 
@@ -101,6 +102,23 @@ void ComplexTextController::ComplexTextRun::createTextRunFromFontDataCoreText(bo
     m_advances = m_advancesVector.data();
 }
 
+struct ProviderInfo {
+    const UChar* cp;
+    unsigned length;
+    CFDictionaryRef attributes;
+};
+
+static const UniChar* provideStringAndAttributes(CFIndex stringIndex, CFIndex* charCount, CFDictionaryRef* attributes, void* refCon)
+{
+    ProviderInfo* info = static_cast<struct ProviderInfo*>(refCon);
+    if (stringIndex >= info->length)
+        return 0;
+
+    *charCount = info->length - stringIndex;
+    *attributes = info->attributes;
+    return info->cp + stringIndex;
+}
+
 void ComplexTextController::collectComplexTextRunsForCharactersCoreText(const UChar* cp, unsigned length, unsigned stringLocation, const SimpleFontData* fontData)
 {
     if (!fontData) {
@@ -112,10 +130,6 @@ void ComplexTextController::collectComplexTextRunsForCharactersCoreText(const UC
     if (m_fallbackFonts && fontData != m_font.primaryFont())
         m_fallbackFonts->add(fontData);
 
-    RetainPtr<CFStringRef> string(AdoptCF, CFStringCreateWithCharactersNoCopy(NULL, cp, length, kCFAllocatorNull));
-
-    RetainPtr<CFAttributedStringRef> attributedString(AdoptCF, CFAttributedStringCreate(NULL, string.get(), fontData->getCFStringAttributes(m_font.typesettingFeatures())));
-
     RetainPtr<CTLineRef> line;
 
     if (!m_mayUseNaturalWritingDirection || m_run.directionalOverride()) {
@@ -126,11 +140,22 @@ void ComplexTextController::collectComplexTextRunsForCharactersCoreText(const UC
         static const void* rtlOptionValues[] = { CFNumberCreate(kCFAllocatorDefault, kCFNumberShortType, &rtlForcedEmbeddingLevelValue) };
         static CFDictionaryRef ltrTypesetterOptions = CFDictionaryCreate(kCFAllocatorDefault, optionKeys, ltrOptionValues, sizeof(optionKeys) / sizeof(*optionKeys), &kCFCopyStringDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
         static CFDictionaryRef rtlTypesetterOptions = CFDictionaryCreate(kCFAllocatorDefault, optionKeys, rtlOptionValues, sizeof(optionKeys) / sizeof(*optionKeys), &kCFCopyStringDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
+
+#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+        ProviderInfo info = { cp, length, fontData->getCFStringAttributes(m_font.typesettingFeatures()) };
+        RetainPtr<CTTypesetterRef> typesetter(AdoptCF, wkCreateCTTypesetterWithUniCharProviderAndOptions(&provideStringAndAttributes, 0, &info, m_run.ltr() ? ltrTypesetterOptions : rtlTypesetterOptions));
+#else
+        RetainPtr<CFStringRef> string(AdoptCF, CFStringCreateWithCharactersNoCopy(kCFAllocatorDefault, cp, length, kCFAllocatorNull));
+        RetainPtr<CFAttributedStringRef> attributedString(AdoptCF, CFAttributedStringCreate(kCFAllocatorDefault, string.get(), fontData->getCFStringAttributes(m_font.typesettingFeatures())));
         RetainPtr<CTTypesetterRef> typesetter(AdoptCF, CTTypesetterCreateWithAttributedStringAndOptions(attributedString.get(), m_run.ltr() ? ltrTypesetterOptions : rtlTypesetterOptions));
+#endif
 
         line.adoptCF(CTTypesetterCreateLine(typesetter.get(), CFRangeMake(0, 0)));
-    } else
-        line.adoptCF(CTLineCreateWithAttributedString(attributedString.get()));
+    } else {
+        ProviderInfo info = { cp, length, fontData->getCFStringAttributes(m_font.typesettingFeatures()) };
+
+        line.adoptCF(wkCreateCTLineWithUniCharProvider(&provideStringAndAttributes, 0, &info));
+    }
 
     CFArrayRef runArray = CTLineGetGlyphRuns(line.get());
 
diff --git a/WebCore/platform/mac/WebCoreSystemInterface.h b/WebCore/platform/mac/WebCoreSystemInterface.h
index 758639d..201266e 100644
--- a/WebCore/platform/mac/WebCoreSystemInterface.h
+++ b/WebCore/platform/mac/WebCoreSystemInterface.h
@@ -176,6 +176,11 @@ extern void* wkGetHyphenationLocationBeforeIndex;
 extern CFIndex (*wkGetHyphenationLocationBeforeIndex)(CFStringRef string, CFIndex index);
 #endif
 
+extern CTLineRef (*wkCreateCTLineWithUniCharProvider)(const UniChar* (*provide)(CFIndex stringIndex, CFIndex* charCount, CFDictionaryRef* attributes, void*), void (*dispose)(const UniChar* chars, void*), void*);
+#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+extern CTTypesetterRef (*wkCreateCTTypesetterWithUniCharProviderAndOptions)(const UniChar* (*provide)(CFIndex stringIndex, CFIndex* charCount, CFDictionaryRef* attributes, void*), void (*dispose)(const UniChar* chars, void*), void*, CFDictionaryRef options);
+#endif
+
 }
 
 #endif
diff --git a/WebCore/platform/mac/WebCoreSystemInterface.mm b/WebCore/platform/mac/WebCoreSystemInterface.mm
index 1882674..9c0c441 100644
--- a/WebCore/platform/mac/WebCoreSystemInterface.mm
+++ b/WebCore/platform/mac/WebCoreSystemInterface.mm
@@ -118,3 +118,8 @@ void* wkGetHyphenationLocationBeforeIndex;
 #else
 CFIndex (*wkGetHyphenationLocationBeforeIndex)(CFStringRef string, CFIndex index);
 #endif
+
+CTLineRef (*wkCreateCTLineWithUniCharProvider)(const UniChar* (*provide)(CFIndex stringIndex, CFIndex* charCount, CFDictionaryRef* attributes, void*), void (*dispose)(const UniChar* chars, void*), void*);
+#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+CTTypesetterRef (*wkCreateCTTypesetterWithUniCharProviderAndOptions)(const UniChar* (*provide)(CFIndex stringIndex, CFIndex* charCount, CFDictionaryRef* attributes, void*), void (*dispose)(const UniChar* chars, void*), void*, CFDictionaryRef options);
+#endif
diff --git a/WebKit/mac/ChangeLog b/WebKit/mac/ChangeLog
index a5abd44..28fa7dd 100644
--- a/WebKit/mac/ChangeLog
+++ b/WebKit/mac/ChangeLog
@@ -1,3 +1,13 @@
+2010-11-08  Ned Holbrook  <nholbrook at apple.com>
+
+        Reviewed by Adam Barth.
+
+        Avoid CFAttributedString creation in ComplexTextController by adopting UniChar provider SPI.
+        https://bugs.webkit.org/show_bug.cgi?id=48886
+
+        * WebCoreSupport/WebSystemInterface.mm:
+        (InitWebCoreSystemInterface):
+
 2010-11-08  Nate Chapin  <japhet at chromium.org>
 
         Unreviewed, build fix.
diff --git a/WebKit/mac/WebCoreSupport/WebSystemInterface.mm b/WebKit/mac/WebCoreSupport/WebSystemInterface.mm
index df3ea4d..2c57646 100644
--- a/WebKit/mac/WebCoreSupport/WebSystemInterface.mm
+++ b/WebKit/mac/WebCoreSupport/WebSystemInterface.mm
@@ -118,5 +118,10 @@ void InitWebCoreSystemInterface(void)
     INIT(GetHyphenationLocationBeforeIndex);
 #endif
 
+    INIT(CreateCTLineWithUniCharProvider);
+#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+    INIT(CreateCTTypesetterWithUniCharProviderAndOptions);
+#endif
+
     didInit = true;
 }

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list