#pragma once
#include "CSSPropertyNames.h"
#include <wtf/Vector.h>
#include <wtf/HashSet.h>
#include <wtf/text/AtomicString.h>
namespace WebCore {
class RenderStyle;
class TimingFunction;
class KeyframeValue {
public:
KeyframeValue(double key, std::unique_ptr<RenderStyle> style)
: m_key(key)
, m_style(WTFMove(style))
{
}
void addProperty(CSSPropertyID prop) { m_properties.add(prop); }
bool containsProperty(CSSPropertyID prop) const { return m_properties.contains(prop); }
const HashSet<CSSPropertyID>& properties() const { return m_properties; }
double key() const { return m_key; }
void setKey(double key) { m_key = key; }
const RenderStyle* style() const { return m_style.get(); }
void setStyle(std::unique_ptr<RenderStyle> style) { m_style = WTFMove(style); }
TimingFunction* timingFunction(const AtomicString& name) const;
private:
double m_key;
HashSet<CSSPropertyID> m_properties; std::unique_ptr<RenderStyle> m_style;
};
class KeyframeList {
public:
explicit KeyframeList(const AtomicString& animationName)
: m_animationName(animationName)
{
}
~KeyframeList();
KeyframeList& operator=(KeyframeList&&) = default;
bool operator==(const KeyframeList& o) const;
bool operator!=(const KeyframeList& o) const { return !(*this == o); }
const AtomicString& animationName() const { return m_animationName; }
void insert(KeyframeValue&&);
void addProperty(CSSPropertyID prop) { m_properties.add(prop); }
bool containsProperty(CSSPropertyID prop) const { return m_properties.contains(prop); }
const HashSet<CSSPropertyID>& properties() const { return m_properties; }
void clear();
bool isEmpty() const { return m_keyframes.isEmpty(); }
size_t size() const { return m_keyframes.size(); }
const KeyframeValue& operator[](size_t index) const { return m_keyframes[index]; }
const Vector<KeyframeValue>& keyframes() const { return m_keyframes; }
private:
AtomicString m_animationName;
Vector<KeyframeValue> m_keyframes; HashSet<CSSPropertyID> m_properties; };
}