| 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 #ifndef CC_TEST_ANIMATION_TIMELINES_TEST_COMMON_H_ | 5 #ifndef CC_TEST_ANIMATION_TIMELINES_TEST_COMMON_H_ |
| 6 #define CC_TEST_ANIMATION_TIMELINES_TEST_COMMON_H_ | 6 #define CC_TEST_ANIMATION_TIMELINES_TEST_COMMON_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <unordered_map> | 9 #include <unordered_map> |
| 10 | 10 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 void set_scroll_offset(const gfx::ScrollOffset& scroll_offset) { | 49 void set_scroll_offset(const gfx::ScrollOffset& scroll_offset) { |
| 50 scroll_offset_ = scroll_offset; | 50 scroll_offset_ = scroll_offset; |
| 51 mutated_properties_[TargetProperty::SCROLL_OFFSET] = true; | 51 mutated_properties_[TargetProperty::SCROLL_OFFSET] = true; |
| 52 } | 52 } |
| 53 | 53 |
| 54 bool transform_is_animating() const { return transform_is_animating_; } | 54 bool transform_is_animating() const { return transform_is_animating_; } |
| 55 void set_transform_is_animating(bool is_animating) { | 55 void set_transform_is_animating(bool is_animating) { |
| 56 transform_is_animating_ = is_animating; | 56 transform_is_animating_ = is_animating; |
| 57 } | 57 } |
| 58 | 58 |
| 59 bool opacity_is_currently_animating() const { |
| 60 return opacity_is_currently_animating_; |
| 61 } |
| 62 void set_opacity_is_currently_animating(bool is_animating) { |
| 63 opacity_is_currently_animating_ = is_animating; |
| 64 } |
| 65 |
| 66 bool has_potential_opacity_animation() const { |
| 67 return has_potential_opacity_animation_; |
| 68 } |
| 69 void set_has_potential_opacity_animation(bool is_animating) { |
| 70 has_potential_opacity_animation_ = is_animating; |
| 71 } |
| 72 |
| 59 bool is_property_mutated(TargetProperty::Type property) const { | 73 bool is_property_mutated(TargetProperty::Type property) const { |
| 60 return mutated_properties_[property]; | 74 return mutated_properties_[property]; |
| 61 } | 75 } |
| 62 | 76 |
| 63 private: | 77 private: |
| 64 TestLayer(); | 78 TestLayer(); |
| 65 | 79 |
| 66 gfx::Transform transform_; | 80 gfx::Transform transform_; |
| 67 float opacity_; | 81 float opacity_; |
| 68 FilterOperations filters_; | 82 FilterOperations filters_; |
| 69 gfx::ScrollOffset scroll_offset_; | 83 gfx::ScrollOffset scroll_offset_; |
| 70 bool transform_is_animating_; | 84 bool transform_is_animating_; |
| 85 bool has_potential_opacity_animation_; |
| 86 bool opacity_is_currently_animating_; |
| 71 | 87 |
| 72 bool mutated_properties_[TargetProperty::LAST_TARGET_PROPERTY + 1]; | 88 bool mutated_properties_[TargetProperty::LAST_TARGET_PROPERTY + 1]; |
| 73 }; | 89 }; |
| 74 | 90 |
| 75 class TestHostClient : public MutatorHostClient { | 91 class TestHostClient : public MutatorHostClient { |
| 76 public: | 92 public: |
| 77 explicit TestHostClient(ThreadInstance thread_instance); | 93 explicit TestHostClient(ThreadInstance thread_instance); |
| 78 ~TestHostClient(); | 94 ~TestHostClient(); |
| 79 | 95 |
| 80 void ClearMutatedProperties(); | 96 void ClearMutatedProperties(); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 100 void SetElementScrollOffsetMutated( | 116 void SetElementScrollOffsetMutated( |
| 101 ElementId element_id, | 117 ElementId element_id, |
| 102 ElementListType list_type, | 118 ElementListType list_type, |
| 103 const gfx::ScrollOffset& scroll_offset) override; | 119 const gfx::ScrollOffset& scroll_offset) override; |
| 104 | 120 |
| 105 void ElementTransformIsPotentiallyAnimatingChanged( | 121 void ElementTransformIsPotentiallyAnimatingChanged( |
| 106 ElementId element_id, | 122 ElementId element_id, |
| 107 ElementListType list_type, | 123 ElementListType list_type, |
| 108 bool is_animating) override; | 124 bool is_animating) override; |
| 109 | 125 |
| 126 void ElementOpacityIsAnimatingChanged(ElementId element_id, |
| 127 ElementListType list_type, |
| 128 AnimationChangeType change_type, |
| 129 bool is_animating) override; |
| 130 |
| 110 void ScrollOffsetAnimationFinished() override {} | 131 void ScrollOffsetAnimationFinished() override {} |
| 111 | 132 |
| 112 void SetScrollOffsetForAnimation(const gfx::ScrollOffset& scroll_offset); | 133 void SetScrollOffsetForAnimation(const gfx::ScrollOffset& scroll_offset); |
| 113 gfx::ScrollOffset GetScrollOffsetForAnimation( | 134 gfx::ScrollOffset GetScrollOffsetForAnimation( |
| 114 ElementId element_id) const override; | 135 ElementId element_id) const override; |
| 115 | 136 |
| 116 bool mutators_need_commit() const { return mutators_need_commit_; } | 137 bool mutators_need_commit() const { return mutators_need_commit_; } |
| 117 void set_mutators_need_commit(bool need) { mutators_need_commit_ = need; } | 138 void set_mutators_need_commit(bool need) { mutators_need_commit_ = need; } |
| 118 | 139 |
| 119 void RegisterElement(ElementId element_id, ElementListType list_type); | 140 void RegisterElement(ElementId element_id, ElementListType list_type); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 130 | 151 |
| 131 FilterOperations GetFilters(ElementId element_id, | 152 FilterOperations GetFilters(ElementId element_id, |
| 132 ElementListType list_type) const; | 153 ElementListType list_type) const; |
| 133 float GetOpacity(ElementId element_id, ElementListType list_type) const; | 154 float GetOpacity(ElementId element_id, ElementListType list_type) const; |
| 134 gfx::Transform GetTransform(ElementId element_id, | 155 gfx::Transform GetTransform(ElementId element_id, |
| 135 ElementListType list_type) const; | 156 ElementListType list_type) const; |
| 136 gfx::ScrollOffset GetScrollOffset(ElementId element_id, | 157 gfx::ScrollOffset GetScrollOffset(ElementId element_id, |
| 137 ElementListType list_type) const; | 158 ElementListType list_type) const; |
| 138 bool GetTransformIsAnimating(ElementId element_id, | 159 bool GetTransformIsAnimating(ElementId element_id, |
| 139 ElementListType list_type) const; | 160 ElementListType list_type) const; |
| 161 bool GetOpacityIsCurrentlyAnimating(ElementId element_id, |
| 162 ElementListType list_type) const; |
| 163 bool GetHasPotentialOpacityAnimation(ElementId element_id, |
| 164 ElementListType list_type) const; |
| 140 | 165 |
| 141 void ExpectFilterPropertyMutated(ElementId element_id, | 166 void ExpectFilterPropertyMutated(ElementId element_id, |
| 142 ElementListType list_type, | 167 ElementListType list_type, |
| 143 float brightness) const; | 168 float brightness) const; |
| 144 void ExpectOpacityPropertyMutated(ElementId element_id, | 169 void ExpectOpacityPropertyMutated(ElementId element_id, |
| 145 ElementListType list_type, | 170 ElementListType list_type, |
| 146 float opacity) const; | 171 float opacity) const; |
| 147 void ExpectTransformPropertyMutated(ElementId element_id, | 172 void ExpectTransformPropertyMutated(ElementId element_id, |
| 148 ElementListType list_type, | 173 ElementListType list_type, |
| 149 int transform_x, | 174 int transform_x, |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 scoped_refptr<AnimationTimeline> timeline_; | 272 scoped_refptr<AnimationTimeline> timeline_; |
| 248 scoped_refptr<AnimationPlayer> player_; | 273 scoped_refptr<AnimationPlayer> player_; |
| 249 | 274 |
| 250 scoped_refptr<AnimationTimeline> timeline_impl_; | 275 scoped_refptr<AnimationTimeline> timeline_impl_; |
| 251 scoped_refptr<AnimationPlayer> player_impl_; | 276 scoped_refptr<AnimationPlayer> player_impl_; |
| 252 }; | 277 }; |
| 253 | 278 |
| 254 } // namespace cc | 279 } // namespace cc |
| 255 | 280 |
| 256 #endif // CC_TEST_ANIMATION_TIMELINES_TEST_COMMON_H_ | 281 #endif // CC_TEST_ANIMATION_TIMELINES_TEST_COMMON_H_ |
| OLD | NEW |