OLD | NEW |
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> |
11 #include <utility> | 11 #include <utility> |
12 | 12 |
13 #include "base/mac/foundation_util.h" | 13 #include "base/mac/foundation_util.h" |
14 #include "base/mac/scoped_cftyperef.h" | 14 #include "base/mac/scoped_cftyperef.h" |
15 #include "base/strings/sys_string_conversions.h" | 15 #include "base/strings/sys_string_conversions.h" |
16 #include "skia/ext/skia_utils_mac.h" | 16 #include "skia/ext/skia_utils_mac.h" |
17 | 17 |
18 namespace gfx { | 18 namespace gfx { |
19 | 19 |
20 RenderTextMac::RenderTextMac() | 20 RenderTextMac::RenderTextMac() |
21 : common_baseline_(0), runs_valid_(false) { | 21 : common_baseline_(0), runs_valid_(false) { |
22 } | 22 } |
23 | 23 |
24 RenderTextMac::~RenderTextMac() { | 24 RenderTextMac::~RenderTextMac() { |
25 } | 25 } |
26 | 26 |
27 scoped_ptr<RenderText> RenderTextMac::CreateInstanceOfSameType() const { | 27 scoped_ptr<RenderText> RenderTextMac::CreateInstanceOfSameType() const { |
28 return scoped_ptr<RenderTextMac>(new RenderTextMac); | 28 return make_scoped_ptr(new RenderTextMac); |
29 } | 29 } |
30 | 30 |
31 const base::string16& RenderTextMac::GetDisplayText() { | 31 const base::string16& RenderTextMac::GetDisplayText() { |
32 return text_elided() ? display_text() : layout_text(); | 32 return text_elided() ? display_text() : layout_text(); |
33 } | 33 } |
34 | 34 |
35 Size RenderTextMac::GetStringSize() { | 35 Size RenderTextMac::GetStringSize() { |
36 EnsureLayout(); | 36 EnsureLayout(); |
37 return Size(std::ceil(string_size_.width()), string_size_.height()); | 37 return Size(std::ceil(string_size_.width()), string_size_.height()); |
38 } | 38 } |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 CTUnderlineStyle value = kCTUnderlineStyleNone; | 357 CTUnderlineStyle value = kCTUnderlineStyleNone; |
358 if (underline && CFNumberGetValue(underline, kCFNumberSInt32Type, &value)) | 358 if (underline && CFNumberGetValue(underline, kCFNumberSInt32Type, &value)) |
359 run->underline = (value == kCTUnderlineStyleSingle); | 359 run->underline = (value == kCTUnderlineStyleSingle); |
360 | 360 |
361 run_origin.offset(run_width, 0); | 361 run_origin.offset(run_width, 0); |
362 } | 362 } |
363 runs_valid_ = true; | 363 runs_valid_ = true; |
364 } | 364 } |
365 | 365 |
366 } // namespace gfx | 366 } // namespace gfx |
OLD | NEW |