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

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

Issue 1868363002: Replace scoped_ptr with std::unique_ptr in //ui (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@scopedptrcc
Patch Set: scopedptrui: rebase-make_scoped_ptr Created 4 years, 8 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
« no previous file with comments | « ui/gfx/render_text_mac.h ('k') | ui/gfx/render_text_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #import <AppKit/AppKit.h> 7 #import <AppKit/AppKit.h>
8 #include <ApplicationServices/ApplicationServices.h> 8 #include <ApplicationServices/ApplicationServices.h>
9 #include <CoreText/CoreText.h> 9 #include <CoreText/CoreText.h>
10 10
11 #include <algorithm> 11 #include <algorithm>
12 #include <cmath> 12 #include <cmath>
13 #include <utility> 13 #include <utility>
14 14
15 #include "base/mac/foundation_util.h" 15 #include "base/mac/foundation_util.h"
16 #include "base/mac/mac_util.h" 16 #include "base/mac/mac_util.h"
17 #include "base/mac/scoped_cftyperef.h" 17 #include "base/mac/scoped_cftyperef.h"
18 #include "base/macros.h" 18 #include "base/macros.h"
19 #include "base/memory/ptr_util.h"
19 #include "base/strings/sys_string_conversions.h" 20 #include "base/strings/sys_string_conversions.h"
20 #include "skia/ext/skia_utils_mac.h" 21 #include "skia/ext/skia_utils_mac.h"
21 #include "third_party/skia/include/ports/SkTypeface_mac.h" 22 #include "third_party/skia/include/ports/SkTypeface_mac.h"
22 23
23 namespace { 24 namespace {
24 25
25 // This function makes a copy of |font| with the given symbolic traits. On OSX 26 // This function makes a copy of |font| with the given symbolic traits. On OSX
26 // 10.11, CTFontCreateCopyWithSymbolicTraits has the right behavior but 27 // 10.11, CTFontCreateCopyWithSymbolicTraits has the right behavior but
27 // CTFontCreateWithFontDescriptor does not. The opposite holds true for OSX 28 // CTFontCreateWithFontDescriptor does not. The opposite holds true for OSX
28 // 10.10. 29 // 10.10.
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 return skia::AdoptRef(SkCreateTypefaceFromCTFont( 73 return skia::AdoptRef(SkCreateTypefaceFromCTFont(
73 static_cast<CTFontRef>(font_with_style.GetNativeFont()))); 74 static_cast<CTFontRef>(font_with_style.GetNativeFont())));
74 } 75 }
75 76
76 } // namespace internal 77 } // namespace internal
77 78
78 RenderTextMac::RenderTextMac() : common_baseline_(0), runs_valid_(false) {} 79 RenderTextMac::RenderTextMac() : common_baseline_(0), runs_valid_(false) {}
79 80
80 RenderTextMac::~RenderTextMac() {} 81 RenderTextMac::~RenderTextMac() {}
81 82
82 scoped_ptr<RenderText> RenderTextMac::CreateInstanceOfSameType() const { 83 std::unique_ptr<RenderText> RenderTextMac::CreateInstanceOfSameType() const {
83 return make_scoped_ptr(new RenderTextMac); 84 return base::WrapUnique(new RenderTextMac);
84 } 85 }
85 86
86 bool RenderTextMac::MultilineSupported() const { 87 bool RenderTextMac::MultilineSupported() const {
87 return false; 88 return false;
88 } 89 }
89 90
90 const base::string16& RenderTextMac::GetDisplayText() { 91 const base::string16& RenderTextMac::GetDisplayText() {
91 return text_elided() ? display_text() : layout_text(); 92 return text_elided() ? display_text() : layout_text();
92 } 93 }
93 94
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 } 436 }
436 437
437 void RenderTextMac::InvalidateStyle() { 438 void RenderTextMac::InvalidateStyle() {
438 line_.reset(); 439 line_.reset();
439 attributes_.reset(); 440 attributes_.reset();
440 runs_.clear(); 441 runs_.clear();
441 runs_valid_ = false; 442 runs_valid_ = false;
442 } 443 }
443 444
444 } // namespace gfx 445 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/render_text_mac.h ('k') | ui/gfx/render_text_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698