Changeset 89750 in webkit
- Timestamp:
- Jun 25, 2011 3:02:29 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 7 added
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r89747 r89750 1 2011-06-25 Dirk Schulze <krit@webkit.org> 2 3 Reviewed by Nikolas Zimmermann. 4 5 SVGAnimatedType should support SVGNumberList animation 6 https://bugs.webkit.org/show_bug.cgi?id=63387 7 8 Test animation of attributes with type SVGNumberList. 9 10 * svg/animations/script-tests/svgnumberlist-animation-1.js: Added. 11 (sample1): 12 (sample2): 13 (sample3): 14 (executeTest): 15 * svg/animations/script-tests/svgnumberlist-animation-2.js: Added. 16 (sample1): 17 (sample2): 18 (sample3): 19 (executeTest): 20 * svg/animations/svgnumberlist-animation-1-expected.txt: Added. 21 * svg/animations/svgnumberlist-animation-1.html: Added. 22 * svg/animations/svgnumberlist-animation-2-expected.txt: Added. 23 * svg/animations/svgnumberlist-animation-2.html: Added. 24 1 25 2011-06-25 Balazs Kelemen <kbalazs@webkit.org> 2 26 -
trunk/Source/WebCore/CMakeLists.txt
r89749 r89750 1661 1661 svg/SVGAnimatedLength.cpp 1662 1662 svg/SVGAnimatedNumber.cpp 1663 svg/SVGAnimatedNumberList.cpp 1663 1664 svg/SVGAnimatedPath.cpp 1664 1665 svg/SVGAnimatedPointList.cpp -
trunk/Source/WebCore/ChangeLog
r89749 r89750 1 2011-06-25 Dirk Schulze <krit@webkit.org> 2 3 Reviewed by Nikolas Zimmermann. 4 5 SVGAnimatedType should support SVGNumberList animation 6 https://bugs.webkit.org/show_bug.cgi?id=63387 7 8 Follow up of "SVGAnimation should use direct unit animation for SVGLength": https://bugs.webkit.org/show_bug.cgi?id=61368 9 This patch continues the conversion to the new concept of SVGAnimatorFactory with SVGNumberList. 10 11 Animations of attributes with type SVGNumberList can be interpolated now. 12 13 Tests: svg/animations/svgnumberlist-animation-1.html 14 svg/animations/svgnumberlist-animation-2.html 15 16 * CMakeLists.txt: Added new file to build system. 17 * GNUmakefile.list.am: Ditto. 18 * WebCore.gypi: Ditto. 19 * WebCore.pro: Ditto. 20 * WebCore.xcodeproj/project.pbxproj: Ditto. 21 * svg/SVGAllInOne.cpp: Ditto. 22 * svg/SVGAnimateElement.cpp: Make use of attribute type AnimatedNumberList. 23 (WebCore::SVGAnimateElement::determineAnimatedAttributeType): 24 (WebCore::SVGAnimateElement::calculateAnimatedValue): 25 (WebCore::SVGAnimateElement::calculateFromAndToValues): 26 (WebCore::SVGAnimateElement::calculateFromAndByValues): 27 (WebCore::SVGAnimateElement::resetToBaseValue): 28 (WebCore::SVGAnimateElement::applyResultsToTarget): 29 (WebCore::SVGAnimateElement::calculateDistance): 30 * svg/SVGAnimatedNumber.cpp: 31 (WebCore::SVGAnimatedNumberAnimator::calculateAnimatedNumber): Made method static for reuse in SVGAnimatedNumberList (and SVGAnimatedNumberOptionalNumber later). 32 (WebCore::SVGAnimatedNumberAnimator::calculateAnimatedValue): Use new static function. 33 * svg/SVGAnimatedNumber.h: 34 * svg/SVGAnimatedNumberList.cpp: Added. New animator for SVGNumberList. 35 (WebCore::SVGAnimatedNumberListAnimator::SVGAnimatedNumberListAnimator): 36 (WebCore::SVGAnimatedNumberListAnimator::constructFromString): 37 (WebCore::SVGAnimatedNumberListAnimator::calculateFromAndToValues): 38 (WebCore::SVGAnimatedNumberListAnimator::calculateFromAndByValues): 39 (WebCore::SVGAnimatedNumberListAnimator::calculateAnimatedValue): 40 (WebCore::SVGAnimatedNumberListAnimator::calculateDistance): 41 * svg/SVGAnimatedNumberList.h: 42 (WebCore::SVGAnimatedNumberListAnimator::~SVGAnimatedNumberListAnimator): 43 * svg/SVGAnimatedType.cpp: Use new Animator. 44 (WebCore::SVGAnimatedType::~SVGAnimatedType): 45 (WebCore::SVGAnimatedType::createNumberList): 46 (WebCore::SVGAnimatedType::numberList): 47 (WebCore::SVGAnimatedType::valueAsString): 48 (WebCore::SVGAnimatedType::setValueAsString): 49 * svg/SVGAnimatedType.h: 50 * svg/SVGAnimatorFactory.h: 51 (WebCore::SVGAnimatorFactory::create): 52 1 53 2011-06-25 Nikolas Zimmermann <nzimmermann@rim.com> 2 54 -
trunk/Source/WebCore/GNUmakefile.list.am
r89749 r89750 3434 3434 Source/WebCore/svg/SVGAnimatedNumber.cpp \ 3435 3435 Source/WebCore/svg/SVGAnimatedNumber.h \ 3436 Source/WebCore/svg/SVGAnimatedNumberList.cpp \ 3436 3437 Source/WebCore/svg/SVGAnimatedNumberList.h \ 3437 3438 Source/WebCore/svg/SVGAnimatedPath.cpp \ -
trunk/Source/WebCore/WebCore.gypi
r89749 r89750 5713 5713 'svg/SVGAnimatedLength.cpp', 5714 5714 'svg/SVGAnimatedNumber.cpp', 5715 'svg/SVGAnimatedNumberList.cpp', 5715 5716 'svg/SVGAnimatedPath.cpp', 5716 5717 'svg/SVGAnimatedPointList.cpp', -
trunk/Source/WebCore/WebCore.pro
r89749 r89750 3340 3340 svg/SVGAnimatedLength.cpp \ 3341 3341 svg/SVGAnimatedNumber.cpp \ 3342 svg/SVGAnimatedNumberList.cpp \ 3342 3343 svg/SVGAnimatedPath.cpp \ 3343 3344 svg/SVGAnimatedPointList.cpp \ -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r89749 r89750 932 932 41FA303F1316C29C00C0BFC5 /* RenderMediaControls.h in Headers */ = {isa = PBXBuildFile; fileRef = 41FA303D1316C29C00C0BFC5 /* RenderMediaControls.h */; }; 933 933 43142E7A13B1E97700F1C871 /* SVGAnimatedRect.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 43142E7913B1E97700F1C871 /* SVGAnimatedRect.cpp */; }; 934 4331AC7813B6870000A9E5AE /* SVGAnimatedNumberList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4331AC7713B6870000A9E5AE /* SVGAnimatedNumberList.cpp */; }; 934 935 4358E86A1360A21600E4748C /* DOMSVGFEDropShadowElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 4358E8671360A21600E4748C /* DOMSVGFEDropShadowElement.h */; }; 935 936 4358E86B1360A21600E4748C /* DOMSVGFEDropShadowElement.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4358E8681360A21600E4748C /* DOMSVGFEDropShadowElement.mm */; }; … … 7391 7392 41FA303D1316C29C00C0BFC5 /* RenderMediaControls.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderMediaControls.h; sourceTree = "<group>"; }; 7392 7393 43142E7913B1E97700F1C871 /* SVGAnimatedRect.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGAnimatedRect.cpp; sourceTree = "<group>"; }; 7394 4331AC7713B6870000A9E5AE /* SVGAnimatedNumberList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGAnimatedNumberList.cpp; sourceTree = "<group>"; }; 7393 7395 4358E8671360A21600E4748C /* DOMSVGFEDropShadowElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMSVGFEDropShadowElement.h; sourceTree = "<group>"; }; 7394 7396 4358E8681360A21600E4748C /* DOMSVGFEDropShadowElement.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DOMSVGFEDropShadowElement.mm; sourceTree = "<group>"; }; … … 17406 17408 08B35B12127B6A7C005314DD /* SVGAnimatedNumber.h */, 17407 17409 B22277EC0D00BF1F0071B782 /* SVGAnimatedNumber.idl */, 17410 4331AC7713B6870000A9E5AE /* SVGAnimatedNumberList.cpp */, 17408 17411 08B35B16127B6A88005314DD /* SVGAnimatedNumberList.h */, 17409 17412 B22277ED0D00BF1F0071B782 /* SVGAnimatedNumberList.idl */, … … 25828 25831 08B5F25513B5FFF2002959EC /* SVGAnimatedPath.cpp in Sources */, 25829 25832 376DCCE113B4F966002EBEFC /* TextRun.cpp in Sources */, 25833 4331AC7813B6870000A9E5AE /* SVGAnimatedNumberList.cpp in Sources */, 25830 25834 ); 25831 25835 runOnlyForDeploymentPostprocessing = 0; -
trunk/Source/WebCore/svg/SVGAllInOne.cpp
r89749 r89750 35 35 #include "SVGAnimatedLength.cpp" 36 36 #include "SVGAnimatedNumber.cpp" 37 #include "SVGAnimatedNumberList.cpp" 37 38 #include "SVGAnimatedPath.cpp" 38 39 #include "SVGAnimatedPointList.cpp" -
trunk/Source/WebCore/svg/SVGAnimateElement.cpp
r89749 r89750 112 112 case AnimatedBoolean: 113 113 case AnimatedEnumeration: 114 case AnimatedNumberList:115 114 case AnimatedNumberOptionalNumber: 116 115 case AnimatedLengthList: … … 125 124 case AnimatedNumber: 126 125 return AnimatedNumber; 126 case AnimatedNumberList: 127 return AnimatedNumberList; 127 128 case AnimatedPath: 128 129 return AnimatedPath; … … 164 165 case AnimatedLength: 165 166 case AnimatedNumber: 167 case AnimatedNumberList: 166 168 case AnimatedPath: 167 169 case AnimatedPoints: … … 229 231 case AnimatedLength: 230 232 case AnimatedNumber: 233 case AnimatedNumberList: 231 234 case AnimatedPath: 232 235 case AnimatedPoints: … … 255 258 case AnimatedLength: 256 259 case AnimatedNumber: 260 case AnimatedNumberList: 257 261 case AnimatedPoints: 258 262 case AnimatedRect: … … 280 284 case AnimatedLength: 281 285 case AnimatedNumber: 286 case AnimatedNumberList: 282 287 case AnimatedPath: 283 288 case AnimatedPoints: … … 304 309 case AnimatedLength: 305 310 case AnimatedNumber: 311 case AnimatedNumberList: 306 312 case AnimatedPath: 307 313 case AnimatedPoints: … … 328 334 case AnimatedLength: 329 335 case AnimatedNumber: 336 case AnimatedNumberList: 330 337 case AnimatedPath: 331 338 case AnimatedPoints: -
trunk/Source/WebCore/svg/SVGAnimatedNumber.cpp
r89587 r89750 68 68 } 69 69 70 void SVGAnimatedNumberAnimator::calculateAnimatedNumber(SVGAnimationElement* animationElement, float percentage, unsigned repeatCount, float& animatedNumber, float fromNumber, float toNumber) 71 { 72 float number; 73 if (animationElement->calcMode() == CalcModeDiscrete) 74 number = percentage < 0.5 ? fromNumber : toNumber; 75 else 76 number = (toNumber - fromNumber) * percentage + fromNumber; 77 78 // FIXME: This is not correct for values animation. Right now we transform values-animation to multiple from-to-animations and 79 // accumulate every single value to the previous one. But accumulation should just take into account after a complete cycle 80 // of values-animaiton. See example at: http://www.w3.org/TR/2001/REC-smil-animation-20010904/#RepeatingAnim 81 if (animationElement->isAccumulated() && repeatCount) 82 number += toNumber * repeatCount; 83 if (animationElement->isAdditive() && animationElement->animationMode() != ToAnimation) 84 animatedNumber += number; 85 else 86 animatedNumber = number; 87 } 88 70 89 void SVGAnimatedNumberAnimator::calculateAnimatedValue(float percentage, unsigned repeatCount, 71 90 OwnPtr<SVGAnimatedType>& from, OwnPtr<SVGAnimatedType>& to, OwnPtr<SVGAnimatedType>& animated) … … 94 113 parseNumberFromString(toNumberString, toNumber); 95 114 } 96 97 float number;98 if (animationElement->calcMode() == CalcModeDiscrete)99 number = percentage < 0.5f ? fromNumber : toNumber;100 else101 number = (toNumber - fromNumber) * percentage + fromNumber;102 115 103 // FIXME: This is not correct for values animation. Right now we transform values-animation to multiple from-to-animations and 104 // accumulate every single value to the previous one. But accumulation should just take into account after a complete cycle 105 // of values-animaiton. See example at: http://www.w3.org/TR/2001/REC-smil-animation-20010904/#RepeatingAnim 106 if (animationElement->isAccumulated() && repeatCount) 107 number += toNumber * repeatCount; 108 if (animationElement->isAdditive() && animationMode != ToAnimation) 109 animatedNumber += number; 110 else 111 animatedNumber = number; 116 calculateAnimatedNumber(animationElement, percentage, repeatCount, animatedNumber, fromNumber, toNumber); 112 117 } 113 118 -
trunk/Source/WebCore/svg/SVGAnimatedNumber.h
r89587 r89750 49 49 virtual ~SVGAnimatedNumberAnimator() { } 50 50 51 static void calculateAnimatedNumber(SVGAnimationElement*, float percentage, unsigned repeatCount, float& animatedNumber, float fromNumber, float toNumber); 52 51 53 virtual PassOwnPtr<SVGAnimatedType> constructFromString(const String&); 52 54 -
trunk/Source/WebCore/svg/SVGAnimatedNumberList.h
r73020 r89750 23 23 #if ENABLE(SVG) 24 24 #include "SVGAnimatedListPropertyTearOff.h" 25 #include "SVGAnimatedTypeAnimator.h" 25 26 #include "SVGNumberList.h" 26 27 … … 35 36 #define DEFINE_ANIMATED_NUMBER_LIST(OwnerType, DOMAttribute, UpperProperty, LowerProperty) \ 36 37 DEFINE_ANIMATED_LIST_PROPERTY(OwnerType, DOMAttribute, DOMAttribute.localName(), SVGAnimatedNumberList, SVGNumberList, UpperProperty, LowerProperty) 38 39 #if ENABLE(SVG_ANIMATION) 40 class SVGAnimationElement; 41 42 class SVGAnimatedNumberListAnimator : public SVGAnimatedTypeAnimator { 43 44 public: 45 SVGAnimatedNumberListAnimator(SVGAnimationElement*, SVGElement*); 46 virtual ~SVGAnimatedNumberListAnimator() { } 47 48 virtual PassOwnPtr<SVGAnimatedType> constructFromString(const String&); 49 50 virtual void calculateFromAndToValues(OwnPtr<SVGAnimatedType>& fromValue, OwnPtr<SVGAnimatedType>& toValue, const String& fromString, const String& toString); 51 virtual void calculateFromAndByValues(OwnPtr<SVGAnimatedType>& fromValue, OwnPtr<SVGAnimatedType>& toValue, const String& fromString, const String& byString); 52 virtual void calculateAnimatedValue(float percentage, unsigned repeatCount, 53 OwnPtr<SVGAnimatedType>& fromValue, OwnPtr<SVGAnimatedType>& toValue, OwnPtr<SVGAnimatedType>& animatedValue); 54 virtual float calculateDistance(const String& fromString, const String& toString); 55 }; 56 #endif // ENABLE(SVG_ANIMATION) 37 57 38 58 } // namespace WebCore -
trunk/Source/WebCore/svg/SVGAnimatedType.cpp
r89749 r89750 27 27 #include "SVGColor.h" 28 28 #include "SVGLength.h" 29 #include "SVGNumberList.h" 29 30 #include "SVGParserUtilities.h" 30 31 #include "SVGPathParserFactory.h" … … 53 54 delete m_data.number; 54 55 break; 56 case AnimatedNumberList: 57 delete m_data.numberList; 58 break; 55 59 case AnimatedPath: 56 60 delete m_data.path; … … 103 107 } 104 108 109 PassOwnPtr<SVGAnimatedType> SVGAnimatedType::createNumberList(SVGNumberList* numberList) 110 { 111 ASSERT(numberList); 112 OwnPtr<SVGAnimatedType> animatedType = adoptPtr(new SVGAnimatedType(AnimatedNumberList)); 113 animatedType->m_data.numberList = numberList; 114 return animatedType.release(); 115 } 116 105 117 PassOwnPtr<SVGAnimatedType> SVGAnimatedType::createPath(PassOwnPtr<SVGPathByteStream> path) 106 118 { … … 157 169 ASSERT(m_type == AnimatedNumber); 158 170 return *m_data.number; 171 } 172 173 SVGNumberList& SVGAnimatedType::numberList() 174 { 175 ASSERT(m_type == AnimatedNumberList); 176 return *m_data.numberList; 159 177 } 160 178 … … 198 216 ASSERT(m_data.number); 199 217 return String::number(*m_data.number); 218 case AnimatedNumberList: 219 ASSERT(m_data.numberList); 220 return m_data.numberList->valueAsString(); 200 221 case AnimatedPath: { 201 222 ASSERT(m_data.path); … … 241 262 parseNumberFromString(value, *m_data.number); 242 263 break; 264 case AnimatedNumberList: 265 ASSERT(m_data.numberList); 266 m_data.numberList->parse(value); 267 break; 243 268 case AnimatedPath: { 244 269 ASSERT(m_data.path); -
trunk/Source/WebCore/svg/SVGAnimatedType.h
r89749 r89750 31 31 class SVGAngle; 32 32 class SVGLength; 33 class SVGNumberList; 33 34 class SVGPointList; 34 35 … … 42 43 static PassOwnPtr<SVGAnimatedType> createLength(SVGLength*); 43 44 static PassOwnPtr<SVGAnimatedType> createNumber(float*); 45 static PassOwnPtr<SVGAnimatedType> createNumberList(SVGNumberList*); 44 46 static PassOwnPtr<SVGAnimatedType> createPath(PassOwnPtr<SVGPathByteStream>); 45 47 static PassOwnPtr<SVGAnimatedType> createPointList(SVGPointList*); … … 53 55 SVGLength& length(); 54 56 float& number(); 57 SVGNumberList& numberList(); 55 58 SVGPathByteStream* path(); 56 59 SVGPointList& pointList(); … … 77 80 SVGLength* length; 78 81 float* number; 82 SVGNumberList* numberList; 79 83 SVGPathByteStream* path; 80 84 SVGPointList* pointList; -
trunk/Source/WebCore/svg/SVGAnimatorFactory.h
r89749 r89750 26 26 #include "SVGAnimatedLength.h" 27 27 #include "SVGAnimatedNumber.h" 28 #include "SVGAnimatedNumberList.h" 28 29 #include "SVGAnimatedPath.h" 29 30 #include "SVGAnimatedPointList.h" … … 52 53 case AnimatedNumber: 53 54 return adoptPtr(new SVGAnimatedNumberAnimator(animationElement, contextElement)); 55 case AnimatedNumberList: 56 return adoptPtr(new SVGAnimatedNumberListAnimator(animationElement, contextElement)); 54 57 case AnimatedPath: 55 58 return adoptPtr(new SVGAnimatedPathAnimator(animationElement, contextElement));
Note: See TracChangeset
for help on using the changeset viewer.