| Index: ui/gfx/render_text_mac.mm
|
| diff --git a/ui/gfx/render_text_mac.mm b/ui/gfx/render_text_mac.mm
|
| index 915f51f927a75e665124221256000cce10843102..5a4e5b115b99aa6f1033438e549d602e954e9a76 100644
|
| --- a/ui/gfx/render_text_mac.mm
|
| +++ b/ui/gfx/render_text_mac.mm
|
| @@ -118,7 +118,8 @@ std::vector<RenderText::FontSpan> RenderTextMac::GetFontSpansForTesting() {
|
| for (size_t i = 0; i < runs_.size(); ++i) {
|
| const CFRange cf_range = CTRunGetStringRange(runs_[i].ct_run);
|
| const Range range(cf_range.location, cf_range.location + cf_range.length);
|
| - spans.push_back(RenderText::FontSpan(runs_[i].font, range));
|
| + spans.push_back(RenderText::FontSpan(
|
| + gfx::Font(base::mac::CFToNSCast(runs_[i].ct_font.get())), range));
|
| }
|
|
|
| return spans;
|
| @@ -210,9 +211,7 @@ void RenderTextMac::DrawVisualText(internal::SkiaTextRenderer* renderer) {
|
| for (size_t i = 0; i < runs_.size(); ++i) {
|
| const TextRun& run = runs_[i];
|
| renderer->SetForegroundColor(run.foreground);
|
| -
|
| - CTFontRef ct_font = static_cast<CTFontRef>(run.font.GetNativeFont());
|
| - renderer->SetTextSize(CTFontGetSize(ct_font));
|
| + renderer->SetTextSize(CTFontGetSize(run.ct_font));
|
|
|
| // The painter adds its own ref. So don't |release()| it from the ref ptr in
|
| // TextRun.
|
| @@ -236,7 +235,7 @@ RenderTextMac::TextRun::TextRun()
|
| strike(false),
|
| diagonal_strike(false) {}
|
|
|
| -RenderTextMac::TextRun::TextRun(const TextRun& other) = default;
|
| +RenderTextMac::TextRun::TextRun(TextRun&& other) = default;
|
|
|
| RenderTextMac::TextRun::~TextRun() {}
|
|
|
| @@ -379,7 +378,7 @@ void RenderTextMac::ComputeRuns() {
|
| continue;
|
| }
|
|
|
| - runs_.push_back(TextRun());
|
| + runs_.emplace_back();
|
| TextRun* run = &runs_.back();
|
| run->ct_run = ct_run;
|
| run->origin = run_origin;
|
| @@ -414,7 +413,7 @@ void RenderTextMac::ComputeRuns() {
|
| CFDictionaryRef attributes = CTRunGetAttributes(ct_run);
|
| CTFontRef ct_font = base::mac::GetValueFromDictionary<CTFontRef>(
|
| attributes, kCTFontAttributeName);
|
| - run->font = Font(static_cast<NSFont*>(ct_font));
|
| + run->ct_font.reset(ct_font, base::scoped_policy::RETAIN);
|
| run->typeface.reset(SkCreateTypefaceFromCTFont(ct_font));
|
|
|
| const CGColorRef foreground = base::mac::GetValueFromDictionary<CGColorRef>(
|
|
|