Changeset 71590 in webkit


Ignore:
Timestamp:
Nov 8, 2010 5:53:55 PM (14 years ago)
Author:
commit-queue@webkit.org
Message:

2010-11-08 Ned Holbrook <nholbrook@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@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):
Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r71589 r71590  
     12010-11-08  Ned Holbrook  <nholbrook@apple.com>
     2
     3        Reviewed by Adam Barth.
     4
     5        Avoid CFAttributedString creation in ComplexTextController by adopting UniChar provider SPI.
     6        https://bugs.webkit.org/show_bug.cgi?id=48886
     7
     8        * WebCore.exp.in:
     9        * platform/graphics/mac/ComplexTextControllerCoreText.cpp:
     10        (WebCore::provideStringAndAttributes):
     11        (WebCore::ComplexTextController::collectComplexTextRunsForCharactersCoreText):
     12        * platform/mac/WebCoreSystemInterface.h:
     13        * platform/mac/WebCoreSystemInterface.mm:
     14
    1152010-11-08  David Hyatt  <hyatt@apple.com>
    216
  • trunk/WebCore/WebCore.exp.in

    r71562 r71590  
    11591159_wkCopyCONNECTProxyResponse
    11601160_wkCopyNSURLResponseStatusLine
     1161_wkCreateCTLineWithUniCharProvider
    11611162_wkCreateCustomCFReadStream
    11621163_wkCreateNSURLConnectionDelegateProxy
     
    12131214_wkSignalCFReadStreamError
    12141215_wkSignalCFReadStreamHasBytes
     1216
     1217#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
     1218_wkCreateCTTypesetterWithUniCharProviderAndOptions
     1219#endif
    12151220
    12161221#if ENABLE(3D_RENDERING)
  • trunk/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.cpp

    r64734 r71590  
    2525#include "config.h"
    2626#include "ComplexTextController.h"
     27#include "WebCoreSystemInterface.h"
    2728
    2829#if USE(CORE_TEXT)
     
    102103}
    103104
     105struct ProviderInfo {
     106    const UChar* cp;
     107    unsigned length;
     108    CFDictionaryRef attributes;
     109};
     110
     111static const UniChar* provideStringAndAttributes(CFIndex stringIndex, CFIndex* charCount, CFDictionaryRef* attributes, void* refCon)
     112{
     113    ProviderInfo* info = static_cast<struct ProviderInfo*>(refCon);
     114    if (stringIndex >= info->length)
     115        return 0;
     116
     117    *charCount = info->length - stringIndex;
     118    *attributes = info->attributes;
     119    return info->cp + stringIndex;
     120}
     121
    104122void ComplexTextController::collectComplexTextRunsForCharactersCoreText(const UChar* cp, unsigned length, unsigned stringLocation, const SimpleFontData* fontData)
    105123{
     
    113131        m_fallbackFonts->add(fontData);
    114132
    115     RetainPtr<CFStringRef> string(AdoptCF, CFStringCreateWithCharactersNoCopy(NULL, cp, length, kCFAllocatorNull));
    116 
    117     RetainPtr<CFAttributedStringRef> attributedString(AdoptCF, CFAttributedStringCreate(NULL, string.get(), fontData->getCFStringAttributes(m_font.typesettingFeatures())));
    118 
    119133    RetainPtr<CTLineRef> line;
    120134
     
    127141        static CFDictionaryRef ltrTypesetterOptions = CFDictionaryCreate(kCFAllocatorDefault, optionKeys, ltrOptionValues, sizeof(optionKeys) / sizeof(*optionKeys), &kCFCopyStringDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
    128142        static CFDictionaryRef rtlTypesetterOptions = CFDictionaryCreate(kCFAllocatorDefault, optionKeys, rtlOptionValues, sizeof(optionKeys) / sizeof(*optionKeys), &kCFCopyStringDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
     143
     144#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
     145        ProviderInfo info = { cp, length, fontData->getCFStringAttributes(m_font.typesettingFeatures()) };
     146        RetainPtr<CTTypesetterRef> typesetter(AdoptCF, wkCreateCTTypesetterWithUniCharProviderAndOptions(&provideStringAndAttributes, 0, &info, m_run.ltr() ? ltrTypesetterOptions : rtlTypesetterOptions));
     147#else
     148        RetainPtr<CFStringRef> string(AdoptCF, CFStringCreateWithCharactersNoCopy(kCFAllocatorDefault, cp, length, kCFAllocatorNull));
     149        RetainPtr<CFAttributedStringRef> attributedString(AdoptCF, CFAttributedStringCreate(kCFAllocatorDefault, string.get(), fontData->getCFStringAttributes(m_font.typesettingFeatures())));
    129150        RetainPtr<CTTypesetterRef> typesetter(AdoptCF, CTTypesetterCreateWithAttributedStringAndOptions(attributedString.get(), m_run.ltr() ? ltrTypesetterOptions : rtlTypesetterOptions));
     151#endif
    130152
    131153        line.adoptCF(CTTypesetterCreateLine(typesetter.get(), CFRangeMake(0, 0)));
    132     } else
    133         line.adoptCF(CTLineCreateWithAttributedString(attributedString.get()));
     154    } else {
     155        ProviderInfo info = { cp, length, fontData->getCFStringAttributes(m_font.typesettingFeatures()) };
     156
     157        line.adoptCF(wkCreateCTLineWithUniCharProvider(&provideStringAndAttributes, 0, &info));
     158    }
    134159
    135160    CFArrayRef runArray = CTLineGetGlyphRuns(line.get());
  • trunk/WebCore/platform/mac/WebCoreSystemInterface.h

    r70751 r71590  
    177177#endif
    178178
     179extern CTLineRef (*wkCreateCTLineWithUniCharProvider)(const UniChar* (*provide)(CFIndex stringIndex, CFIndex* charCount, CFDictionaryRef* attributes, void*), void (*dispose)(const UniChar* chars, void*), void*);
     180#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
     181extern CTTypesetterRef (*wkCreateCTTypesetterWithUniCharProviderAndOptions)(const UniChar* (*provide)(CFIndex stringIndex, CFIndex* charCount, CFDictionaryRef* attributes, void*), void (*dispose)(const UniChar* chars, void*), void*, CFDictionaryRef options);
     182#endif
     183
    179184}
    180185
  • trunk/WebCore/platform/mac/WebCoreSystemInterface.mm

    r70751 r71590  
    119119CFIndex (*wkGetHyphenationLocationBeforeIndex)(CFStringRef string, CFIndex index);
    120120#endif
     121
     122CTLineRef (*wkCreateCTLineWithUniCharProvider)(const UniChar* (*provide)(CFIndex stringIndex, CFIndex* charCount, CFDictionaryRef* attributes, void*), void (*dispose)(const UniChar* chars, void*), void*);
     123#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
     124CTTypesetterRef (*wkCreateCTTypesetterWithUniCharProviderAndOptions)(const UniChar* (*provide)(CFIndex stringIndex, CFIndex* charCount, CFDictionaryRef* attributes, void*), void (*dispose)(const UniChar* chars, void*), void*, CFDictionaryRef options);
     125#endif
  • trunk/WebKit/mac/ChangeLog

    r71564 r71590  
     12010-11-08  Ned Holbrook  <nholbrook@apple.com>
     2
     3        Reviewed by Adam Barth.
     4
     5        Avoid CFAttributedString creation in ComplexTextController by adopting UniChar provider SPI.
     6        https://bugs.webkit.org/show_bug.cgi?id=48886
     7
     8        * WebCoreSupport/WebSystemInterface.mm:
     9        (InitWebCoreSystemInterface):
     10
    1112010-11-08  Nate Chapin  <japhet@chromium.org>
    212
  • trunk/WebKit/mac/WebCoreSupport/WebSystemInterface.mm

    r70751 r71590  
    119119#endif
    120120
     121    INIT(CreateCTLineWithUniCharProvider);
     122#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
     123    INIT(CreateCTTypesetterWithUniCharProviderAndOptions);
     124#endif
     125
    121126    didInit = true;
    122127}
Note: See TracChangeset for help on using the changeset viewer.