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

Unified Diff: ui/views/animation/ink_drop_host_view.cc

Issue 2960393002: Hardcode ripple color/opacity for Harmony. (Closed)
Patch Set: Consolidate FloodFill as well Created 3 years, 6 months 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/animation/ink_drop_host_view.h ('k') | ui/views/controls/button/label_button.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/animation/ink_drop_host_view.cc
diff --git a/ui/views/animation/ink_drop_host_view.cc b/ui/views/animation/ink_drop_host_view.cc
index 1856e89293eba6056dd9d15d57940c5afcc7ddc9..25ab50ad5f5b14d30a2f71b9b12e1fe6195c22c7 100644
--- a/ui/views/animation/ink_drop_host_view.cc
+++ b/ui/views/animation/ink_drop_host_view.cc
@@ -5,10 +5,12 @@
#include "ui/views/animation/ink_drop_host_view.h"
#include "base/memory/ptr_util.h"
+#include "ui/base/material_design/material_design_controller.h"
#include "ui/events/event.h"
#include "ui/events/scoped_target_handler.h"
#include "ui/gfx/color_palette.h"
#include "ui/gfx/geometry/size_conversions.h"
+#include "ui/views/animation/flood_fill_ink_drop_ripple.h"
#include "ui/views/animation/ink_drop.h"
#include "ui/views/animation/ink_drop_highlight.h"
#include "ui/views/animation/ink_drop_impl.h"
@@ -25,7 +27,13 @@ namespace {
const float kLargeInkDropScale = 1.333f;
// Default opacity of the ink drop when it is visible.
-const float kInkDropVisibleOpacity = 0.175f;
+float DefaultInkDropVisibleOpacity() {
+ constexpr float kInkDropVisibleOpacity = 0.175f;
+ constexpr float kInkDropVisibleOpacityMd = 0.05f;
+ return ui::MaterialDesignController::IsSecondaryUiMaterial()
+ ? kInkDropVisibleOpacityMd
+ : kInkDropVisibleOpacity;
+}
} // namespace
@@ -118,7 +126,7 @@ gfx::Size InkDropHostView::CalculateLargeInkDropSize(
InkDropHostView::InkDropHostView()
: ink_drop_mode_(InkDropMode::OFF),
ink_drop_(nullptr),
- ink_drop_visible_opacity_(kInkDropVisibleOpacity),
+ ink_drop_visible_opacity_(DefaultInkDropVisibleOpacity()),
old_paint_to_layer_(false),
destroying_(false) {}
@@ -172,16 +180,25 @@ std::unique_ptr<InkDropRipple> InkDropHostView::CreateDefaultInkDropRipple(
const gfx::Size& size) const {
std::unique_ptr<InkDropRipple> ripple(new SquareInkDropRipple(
CalculateLargeInkDropSize(size), kInkDropLargeCornerRadius, size,
- kInkDropSmallCornerRadius, center_point, GetInkDropBaseColor(),
+ kInkDropSmallCornerRadius, center_point, GetInkDropBaseColorImpl(),
ink_drop_visible_opacity()));
return ripple;
}
+std::unique_ptr<InkDropRipple> InkDropHostView::CreateFloodFillInkDropRipple()
+ const {
+ return std::unique_ptr<InkDropRipple>(new FloodFillInkDropRipple(
+ gfx::Size(kDefaultInkDropSize, kDefaultInkDropSize),
+ GetInkDropCenterBasedOnLastEvent(), GetInkDropBaseColorImpl(),
+ ink_drop_visible_opacity()));
+}
+
std::unique_ptr<InkDropHighlight>
InkDropHostView::CreateDefaultInkDropHighlight(const gfx::PointF& center_point,
const gfx::Size& size) const {
- std::unique_ptr<InkDropHighlight> highlight(new InkDropHighlight(
- size, kInkDropSmallCornerRadius, center_point, GetInkDropBaseColor()));
+ std::unique_ptr<InkDropHighlight> highlight(
+ new InkDropHighlight(size, kInkDropSmallCornerRadius, center_point,
+ GetInkDropBaseColorImpl()));
highlight->set_explode_size(gfx::SizeF(CalculateLargeInkDropSize(size)));
return highlight;
}
@@ -316,4 +333,10 @@ InkDropHostView::CreateDefaultFloodFillInkDropImpl() {
return ink_drop;
}
+SkColor InkDropHostView::GetInkDropBaseColorImpl() const {
+ return ui::MaterialDesignController::IsSecondaryUiMaterial()
+ ? SK_ColorBLACK
+ : GetInkDropBaseColor();
+}
+
} // namespace views
« no previous file with comments | « ui/views/animation/ink_drop_host_view.h ('k') | ui/views/controls/button/label_button.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698