Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1199)

Unified Diff: ui/views/controls/button/label_button.cc

Issue 2447523002: [ash-md] Added different highlighting modes to the InkDropImpl. (Closed)
Patch Set: Fixed InkDropHostView::GetInkDrop() to use CreateInkDrop(). Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/controls/button/label_button.h ('k') | ui/views/controls/button/md_text_button.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/controls/button/label_button.cc
diff --git a/ui/views/controls/button/label_button.cc b/ui/views/controls/button/label_button.cc
index 3d7453d774e0ac997417f755789f7a5cb5059ea0..52457b744572a0d514f16f81ee8c49c814223fc5 100644
--- a/ui/views/controls/button/label_button.cc
+++ b/ui/views/controls/button/label_button.cc
@@ -20,6 +20,7 @@
#include "ui/native_theme/native_theme.h"
#include "ui/views/animation/flood_fill_ink_drop_ripple.h"
#include "ui/views/animation/ink_drop_highlight.h"
+#include "ui/views/animation/ink_drop_impl.h"
#include "ui/views/animation/square_ink_drop_ripple.h"
#include "ui/views/background.h"
#include "ui/views/controls/button/label_button_border.h"
@@ -447,26 +448,29 @@ void LabelButton::RemoveInkDropLayer(ui::Layer* ink_drop_layer) {
ink_drop_container_->SetVisible(false);
}
+std::unique_ptr<InkDrop> LabelButton::CreateInkDrop() {
+ return UseFloodFillInkDrop() ? CreateDefaultFloodFillInkDropImpl()
+ : CustomButton::CreateInkDrop();
+}
+
std::unique_ptr<views::InkDropRipple> LabelButton::CreateInkDropRipple() const {
- return GetText().empty()
- ? CreateDefaultInkDropRipple(
- image()->GetMirroredBounds().CenterPoint())
- : base::MakeUnique<views::FloodFillInkDropRipple>(
+ return UseFloodFillInkDrop()
+ ? base::MakeUnique<views::FloodFillInkDropRipple>(
GetLocalBounds(), GetInkDropCenterBasedOnLastEvent(),
- GetInkDropBaseColor(), ink_drop_visible_opacity());
+ GetInkDropBaseColor(), ink_drop_visible_opacity())
+ : CreateDefaultInkDropRipple(
+ image()->GetMirroredBounds().CenterPoint());
}
std::unique_ptr<views::InkDropHighlight> LabelButton::CreateInkDropHighlight()
const {
- if (!ShouldShowInkDropHighlight())
- return nullptr;
- return GetText().empty()
- ? CreateDefaultInkDropHighlight(
- gfx::RectF(image()->GetMirroredBounds()).CenterPoint())
- : base::MakeUnique<views::InkDropHighlight>(
+ return UseFloodFillInkDrop()
+ ? base::MakeUnique<views::InkDropHighlight>(
size(), kInkDropSmallCornerRadius,
gfx::RectF(GetLocalBounds()).CenterPoint(),
- GetInkDropBaseColor());
+ GetInkDropBaseColor())
+ : CreateDefaultInkDropHighlight(
+ gfx::RectF(image()->GetMirroredBounds()).CenterPoint());
}
void LabelButton::StateChanged() {
@@ -617,4 +621,8 @@ void LabelButton::ResetLabelEnabledColor() {
label_->SetEnabledColor(color);
}
+bool LabelButton::UseFloodFillInkDrop() const {
+ return !GetText().empty();
+}
+
} // namespace views
« no previous file with comments | « ui/views/controls/button/label_button.h ('k') | ui/views/controls/button/md_text_button.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698