| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 filters_ = filters; | 44 filters_ = filters; |
| 45 mutated_properties_[TargetProperty::FILTER] = true; | 45 mutated_properties_[TargetProperty::FILTER] = true; |
| 46 } | 46 } |
| 47 | 47 |
| 48 gfx::ScrollOffset scroll_offset() const { return scroll_offset_; } | 48 gfx::ScrollOffset scroll_offset() const { return scroll_offset_; } |
| 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_currently_animating() const { |
| 55 void set_transform_is_animating(bool is_animating) { | 55 return transform_is_currently_animating_; |
| 56 transform_is_animating_ = is_animating; | 56 } |
| 57 void set_transform_is_currently_animating(bool is_animating) { |
| 58 transform_is_currently_animating_ = is_animating; |
| 59 } |
| 60 |
| 61 bool has_potential_transform_animation() const { |
| 62 return has_potential_transform_animation_; |
| 63 } |
| 64 void set_has_potential_transform_animation(bool is_animating) { |
| 65 has_potential_transform_animation_ = is_animating; |
| 57 } | 66 } |
| 58 | 67 |
| 59 bool opacity_is_currently_animating() const { | 68 bool opacity_is_currently_animating() const { |
| 60 return opacity_is_currently_animating_; | 69 return opacity_is_currently_animating_; |
| 61 } | 70 } |
| 62 void set_opacity_is_currently_animating(bool is_animating) { | 71 void set_opacity_is_currently_animating(bool is_animating) { |
| 63 opacity_is_currently_animating_ = is_animating; | 72 opacity_is_currently_animating_ = is_animating; |
| 64 } | 73 } |
| 65 | 74 |
| 66 bool has_potential_opacity_animation() const { | 75 bool has_potential_opacity_animation() const { |
| 67 return has_potential_opacity_animation_; | 76 return has_potential_opacity_animation_; |
| 68 } | 77 } |
| 69 void set_has_potential_opacity_animation(bool is_animating) { | 78 void set_has_potential_opacity_animation(bool is_animating) { |
| 70 has_potential_opacity_animation_ = is_animating; | 79 has_potential_opacity_animation_ = is_animating; |
| 71 } | 80 } |
| 72 | 81 |
| 73 bool is_property_mutated(TargetProperty::Type property) const { | 82 bool is_property_mutated(TargetProperty::Type property) const { |
| 74 return mutated_properties_[property]; | 83 return mutated_properties_[property]; |
| 75 } | 84 } |
| 76 | 85 |
| 77 private: | 86 private: |
| 78 TestLayer(); | 87 TestLayer(); |
| 79 | 88 |
| 80 gfx::Transform transform_; | 89 gfx::Transform transform_; |
| 81 float opacity_; | 90 float opacity_; |
| 82 FilterOperations filters_; | 91 FilterOperations filters_; |
| 83 gfx::ScrollOffset scroll_offset_; | 92 gfx::ScrollOffset scroll_offset_; |
| 84 bool transform_is_animating_; | 93 bool has_potential_transform_animation_; |
| 94 bool transform_is_currently_animating_; |
| 85 bool has_potential_opacity_animation_; | 95 bool has_potential_opacity_animation_; |
| 86 bool opacity_is_currently_animating_; | 96 bool opacity_is_currently_animating_; |
| 87 | 97 |
| 88 bool mutated_properties_[TargetProperty::LAST_TARGET_PROPERTY + 1]; | 98 bool mutated_properties_[TargetProperty::LAST_TARGET_PROPERTY + 1]; |
| 89 }; | 99 }; |
| 90 | 100 |
| 91 class TestHostClient : public MutatorHostClient { | 101 class TestHostClient : public MutatorHostClient { |
| 92 public: | 102 public: |
| 93 explicit TestHostClient(ThreadInstance thread_instance); | 103 explicit TestHostClient(ThreadInstance thread_instance); |
| 94 ~TestHostClient(); | 104 ~TestHostClient(); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 111 | 121 |
| 112 void SetElementTransformMutated(ElementId element_id, | 122 void SetElementTransformMutated(ElementId element_id, |
| 113 ElementListType list_type, | 123 ElementListType list_type, |
| 114 const gfx::Transform& transform) override; | 124 const gfx::Transform& transform) override; |
| 115 | 125 |
| 116 void SetElementScrollOffsetMutated( | 126 void SetElementScrollOffsetMutated( |
| 117 ElementId element_id, | 127 ElementId element_id, |
| 118 ElementListType list_type, | 128 ElementListType list_type, |
| 119 const gfx::ScrollOffset& scroll_offset) override; | 129 const gfx::ScrollOffset& scroll_offset) override; |
| 120 | 130 |
| 121 void ElementTransformIsPotentiallyAnimatingChanged( | 131 void ElementTransformIsAnimatingChanged(ElementId element_id, |
| 122 ElementId element_id, | 132 ElementListType list_type, |
| 123 ElementListType list_type, | 133 AnimationChangeType change_type, |
| 124 bool is_animating) override; | 134 bool is_animating) override; |
| 125 | 135 |
| 126 void ElementOpacityIsAnimatingChanged(ElementId element_id, | 136 void ElementOpacityIsAnimatingChanged(ElementId element_id, |
| 127 ElementListType list_type, | 137 ElementListType list_type, |
| 128 AnimationChangeType change_type, | 138 AnimationChangeType change_type, |
| 129 bool is_animating) override; | 139 bool is_animating) override; |
| 130 | 140 |
| 131 void ScrollOffsetAnimationFinished() override {} | 141 void ScrollOffsetAnimationFinished() override {} |
| 132 | 142 |
| 133 void SetScrollOffsetForAnimation(const gfx::ScrollOffset& scroll_offset); | 143 void SetScrollOffsetForAnimation(const gfx::ScrollOffset& scroll_offset); |
| 134 gfx::ScrollOffset GetScrollOffsetForAnimation( | 144 gfx::ScrollOffset GetScrollOffsetForAnimation( |
| (...skipping 14 matching lines...) Expand all Loading... |
| 149 ElementListType list_type, | 159 ElementListType list_type, |
| 150 TargetProperty::Type property) const; | 160 TargetProperty::Type property) const; |
| 151 | 161 |
| 152 FilterOperations GetFilters(ElementId element_id, | 162 FilterOperations GetFilters(ElementId element_id, |
| 153 ElementListType list_type) const; | 163 ElementListType list_type) const; |
| 154 float GetOpacity(ElementId element_id, ElementListType list_type) const; | 164 float GetOpacity(ElementId element_id, ElementListType list_type) const; |
| 155 gfx::Transform GetTransform(ElementId element_id, | 165 gfx::Transform GetTransform(ElementId element_id, |
| 156 ElementListType list_type) const; | 166 ElementListType list_type) const; |
| 157 gfx::ScrollOffset GetScrollOffset(ElementId element_id, | 167 gfx::ScrollOffset GetScrollOffset(ElementId element_id, |
| 158 ElementListType list_type) const; | 168 ElementListType list_type) const; |
| 159 bool GetTransformIsAnimating(ElementId element_id, | 169 bool GetHasPotentialTransformAnimation(ElementId element_id, |
| 160 ElementListType list_type) const; | 170 ElementListType list_type) const; |
| 171 bool GetTransformIsCurrentlyAnimating(ElementId element_id, |
| 172 ElementListType list_type) const; |
| 161 bool GetOpacityIsCurrentlyAnimating(ElementId element_id, | 173 bool GetOpacityIsCurrentlyAnimating(ElementId element_id, |
| 162 ElementListType list_type) const; | 174 ElementListType list_type) const; |
| 163 bool GetHasPotentialOpacityAnimation(ElementId element_id, | 175 bool GetHasPotentialOpacityAnimation(ElementId element_id, |
| 164 ElementListType list_type) const; | 176 ElementListType list_type) const; |
| 165 | 177 |
| 166 void ExpectFilterPropertyMutated(ElementId element_id, | 178 void ExpectFilterPropertyMutated(ElementId element_id, |
| 167 ElementListType list_type, | 179 ElementListType list_type, |
| 168 float brightness) const; | 180 float brightness) const; |
| 169 void ExpectOpacityPropertyMutated(ElementId element_id, | 181 void ExpectOpacityPropertyMutated(ElementId element_id, |
| 170 ElementListType list_type, | 182 ElementListType list_type, |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 scoped_refptr<AnimationTimeline> timeline_; | 284 scoped_refptr<AnimationTimeline> timeline_; |
| 273 scoped_refptr<AnimationPlayer> player_; | 285 scoped_refptr<AnimationPlayer> player_; |
| 274 | 286 |
| 275 scoped_refptr<AnimationTimeline> timeline_impl_; | 287 scoped_refptr<AnimationTimeline> timeline_impl_; |
| 276 scoped_refptr<AnimationPlayer> player_impl_; | 288 scoped_refptr<AnimationPlayer> player_impl_; |
| 277 }; | 289 }; |
| 278 | 290 |
| 279 } // namespace cc | 291 } // namespace cc |
| 280 | 292 |
| 281 #endif // CC_TEST_ANIMATION_TIMELINES_TEST_COMMON_H_ | 293 #endif // CC_TEST_ANIMATION_TIMELINES_TEST_COMMON_H_ |
| OLD | NEW |