#ifndef CC_ANIMATION_SCROLL_OFFSET_ANIMATIONS_H_
#define CC_ANIMATION_SCROLL_OFFSET_ANIMATIONS_H_
#include <unordered_map>
#include "base/memory/raw_ptr.h"
#include "cc/animation/scroll_offset_animations_impl.h"
#include "cc/trees/mutator_host_client.h"
namespace cc {
struct CC_ANIMATION_EXPORT ScrollOffsetAnimationUpdate {
ScrollOffsetAnimationUpdate();
explicit ScrollOffsetAnimationUpdate(ElementId);
ElementId element_id_;
gfx::Vector2dF adjustment_;
bool takeover_;
};
class CC_ANIMATION_EXPORT ScrollOffsetAnimations {
public:
explicit ScrollOffsetAnimations(AnimationHost* animation_host);
~ScrollOffsetAnimations();
void AddAdjustmentUpdate(ElementId, gfx::Vector2dF adjustment);
void AddTakeoverUpdate(ElementId);
bool HasUpdatesForTesting() const;
void PushPropertiesTo(ScrollOffsetAnimationsImpl*);
private:
ScrollOffsetAnimationUpdate GetUpdateForElementId(ElementId) const;
using ElementToUpdateMap =
std::unordered_map<ElementId, ScrollOffsetAnimationUpdate, ElementIdHash>;
ElementToUpdateMap element_to_update_map_;
raw_ptr<AnimationHost> animation_host_;
};
}
#endif