Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(58)

Side by Side Diff: Source/platform/fonts/mac/ComplexTextControllerCoreText.mm

Issue 400543004: Rename WebCore namespace to blink in Platform (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 23 matching lines...) Expand all
34 #import <AvailabilityMacros.h> 34 #import <AvailabilityMacros.h>
35 35
36 // Forward declare Mac SPIs. 36 // Forward declare Mac SPIs.
37 extern "C" { 37 extern "C" {
38 // Request for public API: rdar://13803619 38 // Request for public API: rdar://13803619
39 CTLineRef CTLineCreateWithUniCharProvider(const UniChar* (*provide)(CFIndex stri ngIndex, CFIndex* charCount, CFDictionaryRef* attributes, void* context), void ( *dispose)(const UniChar* chars, void* context), void* context); 39 CTLineRef CTLineCreateWithUniCharProvider(const UniChar* (*provide)(CFIndex stri ngIndex, CFIndex* charCount, CFDictionaryRef* attributes, void* context), void ( *dispose)(const UniChar* chars, void* context), void* context);
40 } 40 }
41 41
42 @interface WebCascadeList : NSArray { 42 @interface WebCascadeList : NSArray {
43 @private 43 @private
44 const WebCore::Font* _font; 44 const blink::Font* _font;
45 UChar32 _character; 45 UChar32 _character;
46 NSUInteger _count; 46 NSUInteger _count;
47 Vector<RetainPtr<CTFontDescriptorRef>, 16> _fontDescriptors; 47 Vector<RetainPtr<CTFontDescriptorRef>, 16> _fontDescriptors;
48 } 48 }
49 49
50 - (id)initWithFont:(const WebCore::Font*)font character:(UChar32)character; 50 - (id)initWithFont:(const blink::Font*)font character:(UChar32)character;
51 51
52 @end 52 @end
53 53
54 @implementation WebCascadeList 54 @implementation WebCascadeList
55 55
56 - (id)initWithFont:(const WebCore::Font*)font character:(UChar32)character 56 - (id)initWithFont:(const blink::Font*)font character:(UChar32)character
57 { 57 {
58 if (!(self = [super init])) 58 if (!(self = [super init]))
59 return nil; 59 return nil;
60 60
61 _font = font; 61 _font = font;
62 _character = character; 62 _character = character;
63 63
64 // By the time a WebCascadeList is used, the Font has already been asked to realize all of its 64 // By the time a WebCascadeList is used, the Font has already been asked to realize all of its
65 // FontData, so this loop does not hit the FontCache. 65 // FontData, so this loop does not hit the FontCache.
66 while (_font->fontDataAt(_count)) 66 while (_font->fontDataAt(_count))
67 _count++; 67 _count++;
68 68
69 return self; 69 return self;
70 } 70 }
71 71
72 - (NSUInteger)count 72 - (NSUInteger)count
73 { 73 {
74 return _count; 74 return _count;
75 } 75 }
76 76
77 - (id)objectAtIndex:(NSUInteger)index 77 - (id)objectAtIndex:(NSUInteger)index
78 { 78 {
79 CTFontDescriptorRef fontDescriptor; 79 CTFontDescriptorRef fontDescriptor;
80 if (index < _fontDescriptors.size()) { 80 if (index < _fontDescriptors.size()) {
81 if ((fontDescriptor = _fontDescriptors[index].get())) 81 if ((fontDescriptor = _fontDescriptors[index].get()))
82 return (id)fontDescriptor; 82 return (id)fontDescriptor;
83 } else 83 } else
84 _fontDescriptors.grow(index + 1); 84 _fontDescriptors.grow(index + 1);
85 85
86 const WebCore::SimpleFontData* fontData = _font->fontDataAt(index)->fontData ForCharacter(_character); 86 const blink::SimpleFontData* fontData = _font->fontDataAt(index)->fontDataFo rCharacter(_character);
87 fontDescriptor = CTFontCopyFontDescriptor(fontData->platformData().ctFont()) ; 87 fontDescriptor = CTFontCopyFontDescriptor(fontData->platformData().ctFont()) ;
88 _fontDescriptors[index] = RetainPtr<CTFontDescriptorRef>(AdoptCF, fontDescri ptor); 88 _fontDescriptors[index] = RetainPtr<CTFontDescriptorRef>(AdoptCF, fontDescri ptor);
89 return (id)fontDescriptor; 89 return (id)fontDescriptor;
90 } 90 }
91 91
92 @end 92 @end
93 93
94 namespace WebCore { 94 namespace blink {
95 95
96 ComplexTextController::ComplexTextRun::ComplexTextRun(CTRunRef ctRun, const Simp leFontData* fontData, const UChar* characters, unsigned stringLocation, size_t s tringLength, CFRange runRange) 96 ComplexTextController::ComplexTextRun::ComplexTextRun(CTRunRef ctRun, const Simp leFontData* fontData, const UChar* characters, unsigned stringLocation, size_t s tringLength, CFRange runRange)
97 : m_fontData(fontData) 97 : m_fontData(fontData)
98 , m_characters(characters) 98 , m_characters(characters)
99 , m_stringLocation(stringLocation) 99 , m_stringLocation(stringLocation)
100 , m_stringLength(stringLength) 100 , m_stringLength(stringLength)
101 , m_indexBegin(runRange.location) 101 , m_indexBegin(runRange.location)
102 , m_indexEnd(runRange.location + runRange.length) 102 , m_indexEnd(runRange.location + runRange.length)
103 , m_isLTR(!(CTRunGetStatus(ctRun) & kCTRunStatusRightToLeft)) 103 , m_isLTR(!(CTRunGetStatus(ctRun) & kCTRunStatusRightToLeft))
104 , m_isMonotonic(true) 104 , m_isMonotonic(true)
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 m_fallbackFonts->add(runFontData); 287 m_fallbackFonts->add(runFontData);
288 } 288 }
289 } 289 }
290 if (m_fallbackFonts && runFontData != m_font.primaryFont()) 290 if (m_fallbackFonts && runFontData != m_font.primaryFont())
291 m_fallbackFonts->add(fontData); 291 m_fallbackFonts->add(fontData);
292 292
293 m_complexTextRuns.append(ComplexTextRun::create(ctRun, runFontData, cp, stringLocation, length, runRange)); 293 m_complexTextRuns.append(ComplexTextRun::create(ctRun, runFontData, cp, stringLocation, length, runRange));
294 } 294 }
295 } 295 }
296 296
297 } // namespace WebCore 297 } // namespace blink
OLDNEW
« no previous file with comments | « Source/platform/fonts/mac/ComplexTextController.cpp ('k') | Source/platform/fonts/mac/FontCacheMac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698