Commit e39ae2ba authored by Peter Kasting's avatar Peter Kasting Committed by Commit Bot

Remove dead code.

Create(Default,Square)InkDropHighlight() are never called.  Removing
these removed the only caller of set_explode_size(), which meant the
explode size was always the same as the nomal size.  This in turn
allowed removing the scaling transform machinery.

Bug: none
Change-Id: I63e6dca81db75ec16d2d1c079de4bdc0e6589625
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2067550Reviewed-by: default avatarPeter Boström <pbos@chromium.org>
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/master@{#744066}
parent e2902619
...@@ -28,9 +28,6 @@ namespace { ...@@ -28,9 +28,6 @@ namespace {
// The opacity of the highlight when it is not visible. // The opacity of the highlight when it is not visible.
constexpr float kHiddenOpacity = 0.0f; constexpr float kHiddenOpacity = 0.0f;
// Default opacity of the highlight.
constexpr float kDefaultOpacity = 0.128f;
} // namespace } // namespace
std::string ToString(InkDropHighlight::AnimationType animation_type) { std::string ToString(InkDropHighlight::AnimationType animation_type) {
...@@ -40,24 +37,16 @@ std::string ToString(InkDropHighlight::AnimationType animation_type) { ...@@ -40,24 +37,16 @@ std::string ToString(InkDropHighlight::AnimationType animation_type) {
case InkDropHighlight::AnimationType::kFadeOut: case InkDropHighlight::AnimationType::kFadeOut:
return std::string("FADE_OUT"); return std::string("FADE_OUT");
} }
NOTREACHED()
<< "Should never be reached but is necessary for some compilers.";
return std::string("UNKNOWN");
} }
InkDropHighlight::InkDropHighlight( InkDropHighlight::InkDropHighlight(
const gfx::PointF& center_point, const gfx::PointF& center_point,
std::unique_ptr<BasePaintedLayerDelegate> layer_delegate) std::unique_ptr<BasePaintedLayerDelegate> layer_delegate)
: center_point_(center_point), : center_point_(center_point),
// TODO(sammiequon) : Make the default opacity consistent between all
// constructors.
visible_opacity_(1.f),
last_animation_initiated_was_fade_in_(false),
layer_delegate_(std::move(layer_delegate)), layer_delegate_(std::move(layer_delegate)),
layer_(new ui::Layer()), layer_(std::make_unique<ui::Layer>()) {
observer_(nullptr) {
const gfx::RectF painted_bounds = layer_delegate_->GetPaintedBounds(); const gfx::RectF painted_bounds = layer_delegate_->GetPaintedBounds();
size_ = explode_size_ = painted_bounds.size(); size_ = painted_bounds.size();
layer_->SetBounds(gfx::ToEnclosingRect(painted_bounds)); layer_->SetBounds(gfx::ToEnclosingRect(painted_bounds));
layer_->SetFillsBoundsOpaquely(false); layer_->SetFillsBoundsOpaquely(false);
...@@ -73,9 +62,9 @@ InkDropHighlight::InkDropHighlight(const gfx::SizeF& size, ...@@ -73,9 +62,9 @@ InkDropHighlight::InkDropHighlight(const gfx::SizeF& size,
SkColor color) SkColor color)
: InkDropHighlight( : InkDropHighlight(
center_point, center_point,
std::unique_ptr<BasePaintedLayerDelegate>( std::make_unique<RoundedRectangleLayerDelegate>(color,
new RoundedRectangleLayerDelegate(color, size, corner_radius))) { size,
visible_opacity_ = kDefaultOpacity; corner_radius)) {
layer_->SetOpacity(visible_opacity_); layer_->SetOpacity(visible_opacity_);
} }
...@@ -86,11 +75,7 @@ InkDropHighlight::InkDropHighlight(const gfx::Size& size, ...@@ -86,11 +75,7 @@ InkDropHighlight::InkDropHighlight(const gfx::Size& size,
: InkDropHighlight(gfx::SizeF(size), corner_radius, center_point, color) {} : InkDropHighlight(gfx::SizeF(size), corner_radius, center_point, color) {}
InkDropHighlight::InkDropHighlight(const gfx::SizeF& size, SkColor base_color) InkDropHighlight::InkDropHighlight(const gfx::SizeF& size, SkColor base_color)
: last_animation_initiated_was_fade_in_(false), observer_(nullptr) { : size_(size), layer_(std::make_unique<ui::Layer>(ui::LAYER_SOLID_COLOR)) {
size_ = explode_size_ = size;
visible_opacity_ = kDefaultOpacity;
layer_ = std::make_unique<ui::Layer>(ui::LAYER_SOLID_COLOR);
layer_->SetColor(base_color); layer_->SetColor(base_color);
layer_->SetBounds(gfx::Rect(gfx::ToRoundedSize(size))); layer_->SetBounds(gfx::Rect(gfx::ToRoundedSize(size)));
layer_->SetVisible(false); layer_->SetVisible(false);
...@@ -112,12 +97,11 @@ bool InkDropHighlight::IsFadingInOrVisible() const { ...@@ -112,12 +97,11 @@ bool InkDropHighlight::IsFadingInOrVisible() const {
void InkDropHighlight::FadeIn(const base::TimeDelta& duration) { void InkDropHighlight::FadeIn(const base::TimeDelta& duration) {
layer_->SetOpacity(kHiddenOpacity); layer_->SetOpacity(kHiddenOpacity);
layer_->SetVisible(true); layer_->SetVisible(true);
AnimateFade(AnimationType::kFadeIn, duration, size_, size_); AnimateFade(AnimationType::kFadeIn, duration);
} }
void InkDropHighlight::FadeOut(const base::TimeDelta& duration, bool explode) { void InkDropHighlight::FadeOut(const base::TimeDelta& duration) {
AnimateFade(AnimationType::kFadeOut, duration, size_, AnimateFade(AnimationType::kFadeOut, duration);
explode ? explode_size_ : size_);
} }
test::InkDropHighlightTestApi* InkDropHighlight::GetTestApi() { test::InkDropHighlightTestApi* InkDropHighlight::GetTestApi() {
...@@ -125,16 +109,14 @@ test::InkDropHighlightTestApi* InkDropHighlight::GetTestApi() { ...@@ -125,16 +109,14 @@ test::InkDropHighlightTestApi* InkDropHighlight::GetTestApi() {
} }
void InkDropHighlight::AnimateFade(AnimationType animation_type, void InkDropHighlight::AnimateFade(AnimationType animation_type,
const base::TimeDelta& duration, const base::TimeDelta& duration) {
const gfx::SizeF& initial_size,
const gfx::SizeF& target_size) {
const base::TimeDelta effective_duration = const base::TimeDelta effective_duration =
gfx::Animation::ShouldRenderRichAnimation() ? duration gfx::Animation::ShouldRenderRichAnimation() ? duration
: base::TimeDelta(); : base::TimeDelta();
last_animation_initiated_was_fade_in_ = last_animation_initiated_was_fade_in_ =
animation_type == AnimationType::kFadeIn; animation_type == AnimationType::kFadeIn;
layer_->SetTransform(CalculateTransform(initial_size)); layer_->SetTransform(CalculateTransform());
// The |animation_observer| will be destroyed when the // The |animation_observer| will be destroyed when the
// AnimationStartedCallback() returns true. // AnimationStartedCallback() returns true.
...@@ -161,33 +143,16 @@ void InkDropHighlight::AnimateFade(AnimationType animation_type, ...@@ -161,33 +143,16 @@ void InkDropHighlight::AnimateFade(AnimationType animation_type,
opacity_sequence->AddObserver(animation_observer); opacity_sequence->AddObserver(animation_observer);
animator->StartAnimation(opacity_sequence); animator->StartAnimation(opacity_sequence);
if (initial_size != target_size) {
std::unique_ptr<ui::LayerAnimationElement> transform_element =
ui::LayerAnimationElement::CreateTransformElement(
CalculateTransform(target_size), effective_duration);
ui::LayerAnimationSequence* transform_sequence =
new ui::LayerAnimationSequence(std::move(transform_element));
transform_sequence->AddObserver(animation_observer);
animator->StartAnimation(transform_sequence);
}
animation_observer->SetActive(); animation_observer->SetActive();
} }
gfx::Transform InkDropHighlight::CalculateTransform( gfx::Transform InkDropHighlight::CalculateTransform() const {
const gfx::SizeF& size) const {
gfx::Transform transform; gfx::Transform transform;
// No transform needed for a solid color layer. // No transform needed for a solid color layer.
if (!layer_delegate_) if (!layer_delegate_)
return transform; return transform;
transform.Translate(center_point_.x(), center_point_.y()); transform.Translate(center_point_.x(), center_point_.y());
// TODO(bruthig): Fix the InkDropHighlight to work well when initialized with
// a (0x0) size. See https://crbug.com/661618.
transform.Scale(size_.width() == 0 ? 0 : size.width() / size_.width(),
size_.height() == 0 ? 0 : size.height() / size_.height());
gfx::Vector2dF layer_offset = layer_delegate_->GetCenteringOffset(); gfx::Vector2dF layer_offset = layer_delegate_->GetCenteringOffset();
transform.Translate(-layer_offset.x(), -layer_offset.y()); transform.Translate(-layer_offset.x(), -layer_offset.y());
......
...@@ -68,8 +68,6 @@ class VIEWS_EXPORT InkDropHighlight { ...@@ -68,8 +68,6 @@ class VIEWS_EXPORT InkDropHighlight {
observer_ = observer; observer_ = observer;
} }
void set_explode_size(const gfx::SizeF& size) { explode_size_ = size; }
void set_visible_opacity(float visible_opacity) { void set_visible_opacity(float visible_opacity) {
visible_opacity_ = visible_opacity; visible_opacity_ = visible_opacity;
} }
...@@ -81,10 +79,8 @@ class VIEWS_EXPORT InkDropHighlight { ...@@ -81,10 +79,8 @@ class VIEWS_EXPORT InkDropHighlight {
// Fades in the highlight visual over the given |duration|. // Fades in the highlight visual over the given |duration|.
void FadeIn(const base::TimeDelta& duration); void FadeIn(const base::TimeDelta& duration);
// Fades out the highlight visual over the given |duration|. If |explode| is // Fades out the highlight visual over the given |duration|.
// true then the highlight will animate a size increase in addition to the void FadeOut(const base::TimeDelta& duration);
// fade out.
void FadeOut(const base::TimeDelta& duration, bool explode);
// The root Layer that can be added in to a Layer tree. // The root Layer that can be added in to a Layer tree.
ui::Layer* layer() { return layer_.get(); } ui::Layer* layer() { return layer_.get(); }
...@@ -97,16 +93,13 @@ class VIEWS_EXPORT InkDropHighlight { ...@@ -97,16 +93,13 @@ class VIEWS_EXPORT InkDropHighlight {
private: private:
friend class test::InkDropHighlightTestApi; friend class test::InkDropHighlightTestApi;
// Animates a fade in/out as specified by |animation_type| combined with a // Animates a fade in/out as specified by |animation_type| over the given
// transformation from the |initial_size| to the |target_size| over the given
// |duration|. // |duration|.
void AnimateFade(AnimationType animation_type, void AnimateFade(AnimationType animation_type,
const base::TimeDelta& duration, const base::TimeDelta& duration);
const gfx::SizeF& initial_size,
const gfx::SizeF& target_size);
// Calculates the Transform to apply to |layer_| for the given |size|. // Calculates the Transform to apply to |layer_|.
gfx::Transform CalculateTransform(const gfx::SizeF& size) const; gfx::Transform CalculateTransform() const;
// The callback that will be invoked when a fade in/out animation is started. // The callback that will be invoked when a fade in/out animation is started.
void AnimationStartedCallback( void AnimationStartedCallback(
...@@ -121,20 +114,16 @@ class VIEWS_EXPORT InkDropHighlight { ...@@ -121,20 +114,16 @@ class VIEWS_EXPORT InkDropHighlight {
// The size of the highlight shape when fully faded in. // The size of the highlight shape when fully faded in.
gfx::SizeF size_; gfx::SizeF size_;
// The target size of the highlight shape when it expands during a fade out
// animation.
gfx::SizeF explode_size_;
// The center point of the highlight shape in the parent Layer's coordinate // The center point of the highlight shape in the parent Layer's coordinate
// space. // space.
gfx::PointF center_point_; gfx::PointF center_point_;
// The opacity for the fully visible state of the highlight. // The opacity for the fully visible state of the highlight.
float visible_opacity_; float visible_opacity_ = 0.128f;
// True if the last animation to be initiated was a kFadeIn, and false // True if the last animation to be initiated was a kFadeIn, and false
// otherwise. // otherwise.
bool last_animation_initiated_was_fade_in_; bool last_animation_initiated_was_fade_in_ = false;
// The LayerDelegate that paints the highlight |layer_|. Null if |layer_| is a // The LayerDelegate that paints the highlight |layer_|. Null if |layer_| is a
// solid color layer. // solid color layer.
...@@ -143,7 +132,7 @@ class VIEWS_EXPORT InkDropHighlight { ...@@ -143,7 +132,7 @@ class VIEWS_EXPORT InkDropHighlight {
// The visual highlight layer. // The visual highlight layer.
std::unique_ptr<ui::Layer> layer_; std::unique_ptr<ui::Layer> layer_;
InkDropHighlightObserver* observer_; InkDropHighlightObserver* observer_ = nullptr;
DISALLOW_COPY_AND_ASSIGN(InkDropHighlight); DISALLOW_COPY_AND_ASSIGN(InkDropHighlight);
}; };
......
...@@ -94,8 +94,7 @@ TEST_F(InkDropHighlightTest, IsHighlightedStateTransitions) { ...@@ -94,8 +94,7 @@ TEST_F(InkDropHighlightTest, IsHighlightedStateTransitions) {
test_api()->CompleteAnimations(); test_api()->CompleteAnimations();
EXPECT_TRUE(ink_drop_highlight()->IsFadingInOrVisible()); EXPECT_TRUE(ink_drop_highlight()->IsFadingInOrVisible());
ink_drop_highlight()->FadeOut(base::TimeDelta::FromSeconds(1), ink_drop_highlight()->FadeOut(base::TimeDelta::FromSeconds(1));
false /* explode */);
EXPECT_FALSE(ink_drop_highlight()->IsFadingInOrVisible()); EXPECT_FALSE(ink_drop_highlight()->IsFadingInOrVisible());
test_api()->CompleteAnimations(); test_api()->CompleteAnimations();
...@@ -132,8 +131,7 @@ TEST_F(InkDropHighlightTest, ...@@ -132,8 +131,7 @@ TEST_F(InkDropHighlightTest,
EXPECT_EQ(InkDropHighlight::AnimationType::kFadeIn, EXPECT_EQ(InkDropHighlight::AnimationType::kFadeIn,
observer()->last_animation_started_context()); observer()->last_animation_started_context());
ink_drop_highlight()->FadeOut(base::TimeDelta::FromSeconds(1), ink_drop_highlight()->FadeOut(base::TimeDelta::FromSeconds(1));
false /* explode */);
EXPECT_EQ(InkDropHighlight::AnimationType::kFadeOut, EXPECT_EQ(InkDropHighlight::AnimationType::kFadeOut,
observer()->last_animation_started_context()); observer()->last_animation_started_context());
...@@ -158,8 +156,7 @@ TEST_F(InkDropHighlightTest, VerifyObserversAreNotifiedOfPreemptedAnimations) { ...@@ -158,8 +156,7 @@ TEST_F(InkDropHighlightTest, VerifyObserversAreNotifiedOfPreemptedAnimations) {
return; return;
ink_drop_highlight()->FadeIn(base::TimeDelta::FromSeconds(1)); ink_drop_highlight()->FadeIn(base::TimeDelta::FromSeconds(1));
ink_drop_highlight()->FadeOut(base::TimeDelta::FromSeconds(1), ink_drop_highlight()->FadeOut(base::TimeDelta::FromSeconds(1));
false /* explode */);
EXPECT_EQ(2, observer()->last_animation_ended_ordinal()); EXPECT_EQ(2, observer()->last_animation_ended_ordinal());
EXPECT_EQ(InkDropHighlight::AnimationType::kFadeIn, EXPECT_EQ(InkDropHighlight::AnimationType::kFadeIn,
...@@ -175,8 +172,7 @@ TEST_F(InkDropHighlightTest, NullObserverIsSafe) { ...@@ -175,8 +172,7 @@ TEST_F(InkDropHighlightTest, NullObserverIsSafe) {
ink_drop_highlight()->FadeIn(base::TimeDelta::FromSeconds(1)); ink_drop_highlight()->FadeIn(base::TimeDelta::FromSeconds(1));
test_api()->CompleteAnimations(); test_api()->CompleteAnimations();
ink_drop_highlight()->FadeOut(base::TimeDelta::FromMilliseconds(0), ink_drop_highlight()->FadeOut(base::TimeDelta::FromMilliseconds(0));
false /* explode */);
test_api()->CompleteAnimations(); test_api()->CompleteAnimations();
EXPECT_FALSE(ink_drop_highlight()->IsFadingInOrVisible()); EXPECT_FALSE(ink_drop_highlight()->IsFadingInOrVisible());
} }
...@@ -203,15 +199,14 @@ TEST_F(InkDropHighlightTest, AnimationsAbortedDuringDeletion) { ...@@ -203,15 +199,14 @@ TEST_F(InkDropHighlightTest, AnimationsAbortedDuringDeletion) {
TEST_F(InkDropHighlightTest, AnimatingAZeroSizeHighlight) { TEST_F(InkDropHighlightTest, AnimatingAZeroSizeHighlight) {
InitHighlight(std::make_unique<InkDropHighlight>( InitHighlight(std::make_unique<InkDropHighlight>(
gfx::Size(0, 0), 3, gfx::PointF(), SK_ColorBLACK)); gfx::Size(0, 0), 3, gfx::PointF(), SK_ColorBLACK));
ink_drop_highlight()->FadeOut(base::TimeDelta::FromMilliseconds(0), ink_drop_highlight()->FadeOut(base::TimeDelta::FromMilliseconds(0));
false /* explode */);
} }
TEST_F(InkDropHighlightTest, TransformIsPixelAligned) { TEST_F(InkDropHighlightTest, TransformIsPixelAligned) {
const float kEpsilon = 0.001f; constexpr float kEpsilon = 0.001f;
gfx::Size highlight_size(10, 10); constexpr gfx::Size kHighlightSize(10, 10);
InitHighlight(std::make_unique<InkDropHighlight>( InitHighlight(std::make_unique<InkDropHighlight>(
highlight_size, 3, gfx::PointF(3.5f, 3.5f), SK_ColorYELLOW)); kHighlightSize, 3, gfx::PointF(3.5f, 3.5f), SK_ColorYELLOW));
const gfx::PointF layer_origin( const gfx::PointF layer_origin(
ink_drop_highlight()->layer()->bounds().origin()); ink_drop_highlight()->layer()->bounds().origin());
for (auto dsf : {1.25, 1.33, 1.5, 1.6, 1.75, 1.8, 2.25}) { for (auto dsf : {1.25, 1.33, 1.5, 1.6, 1.75, 1.8, 2.25}) {
...@@ -220,8 +215,7 @@ TEST_F(InkDropHighlightTest, TransformIsPixelAligned) { ...@@ -220,8 +215,7 @@ TEST_F(InkDropHighlightTest, TransformIsPixelAligned) {
<< "Device Scale Factor: " << dsf << std::endl); << "Device Scale Factor: " << dsf << std::endl);
ink_drop_highlight()->layer()->OnDeviceScaleFactorChanged(dsf); ink_drop_highlight()->layer()->OnDeviceScaleFactorChanged(dsf);
const gfx::SizeF size(highlight_size); gfx::Transform transform = test_api()->CalculateTransform();
gfx::Transform transform = test_api()->CalculateTransform(size);
gfx::Point3F transformed_layer_origin(layer_origin.x(), layer_origin.y(), gfx::Point3F transformed_layer_origin(layer_origin.x(), layer_origin.y(),
0); 0);
transform.TransformPoint(&transformed_layer_origin); transform.TransformPoint(&transformed_layer_origin);
......
...@@ -161,21 +161,6 @@ std::unique_ptr<InkDropRipple> InkDropHostView::CreateSquareInkDropRipple( ...@@ -161,21 +161,6 @@ std::unique_ptr<InkDropRipple> InkDropHostView::CreateSquareInkDropRipple(
return ripple; return ripple;
} }
std::unique_ptr<InkDropHighlight>
InkDropHostView::CreateDefaultInkDropHighlight(const gfx::PointF& center_point,
const gfx::Size& size) const {
return CreateSquareInkDropHighlight(center_point, size);
}
std::unique_ptr<InkDropHighlight> InkDropHostView::CreateSquareInkDropHighlight(
const gfx::PointF& center_point,
const gfx::Size& size) const {
auto highlight = std::make_unique<InkDropHighlight>(
size, ink_drop_small_corner_radius_, center_point, GetInkDropBaseColor());
highlight->set_explode_size(gfx::SizeF(CalculateLargeInkDropSize(size)));
return highlight;
}
bool InkDropHostView::HasInkDrop() const { bool InkDropHostView::HasInkDrop() const {
return !!ink_drop_; return !!ink_drop_;
} }
......
...@@ -13,10 +13,6 @@ ...@@ -13,10 +13,6 @@
#include "ui/views/animation/ink_drop_event_handler.h" #include "ui/views/animation/ink_drop_event_handler.h"
#include "ui/views/view.h" #include "ui/views/view.h"
namespace gfx {
class PointF;
} // namespace gfx
namespace ui { namespace ui {
class Layer; class Layer;
class LocatedEvent; class LocatedEvent;
...@@ -168,17 +164,6 @@ class VIEWS_EXPORT InkDropHostView : public View { ...@@ -168,17 +164,6 @@ class VIEWS_EXPORT InkDropHostView : public View {
const gfx::Point& center_point, const gfx::Point& center_point,
const gfx::Size& size) const; const gfx::Size& size) const;
// TODO(pbos): Migrate uses to CreateSquareInkDropHighlight which this calls
// directly.
std::unique_ptr<InkDropHighlight> CreateDefaultInkDropHighlight(
const gfx::PointF& center_point,
const gfx::Size& size = kDefaultInkDropSize) const;
// Creates a InkDropHighlight centered on |center_point|.
std::unique_ptr<InkDropHighlight> CreateSquareInkDropHighlight(
const gfx::PointF& center_point,
const gfx::Size& size) const;
// Returns true if an ink drop instance has been created. // Returns true if an ink drop instance has been created.
bool HasInkDrop() const; bool HasInkDrop() const;
......
This diff is collapsed.
...@@ -171,12 +171,10 @@ class VIEWS_EXPORT InkDropImpl : public InkDrop, ...@@ -171,12 +171,10 @@ class VIEWS_EXPORT InkDropImpl : public InkDrop,
std::unique_ptr<HighlightState> CreateStartState(); std::unique_ptr<HighlightState> CreateStartState();
std::unique_ptr<HighlightState> CreateHiddenState( std::unique_ptr<HighlightState> CreateHiddenState(
base::TimeDelta animation_duration, base::TimeDelta animation_duration);
bool explode);
std::unique_ptr<HighlightState> CreateVisibleState( std::unique_ptr<HighlightState> CreateVisibleState(
base::TimeDelta animation_duration, base::TimeDelta animation_duration);
bool explode);
InkDropImpl* ink_drop() { return ink_drop_; } InkDropImpl* ink_drop() { return ink_drop_; }
...@@ -244,11 +242,8 @@ class VIEWS_EXPORT InkDropImpl : public InkDrop, ...@@ -244,11 +242,8 @@ class VIEWS_EXPORT InkDropImpl : public InkDrop,
// Enables or disables the highlight state based on |should_highlight| and if // Enables or disables the highlight state based on |should_highlight| and if
// an animation is triggered it will be scheduled to have the given // an animation is triggered it will be scheduled to have the given
// |animation_duration|. If |explode| is true the highlight will expand as it // |animation_duration|.
// fades out. |explode| is ignored when |should_higlight| is true. void SetHighlight(bool should_highlight, base::TimeDelta animation_duration);
void SetHighlight(bool should_highlight,
base::TimeDelta animation_duration,
bool explode);
// Returns true if |this| the highlight should be visible based on the // Returns true if |this| the highlight should be visible based on the
// hover/focus status. // hover/focus status.
......
...@@ -26,9 +26,8 @@ std::vector<ui::LayerAnimator*> InkDropHighlightTestApi::GetLayerAnimators() { ...@@ -26,9 +26,8 @@ std::vector<ui::LayerAnimator*> InkDropHighlightTestApi::GetLayerAnimators() {
return animators; return animators;
} }
gfx::Transform InkDropHighlightTestApi::CalculateTransform( gfx::Transform InkDropHighlightTestApi::CalculateTransform() {
const gfx::SizeF& size) { return ink_drop_highlight()->CalculateTransform();
return ink_drop_highlight()->CalculateTransform(size);
} }
} // namespace test } // namespace test
......
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
#include "base/macros.h" #include "base/macros.h"
#include "ui/compositor/test/multi_layer_animator_test_controller.h" #include "ui/compositor/test/multi_layer_animator_test_controller.h"
#include "ui/compositor/test/multi_layer_animator_test_controller_delegate.h" #include "ui/compositor/test/multi_layer_animator_test_controller_delegate.h"
#include "ui/gfx/geometry/size_f.h"
#include "ui/gfx/transform.h" #include "ui/gfx/transform.h"
namespace ui { namespace ui {
...@@ -35,7 +34,7 @@ class InkDropHighlightTestApi ...@@ -35,7 +34,7 @@ class InkDropHighlightTestApi
// MultiLayerAnimatorTestControllerDelegate: // MultiLayerAnimatorTestControllerDelegate:
std::vector<ui::LayerAnimator*> GetLayerAnimators() override; std::vector<ui::LayerAnimator*> GetLayerAnimators() override;
gfx::Transform CalculateTransform(const gfx::SizeF& size); gfx::Transform CalculateTransform();
protected: protected:
InkDropHighlight* ink_drop_highlight() { InkDropHighlight* ink_drop_highlight() {
......
...@@ -142,11 +142,13 @@ std::unique_ptr<views::InkDropHighlight> MdTextButton::CreateInkDropHighlight() ...@@ -142,11 +142,13 @@ std::unique_ptr<views::InkDropHighlight> MdTextButton::CreateInkDropHighlight()
// the mask bounds. // the mask bounds.
shadows.emplace_back(gfx::Vector2d(0, kYOffset), 2 * kSkiaBlurRadius, shadows.emplace_back(gfx::Vector2d(0, kYOffset), 2 * kSkiaBlurRadius,
theme->GetSystemColor(shadow_color_id)); theme->GetSystemColor(shadow_color_id));
return std::make_unique<InkDropHighlight>( auto highlight = std::make_unique<InkDropHighlight>(
gfx::RectF(GetLocalBounds()).CenterPoint(), gfx::RectF(GetLocalBounds()).CenterPoint(),
base::WrapUnique(new BorderShadowLayerDelegate( std::make_unique<BorderShadowLayerDelegate>(
shadows, GetLocalBounds(), theme->GetSystemColor(fill_color_id), shadows, GetLocalBounds(), theme->GetSystemColor(fill_color_id),
corner_radius_))); corner_radius_));
highlight->set_visible_opacity(1.0f);
return highlight;
} }
void MdTextButton::SetEnabledTextColors(base::Optional<SkColor> color) { void MdTextButton::SetEnabledTextColors(base::Optional<SkColor> color) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment