void SVGRect::calculateAnimatedValue(SVGAnimationElement* animationElement, float percentage, unsigned repeatCount, PassRefPtrWillBeRawPtr<SVGPropertyBase> fromValue, PassRefPtrWillBeRawPtr<SVGPropertyBase> toValue, PassRefPtrWillBeRawPtr<SVGPropertyBase> toAtEndOfDurationValue, SVGElement*) { ASSERT(animationElement); RefPtrWillBeRawPtr<SVGRect> fromRect = animationElement->animationMode() == ToAnimation ? PassRefPtrWillBeRawPtr<SVGRect>(this) : toSVGRect(fromValue); RefPtrWillBeRawPtr<SVGRect> toRect = toSVGRect(toValue); RefPtrWillBeRawPtr<SVGRect> toAtEndOfDurationRect = toSVGRect(toAtEndOfDurationValue); float animatedX = x(); float animatedY = y(); float animatedWidth = width(); float animatedHeight = height(); animationElement->animateAdditiveNumber(percentage, repeatCount, fromRect->x(), toRect->x(), toAtEndOfDurationRect->x(), animatedX); animationElement->animateAdditiveNumber(percentage, repeatCount, fromRect->y(), toRect->y(), toAtEndOfDurationRect->y(), animatedY); animationElement->animateAdditiveNumber(percentage, repeatCount, fromRect->width(), toRect->width(), toAtEndOfDurationRect->width(), animatedWidth); animationElement->animateAdditiveNumber(percentage, repeatCount, fromRect->height(), toRect->height(), toAtEndOfDurationRect->height(), animatedHeight); m_value = FloatRect(animatedX, animatedY, animatedWidth, animatedHeight); }
PassOwnPtr<InterpolableValue> RectSVGInterpolation::toInterpolableValue(SVGPropertyBase* value) { RefPtrWillBeRawPtr<SVGRect> rect = toSVGRect(value); float element[] = { rect->x(), rect->y(), rect->width(), rect->height() }; OwnPtr<InterpolableList> result = InterpolableList::create(WTF_ARRAY_LENGTH(element)); for (size_t i = 0; i < WTF_ARRAY_LENGTH(element); i++) { result->set(i, InterpolableNumber::create(element[i])); } return result.release(); }
PassOwnPtr<InterpolationValue> SVGRectInterpolationType::maybeConvertSVGValue(const SVGPropertyBase& svgValue) const { if (svgValue.type() != AnimatedRect) return nullptr; const SVGRect& rect = toSVGRect(svgValue); OwnPtr<InterpolableList> result = InterpolableList::create(RectComponentIndexCount); result->set(RectX, InterpolableNumber::create(rect.x())); result->set(RectY, InterpolableNumber::create(rect.y())); result->set(RectWidth, InterpolableNumber::create(rect.width())); result->set(RectHeight, InterpolableNumber::create(rect.height())); return InterpolationValue::create(*this, result.release()); }
void SVGRect::add(PassRefPtrWillBeRawPtr<SVGPropertyBase> other, SVGElement*) { m_value += toSVGRect(other)->value(); }