OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 11 matching lines...) Expand all Loading... |
22 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 22 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
23 */ | 23 */ |
24 | 24 |
25 #include "config.h" | 25 #include "config.h" |
26 | 26 |
27 #include "core/platform/graphics/mac/ComplexTextController.h" | 27 #include "core/platform/graphics/mac/ComplexTextController.h" |
28 | 28 |
29 #include "core/platform/graphics/Font.h" | 29 #include "core/platform/graphics/Font.h" |
30 #include "core/platform/graphics/FontCache.h" | 30 #include "core/platform/graphics/FontCache.h" |
31 #include "core/platform/graphics/TextRun.h" | 31 #include "core/platform/graphics/TextRun.h" |
32 #include "core/platform/mac/WebCoreSystemInterface.h" | |
33 | 32 |
34 #include <ApplicationServices/ApplicationServices.h> | 33 #include <ApplicationServices/ApplicationServices.h> |
35 | 34 |
| 35 // Forward declare Mac SPIs. |
| 36 extern "C" { |
| 37 // Request for public API: rdar://13803619 |
| 38 CTLineRef CTLineCreateWithUniCharProvider(const UniChar* (*provide)(CFIndex stri
ngIndex, CFIndex* charCount, CFDictionaryRef* attributes, void* context), void (
*dispose)(const UniChar* chars, void* context), void* context); |
| 39 } |
| 40 |
36 @interface WebCascadeList : NSArray { | 41 @interface WebCascadeList : NSArray { |
37 @private | 42 @private |
38 const WebCore::Font* _font; | 43 const WebCore::Font* _font; |
39 UChar32 _character; | 44 UChar32 _character; |
40 NSUInteger _count; | 45 NSUInteger _count; |
41 Vector<RetainPtr<CTFontDescriptorRef>, 16> _fontDescriptors; | 46 Vector<RetainPtr<CTFontDescriptorRef>, 16> _fontDescriptors; |
42 } | 47 } |
43 | 48 |
44 - (id)initWithFont:(const WebCore::Font*)font character:(UChar32)character; | 49 - (id)initWithFont:(const WebCore::Font*)font character:(UChar32)character; |
45 | 50 |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 #else | 228 #else |
224 RetainPtr<CFStringRef> string(AdoptCF, CFStringCreateWithCharactersNoCop
y(kCFAllocatorDefault, cp, length, kCFAllocatorNull)); | 229 RetainPtr<CFStringRef> string(AdoptCF, CFStringCreateWithCharactersNoCop
y(kCFAllocatorDefault, cp, length, kCFAllocatorNull)); |
225 RetainPtr<CFAttributedStringRef> attributedString(AdoptCF, CFAttributedS
tringCreate(kCFAllocatorDefault, string.get(), stringAttributes.get())); | 230 RetainPtr<CFAttributedStringRef> attributedString(AdoptCF, CFAttributedS
tringCreate(kCFAllocatorDefault, string.get(), stringAttributes.get())); |
226 RetainPtr<CTTypesetterRef> typesetter(AdoptCF, CTTypesetterCreateWithAtt
ributedStringAndOptions(attributedString.get(), m_run.ltr() ? ltrTypesetterOptio
ns : rtlTypesetterOptions)); | 231 RetainPtr<CTTypesetterRef> typesetter(AdoptCF, CTTypesetterCreateWithAtt
ributedStringAndOptions(attributedString.get(), m_run.ltr() ? ltrTypesetterOptio
ns : rtlTypesetterOptions)); |
227 #endif | 232 #endif |
228 | 233 |
229 line.adoptCF(CTTypesetterCreateLine(typesetter.get(), CFRangeMake(0, 0))
); | 234 line.adoptCF(CTTypesetterCreateLine(typesetter.get(), CFRangeMake(0, 0))
); |
230 } else { | 235 } else { |
231 ProviderInfo info = { cp, length, stringAttributes.get() }; | 236 ProviderInfo info = { cp, length, stringAttributes.get() }; |
232 | 237 |
233 line.adoptCF(WKCreateCTLineWithUniCharProvider(&provideStringAndAttribut
es, 0, &info)); | 238 line.adoptCF(CTLineCreateWithUniCharProvider(&provideStringAndAttributes
, 0, &info)); |
234 } | 239 } |
235 | 240 |
236 m_coreTextLines.append(line.get()); | 241 m_coreTextLines.append(line.get()); |
237 | 242 |
238 CFArrayRef runArray = CTLineGetGlyphRuns(line.get()); | 243 CFArrayRef runArray = CTLineGetGlyphRuns(line.get()); |
239 | 244 |
240 CFIndex runCount = CFArrayGetCount(runArray); | 245 CFIndex runCount = CFArrayGetCount(runArray); |
241 | 246 |
242 for (CFIndex r = 0; r < runCount; r++) { | 247 for (CFIndex r = 0; r < runCount; r++) { |
243 CTRunRef ctRun = static_cast<CTRunRef>(CFArrayGetValueAtIndex(runArray,
m_run.ltr() ? r : runCount - 1 - r)); | 248 CTRunRef ctRun = static_cast<CTRunRef>(CFArrayGetValueAtIndex(runArray,
m_run.ltr() ? r : runCount - 1 - r)); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 } | 287 } |
283 } | 288 } |
284 if (m_fallbackFonts && runFontData != m_font.primaryFont()) | 289 if (m_fallbackFonts && runFontData != m_font.primaryFont()) |
285 m_fallbackFonts->add(fontData); | 290 m_fallbackFonts->add(fontData); |
286 | 291 |
287 m_complexTextRuns.append(ComplexTextRun::create(ctRun, runFontData, cp,
stringLocation, length, runRange)); | 292 m_complexTextRuns.append(ComplexTextRun::create(ctRun, runFontData, cp,
stringLocation, length, runRange)); |
288 } | 293 } |
289 } | 294 } |
290 | 295 |
291 } // namespace WebCore | 296 } // namespace WebCore |
OLD | NEW |