void SVGLengthList::calculateAnimatedValue( SVGAnimationElement* animationElement, float percentage, unsigned repeatCount, SVGPropertyBase* fromValue, SVGPropertyBase* toValue, SVGPropertyBase* toAtEndOfDurationValue, SVGElement* contextElement) { SVGLengthList* fromList = toSVGLengthList(fromValue); SVGLengthList* toList = toSVGLengthList(toValue); SVGLengthList* toAtEndOfDurationList = toSVGLengthList(toAtEndOfDurationValue); SVGLengthContext lengthContext(contextElement); ASSERT(m_mode == SVGLength::lengthModeForAnimatedLengthAttribute( animationElement->attributeName())); size_t fromLengthListSize = fromList->length(); size_t toLengthListSize = toList->length(); size_t toAtEndOfDurationListSize = toAtEndOfDurationList->length(); if (!adjustFromToListValues(fromList, toList, percentage, animationElement->getAnimationMode())) return; for (size_t i = 0; i < toLengthListSize; ++i) { // TODO(shanmuga.m): Support calc for SVGLengthList animation float animatedNumber = at(i)->value(lengthContext); CSSPrimitiveValue::UnitType unitType = toList->at(i)->typeWithCalcResolved(); float effectiveFrom = 0; if (fromLengthListSize) { if (percentage < 0.5) unitType = fromList->at(i)->typeWithCalcResolved(); effectiveFrom = fromList->at(i)->value(lengthContext); } float effectiveTo = toList->at(i)->value(lengthContext); float effectiveToAtEnd = i < toAtEndOfDurationListSize ? toAtEndOfDurationList->at(i)->value(lengthContext) : 0; animationElement->animateAdditiveNumber(percentage, repeatCount, effectiveFrom, effectiveTo, effectiveToAtEnd, animatedNumber); at(i)->setUnitType(unitType); at(i)->setValue(animatedNumber, lengthContext); } }
void SVGLengthList::add(SVGPropertyBase* other, SVGElement* contextElement) { SVGLengthList* otherList = toSVGLengthList(other); if (length() != otherList->length()) return; SVGLengthContext lengthContext(contextElement); for (size_t i = 0; i < length(); ++i) at(i)->setValue( at(i)->value(lengthContext) + otherList->at(i)->value(lengthContext), lengthContext); }