Changeset 71590 in webkit
- Timestamp:
- Nov 8, 2010 5:53:55 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r71589 r71590 1 2010-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 1 15 2010-11-08 David Hyatt <hyatt@apple.com> 2 16 -
trunk/WebCore/WebCore.exp.in
r71562 r71590 1159 1159 _wkCopyCONNECTProxyResponse 1160 1160 _wkCopyNSURLResponseStatusLine 1161 _wkCreateCTLineWithUniCharProvider 1161 1162 _wkCreateCustomCFReadStream 1162 1163 _wkCreateNSURLConnectionDelegateProxy … … 1213 1214 _wkSignalCFReadStreamError 1214 1215 _wkSignalCFReadStreamHasBytes 1216 1217 #if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) 1218 _wkCreateCTTypesetterWithUniCharProviderAndOptions 1219 #endif 1215 1220 1216 1221 #if ENABLE(3D_RENDERING) -
trunk/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.cpp
r64734 r71590 25 25 #include "config.h" 26 26 #include "ComplexTextController.h" 27 #include "WebCoreSystemInterface.h" 27 28 28 29 #if USE(CORE_TEXT) … … 102 103 } 103 104 105 struct ProviderInfo { 106 const UChar* cp; 107 unsigned length; 108 CFDictionaryRef attributes; 109 }; 110 111 static 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 104 122 void ComplexTextController::collectComplexTextRunsForCharactersCoreText(const UChar* cp, unsigned length, unsigned stringLocation, const SimpleFontData* fontData) 105 123 { … … 113 131 m_fallbackFonts->add(fontData); 114 132 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 119 133 RetainPtr<CTLineRef> line; 120 134 … … 127 141 static CFDictionaryRef ltrTypesetterOptions = CFDictionaryCreate(kCFAllocatorDefault, optionKeys, ltrOptionValues, sizeof(optionKeys) / sizeof(*optionKeys), &kCFCopyStringDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); 128 142 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()))); 129 150 RetainPtr<CTTypesetterRef> typesetter(AdoptCF, CTTypesetterCreateWithAttributedStringAndOptions(attributedString.get(), m_run.ltr() ? ltrTypesetterOptions : rtlTypesetterOptions)); 151 #endif 130 152 131 153 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 } 134 159 135 160 CFArrayRef runArray = CTLineGetGlyphRuns(line.get()); -
trunk/WebCore/platform/mac/WebCoreSystemInterface.h
r70751 r71590 177 177 #endif 178 178 179 extern 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) 181 extern CTTypesetterRef (*wkCreateCTTypesetterWithUniCharProviderAndOptions)(const UniChar* (*provide)(CFIndex stringIndex, CFIndex* charCount, CFDictionaryRef* attributes, void*), void (*dispose)(const UniChar* chars, void*), void*, CFDictionaryRef options); 182 #endif 183 179 184 } 180 185 -
trunk/WebCore/platform/mac/WebCoreSystemInterface.mm
r70751 r71590 119 119 CFIndex (*wkGetHyphenationLocationBeforeIndex)(CFStringRef string, CFIndex index); 120 120 #endif 121 122 CTLineRef (*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) 124 CTTypesetterRef (*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 1 2010-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 1 11 2010-11-08 Nate Chapin <japhet@chromium.org> 2 12 -
trunk/WebKit/mac/WebCoreSupport/WebSystemInterface.mm
r70751 r71590 119 119 #endif 120 120 121 INIT(CreateCTLineWithUniCharProvider); 122 #if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) 123 INIT(CreateCTTypesetterWithUniCharProviderAndOptions); 124 #endif 125 121 126 didInit = true; 122 127 }
Note: See TracChangeset
for help on using the changeset viewer.