Changeset 89220 in webkit
- Timestamp:
- Jun 19, 2011, 1:11:24 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 11 added
- 14 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/svg/animations/script-tests/svgnumber-animation-1.js (added)
-
LayoutTests/svg/animations/script-tests/svgnumber-animation-2.js (added)
-
LayoutTests/svg/animations/script-tests/svgnumber-animation-3.js (added)
-
LayoutTests/svg/animations/svgnumber-animation-1-expected.txt (added)
-
LayoutTests/svg/animations/svgnumber-animation-1.html (added)
-
LayoutTests/svg/animations/svgnumber-animation-2-expected.txt (added)
-
LayoutTests/svg/animations/svgnumber-animation-2.html (added)
-
LayoutTests/svg/animations/svgnumber-animation-3-expected.txt (added)
-
LayoutTests/svg/animations/svgnumber-animation-3.html (added)
-
Source/WebCore/CMakeLists.txt (modified) (1 diff)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/GNUmakefile.list.am (modified) (2 diffs)
-
Source/WebCore/WebCore.gypi (modified) (1 diff)
-
Source/WebCore/WebCore.pro (modified) (1 diff)
-
Source/WebCore/WebCore.xcodeproj/project.pbxproj (modified) (5 diffs)
-
Source/WebCore/svg/SVGAllInOne.cpp (modified) (1 diff)
-
Source/WebCore/svg/SVGAnimateElement.cpp (modified) (13 diffs)
-
Source/WebCore/svg/SVGAnimateElement.h (modified) (1 diff)
-
Source/WebCore/svg/SVGAnimatedNumber.cpp (added)
-
Source/WebCore/svg/SVGAnimatedNumber.h (modified) (2 diffs)
-
Source/WebCore/svg/SVGAnimatedType.cpp (added)
-
Source/WebCore/svg/SVGAnimatedType.h (modified) (2 diffs)
-
Source/WebCore/svg/SVGAnimatorFactory.h (modified) (2 diffs)
-
Source/WebCore/svg/SVGParserUtilities.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r89218 r89220 1 2011-06-19 Dirk Schulze <krit@webkit.org> 2 3 Reviewed by Nikolas Zimmermann. 4 5 SVGAnimatorFactory does not support SVGNumber 6 https://bugs.webkit.org/show_bug.cgi?id=62938 7 8 Added new tests to check behavior on SVGNumber animation. 9 10 * svg/animations/script-tests/svgnumber-animation-1.js: Added. 11 (sample1): 12 (sample2): 13 (sample3): 14 (executeTest): 15 * svg/animations/script-tests/svgnumber-animation-2.js: Added. 16 (sample1): 17 (sample2): 18 (sample3): 19 (executeTest): 20 * svg/animations/script-tests/svgnumber-animation-3.js: Added. 21 (sample1): 22 (sample2): 23 (sample3): 24 (executeTest): 25 * svg/animations/svgnumber-animation-1-expected.txt: Added. 26 * svg/animations/svgnumber-animation-1.html: Added. 27 * svg/animations/svgnumber-animation-2-expected.txt: Added. 28 * svg/animations/svgnumber-animation-2.html: Added. 29 * svg/animations/svgnumber-animation-3-expected.txt: Added. 30 * svg/animations/svgnumber-animation-3.html: Added. 31 1 32 2011-06-19 Stephen White <senorblanco@chromium.org> 2 33 -
trunk/Source/WebCore/CMakeLists.txt
r89216 r89220 1656 1656 svg/SVGAnimatedAngle.cpp 1657 1657 svg/SVGAnimatedLength.cpp 1658 svg/SVGAnimatedNumber.cpp 1659 svg/SVGAnimatedType.cpp 1658 1660 svg/SVGAnimateElement.cpp 1659 1661 svg/SVGAnimateMotionElement.cpp -
trunk/Source/WebCore/ChangeLog
r89216 r89220 1 2011-06-19 Dirk Schulze <krit@webkit.org> 2 3 Reviewed by Nikolas Zimmermann. 4 5 SVGAnimatorFactory does not support SVGNumber 6 https://bugs.webkit.org/show_bug.cgi?id=62938 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 SVGNumber. With the new animator for the 10 With the new animator for SVGNumber we also support the scientific notation, and everything else that's supported by 11 the SVGNumber parsing, removing the SVGAnimate* specific number parsing functionality. 12 13 Moving the content of SVGAnimatedType header into its own cpp. 14 15 Changed behavior of parseNumberFromString(). It checks if the String simply consits of a number now. parseNumberFromString() 16 is using genericParseNumber() for parsing numbers. But this method just stops at the first char that does not belong to a number and 17 returns true. I added a check if the current char pointer is at the last char of the String and return false if not. 18 19 Tests: svg/animations/svgnumber-animation-1.html 20 svg/animations/svgnumber-animation-2.html 21 svg/animations/svgnumber-animation-3.html 22 23 * CMakeLists.txt: Added new files to build system. 24 * GNUmakefile.list.am: Ditto. 25 * WebCore.gypi: Ditto. 26 * WebCore.pro: Ditto. 27 * WebCore.xcodeproj/project.pbxproj: Ditto. 28 * svg/SVGAllInOne.cpp: Ditto. 29 * svg/SVGAnimateElement.cpp: Use SVGAnimatedNumberAnimator for animations of SVGNumbers. 30 (WebCore::SVGAnimateElement::SVGAnimateElement): 31 (WebCore::SVGAnimateElement::calculateAnimatedValue): 32 (WebCore::SVGAnimateElement::calculateFromAndToValues): 33 (WebCore::SVGAnimateElement::calculateFromAndByValues): 34 (WebCore::SVGAnimateElement::resetToBaseValue): 35 (WebCore::SVGAnimateElement::applyResultsToTarget): 36 (WebCore::SVGAnimateElement::calculateDistance): 37 * svg/SVGAnimateElement.h: Remove floats for value storage. This is done by SVGAnimatedTypes now. 38 * svg/SVGAnimatedNumber.cpp: Added. Animator for SVGNumbers. 39 (WebCore::SVGAnimatedNumberAnimator::SVGAnimatedNumberAnimator): 40 (WebCore::SVGAnimatedNumberAnimator::constructFromString): 41 (WebCore::SVGAnimatedNumberAnimator::calculateFromAndToValues): 42 (WebCore::SVGAnimatedNumberAnimator::calculateFromAndByValues): 43 (WebCore::SVGAnimatedNumberAnimator::calculateAnimatedValue): 44 (WebCore::SVGAnimatedNumberAnimator::calculateDistance): 45 * svg/SVGAnimatedNumber.h: 46 (WebCore::SVGAnimatedNumberAnimator::~SVGAnimatedNumberAnimator): 47 * svg/SVGAnimatedType.cpp: Added. Moved content from header to cpp. 48 (WebCore::SVGAnimatedType::SVGAnimatedType): 49 (WebCore::SVGAnimatedType::~SVGAnimatedType): 50 (WebCore::SVGAnimatedType::createAngle): 51 (WebCore::SVGAnimatedType::createLength): 52 (WebCore::SVGAnimatedType::createNumber): 53 (WebCore::SVGAnimatedType::angle): 54 (WebCore::SVGAnimatedType::length): 55 (WebCore::SVGAnimatedType::number): 56 (WebCore::SVGAnimatedType::valueAsString): 57 (WebCore::SVGAnimatedType::setValueAsString): 58 * svg/SVGAnimatedType.h: Removed method create(). Allways call type specific create funtcions. 59 * svg/SVGAnimatorFactory.h: 60 (WebCore::SVGAnimatorFactory::create): 61 * svg/SVGParserUtilities.cpp: 62 (WebCore::parseNumberFromString): Check if String simply consits of a number. Return false otherwise. 63 1 64 2011-06-18 Dimitri Glazkov <dglazkov@chromium.org> 2 65 -
trunk/Source/WebCore/GNUmakefile.list.am
r89216 r89220 3346 3346 Source/WebCore/svg/SVGAnimatedLength.h \ 3347 3347 Source/WebCore/svg/SVGAnimatedLengthList.h \ 3348 Source/WebCore/svg/SVGAnimatedNumber.cpp \ 3348 3349 Source/WebCore/svg/SVGAnimatedNumber.h \ 3349 3350 Source/WebCore/svg/SVGAnimatedNumberList.h \ … … 3352 3353 Source/WebCore/svg/SVGAnimatedString.h \ 3353 3354 Source/WebCore/svg/SVGAnimatedTransformList.h \ 3355 Source/WebCore/svg/SVGAnimatedType.cpp \ 3354 3356 Source/WebCore/svg/SVGAnimatedType.h \ 3355 3357 Source/WebCore/svg/SVGAnimatedTypeAnimator.h \ -
trunk/Source/WebCore/WebCore.gypi
r89216 r89220 5709 5709 'svg/SVGAnimatedAngle.cpp', 5710 5710 'svg/SVGAnimatedLength.cpp', 5711 'svg/SVGAnimatedNumber.cpp', 5712 'svg/SVGAnimatedType.cpp', 5711 5713 'svg/SVGAnimateElement.cpp', 5712 5714 'svg/SVGAnimateElement.h', -
trunk/Source/WebCore/WebCore.pro
r89216 r89220 3296 3296 svg/SVGAnimatedAngle.cpp \ 3297 3297 svg/SVGAnimatedLength.cpp \ 3298 svg/SVGAnimatedNumber.cpp \ 3299 svg/SVGAnimatedType.cpp \ 3298 3300 svg/SVGAnimateElement.cpp \ 3299 3301 svg/SVGAnimateMotionElement.cpp \ -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r89216 r89220 995 995 439D334413A6911C00C20F4F /* SVGAnimatedTypeAnimator.h in Headers */ = {isa = PBXBuildFile; fileRef = 439D334113A6911C00C20F4F /* SVGAnimatedTypeAnimator.h */; }; 996 996 439D334513A6911C00C20F4F /* SVGAnimatorFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = 439D334213A6911C00C20F4F /* SVGAnimatorFactory.h */; }; 997 43A0F0B113AC7D6D00A5F0A7 /* SVGAnimatedNumber.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 43A0F0B013AC7D6D00A5F0A7 /* SVGAnimatedNumber.cpp */; }; 998 43A0F0B613ACCCFF00A5F0A7 /* SVGAnimatedType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 43A0F0B513ACCCFF00A5F0A7 /* SVGAnimatedType.cpp */; }; 997 999 43C092BC12D9E4EE00A989C3 /* RenderSVGForeignObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 43C092BA12D9E4EE00A989C3 /* RenderSVGForeignObject.h */; }; 998 1000 4415292E0E1AE8A000C4A2D0 /* HTMLPlugInImageElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 4415292C0E1AE8A000C4A2D0 /* HTMLPlugInImageElement.h */; settings = {ATTRIBUTES = (Private, ); }; }; … … 7460 7462 439D334113A6911C00C20F4F /* SVGAnimatedTypeAnimator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAnimatedTypeAnimator.h; sourceTree = "<group>"; }; 7461 7463 439D334213A6911C00C20F4F /* SVGAnimatorFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAnimatorFactory.h; sourceTree = "<group>"; }; 7464 43A0F0B013AC7D6D00A5F0A7 /* SVGAnimatedNumber.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGAnimatedNumber.cpp; sourceTree = "<group>"; }; 7465 43A0F0B513ACCCFF00A5F0A7 /* SVGAnimatedType.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGAnimatedType.cpp; sourceTree = "<group>"; }; 7462 7466 43C092B912D9E4EE00A989C3 /* RenderSVGForeignObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderSVGForeignObject.cpp; sourceTree = "<group>"; }; 7463 7467 43C092BA12D9E4EE00A989C3 /* RenderSVGForeignObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderSVGForeignObject.h; sourceTree = "<group>"; }; … … 17357 17361 089021AC126EF5E90092D5EA /* SVGAnimatedLengthList.h */, 17358 17362 B22277EB0D00BF1F0071B782 /* SVGAnimatedLengthList.idl */, 17363 43A0F0B013AC7D6D00A5F0A7 /* SVGAnimatedNumber.cpp */, 17359 17364 08B35B12127B6A7C005314DD /* SVGAnimatedNumber.h */, 17360 17365 B22277EC0D00BF1F0071B782 /* SVGAnimatedNumber.idl */, … … 17369 17374 08250938128BD4D800E2ED8E /* SVGAnimatedTransformList.h */, 17370 17375 B22277F80D00BF1F0071B782 /* SVGAnimatedTransformList.idl */, 17376 43A0F0B513ACCCFF00A5F0A7 /* SVGAnimatedType.cpp */, 17371 17377 439D334013A6911C00C20F4F /* SVGAnimatedType.h */, 17372 17378 439D334113A6911C00C20F4F /* SVGAnimatedTypeAnimator.h */, … … 25742 25748 B1AD4E7B13A12A7200846B27 /* CueParser.cpp in Sources */, 25743 25749 4362C7B913AC6F1A00344BEB /* SVGAnimatedAngle.cpp in Sources */, 25750 43A0F0B113AC7D6D00A5F0A7 /* SVGAnimatedNumber.cpp in Sources */, 25751 43A0F0B613ACCCFF00A5F0A7 /* SVGAnimatedType.cpp in Sources */, 25744 25752 ); 25745 25753 runOnlyForDeploymentPostprocessing = 0; -
trunk/Source/WebCore/svg/SVGAllInOne.cpp
r89187 r89220 33 33 #include "SVGAnimatedAngle.cpp" 34 34 #include "SVGAnimatedLength.cpp" 35 #include "SVGAnimatedNumber.cpp" 36 #include "SVGAnimatedType.cpp" 35 37 #include "SVGAnimateElement.cpp" 36 38 #include "SVGAnimateMotionElement.cpp" -
trunk/Source/WebCore/svg/SVGAnimateElement.cpp
r89187 r89220 30 30 #include "CSSPropertyNames.h" 31 31 #include "ColorDistance.h" 32 #include "FloatConversion.h"33 32 #include "QualifiedName.h" 34 33 #include "RenderObject.h" … … 49 48 : SVGAnimationElement(tagName, document) 50 49 , m_animatedAttributeType(AnimatedString) 51 , m_fromNumber(0)52 , m_toNumber(0)53 , m_animatedNumber(numeric_limits<float>::infinity())54 50 , m_animatedPathPointer(0) 55 51 { … … 170 166 return; 171 167 switch (m_animatedAttributeType) { 172 case AnimatedNumber: {173 // To animation uses contributions from the lower priority animations as the base value.174 if (animationMode == ToAnimation)175 m_fromNumber = results->m_animatedNumber;176 177 // Replace 'currentColor' / 'inherit' by their computed property values.178 if (m_fromPropertyValueType == InheritValue) {179 String fromNumberString;180 adjustForInheritance(targetElement, attributeName(), fromNumberString);181 if (!parseNumberFromString(fromNumberString, m_fromNumber, false))182 return;183 }184 if (m_toPropertyValueType == InheritValue) {185 String toNumberString;186 adjustForInheritance(targetElement, attributeName(), toNumberString);187 if (!parseNumberFromString(toNumberString, m_toNumber, false))188 return;189 }190 191 float number;192 if (calcMode() == CalcModeDiscrete)193 number = isInFirstHalfOfAnimation ? m_fromNumber : m_toNumber;194 else195 number = (m_toNumber - m_fromNumber) * percentage + m_fromNumber;196 197 // FIXME: This is not correct for values animation.198 if (isAccumulated() && repeat)199 number += m_toNumber * repeat;200 if (isAdditive() && animationMode != ToAnimation)201 results->m_animatedNumber += number;202 else203 results->m_animatedNumber = number;204 return;205 }206 168 case AnimatedColor: { 207 169 if (animationMode == ToAnimation) … … 288 250 } 289 251 case AnimatedAngle: 290 case AnimatedLength: { 252 case AnimatedLength: 253 case AnimatedNumber: { 291 254 ASSERT(m_animator); 292 255 ASSERT(results->m_animatedType); … … 358 321 break; 359 322 } 360 case AnimatedNumber: {361 if (parseNumberFromString(toString, m_toNumber, false)) {362 // For to-animations the from number is calculated later363 if (animationMode() == ToAnimation || parseNumberFromString(fromString, m_fromNumber, false))364 return true;365 }366 break;367 }368 323 case AnimatedPath: { 369 324 SVGPathParserFactory* factory = SVGPathParserFactory::self(); … … 388 343 case AnimatedAngle: 389 344 case AnimatedLength: 345 case AnimatedNumber: 390 346 ensureAnimator()->calculateFromAndToValues(m_fromType, m_toType, fromString, toString); 391 347 return true; … … 429 385 case AnimatedAngle: 430 386 case AnimatedLength: 387 case AnimatedNumber: 431 388 ensureAnimator()->calculateFromAndByValues(m_fromType, m_toType, fromString, byString); 432 389 return true; 433 390 default: 434 m_fromNumber = 0; 435 if (!fromString.isEmpty() && !parseNumberFromString(fromString, m_fromNumber, false)) 436 return false; 437 if (!parseNumberFromString(byString, m_toNumber, false)) 438 return false; 439 m_toNumber += m_fromNumber; 391 break; 440 392 } 441 393 return true; … … 457 409 } 458 410 break; 459 case AnimatedNumber:460 if (baseString.isEmpty()) {461 m_animatedNumber = 0;462 return;463 }464 if (parseNumberFromString(baseString, m_animatedNumber, false))465 return;466 break;467 411 case AnimatedPath: { 468 412 m_animatedPath.clear(); … … 476 420 return; 477 421 case AnimatedAngle: 478 case AnimatedLength: { 422 case AnimatedLength: 423 case AnimatedNumber: { 479 424 if (!m_animatedType) 480 425 m_animatedType = ensureAnimator()->constructFromString(baseString); … … 495 440 case AnimatedColor: 496 441 valueToApply = m_animatedColor.serialized(); 497 break;498 case AnimatedNumber:499 valueToApply = String::number(m_animatedNumber);500 442 break; 501 443 case AnimatedPath: { … … 517 459 case AnimatedAngle: 518 460 case AnimatedLength: 461 case AnimatedNumber: 519 462 valueToApply = m_animatedType->valueAsString(); 520 463 break; … … 527 470 float SVGAnimateElement::calculateDistance(const String& fromString, const String& toString) 528 471 { 472 // FIXME: A return value of float is not enough to support paced animations on lists. 529 473 SVGElement* targetElement = this->targetElement(); 530 474 if (!targetElement) 531 475 return -1; 532 476 m_animatedAttributeType = determineAnimatedAttributeType(targetElement); 533 if (m_animatedAttributeType == AnimatedNumber) { 534 float from; 535 float to; 536 if (!parseNumberFromString(fromString, from, false)) 537 return -1; 538 if (!parseNumberFromString(toString, to, false)) 539 return -1; 540 return fabs(to - from); 541 } 542 if (m_animatedAttributeType == AnimatedColor) { 477 switch (m_animatedAttributeType) { 478 case AnimatedColor: { 543 479 Color from = SVGColor::colorFromRGBColorString(fromString); 544 480 if (!from.isValid()) … … 549 485 return ColorDistance(from, to).distance(); 550 486 } 551 if (m_animatedAttributeType == AnimatedAngle || m_animatedAttributeType == AnimatedLength) 487 case AnimatedAngle: 488 case AnimatedLength: 489 case AnimatedNumber: 552 490 return ensureAnimator()->calculateDistance(this, fromString, toString); 491 default: 492 break; 493 } 553 494 return -1; 554 495 } -
trunk/Source/WebCore/svg/SVGAnimateElement.h
r89187 r89220 73 73 AnimatedPropertyValueType m_fromPropertyValueType; 74 74 AnimatedPropertyValueType m_toPropertyValueType; 75 float m_fromNumber;76 float m_toNumber;77 float m_animatedNumber;78 75 Color m_fromColor; 79 76 Color m_toColor; -
trunk/Source/WebCore/svg/SVGAnimatedNumber.h
r74472 r89220 22 22 23 23 #if ENABLE(SVG) 24 #include "SVGAnimateElement.h" 24 25 #include "SVGAnimatedPropertyMacros.h" 25 26 #include "SVGAnimatedStaticPropertyTearOff.h" … … 39 40 DEFINE_ANIMATED_PROPERTY(OwnerType, DOMAttribute, SVGDOMAttributeIdentifier, SVGAnimatedNumber, float, UpperProperty, LowerProperty) 40 41 42 #if ENABLE(SVG_ANIMATION) 43 class SVGAnimatedNumberAnimator : public SVGAnimatedTypeAnimator { 44 45 public: 46 SVGAnimatedNumberAnimator(SVGElement*, const QualifiedName&); 47 virtual ~SVGAnimatedNumberAnimator() { } 48 49 virtual PassOwnPtr<SVGAnimatedType> constructFromString(const String&); 50 51 virtual void calculateFromAndToValues(OwnPtr<SVGAnimatedType>& fromValue, OwnPtr<SVGAnimatedType>& toValue, const String& fromString, const String& toString); 52 virtual void calculateFromAndByValues(OwnPtr<SVGAnimatedType>& fromValue, OwnPtr<SVGAnimatedType>& toValue, const String& fromString, const String& byString); 53 virtual void calculateAnimatedValue(SVGSMILElement*, float percentage, unsigned repeatCount, 54 OwnPtr<SVGAnimatedType>& fromValue, OwnPtr<SVGAnimatedType>& toValue, OwnPtr<SVGAnimatedType>& animatedValue, 55 bool fromPropertyInherits, bool toPropertyInherits); 56 virtual float calculateDistance(SVGSMILElement*, const String& fromString, const String& toString); 57 }; 41 58 } // namespace WebCore 42 59 60 #endif // ENABLE(SVG_ANIMATION) 43 61 #endif // ENABLE(SVG) 44 62 #endif -
trunk/Source/WebCore/svg/SVGAnimatedType.h
r89187 r89220 22 22 23 23 #if ENABLE(SVG) && ENABLE(SVG_ANIMATION) 24 #include "SVGAngle.h"25 24 #include "SVGElement.h" 26 #include "SVGLength.h"27 25 28 26 namespace WebCore { 27 28 class SVGAngle; 29 class SVGLength; 29 30 30 31 class SVGAnimatedType { 31 32 WTF_MAKE_FAST_ALLOCATED; 32 33 public: 33 static PassOwnPtr<SVGAnimatedType> create(AnimatedAttributeType type) 34 { 35 return adoptPtr(new SVGAnimatedType(type)); 36 } 34 virtual ~SVGAnimatedType(); 37 35 38 static PassOwnPtr<SVGAnimatedType> createAngle(SVGAngle* angle) 39 { 40 ASSERT(angle); 41 OwnPtr<SVGAnimatedType> animatedType = create(AnimatedAngle); 42 animatedType->m_data.angle = angle; 43 return animatedType.release(); 44 } 45 46 static PassOwnPtr<SVGAnimatedType> createLength(SVGLength* length) 47 { 48 ASSERT(length); 49 OwnPtr<SVGAnimatedType> animatedType = create(AnimatedLength); 50 animatedType->m_data.length = length; 51 return animatedType.release(); 52 } 53 54 virtual ~SVGAnimatedType() 55 { 56 switch (m_type) { 57 case AnimatedAngle: 58 delete m_data.angle; 59 break; 60 case AnimatedLength: 61 delete m_data.length; 62 break; 63 default: 64 ASSERT_NOT_REACHED(); 65 break; 66 } 67 } 36 static PassOwnPtr<SVGAnimatedType> createAngle(SVGAngle*); 37 static PassOwnPtr<SVGAnimatedType> createLength(SVGLength*); 38 static PassOwnPtr<SVGAnimatedType> createNumber(float*); 68 39 69 40 AnimatedAttributeType type() const { return m_type; } 70 41 71 SVGAngle& angle() 72 { 73 ASSERT(m_type == AnimatedAngle); 74 return *m_data.angle; 75 } 42 SVGAngle& angle(); 43 SVGLength& length(); 44 float& number(); 76 45 77 SVGLength& length() 78 { 79 ASSERT(m_type == AnimatedLength); 80 return *m_data.length; 81 } 82 83 String valueAsString() 84 { 85 switch (m_type) { 86 case AnimatedAngle: 87 ASSERT(m_data.angle); 88 return m_data.angle->valueAsString(); 89 case AnimatedLength: 90 ASSERT(m_data.length); 91 return m_data.length->valueAsString(); 92 default: 93 break; 94 } 95 ASSERT_NOT_REACHED(); 96 return String(); 97 } 98 99 bool setValueAsString(const QualifiedName& attrName, const String& value) 100 { 101 ExceptionCode ec = 0; 102 switch (m_type) { 103 case AnimatedAngle: 104 ASSERT(m_data.angle); 105 m_data.angle->setValueAsString(value, ec); 106 break; 107 case AnimatedLength: 108 ASSERT(m_data.length); 109 m_data.length->setValueAsString(value, SVGLength::lengthModeForAnimatedLengthAttribute(attrName), ec); 110 break; 111 default: 112 ASSERT_NOT_REACHED(); 113 break; 114 } 115 return !ec; 116 } 46 String valueAsString(); 47 bool setValueAsString(const QualifiedName&, const String&); 117 48 118 49 private: 119 SVGAnimatedType(AnimatedAttributeType type) 120 : m_type(type) 121 { 122 } 50 SVGAnimatedType(AnimatedAttributeType); 123 51 124 52 AnimatedAttributeType m_type; … … 133 61 SVGAngle* angle; 134 62 SVGLength* length; 63 float* number; 135 64 } m_data; 136 65 }; -
trunk/Source/WebCore/svg/SVGAnimatorFactory.h
r89187 r89220 24 24 #include "SVGAnimatedAngle.h" 25 25 #include "SVGAnimatedLength.h" 26 #include "SVGAnimatedNumber.h" 26 27 27 28 namespace WebCore { … … 37 38 case AnimatedLength: 38 39 return adoptPtr(new SVGAnimatedLengthAnimator(contextElement, attributeName)); 40 case AnimatedNumber: 41 return adoptPtr(new SVGAnimatedNumberAnimator(contextElement, attributeName)); 39 42 default: 40 43 ASSERT_NOT_REACHED(); -
trunk/Source/WebCore/svg/SVGParserUtilities.cpp
r89187 r89220 152 152 const UChar* ptr = string.characters(); 153 153 const UChar* end = ptr + string.length(); 154 return genericParseNumber(ptr, end, number, skip) ;154 return genericParseNumber(ptr, end, number, skip) && ptr == end; 155 155 } 156 156
Note:
See TracChangeset
for help on using the changeset viewer.