Changeset 90219 in webkit
- Timestamp:
- Jul 1, 2011, 1:51:28 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 6 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r90218 r90219 1 2011-07-01 Dirk Schulze <krit@webkit.org> 2 3 Reviewed by Nikolas Zimmermann. 4 5 SVGAnimatedLengthListAnimator does not take additive="sum" into accout 6 https://bugs.webkit.org/show_bug.cgi?id=63705 7 8 Tests additive animations for SVGLengthLists as well as unit animations on SVGLength. 9 10 * svg/animations/script-tests/svglength-animation-unitType.js: Added. 11 (sample1): 12 (sample2): 13 (sample3): 14 (executeTest): 15 * svg/animations/script-tests/svglengthlist-animation-5.js: Added. 16 (sample1): 17 (sample2): 18 (sample3): 19 (executeTest): 20 * svg/animations/svglength-animation-unitType-expected.txt: Added. 21 * svg/animations/svglength-animation-unitType.html: Added. 22 * svg/animations/svglengthlist-animation-5-expected.txt: Added. 23 * svg/animations/svglengthlist-animation-5.html: Added. 24 1 25 2011-07-01 Dirk Schulze <krit@webkit.org> 2 26 -
trunk/LayoutTests/platform/wk2/Skipped
r90218 r90219 473 473 svg/animations/svglength-animation-px-to-pt.html 474 474 svg/animations/svglength-animation-px-to-px.html 475 svg/animations/svglength-animation-unitType.html 475 476 svg/animations/svglength-animation-values.html 476 477 svg/animations/svglengthlist-animation-1.html … … 478 479 svg/animations/svglengthlist-animation-3.html 479 480 svg/animations/svglengthlist-animation-4.html 481 svg/animations/svglengthlist-animation-5.html 480 482 svg/animations/svgnumber-animation-1.html 481 483 svg/animations/svgnumber-animation-2.html -
trunk/Source/WebCore/ChangeLog
r90218 r90219 1 2011-07-01 Dirk Schulze <krit@webkit.org> 2 3 Reviewed by Nikolas Zimmermann. 4 5 SVGAnimatedLengthListAnimator does not take additive="sum" into accout 6 https://bugs.webkit.org/show_bug.cgi?id=63705 7 8 Added support for additive animations to SVGAnimatedLengthListAnimator. Don't clear the animatedList if not 9 necessary. 10 11 SVGLength unit gets animated as well now. We used to take the unit of 'from' all the time. 12 13 Tests: svg/animations/svglength-animation-unitType.html 14 svg/animations/svglengthlist-animation-5.html 15 16 * svg/SVGAnimatedLength.cpp: 17 (WebCore::SVGAnimatedLengthAnimator::calculateAnimatedValue): Code clean-up and support for unit animation. 18 * svg/SVGAnimatedLengthList.cpp: Add support for additive animations. 19 (WebCore::SVGAnimatedLengthListAnimator::calculateAnimatedValue): 20 * svg/SVGLength.cpp: 21 (WebCore::SVGLength::SVGLength): 22 (WebCore::SVGLength::setValue): New setValue that gets the LengthType and UnitType as argument for supporting animations of units as well. 23 * svg/SVGLength.h: 24 1 25 2011-07-01 Dirk Schulze <krit@webkit.org> 2 26 -
trunk/Source/WebCore/svg/SVGAnimatedLength.cpp
r89587 r90219 24 24 25 25 #include "SVGAnimateElement.h" 26 #include "SVGAnimatedNumber.h" 26 27 27 28 namespace WebCore { … … 80 81 ASSERT(m_animationElement); 81 82 ASSERT(m_contextElement); 83 82 84 SVGAnimateElement* animationElement = static_cast<SVGAnimateElement*>(m_animationElement); 83 84 85 AnimationMode animationMode = animationElement->animationMode(); 86 85 87 // To animation uses contributions from the lower priority animations as the base value. 86 // FIXME: Avoid string parsing. 88 SVGLength& animatedSVGLength = animated->length(); 89 SVGLength& fromSVGLength = from->length(); 87 90 if (animationMode == ToAnimation) 88 from = constructFromString(animated->length().valueAsString());91 fromSVGLength = animatedSVGLength; 89 92 90 93 // Replace 'inherit' by their computed property values. 91 float number; 92 float fromLength = from->length().value(m_contextElement); 93 float toLength = to->length().value(m_contextElement); 94 94 SVGLength& toSVGLength = to->length(); 95 95 if (animationElement->fromPropertyValueType() == InheritValue) { 96 96 String fromLengthString; 97 97 animationElement->adjustForInheritance(m_contextElement, animationElement->attributeName(), fromLengthString); 98 from Length = sharedSVGLength(m_lengthMode, fromLengthString).value(m_contextElement);98 fromSVGLength = sharedSVGLength(m_lengthMode, fromLengthString); 99 99 } 100 100 if (animationElement->toPropertyValueType() == InheritValue) { 101 101 String toLengthString; 102 102 animationElement->adjustForInheritance(m_contextElement, animationElement->attributeName(), toLengthString); 103 to Length = sharedSVGLength(m_lengthMode, toLengthString).value(m_contextElement);103 toSVGLength = sharedSVGLength(m_lengthMode, toLengthString); 104 104 } 105 105 106 if (animationElement->calcMode() == CalcModeDiscrete) 107 number = percentage < 0.5f ? fromLength : toLength; 108 else 109 number = (toLength - fromLength) * percentage + fromLength; 110 111 // FIXME: This is not correct for values animation. 112 if (animationElement->isAccumulated() && repeatCount) 113 number += toLength * repeatCount; 106 float result = animatedSVGLength.value(m_contextElement); 107 SVGLengthType unitType = percentage < 0.5 ? fromSVGLength.unitType() : toSVGLength.unitType(); 108 SVGAnimatedNumberAnimator::calculateAnimatedNumber(animationElement, percentage, repeatCount, result, fromSVGLength.value(m_contextElement), toSVGLength.value(m_contextElement)); 109 114 110 ExceptionCode ec = 0; 115 SVGLength& animatedSVGLength = animated->length(); 116 if (animationElement->isAdditive() && animationMode != ToAnimation) { 117 float animatedSVGLengthValue = animatedSVGLength.value(m_contextElement); 118 animatedSVGLengthValue += number; 119 animatedSVGLength.setValue(animatedSVGLengthValue, m_contextElement, ec); 120 } else 121 animatedSVGLength.setValue(number, m_contextElement, ec); 111 animatedSVGLength.setValue(m_contextElement, result, m_lengthMode, unitType, ec); 122 112 ASSERT(!ec); 123 113 } -
trunk/Source/WebCore/svg/SVGAnimatedLengthList.cpp
r89783 r90219 112 112 } 113 113 114 animatedLengthList.clear(); 114 bool animatedListSizeEqual = itemsCount == animatedLengthList.size(); 115 if (!animatedListSizeEqual) 116 animatedLengthList.clear(); 117 ExceptionCode ec = 0; 115 118 for (unsigned i = 0; i < itemsCount; ++i) { 116 float result = 0;119 float result = animatedListSizeEqual ? animatedLengthList[i].value(m_contextElement) : 0; 117 120 SVGLengthType unitType = percentage < 0.5 ? fromLengthList[i].unitType() : toLengthList[i].unitType(); 118 121 SVGAnimatedNumberAnimator::calculateAnimatedNumber(animationElement, percentage, repeatCount, result, fromLengthList[i].value(m_contextElement), toLengthList[i].value(m_contextElement)); 119 animatedLengthList.append(SVGLength(m_contextElement, result, m_lengthMode, unitType)); 122 if (!animatedListSizeEqual) 123 animatedLengthList.append(SVGLength(m_contextElement, result, m_lengthMode, unitType)); 124 else { 125 animatedLengthList[i].setValue(m_contextElement, result, m_lengthMode, unitType, ec); 126 ASSERT(!ec); 127 } 120 128 } 121 129 } -
trunk/Source/WebCore/svg/SVGLength.cpp
r89783 r90219 142 142 } 143 143 144 SVGLength::SVGLength(const SVGLength& other) 145 : m_valueInSpecifiedUnits(other.m_valueInSpecifiedUnits) 146 , m_unit(other.m_unit) 147 { 148 } 149 144 150 void SVGLength::setValueAsString(const String& valueAsString, SVGLengthMode mode, ExceptionCode& ec) 145 151 { … … 147 153 m_unit = storeUnit(mode, LengthTypeNumber); 148 154 setValueAsString(valueAsString, ec); 149 }150 151 SVGLength::SVGLength(const SVGLength& other)152 : m_valueInSpecifiedUnits(other.m_valueInSpecifiedUnits)153 , m_unit(other.m_unit)154 {155 155 } 156 156 … … 207 207 ASSERT_NOT_REACHED(); 208 208 return 0; 209 } 210 211 void SVGLength::setValue(const SVGElement* context, float value, SVGLengthMode mode, SVGLengthType unitType, ExceptionCode& ec) 212 { 213 m_unit = storeUnit(mode, unitType); 214 setValue(value, context, ec); 209 215 } 210 216 -
trunk/Source/WebCore/svg/SVGLength.h
r89783 r90219 82 82 float value(const SVGElement* context, ExceptionCode&) const; 83 83 void setValue(float, const SVGElement* context, ExceptionCode&); 84 void setValue(const SVGElement* context, float, SVGLengthMode, SVGLengthType, ExceptionCode&); 84 85 85 86 float valueInSpecifiedUnits() const { return m_valueInSpecifiedUnits; }
Note:
See TracChangeset
for help on using the changeset viewer.