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

Side by Side Diff: ui/views/animation/ink_drop_impl.cc

Issue 2487723003: [ash-md] Fixed crash when DEACTIVATING a focused ink drop button. (Closed)
Patch Set: 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 unified diff | Download patch
OLDNEW
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_impl.h" 5 #include "ui/views/animation/ink_drop_impl.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/timer/timer.h" 8 #include "base/timer/timer.h"
9 #include "ui/compositor/layer.h" 9 #include "ui/compositor/layer.h"
10 #include "ui/views/animation/ink_drop_highlight.h" 10 #include "ui/views/animation/ink_drop_highlight.h"
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 308
309 void InkDropImpl::HideHighlightOnRippleHiddenState::OnFocusChanged() { 309 void InkDropImpl::HideHighlightOnRippleHiddenState::OnFocusChanged() {
310 if (GetInkDrop()->GetTargetInkDropState() != InkDropState::HIDDEN) 310 if (GetInkDrop()->GetTargetInkDropState() != InkDropState::HIDDEN)
311 return; 311 return;
312 NoAutoHighlightHiddenState::OnFocusChanged(); 312 NoAutoHighlightHiddenState::OnFocusChanged();
313 } 313 }
314 314
315 void InkDropImpl::HideHighlightOnRippleHiddenState::AnimationStarted( 315 void InkDropImpl::HideHighlightOnRippleHiddenState::AnimationStarted(
316 InkDropState ink_drop_state) { 316 InkDropState ink_drop_state) {
317 if (ink_drop_state == views::InkDropState::DEACTIVATED && 317 if (ink_drop_state == views::InkDropState::DEACTIVATED &&
318 GetInkDrop()->is_focused_) { 318 GetInkDrop()->ShouldHighlightBasedOnFocus()) {
319 GetInkDrop()->ink_drop_ripple_->HideImmediately(); 319 // It's possible to get animation started events when destroying the
320 // |ink_drop_ripple_|.
321 // TODO(bruthig): Investigate if the animation framework can address this
322 // issue instead. See https://crbug.com/663335.
323 if (GetInkDrop()->ink_drop_ripple_)
324 GetInkDrop()->ink_drop_ripple_->HideImmediately();
320 GetInkDrop()->SetHighlightState( 325 GetInkDrop()->SetHighlightState(
321 state_factory()->CreateVisibleState(base::TimeDelta(), false)); 326 state_factory()->CreateVisibleState(base::TimeDelta(), false));
322 } 327 }
323 } 328 }
324 329
325 void InkDropImpl::HideHighlightOnRippleHiddenState::AnimationEnded( 330 void InkDropImpl::HideHighlightOnRippleHiddenState::AnimationEnded(
326 InkDropState ink_drop_state, 331 InkDropState ink_drop_state,
327 InkDropAnimationEndedReason reason) { 332 InkDropAnimationEndedReason reason) {
328 if (ink_drop_state == InkDropState::HIDDEN) { 333 if (ink_drop_state == InkDropState::HIDDEN) {
329 // Re-highlight, as necessary. For hover, there's a delay; for focus, jump 334 // Re-highlight, as necessary. For hover, there's a delay; for focus, jump
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after
764 "within a call to " 769 "within a call to "
765 "HighlightState::Exit()."; 770 "HighlightState::Exit().";
766 if (highlight_state_) { 771 if (highlight_state_) {
767 base::AutoReset<bool> exit_guard(&exiting_highlight_state_, true); 772 base::AutoReset<bool> exit_guard(&exiting_highlight_state_, true);
768 highlight_state_->Exit(); 773 highlight_state_->Exit();
769 } 774 }
770 highlight_state_ = nullptr; 775 highlight_state_ = nullptr;
771 } 776 }
772 777
773 } // namespace views 778 } // namespace views
OLDNEW
« no previous file with comments | « no previous file | ui/views/animation/ink_drop_impl_unittest.cc » ('j') | ui/views/animation/ink_drop_impl_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698