| 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() : common_baseline_(0), runs_valid_(false) { | 20 RenderTextMac::RenderTextMac() : common_baseline_(0), runs_valid_(false) { |
| 21 } | 21 } |
| 22 | 22 |
| 23 RenderTextMac::~RenderTextMac() { | 23 RenderTextMac::~RenderTextMac() { |
| 24 } | 24 } |
| 25 | 25 |
| 26 scoped_ptr<RenderText> RenderTextMac::CreateInstanceOfSameType() const { |
| 27 return scoped_ptr<RenderTextMac>(new RenderTextMac); |
| 28 } |
| 29 |
| 26 Size RenderTextMac::GetStringSize() { | 30 Size RenderTextMac::GetStringSize() { |
| 27 EnsureLayout(); | 31 EnsureLayout(); |
| 28 return Size(std::ceil(string_size_.width()), string_size_.height()); | 32 return Size(std::ceil(string_size_.width()), string_size_.height()); |
| 29 } | 33 } |
| 30 | 34 |
| 31 SizeF RenderTextMac::GetStringSizeF() { | 35 SizeF RenderTextMac::GetStringSizeF() { |
| 32 EnsureLayout(); | 36 EnsureLayout(); |
| 33 return string_size_; | 37 return string_size_; |
| 34 } | 38 } |
| 35 | 39 |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 run_origin.offset(run_width, 0); | 341 run_origin.offset(run_width, 0); |
| 338 } | 342 } |
| 339 runs_valid_ = true; | 343 runs_valid_ = true; |
| 340 } | 344 } |
| 341 | 345 |
| 342 RenderText* RenderText::CreateNativeInstance() { | 346 RenderText* RenderText::CreateNativeInstance() { |
| 343 return new RenderTextMac; | 347 return new RenderTextMac; |
| 344 } | 348 } |
| 345 | 349 |
| 346 } // namespace gfx | 350 } // namespace gfx |
| OLD | NEW |