This source file includes following definitions.
- cloneForAnimation
- valueAsString
- setValueAsString
- add
- calculateAnimatedValue
- calculateDistance
#include "config.h"
#include "core/svg/SVGBoolean.h"
#include "bindings/v8/ExceptionState.h"
#include "bindings/v8/ExceptionStatePlaceholder.h"
#include "core/dom/ExceptionCode.h"
#include "core/svg/SVGAnimationElement.h"
namespace WebCore {
PassRefPtr<SVGPropertyBase> SVGBoolean::cloneForAnimation(const String& value) const
{
RefPtr<SVGBoolean> svgBoolean = create();
svgBoolean->setValueAsString(value, IGNORE_EXCEPTION);
return svgBoolean.release();
}
String SVGBoolean::valueAsString() const
{
return m_value ? "true" : "false";
}
void SVGBoolean::setValueAsString(const String& value, ExceptionState& exceptionState)
{
if (value == "true") {
m_value = true;
} else if (value == "false") {
m_value = false;
} else {
exceptionState.throwDOMException(SyntaxError, "The value provided ('" + value + "') is invalid.");
}
}
void SVGBoolean::add(PassRefPtr<SVGPropertyBase>, SVGElement*)
{
ASSERT_NOT_REACHED();
}
void SVGBoolean::calculateAnimatedValue(SVGAnimationElement* animationElement, float percentage, unsigned repeatCount, PassRefPtr<SVGPropertyBase> from, PassRefPtr<SVGPropertyBase> to, PassRefPtr<SVGPropertyBase>, SVGElement*)
{
ASSERT(animationElement);
bool fromBoolean = animationElement->animationMode() == ToAnimation ? m_value : toSVGBoolean(from)->value();
bool toBoolean = toSVGBoolean(to)->value();
animationElement->animateDiscreteType<bool>(percentage, fromBoolean, toBoolean, m_value);
}
float SVGBoolean::calculateDistance(PassRefPtr<SVGPropertyBase>, SVGElement*)
{
return -1;
}
}