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 "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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 set_has_element_in_pending_list(false); | 82 set_has_element_in_pending_list(false); |
83 | 83 |
84 animation_host_->DidDeactivateElementAnimations(this); | 84 animation_host_->DidDeactivateElementAnimations(this); |
85 UpdateActivation(FORCE_ACTIVATION); | 85 UpdateActivation(FORCE_ACTIVATION); |
86 } | 86 } |
87 | 87 |
88 void ElementAnimations::ElementRegistered(ElementId element_id, | 88 void ElementAnimations::ElementRegistered(ElementId element_id, |
89 ElementListType list_type) { | 89 ElementListType list_type) { |
90 DCHECK_EQ(element_id_, element_id); | 90 DCHECK_EQ(element_id_, element_id); |
91 | 91 |
| 92 if (!has_element_in_any_list()) |
| 93 UpdateActivation(FORCE_ACTIVATION); |
| 94 |
92 if (list_type == ElementListType::ACTIVE) | 95 if (list_type == ElementListType::ACTIVE) |
93 set_has_element_in_active_list(true); | 96 set_has_element_in_active_list(true); |
94 else | 97 else |
95 set_has_element_in_pending_list(true); | 98 set_has_element_in_pending_list(true); |
96 } | 99 } |
97 | 100 |
98 void ElementAnimations::ElementUnregistered(ElementId element_id, | 101 void ElementAnimations::ElementUnregistered(ElementId element_id, |
99 ElementListType list_type) { | 102 ElementListType list_type) { |
100 DCHECK_EQ(this->element_id(), element_id); | 103 DCHECK_EQ(this->element_id(), element_id); |
101 if (list_type == ElementListType::ACTIVE) | 104 if (list_type == ElementListType::ACTIVE) |
102 set_has_element_in_active_list(false); | 105 set_has_element_in_active_list(false); |
103 else | 106 else |
104 set_has_element_in_pending_list(false); | 107 set_has_element_in_pending_list(false); |
| 108 |
| 109 if (!has_element_in_any_list()) |
| 110 animation_host_->DidDeactivateElementAnimations(this); |
105 } | 111 } |
106 | 112 |
107 void ElementAnimations::AddPlayer(AnimationPlayer* player) { | 113 void ElementAnimations::AddPlayer(AnimationPlayer* player) { |
108 players_list_->Append(player); | 114 players_list_->Append(player); |
109 } | 115 } |
110 | 116 |
111 void ElementAnimations::RemovePlayer(AnimationPlayer* player) { | 117 void ElementAnimations::RemovePlayer(AnimationPlayer* player) { |
112 for (PlayersListNode* node = players_list_->head(); | 118 for (PlayersListNode* node = players_list_->head(); |
113 node != players_list_->end(); node = node->next()) { | 119 node != players_list_->end(); node = node->next()) { |
114 if (node->value() == player) { | 120 if (node->value() == player) { |
(...skipping 1315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1430 if (animation_host()) { | 1436 if (animation_host()) { |
1431 DCHECK(animation_host()->mutator_host_client()); | 1437 DCHECK(animation_host()->mutator_host_client()); |
1432 return animation_host()->mutator_host_client()->GetScrollOffsetForAnimation( | 1438 return animation_host()->mutator_host_client()->GetScrollOffsetForAnimation( |
1433 element_id()); | 1439 element_id()); |
1434 } | 1440 } |
1435 | 1441 |
1436 return gfx::ScrollOffset(); | 1442 return gfx::ScrollOffset(); |
1437 } | 1443 } |
1438 | 1444 |
1439 } // namespace cc | 1445 } // namespace cc |
OLD | NEW |