KeyframeEffect.cpp [plain text]
#include "config.h"
#include "KeyframeEffect.h"
#include "AnimationEffectTiming.h"
namespace WebCore {
using namespace JSC;
ExceptionOr<Ref<KeyframeEffect>> KeyframeEffect::create(ExecState& state, Element* target, Strong<JSObject>&& keyframes, std::optional<Variant<double, KeyframeEffectOptions>>&& options)
{
auto keyframeEffect = adoptRef(*new KeyframeEffect(AnimationEffectTiming::create(), target));
auto setPropertiesResult = keyframeEffect->timing()->setProperties(WTFMove(options));
if (setPropertiesResult.hasException())
return setPropertiesResult.releaseException();
auto setKeyframesResult = keyframeEffect->setKeyframes(state, WTFMove(keyframes));
if (setKeyframesResult.hasException())
return setKeyframesResult.releaseException();
return WTFMove(keyframeEffect);
}
ExceptionOr<Ref<KeyframeEffect>> KeyframeEffect::create(JSC::ExecState&, Ref<KeyframeEffectReadOnly>&& source)
{
auto keyframeEffect = adoptRef(*new KeyframeEffect(AnimationEffectTiming::create(), nullptr));
keyframeEffect->copyPropertiesFromSource(WTFMove(source));
return WTFMove(keyframeEffect);
}
KeyframeEffect::KeyframeEffect(Ref<AnimationEffectTimingReadOnly>&& timing, Element* target)
: KeyframeEffectReadOnly(KeyframeEffectClass, WTFMove(timing), target)
{
}
ExceptionOr<void> KeyframeEffect::setKeyframes(ExecState& state, Strong<JSObject>&& keyframesInput)
{
return processKeyframes(state, WTFMove(keyframesInput));
}
}