Chromium Code Reviews| 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/button/label_button.h" | 5 #include "ui/views/controls/button/label_button.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 534 } | 534 } |
| 535 | 535 |
| 536 void LabelButton::SetTextInternal(const base::string16& text) { | 536 void LabelButton::SetTextInternal(const base::string16& text) { |
| 537 SetAccessibleName(text); | 537 SetAccessibleName(text); |
| 538 label_->SetText(text); | 538 label_->SetText(text); |
| 539 } | 539 } |
| 540 | 540 |
| 541 void LabelButton::ChildPreferredSizeChanged(View* child) { | 541 void LabelButton::ChildPreferredSizeChanged(View* child) { |
| 542 ResetCachedPreferredSize(); | 542 ResetCachedPreferredSize(); |
| 543 PreferredSizeChanged(); | 543 PreferredSizeChanged(); |
| 544 Layout(); | |
|
sadrul
2016/07/12 16:57:42
Interesting. Looks like PreferredSizeChanged() inv
varkha
2016/07/12 19:58:44
Discussed this offline. sadrul@ thought we could h
| |
| 544 } | 545 } |
| 545 | 546 |
| 546 ui::NativeTheme::Part LabelButton::GetThemePart() const { | 547 ui::NativeTheme::Part LabelButton::GetThemePart() const { |
| 547 return ui::NativeTheme::kPushButton; | 548 return ui::NativeTheme::kPushButton; |
| 548 } | 549 } |
| 549 | 550 |
| 550 gfx::Rect LabelButton::GetThemePaintRect() const { | 551 gfx::Rect LabelButton::GetThemePaintRect() const { |
| 551 return GetLocalBounds(); | 552 return GetLocalBounds(); |
| 552 } | 553 } |
| 553 | 554 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 588 void LabelButton::ResetLabelEnabledColor() { | 589 void LabelButton::ResetLabelEnabledColor() { |
| 589 const SkColor color = | 590 const SkColor color = |
| 590 explicitly_set_colors_[state()] | 591 explicitly_set_colors_[state()] |
| 591 ? button_state_colors_[state()] | 592 ? button_state_colors_[state()] |
| 592 : PlatformStyle::TextColorForButton(button_state_colors_, *this); | 593 : PlatformStyle::TextColorForButton(button_state_colors_, *this); |
| 593 if (state() != STATE_DISABLED && label_->enabled_color() != color) | 594 if (state() != STATE_DISABLED && label_->enabled_color() != color) |
| 594 label_->SetEnabledColor(color); | 595 label_->SetEnabledColor(color); |
| 595 } | 596 } |
| 596 | 597 |
| 597 } // namespace views | 598 } // namespace views |
| OLD | NEW |