WebKitCSSKeyframeRule.h [plain text]
#ifndef WebKitCSSKeyframeRule_h
#define WebKitCSSKeyframeRule_h
#include "CSSRule.h"
#include "StyleProperties.h"
namespace WebCore {
class CSSStyleDeclaration;
class StyleRuleCSSStyleDeclaration;
class WebKitCSSKeyframesRule;
class StyleKeyframe : public RefCounted<StyleKeyframe> {
WTF_MAKE_FAST_ALLOCATED;
public:
static PassRefPtr<StyleKeyframe> create(PassRef<StyleProperties> properties)
{
return adoptRef(new StyleKeyframe(WTF::move(properties)));
}
~StyleKeyframe();
String keyText() const { return m_key; }
void setKeyText(const String& s) { m_key = s; }
void getKeys(Vector<double>& keys) const { parseKeyString(m_key, keys); }
const StyleProperties& properties() const { return m_properties.get(); }
MutableStyleProperties& mutableProperties();
String cssText() const;
private:
explicit StyleKeyframe(PassRef<StyleProperties>);
static void parseKeyString(const String&, Vector<double>& keys);
Ref<StyleProperties> m_properties;
String m_key;
};
class WebKitCSSKeyframeRule : public CSSRule {
public:
virtual ~WebKitCSSKeyframeRule();
virtual CSSRule::Type type() const override { return WEBKIT_KEYFRAME_RULE; }
virtual String cssText() const override { return m_keyframe->cssText(); }
virtual void reattach(StyleRuleBase*) override;
String keyText() const { return m_keyframe->keyText(); }
void setKeyText(const String& s) { m_keyframe->setKeyText(s); }
CSSStyleDeclaration* style();
private:
WebKitCSSKeyframeRule(StyleKeyframe*, WebKitCSSKeyframesRule* parent);
RefPtr<StyleKeyframe> m_keyframe;
mutable RefPtr<StyleRuleCSSStyleDeclaration> m_propertiesCSSOMWrapper;
friend class WebKitCSSKeyframesRule;
};
}
#endif // WebKitCSSKeyframeRule_h