#ifndef KeyframeList_h
#define KeyframeList_h
#include "CSSPropertyNames.h"
#include "core/rendering/style/StyleInheritedData.h"
#include "wtf/HashSet.h"
#include "wtf/RefPtr.h"
#include "wtf/Vector.h"
#include "wtf/text/AtomicString.h"
namespace WebCore {
class RenderObject;
class RenderStyle;
class StylePropertySet;
class TimingFunction;
class KeyframeValue {
public:
KeyframeValue(double key, PassRefPtr<RenderStyle> style)
: m_key(key)
, m_style(style)
{
}
void addProperties(const StylePropertySet*);
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(PassRefPtr<RenderStyle> style) { m_style = style; }
static TimingFunction* timingFunction(const RenderStyle& keyframeStyle);
private:
double m_key;
HashSet<CSSPropertyID> m_properties;
RefPtr<RenderStyle> m_style;
};
class KeyframeList {
public:
KeyframeList(RenderObject&, const AtomicString& animationName)
: m_animationName(animationName)
{
insert(KeyframeValue(0, nullptr));
insert(KeyframeValue(1, nullptr));
}
~KeyframeList();
const AtomicString& animationName() const { return m_animationName; }
void insert(const KeyframeValue& keyframe);
void addProperty(CSSPropertyID prop) { m_properties.add(prop); }
bool containsProperty(CSSPropertyID prop) const { return m_properties.contains(prop); }
HashSet<CSSPropertyID>::const_iterator beginProperties() const { return m_properties.begin(); }
HashSet<CSSPropertyID>::const_iterator endProperties() const { return m_properties.end(); }
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]; }
private:
AtomicString m_animationName;
Vector<KeyframeValue> m_keyframes;
HashSet<CSSPropertyID> m_properties;
};
}
#endif