Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CC_ANIMATION_SCROLL_OFFSET_ANIMATIONS_H_ | |
| 6 #define CC_ANIMATION_SCROLL_OFFSET_ANIMATIONS_H_ | |
| 7 | |
| 8 #include "cc/animation/scroll_offset_animations_impl.h" | |
| 9 #include "cc/trees/mutator_host_client.h" | |
| 10 | |
| 11 namespace cc { | |
| 12 | |
| 13 // A ScrollOffsetAnimationUpdate represents a change on the main thread | |
| 14 // that may impact an impl-only scroll offset animation. PushPropertiesTo is | |
| 15 // called during commit time and the necessary update is made to the impl-only | |
| 16 // animation. | |
| 17 // Note that this class only exists on the main thread. | |
| 18 struct CC_EXPORT ScrollOffsetAnimationUpdate { | |
| 19 enum Type { SCROLL_OFFSET_CHANGED }; | |
| 20 | |
| 21 ScrollOffsetAnimationUpdate(); | |
| 22 | |
| 23 // The element to which this update applies. | |
| 24 ElementId element_id_; | |
| 25 Type type_; | |
| 26 | |
| 27 // The amount by which the scroll offset is changed on the main thread. | |
| 28 gfx::Vector2dF adjustment_; | |
| 29 }; | |
| 30 | |
| 31 class CC_EXPORT ScrollOffsetAnimations { | |
| 32 public: | |
| 33 ScrollOffsetAnimations(); | |
| 34 ~ScrollOffsetAnimations(); | |
| 35 | |
| 36 void AddUpdate(ScrollOffsetAnimationUpdate); | |
| 37 bool HasUpdates() const; | |
| 38 | |
| 39 // Goes through the updates in the order in which they're added and calls the | |
| 40 // appropriate handler for each update. | |
| 41 void PushPropertiesTo(ScrollOffsetAnimationsImpl*, | |
| 42 base::TimeTicks frame_monotonic_time); | |
| 43 | |
| 44 private: | |
| 45 std::vector<ScrollOffsetAnimationUpdate> queue_; | |
|
loyso (OOO)
2016/05/06 01:04:38
using UpdatesQueue = std::vector<ScrollOffsetAnima
ymalik
2016/05/06 05:41:49
Done.
| |
| 46 }; | |
| 47 | |
| 48 } // namespace cc | |
| 49 | |
| 50 #endif // CC_ANIMATION_SCROLL_OFFSET_ANIMATIONS_H_ | |
| OLD | NEW |