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 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 416 InvalidateLayout(); | 416 InvalidateLayout(); |
| 417 // The entire button has to be repainted here, since the native theme can | 417 // The entire button has to be repainted here, since the native theme can |
| 418 // define the tint for the entire background/border/focus ring. | 418 // define the tint for the entire background/border/focus ring. |
| 419 SchedulePaint(); | 419 SchedulePaint(); |
| 420 } | 420 } |
| 421 | 421 |
| 422 void LabelButton::AddInkDropLayer(ui::Layer* ink_drop_layer) { | 422 void LabelButton::AddInkDropLayer(ui::Layer* ink_drop_layer) { |
| 423 image()->SetPaintToLayer(); | 423 image()->SetPaintToLayer(); |
| 424 image()->layer()->SetFillsBoundsOpaquely(false); | 424 image()->layer()->SetFillsBoundsOpaquely(false); |
| 425 ink_drop_container_->AddInkDropLayer(ink_drop_layer); | 425 ink_drop_container_->AddInkDropLayer(ink_drop_layer); |
| 426 InstallInkDropMask(ink_drop_layer); | |
|
Peter Kasting
2017/04/27 02:13:18
It looks from code search like several other place
Evan Stade
2017/04/27 20:28:52
They would need this if they were to use a mask, b
| |
| 426 } | 427 } |
| 427 | 428 |
| 428 void LabelButton::RemoveInkDropLayer(ui::Layer* ink_drop_layer) { | 429 void LabelButton::RemoveInkDropLayer(ui::Layer* ink_drop_layer) { |
| 429 image()->DestroyLayer(); | 430 image()->DestroyLayer(); |
| 431 ResetInkDropMask(); | |
| 430 ink_drop_container_->RemoveInkDropLayer(ink_drop_layer); | 432 ink_drop_container_->RemoveInkDropLayer(ink_drop_layer); |
| 431 } | 433 } |
| 432 | 434 |
| 433 std::unique_ptr<InkDrop> LabelButton::CreateInkDrop() { | 435 std::unique_ptr<InkDrop> LabelButton::CreateInkDrop() { |
| 434 return UseFloodFillInkDrop() ? CreateDefaultFloodFillInkDropImpl() | 436 return UseFloodFillInkDrop() ? CreateDefaultFloodFillInkDropImpl() |
| 435 : CustomButton::CreateInkDrop(); | 437 : CustomButton::CreateInkDrop(); |
| 436 } | 438 } |
| 437 | 439 |
| 438 std::unique_ptr<views::InkDropRipple> LabelButton::CreateInkDropRipple() const { | 440 std::unique_ptr<views::InkDropRipple> LabelButton::CreateInkDropRipple() const { |
| 439 return UseFloodFillInkDrop() | 441 return UseFloodFillInkDrop() |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 601 : PlatformStyle::TextColorForButton(button_state_colors_, *this); | 603 : PlatformStyle::TextColorForButton(button_state_colors_, *this); |
| 602 if (state() != STATE_DISABLED && label_->enabled_color() != color) | 604 if (state() != STATE_DISABLED && label_->enabled_color() != color) |
| 603 label_->SetEnabledColor(color); | 605 label_->SetEnabledColor(color); |
| 604 } | 606 } |
| 605 | 607 |
| 606 bool LabelButton::UseFloodFillInkDrop() const { | 608 bool LabelButton::UseFloodFillInkDrop() const { |
| 607 return !GetText().empty(); | 609 return !GetText().empty(); |
| 608 } | 610 } |
| 609 | 611 |
| 610 } // namespace views | 612 } // namespace views |
| OLD | NEW |