Chromium Code Reviews| Index: ui/views/animation/flood_fill_ink_drop_ripple.cc |
| diff --git a/ui/views/animation/flood_fill_ink_drop_ripple.cc b/ui/views/animation/flood_fill_ink_drop_ripple.cc |
| index 9f61bed3559877d7a1d3a48a5e80fe618484df78..00779d69e4277b5bfcd452467705b648de8e5b2a 100644 |
| --- a/ui/views/animation/flood_fill_ink_drop_ripple.cc |
| +++ b/ui/views/animation/flood_fill_ink_drop_ripple.cc |
| @@ -107,21 +107,35 @@ base::TimeDelta GetAnimationDuration(InkDropSubAnimations state) { |
| kAnimationDurationInMs[state]); |
| } |
| +gfx::Rect CalculateClipBounds(const gfx::Size& host_size, |
| + const gfx::Insets& clip_insets) { |
| + gfx::Rect clip_bounds(host_size); |
| + clip_bounds.Inset(clip_insets); |
| + return clip_bounds; |
| +} |
| + |
| +float CalculateCircleLayerRadius(const gfx::Rect& clip_bounds) { |
| + return std::max(clip_bounds.width(), clip_bounds.height()) / 2.f; |
| +} |
| + |
| } // namespace |
| namespace views { |
| -FloodFillInkDropRipple::FloodFillInkDropRipple(const gfx::Rect& clip_bounds, |
| +FloodFillInkDropRipple::FloodFillInkDropRipple(const gfx::Size& host_size, |
| + const gfx::Insets& clip_insets, |
| const gfx::Point& center_point, |
| SkColor color, |
| float visible_opacity) |
| - : center_point_(center_point), |
| + : clip_insets_(clip_insets), |
| + center_point_(center_point), |
| visible_opacity_(visible_opacity), |
| root_layer_(ui::LAYER_NOT_DRAWN), |
| - circle_layer_delegate_( |
| - color, |
| - std::max(clip_bounds.width(), clip_bounds.height()) / 2.f), |
| + circle_layer_delegate_(color, |
| + CalculateCircleLayerRadius( |
| + CalculateClipBounds(host_size, clip_insets))), |
| ink_drop_state_(InkDropState::HIDDEN) { |
| + gfx::Rect clip_bounds = CalculateClipBounds(host_size, clip_insets); |
| root_layer_.set_name("FloodFillInkDropRipple:ROOT_LAYER"); |
| root_layer_.SetMasksToBounds(true); |
| root_layer_.SetBounds(clip_bounds); |
| @@ -148,6 +162,19 @@ FloodFillInkDropRipple::~FloodFillInkDropRipple() { |
| AbortAllAnimations(); |
| } |
| +void FloodFillInkDropRipple::HostSizeChanged(const gfx::Size& new_size) { |
| + root_layer_.SetBounds(CalculateClipBounds(new_size, clip_insets_)); |
| + switch (target_ink_drop_state()) { |
| + case InkDropState::ACTION_PENDING: |
| + case InkDropState::ALTERNATE_ACTION_PENDING: |
| + case InkDropState::ACTIVATED: |
| + painted_layer_.SetTransform(GetMaxSizeTargetTransform()); |
|
bruthig
2016/11/28 22:13:46
So will opacity animations continue here or do we
mohsen
2016/11/29 00:07:12
I think the opacity animations continue and it mak
bruthig
2016/11/29 01:37:48
sgtm
|
| + break; |
| + default: |
| + break; |
| + } |
| +} |
| + |
| void FloodFillInkDropRipple::SnapToActivated() { |
| InkDropRipple::SnapToActivated(); |
| SetOpacity(visible_opacity_); |