| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/animation/ink_drop_highlight.h" | 5 #include "ui/views/animation/ink_drop_highlight.h" |
| 6 | 6 |
| 7 #include "third_party/skia/include/core/SkColor.h" | 7 #include "third_party/skia/include/core/SkColor.h" |
| 8 #include "ui/compositor/callback_layer_animation_observer.h" | 8 #include "ui/compositor/callback_layer_animation_observer.h" |
| 9 #include "ui/compositor/layer.h" | 9 #include "ui/compositor/layer.h" |
| 10 #include "ui/compositor/layer_animation_sequence.h" | 10 #include "ui/compositor/layer_animation_sequence.h" |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 animator->StartAnimation(transform_sequence); | 132 animator->StartAnimation(transform_sequence); |
| 133 } | 133 } |
| 134 | 134 |
| 135 animation_observer->SetActive(); | 135 animation_observer->SetActive(); |
| 136 } | 136 } |
| 137 | 137 |
| 138 gfx::Transform InkDropHighlight::CalculateTransform( | 138 gfx::Transform InkDropHighlight::CalculateTransform( |
| 139 const gfx::Size& size) const { | 139 const gfx::Size& size) const { |
| 140 gfx::Transform transform; | 140 gfx::Transform transform; |
| 141 transform.Translate(center_point_.x(), center_point_.y()); | 141 transform.Translate(center_point_.x(), center_point_.y()); |
| 142 transform.Scale(size.width() / size_.width(), size.height() / size_.height()); | 142 // TODO(bruthig): Fix the InkDropHighlight to work well when initialized with |
| 143 // a (0x0) size. See https://crbug.com/661618. |
| 144 transform.Scale(size_.width() == 0 ? 0 : size.width() / size_.width(), |
| 145 size_.height() == 0 ? 0 : size.height() / size_.height()); |
| 143 gfx::Vector2dF layer_offset = layer_delegate_->GetCenteringOffset(); | 146 gfx::Vector2dF layer_offset = layer_delegate_->GetCenteringOffset(); |
| 144 transform.Translate(-layer_offset.x(), -layer_offset.y()); | 147 transform.Translate(-layer_offset.x(), -layer_offset.y()); |
| 145 return transform; | 148 return transform; |
| 146 } | 149 } |
| 147 | 150 |
| 148 void InkDropHighlight::AnimationStartedCallback( | 151 void InkDropHighlight::AnimationStartedCallback( |
| 149 AnimationType animation_type, | 152 AnimationType animation_type, |
| 150 const ui::CallbackLayerAnimationObserver& observer) { | 153 const ui::CallbackLayerAnimationObserver& observer) { |
| 151 if (observer_) | 154 if (observer_) |
| 152 observer_->AnimationStarted(animation_type); | 155 observer_->AnimationStarted(animation_type); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 163 if (observer_) { | 166 if (observer_) { |
| 164 observer_->AnimationEnded(animation_type, | 167 observer_->AnimationEnded(animation_type, |
| 165 observer.aborted_count() | 168 observer.aborted_count() |
| 166 ? InkDropAnimationEndedReason::PRE_EMPTED | 169 ? InkDropAnimationEndedReason::PRE_EMPTED |
| 167 : InkDropAnimationEndedReason::SUCCESS); | 170 : InkDropAnimationEndedReason::SUCCESS); |
| 168 } | 171 } |
| 169 return true; | 172 return true; |
| 170 } | 173 } |
| 171 | 174 |
| 172 } // namespace views | 175 } // namespace views |
| OLD | NEW |