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

Side by Side Diff: ui/views/controls/button/custom_button.cc

Issue 2406323002: CustomButton: restrict animation repaints to buttons that actually animate (Closed)
Patch Set: CustomButton: restrict animation repaints to buttons that actually animate Created 4 years, 2 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/controls/button/custom_button.h" 5 #include "ui/views/controls/button/custom_button.h"
6 6
7 #include "ui/accessibility/ax_view_state.h" 7 #include "ui/accessibility/ax_view_state.h"
8 #include "ui/events/event.h" 8 #include "ui/events/event.h"
9 #include "ui/events/event_utils.h" 9 #include "ui/events/event_utils.h"
10 #include "ui/events/keycodes/keyboard_codes.h" 10 #include "ui/events/keycodes/keyboard_codes.h"
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 } 358 }
359 359
360 SkColor CustomButton::GetInkDropBaseColor() const { 360 SkColor CustomButton::GetInkDropBaseColor() const {
361 return ink_drop_base_color_; 361 return ink_drop_base_color_;
362 } 362 }
363 363
364 //////////////////////////////////////////////////////////////////////////////// 364 ////////////////////////////////////////////////////////////////////////////////
365 // CustomButton, gfx::AnimationDelegate implementation: 365 // CustomButton, gfx::AnimationDelegate implementation:
366 366
367 void CustomButton::AnimationProgressed(const gfx::Animation* animation) { 367 void CustomButton::AnimationProgressed(const gfx::Animation* animation) {
368 SchedulePaint(); 368 if (animates_hover())
369 SchedulePaint();
369 } 370 }
370 371
371 //////////////////////////////////////////////////////////////////////////////// 372 ////////////////////////////////////////////////////////////////////////////////
372 // CustomButton, View overrides (public): 373 // CustomButton, View overrides (public):
373 374
374 void CustomButton::ViewHierarchyChanged( 375 void CustomButton::ViewHierarchyChanged(
375 const ViewHierarchyChangedDetails& details) { 376 const ViewHierarchyChangedDetails& details) {
376 if (!details.is_add && state_ != STATE_DISABLED) 377 if (!details.is_add && state_ != STATE_DISABLED)
377 SetState(STATE_NORMAL); 378 SetState(STATE_NORMAL);
378 } 379 }
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 views::InkDropState::ACTION_PENDING || 472 views::InkDropState::ACTION_PENDING ||
472 ink_drop()->GetTargetInkDropState() == 473 ink_drop()->GetTargetInkDropState() ==
473 views::InkDropState::ALTERNATE_ACTION_PENDING) { 474 views::InkDropState::ALTERNATE_ACTION_PENDING) {
474 AnimateInkDrop(views::InkDropState::HIDDEN, 475 AnimateInkDrop(views::InkDropState::HIDDEN,
475 ui::LocatedEvent::FromIfValid(&event)); 476 ui::LocatedEvent::FromIfValid(&event));
476 } 477 }
477 Button::OnClickCanceled(event); 478 Button::OnClickCanceled(event);
478 } 479 }
479 480
480 } // namespace views 481 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698