SVGTransformList.h [plain text]
#pragma once
#include "SVGAnimatedListPropertyTearOff.h"
#include "SVGListPropertyTearOff.h"
#include "SVGTransformListValues.h"
namespace WebCore {
class SVGTransformList final : public SVGListPropertyTearOff<SVGTransformListValues> {
public:
using AnimatedListPropertyTearOff = SVGAnimatedListPropertyTearOff<SVGTransformListValues>;
using ListWrapperCache = AnimatedListPropertyTearOff::ListWrapperCache;
static Ref<SVGTransformList> create(AnimatedListPropertyTearOff& animatedProperty, SVGPropertyRole role, SVGTransformListValues& values, ListWrapperCache& wrappers)
{
return adoptRef(*new SVGTransformList(animatedProperty, role, values, wrappers));
}
ExceptionOr<Ref<SVGTransform>> createSVGTransformFromMatrix(SVGMatrix& matrix)
{
ASSERT(m_values);
return m_values->createSVGTransformFromMatrix(matrix);
}
ExceptionOr<RefPtr<SVGTransform>> consolidate()
{
ASSERT(m_values);
ASSERT(m_wrappers);
auto result = canAlterList();
if (result.hasException())
return result.releaseException();
ASSERT(result.releaseReturnValue());
ASSERT(m_values->size() == m_wrappers->size());
if (m_values->isEmpty())
return nullptr;
detachListWrappers(0);
RefPtr<SVGTransform> wrapper = m_values->consolidate();
m_wrappers->append(wrapper.get());
ASSERT(m_values->size() == m_wrappers->size());
return WTFMove(wrapper);
}
private:
SVGTransformList(AnimatedListPropertyTearOff& animatedProperty, SVGPropertyRole role, SVGTransformListValues& values, ListWrapperCache& wrappers)
: SVGListPropertyTearOff<SVGTransformListValues>(animatedProperty, role, values, wrappers)
{
}
};
}