| 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 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 397 render_text_->SetElideBehavior(gfx::NO_ELIDE); | 397 render_text_->SetElideBehavior(gfx::NO_ELIDE); |
| 398 render_text_->SetFontList(font_list); | 398 render_text_->SetFontList(font_list); |
| 399 render_text_->SetCursorEnabled(false); | 399 render_text_->SetCursorEnabled(false); |
| 400 render_text_->SetWordWrapBehavior(gfx::TRUNCATE_LONG_WORDS); | 400 render_text_->SetWordWrapBehavior(gfx::TRUNCATE_LONG_WORDS); |
| 401 | 401 |
| 402 elide_behavior_ = gfx::ELIDE_TAIL; | 402 elide_behavior_ = gfx::ELIDE_TAIL; |
| 403 enabled_color_set_ = disabled_color_set_ = background_color_set_ = false; | 403 enabled_color_set_ = disabled_color_set_ = background_color_set_ = false; |
| 404 subpixel_rendering_enabled_ = true; | 404 subpixel_rendering_enabled_ = true; |
| 405 auto_color_readability_ = true; | 405 auto_color_readability_ = true; |
| 406 multi_line_ = false; | 406 multi_line_ = false; |
| 407 UpdateColorsFromTheme(ui::NativeTheme::instance()); | |
| 408 handles_tooltips_ = true; | 407 handles_tooltips_ = true; |
| 409 collapse_when_hidden_ = false; | 408 collapse_when_hidden_ = false; |
| 410 max_width_ = 0; | 409 max_width_ = 0; |
| 411 is_first_paint_text_ = true; | 410 is_first_paint_text_ = true; |
| 412 SetText(text); | 411 SetText(text); |
| 413 } | 412 } |
| 414 | 413 |
| 415 void Label::ResetLayout() { | 414 void Label::ResetLayout() { |
| 416 InvalidateLayout(); | 415 InvalidateLayout(); |
| 417 PreferredSizeChanged(); | 416 PreferredSizeChanged(); |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 574 } | 573 } |
| 575 | 574 |
| 576 bool Label::ShouldShowDefaultTooltip() const { | 575 bool Label::ShouldShowDefaultTooltip() const { |
| 577 const gfx::Size text_size = GetTextSize(); | 576 const gfx::Size text_size = GetTextSize(); |
| 578 const gfx::Size size = GetContentsBounds().size(); | 577 const gfx::Size size = GetContentsBounds().size(); |
| 579 return !obscured() && (text_size.width() > size.width() || | 578 return !obscured() && (text_size.width() > size.width() || |
| 580 (multi_line() && text_size.height() > size.height())); | 579 (multi_line() && text_size.height() > size.height())); |
| 581 } | 580 } |
| 582 | 581 |
| 583 } // namespace views | 582 } // namespace views |
| OLD | NEW |