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/views/controls/label.h" | 5 #include "ui/views/controls/label.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 #include <limits> | 9 #include <limits> |
10 #include <vector> | 10 #include <vector> |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 } | 47 } |
48 | 48 |
49 void Label::SetFont(const gfx::Font& font) { | 49 void Label::SetFont(const gfx::Font& font) { |
50 font_ = font; | 50 font_ = font; |
51 text_size_valid_ = false; | 51 text_size_valid_ = false; |
52 PreferredSizeChanged(); | 52 PreferredSizeChanged(); |
53 SchedulePaint(); | 53 SchedulePaint(); |
54 } | 54 } |
55 | 55 |
56 void Label::SetText(const string16& text) { | 56 void Label::SetText(const string16& text) { |
| 57 if (text == text_) |
| 58 return; |
57 text_ = text; | 59 text_ = text; |
58 text_size_valid_ = false; | 60 text_size_valid_ = false; |
59 is_email_ = false; | 61 is_email_ = false; |
60 PreferredSizeChanged(); | 62 PreferredSizeChanged(); |
61 SchedulePaint(); | 63 SchedulePaint(); |
62 } | 64 } |
63 | 65 |
64 void Label::SetEmail(const string16& email) { | 66 void Label::SetEmail(const string16& email) { |
65 SetText(email); | 67 SetText(email); |
66 is_email_ = true; | 68 is_email_ = true; |
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
493 ui::ELIDE_AT_END); | 495 ui::ELIDE_AT_END); |
494 } else { | 496 } else { |
495 *paint_text = text_; | 497 *paint_text = text_; |
496 } | 498 } |
497 | 499 |
498 *text_bounds = GetTextBounds(); | 500 *text_bounds = GetTextBounds(); |
499 *flags = ComputeDrawStringFlags(); | 501 *flags = ComputeDrawStringFlags(); |
500 } | 502 } |
501 | 503 |
502 } // namespace views | 504 } // namespace views |
OLD | NEW |