| Index: ui/gfx/render_text_mac.cc
|
| diff --git a/ui/gfx/render_text_mac.cc b/ui/gfx/render_text_mac.cc
|
| index 67a547d182ae3d2cd8e1b3c8f5437e52ef62576b..f6a1b78c432459d585a54990873edd5460eebe0e 100644
|
| --- a/ui/gfx/render_text_mac.cc
|
| +++ b/ui/gfx/render_text_mac.cc
|
| @@ -107,22 +107,26 @@ void RenderTextMac::EnsureLayout() {
|
| runs_valid_ = false;
|
|
|
| const Font& font = GetFont();
|
| - base::mac::ScopedCFTypeRef<CFStringRef> font_name_cf_string(
|
| + base::ScopedCFTypeRef<CFStringRef> font_name_cf_string(
|
| base::SysUTF8ToCFStringRef(font.GetFontName()));
|
| - base::mac::ScopedCFTypeRef<CTFontRef> ct_font(
|
| + base::ScopedCFTypeRef<CTFontRef> ct_font(
|
| CTFontCreateWithName(font_name_cf_string, font.GetFontSize(), NULL));
|
|
|
| const void* keys[] = { kCTFontAttributeName };
|
| const void* values[] = { ct_font };
|
| - base::mac::ScopedCFTypeRef<CFDictionaryRef> attributes(
|
| - CFDictionaryCreate(NULL, keys, values, arraysize(keys), NULL,
|
| + base::ScopedCFTypeRef<CFDictionaryRef> attributes(
|
| + CFDictionaryCreate(NULL,
|
| + keys,
|
| + values,
|
| + arraysize(keys),
|
| + NULL,
|
| &kCFTypeDictionaryValueCallBacks));
|
|
|
| - base::mac::ScopedCFTypeRef<CFStringRef> cf_text(
|
| + base::ScopedCFTypeRef<CFStringRef> cf_text(
|
| base::SysUTF16ToCFStringRef(text()));
|
| - base::mac::ScopedCFTypeRef<CFAttributedStringRef> attr_text(
|
| + base::ScopedCFTypeRef<CFAttributedStringRef> attr_text(
|
| CFAttributedStringCreate(NULL, cf_text, attributes));
|
| - base::mac::ScopedCFTypeRef<CFMutableAttributedStringRef> attr_text_mutable(
|
| + base::ScopedCFTypeRef<CFMutableAttributedStringRef> attr_text_mutable(
|
| CFAttributedStringCreateMutableCopy(NULL, 0, attr_text));
|
|
|
| // TODO(asvitkine|msw): Respect GetTextDirection(), which may not match the
|
| @@ -193,7 +197,7 @@ void RenderTextMac::ApplyStyles(CFMutableAttributedStringRef attr_string,
|
| for (size_t i = 0, end = 0; i < layout_text_length; i = end) {
|
| end = TextIndexToLayoutIndex(style.GetRange().end());
|
| const CFRange range = CFRangeMake(i, end - i);
|
| - base::mac::ScopedCFTypeRef<CGColorRef> foreground(
|
| + base::ScopedCFTypeRef<CGColorRef> foreground(
|
| gfx::CGColorCreateFromSkColor(style.color()));
|
| CFAttributedStringSetAttribute(attr_string, range,
|
| kCTForegroundColorAttributeName, foreground);
|
| @@ -201,7 +205,7 @@ void RenderTextMac::ApplyStyles(CFMutableAttributedStringRef attr_string,
|
|
|
| if (style.style(UNDERLINE)) {
|
| CTUnderlineStyle value = kCTUnderlineStyleSingle;
|
| - base::mac::ScopedCFTypeRef<CFNumberRef> underline_value(
|
| + base::ScopedCFTypeRef<CFNumberRef> underline_value(
|
| CFNumberCreate(NULL, kCFNumberSInt32Type, &value));
|
| CFAttributedStringSetAttribute(attr_string, range,
|
| kCTUnderlineStyleAttributeName,
|
| @@ -212,7 +216,7 @@ void RenderTextMac::ApplyStyles(CFMutableAttributedStringRef attr_string,
|
| const int traits = (style.style(BOLD) ? kCTFontBoldTrait : 0) |
|
| (style.style(ITALIC) ? kCTFontItalicTrait : 0);
|
| if (traits != 0) {
|
| - base::mac::ScopedCFTypeRef<CTFontRef> styled_font(
|
| + base::ScopedCFTypeRef<CTFontRef> styled_font(
|
| CTFontCreateCopyWithSymbolicTraits(font, 0.0, NULL, traits, traits));
|
| // TODO(asvitkine): Handle |styled_font| == NULL case better.
|
| if (styled_font) {
|
| @@ -293,7 +297,7 @@ void RenderTextMac::ComputeRuns() {
|
| CTFontRef ct_font =
|
| base::mac::GetValueFromDictionary<CTFontRef>(attributes,
|
| kCTFontAttributeName);
|
| - base::mac::ScopedCFTypeRef<CFStringRef> font_name_ref(
|
| + base::ScopedCFTypeRef<CFStringRef> font_name_ref(
|
| CTFontCopyFamilyName(ct_font));
|
| run->font_name = base::SysCFStringRefToUTF8(font_name_ref);
|
| run->text_size = CTFontGetSize(ct_font);
|
|
|