| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "views/controls/label.h" | 5 #include "views/controls/label.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 #include <limits> | 8 #include <limits> |
| 9 | 9 |
| 10 #include "app/resource_bundle.h" | 10 #include "app/resource_bundle.h" |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 font_ = font; | 100 font_ = font; |
| 101 text_size_valid_ = false; | 101 text_size_valid_ = false; |
| 102 PreferredSizeChanged(); | 102 PreferredSizeChanged(); |
| 103 SchedulePaint(); | 103 SchedulePaint(); |
| 104 } | 104 } |
| 105 | 105 |
| 106 void Label::SetText(const std::wstring& text) { | 106 void Label::SetText(const std::wstring& text) { |
| 107 text_ = WideToUTF16Hack(text); | 107 text_ = WideToUTF16Hack(text); |
| 108 url_set_ = false; | 108 url_set_ = false; |
| 109 text_size_valid_ = false; | 109 text_size_valid_ = false; |
| 110 SetAccessibleName(text); | 110 SetAccessibleName(WideToUTF16Hack(text)); |
| 111 PreferredSizeChanged(); | 111 PreferredSizeChanged(); |
| 112 SchedulePaint(); | 112 SchedulePaint(); |
| 113 } | 113 } |
| 114 | 114 |
| 115 const std::wstring Label::GetText() const { | 115 const std::wstring Label::GetText() const { |
| 116 return url_set_ ? UTF8ToWide(url_.spec()) : UTF16ToWideHack(text_); | 116 return url_set_ ? UTF8ToWide(url_.spec()) : UTF16ToWideHack(text_); |
| 117 } | 117 } |
| 118 | 118 |
| 119 void Label::SetURL(const GURL& url) { | 119 void Label::SetURL(const GURL& url) { |
| 120 url_ = url; | 120 url_ = url; |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 font_, GetAvailableRect().width(), true)); | 446 font_, GetAvailableRect().width(), true)); |
| 447 } else { | 447 } else { |
| 448 *paint_text = UTF16ToWideHack(text_); | 448 *paint_text = UTF16ToWideHack(text_); |
| 449 } | 449 } |
| 450 | 450 |
| 451 *text_bounds = GetTextBounds(); | 451 *text_bounds = GetTextBounds(); |
| 452 *flags = ComputeMultiLineFlags(); | 452 *flags = ComputeMultiLineFlags(); |
| 453 } | 453 } |
| 454 | 454 |
| 455 } // namespace views | 455 } // namespace views |
| OLD | NEW |