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

Side by Side Diff: cc/animation/element_animations.cc

Issue 2251933002: Fix smooth scroll animation flake on janky pages (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix UpdateTarget while animation is not started Created 4 years, 4 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 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 "cc/animation/element_animations.h" 5 #include "cc/animation/element_animations.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 996 matching lines...) Expand 10 before | Expand all | Expand 10 after
1007 if (animation_host_) { 1007 if (animation_host_) {
1008 bool was_active = is_active_; 1008 bool was_active = is_active_;
1009 is_active_ = false; 1009 is_active_ = false;
1010 for (size_t i = 0; i < animations_.size(); ++i) { 1010 for (size_t i = 0; i < animations_.size(); ++i) {
1011 if (animations_[i]->run_state() != Animation::WAITING_FOR_DELETION) { 1011 if (animations_[i]->run_state() != Animation::WAITING_FOR_DELETION) {
1012 is_active_ = true; 1012 is_active_ = true;
1013 break; 1013 break;
1014 } 1014 }
1015 } 1015 }
1016 1016
1017 if (is_active_ && (!was_active || force)) 1017 if (is_active_ && (!was_active || force)) {
1018 animation_host_->DidActivateElementAnimations(this); 1018 animation_host_->DidActivateElementAnimations(this);
1019 else if (!is_active_ && (was_active || force)) 1019 } else if (!is_active_ && (was_active || force)) {
1020 // Resetting last_tick_time_ here ensures that calling ::UpdateState
1021 // before ::Animate doesn't start an animation.
1022 last_tick_time_ = base::TimeTicks();
1020 animation_host_->DidDeactivateElementAnimations(this); 1023 animation_host_->DidDeactivateElementAnimations(this);
1024 }
1021 } 1025 }
1022 } 1026 }
1023 1027
1024 void ElementAnimations::NotifyClientOpacityAnimated( 1028 void ElementAnimations::NotifyClientOpacityAnimated(
1025 float opacity, 1029 float opacity,
1026 bool notify_active_elements, 1030 bool notify_active_elements,
1027 bool notify_pending_elements) { 1031 bool notify_pending_elements) {
1028 if (notify_active_elements && has_element_in_active_list()) 1032 if (notify_active_elements && has_element_in_active_list())
1029 OnOpacityAnimated(ElementListType::ACTIVE, opacity); 1033 OnOpacityAnimated(ElementListType::ACTIVE, opacity);
1030 if (notify_pending_elements && has_element_in_pending_list()) 1034 if (notify_pending_elements && has_element_in_pending_list())
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after
1477 if (animation_host()) { 1481 if (animation_host()) {
1478 DCHECK(animation_host()->mutator_host_client()); 1482 DCHECK(animation_host()->mutator_host_client());
1479 return animation_host()->mutator_host_client()->GetScrollOffsetForAnimation( 1483 return animation_host()->mutator_host_client()->GetScrollOffsetForAnimation(
1480 element_id()); 1484 element_id());
1481 } 1485 }
1482 1486
1483 return gfx::ScrollOffset(); 1487 return gfx::ScrollOffset();
1484 } 1488 }
1485 1489
1486 } // namespace cc 1490 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/animation/element_animations_unittest.cc » ('j') | cc/animation/scroll_offset_animations_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698