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

Side by Side Diff: ui/gfx/render_text_mac.cc

Issue 968923004: Use GetDisplayText() instead of text() for rendering text. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comments addressed Created 5 years, 9 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/gfx/render_text_mac.h" 5 #include "ui/gfx/render_text_mac.h"
6 6
7 #include <ApplicationServices/ApplicationServices.h> 7 #include <ApplicationServices/ApplicationServices.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <cmath> 10 #include <cmath>
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 const void* values[] = { ct_font }; 141 const void* values[] = { ct_font };
142 base::ScopedCFTypeRef<CFDictionaryRef> attributes( 142 base::ScopedCFTypeRef<CFDictionaryRef> attributes(
143 CFDictionaryCreate(NULL, 143 CFDictionaryCreate(NULL,
144 keys, 144 keys,
145 values, 145 values,
146 arraysize(keys), 146 arraysize(keys),
147 NULL, 147 NULL,
148 &kCFTypeDictionaryValueCallBacks)); 148 &kCFTypeDictionaryValueCallBacks));
149 149
150 base::ScopedCFTypeRef<CFStringRef> cf_text( 150 base::ScopedCFTypeRef<CFStringRef> cf_text(
151 base::SysUTF16ToCFStringRef(text())); 151 base::SysUTF16ToCFStringRef(GetDisplayText()));
152 base::ScopedCFTypeRef<CFAttributedStringRef> attr_text( 152 base::ScopedCFTypeRef<CFAttributedStringRef> attr_text(
153 CFAttributedStringCreate(NULL, cf_text, attributes)); 153 CFAttributedStringCreate(NULL, cf_text, attributes));
154 base::ScopedCFTypeRef<CFMutableAttributedStringRef> attr_text_mutable( 154 base::ScopedCFTypeRef<CFMutableAttributedStringRef> attr_text_mutable(
155 CFAttributedStringCreateMutableCopy(NULL, 0, attr_text)); 155 CFAttributedStringCreateMutableCopy(NULL, 0, attr_text));
156 156
157 // TODO(asvitkine|msw): Respect GetTextDirection(), which may not match the 157 // TODO(asvitkine|msw): Respect GetTextDirection(), which may not match the
158 // natural text direction. See kCTTypesetterOptionForcedEmbeddingLevel, etc. 158 // natural text direction. See kCTTypesetterOptionForcedEmbeddingLevel, etc.
159 159
160 ApplyStyles(attr_text_mutable, ct_font); 160 ApplyStyles(attr_text_mutable, ct_font);
161 line_.reset(CTLineCreateWithAttributedString(attr_text_mutable)); 161 line_.reset(CTLineCreateWithAttributedString(attr_text_mutable));
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 CTUnderlineStyle value = kCTUnderlineStyleNone; 358 CTUnderlineStyle value = kCTUnderlineStyleNone;
359 if (underline && CFNumberGetValue(underline, kCFNumberSInt32Type, &value)) 359 if (underline && CFNumberGetValue(underline, kCFNumberSInt32Type, &value))
360 run->underline = (value == kCTUnderlineStyleSingle); 360 run->underline = (value == kCTUnderlineStyleSingle);
361 361
362 run_origin.offset(run_width, 0); 362 run_origin.offset(run_width, 0);
363 } 363 }
364 runs_valid_ = true; 364 runs_valid_ = true;
365 } 365 }
366 366
367 } // namespace gfx 367 } // namespace gfx
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698