2012-04-03 Nikolas Zimmermann <nzimmermann@rim.com>
Enable animVal support for SVGAnimatedEnumeration
https://bugs.webkit.org/show_bug.cgi?id=82459
Reviewed by Dirk Schulze.
Add new tests for all SVGAnimatedEnumeration in the SVG DOM to proof they animate and update animVal correctly.
* platform/gtk/Skipped: Unskip svgenum tests.
* svg/animations/animate-marker-orient-from-angle-to-angle-expected.txt: Added.
* svg/animations/animate-marker-orient-from-angle-to-angle.html: Added.
* svg/animations/animate-marker-orient-from-angle-to-auto-expected.txt: Added.
* svg/animations/animate-marker-orient-from-angle-to-auto.html: Added.
* svg/animations/animate-marker-orient-to-angle-expected.txt: Added.
* svg/animations/animate-marker-orient-to-angle.html: Added.
* svg/animations/script-tests/animate-marker-orient-from-angle-to-angle.js: Added.
(sample1):
(sample2):
(sample3):
(sample4):
(executeTest):
* svg/animations/script-tests/animate-marker-orient-from-angle-to-auto.js: Added.
(sample1):
(sample2):
(sample3):
(executeTest):
* svg/animations/script-tests/animate-marker-orient-to-angle.js: Added.
(sample1):
(sample2):
(sample3):
(executeTest):
* svg/animations/script-tests/svgangle-animation-deg-to-grad.js:
(sample1):
(sample2):
(sample3):
* svg/animations/script-tests/svgangle-animation-deg-to-rad.js:
(sample1):
(sample2):
(sample3):
* svg/animations/script-tests/svgangle-animation-grad-to-deg.js:
(sample1):
(sample2):
(sample3):
* svg/animations/script-tests/svgangle-animation-grad-to-rad.js:
(sample1):
(sample2):
(sample3):
* svg/animations/script-tests/svgangle-animation-rad-to-deg.js:
(sample1):
(sample2):
(sample3):
* svg/animations/script-tests/svgangle-animation-rad-to-grad.js:
(sample1):
(sample2):
(sample3):
* svg/animations/script-tests/svgenum-animation-1.js: Added.
(sample1):
(sample2):
(executeTest):
* svg/animations/script-tests/svgenum-animation-10.js: Added.
(sample1):
(sample2):
(executeTest):
* svg/animations/script-tests/svgenum-animation-11.js: Added.
(sample1):
(sample2):
(sample3):
(sample4):
(sample5):
(executeTest):
* svg/animations/script-tests/svgenum-animation-12.js: Added.
(sample1):
(sample2):
(sample3):
(executeTest):
* svg/animations/script-tests/svgenum-animation-13.js: Added.
(sample1):
(sample2):
(sample3):
(sample4):
(executeTest):
* svg/animations/script-tests/svgenum-animation-2.js: Added.
(sample1):
(sample2):
(sample3):
(executeTest):
* svg/animations/script-tests/svgenum-animation-3.js: Added.
(sample1):
(sample2):
(executeTest):
* svg/animations/script-tests/svgenum-animation-4.js: Added.
(sample1):
(sample2):
(sample3):
(sample4):
(sample5):
(sample6):
(executeTest):
* svg/animations/script-tests/svgenum-animation-5.js: Added.
(sample1):
(sample2):
(executeTest):
* svg/animations/script-tests/svgenum-animation-6.js: Added.
(sample1):
(sample2):
(sample3):
(sample4):
(executeTest):
* svg/animations/script-tests/svgenum-animation-7.js: Added.
(sample1):
(sample2):
(executeTest):
* svg/animations/script-tests/svgenum-animation-8.js: Added.
(sample1):
(sample2):
(sample3):
(sample4):
(sample5):
(executeTest):
* svg/animations/script-tests/svgenum-animation-9.js: Added.
(sample1):
(sample2):
(executeTest):
* svg/animations/svgangle-animation-deg-to-grad-expected.txt:
* svg/animations/svgangle-animation-deg-to-rad-expected.txt:
* svg/animations/svgangle-animation-grad-to-deg-expected.txt:
* svg/animations/svgangle-animation-grad-to-rad-expected.txt:
* svg/animations/svgangle-animation-rad-to-deg-expected.txt:
* svg/animations/svgangle-animation-rad-to-grad-expected.txt:
* svg/animations/svgenum-animation-1-expected.txt: Added.
* svg/animations/svgenum-animation-1.html: Added.
* svg/animations/svgenum-animation-10-expected.txt: Added.
* svg/animations/svgenum-animation-10.html: Added.
* svg/animations/svgenum-animation-11-expected.txt: Added.
* svg/animations/svgenum-animation-11.html: Added.
* svg/animations/svgenum-animation-12-expected.txt: Added.
* svg/animations/svgenum-animation-12.html: Added.
* svg/animations/svgenum-animation-13-expected.txt: Added.
* svg/animations/svgenum-animation-13.html: Added.
* svg/animations/svgenum-animation-2-expected.txt: Added.
* svg/animations/svgenum-animation-2.html: Added.
* svg/animations/svgenum-animation-3-expected.txt: Added.
* svg/animations/svgenum-animation-3.html: Added.
* svg/animations/svgenum-animation-4-expected.txt: Added.
* svg/animations/svgenum-animation-4.html: Added.
* svg/animations/svgenum-animation-5-expected.txt: Added.
* svg/animations/svgenum-animation-5.html: Added.
* svg/animations/svgenum-animation-6-expected.txt: Added.
* svg/animations/svgenum-animation-6.html: Added.
* svg/animations/svgenum-animation-7-expected.txt: Added.
* svg/animations/svgenum-animation-7.html: Added.
* svg/animations/svgenum-animation-8-expected.txt: Added.
* svg/animations/svgenum-animation-8.html: Added.
* svg/animations/svgenum-animation-9-expected.txt: Added.
* svg/animations/svgenum-animation-9.html: Added.
2012-04-03 Nikolas Zimmermann <nzimmermann@rim.com>
Enable animVal support for SVGAnimatedEnumeration
https://bugs.webkit.org/show_bug.cgi?id=82459
Reviewed by Dirk Schulze.
Enable animVal support for the last missing SVG DOM primitive: SVGAnimatedEnumeration.
It's a bit more involved than the others as we have to differentiate between the various
enumerations to use the correct SVGPropertyTraits<MyEnum>::fromString() code-path.
One SVGAnimatedEnumeration property in the SVG DOM is special: SVGAnimatedEnumeration orientType
from SVGMarkerElement. SVGMarkerElement exposes both the orientType and SVGAnimatedAngle orientAngle
SVG DOM properties and both get mapped to the same SVGNames::orientAttr ("orient" XML attribute).
That means that any animation of the orientAttr has to update both orientType & orientAngle.
This is a not a new requirement, we already support attributes like 'stdDeviation' from
SVGFEGaussianBlurElement, which get mapped to multiple SVG DOM objects: SVGAnimatedInteger stdDeviationX/Y.
The difference is that <integer-optional-integer> or <number-optional-number> animations use the
same type in the pair<xxx, xxx> (eg. both int, or both float). The 'orient' attribute needs to be
mapped to pair<xxx, yyy> types. Generalize the templates in SVGAnimatedTypeAnimator to support that.
Example:
<marker id="someMarkerElement" orient="45deg"/>
<animate fill="remove" begin="1s" dur="2s" from="90deg" to="auto" attributeName="orient" xlink:href="#someMarkerElement"/>
at 0s: someMarkerElement.orientType.animVal = SVGMarkerElement.SVG_MARKER_ORIENT_ANGLE
someMarkerElement.orientAngle.animVal.value = 45
someMarkerElement.orientType.baseVal = SVGMarkerElement.SVG_MARKER_ORIENT_ANGLE
someMarkerElement.orientAngle.baseVal.value = 45
at 1s: someMarkerElement.orientType.animVal = SVGMarkerElement.SVG_MARKER_ORIENT_ANGLE
someMarkerElement.orientAngle.animVal.value = 90
someMarkerElement.orientType.baseVal = SVGMarkerElement.SVG_MARKER_ORIENT_ANGLE
someMarkerElement.orientAngle.baseVal.value = 45
at 2s: someMarkerElement.orientType.animVal = SVGMarkerElement.SVG_MARKER_ORIENT_AUTO
someMarkerElement.orientAngle.animVal.value = 0
someMarkerElement.orientType.baseVal = SVGMarkerElement.SVG_MARKER_ORIENT_ANGLE
someMarkerElement.orientAngle.baseVal.value = 45
> 3s: someMarkerElement.orientType.animVal = SVGMarkerElement.SVG_MARKER_ORIENT_ANGLE
someMarkerElement.orientAngle.animVal.value = 45
someMarkerElement.orientType.baseVal = SVGMarkerElement.SVG_MARKER_ORIENT_ANGLE
someMarkerElement.orientAngle.baseVal.value = 45
We need to map the 'orient' attribute to a pair<SVGAngle, unsigned short> type, in order
to track both orientAngle & orientType at the same type. Fortunately SVGAnimatedAngle
is only used in the SVG DOM for SVGMarkerElements orientAngle property. We can directly
switch SVGAnimatedAngleAnimator to the new pair<SVGAngle, unsigned short> type instead
of having to introduce a special SVGAnimatedAngleAndEnumerationAnimator.
Added tests for all SVGAnimatedEnumeration properties in the SVG DOM, including an extensive set of tests
for the synchronization of the orientType / orientAngle properties, when they get animated.
Tests: svg/animations/animate-marker-orient-from-angle-to-angle.html
svg/animations/animate-marker-orient-from-angle-to-auto.html
svg/animations/animate-marker-orient-to-angle.html
svg/animations/svgenum-animation-1.html
svg/animations/svgenum-animation-10.html
svg/animations/svgenum-animation-11.html
svg/animations/svgenum-animation-12.html
svg/animations/svgenum-animation-13.html
svg/animations/svgenum-animation-2.html
svg/animations/svgenum-animation-3.html
svg/animations/svgenum-animation-4.html
svg/animations/svgenum-animation-5.html
svg/animations/svgenum-animation-6.html
svg/animations/svgenum-animation-7.html
svg/animations/svgenum-animation-8.html
svg/animations/svgenum-animation-9.html
* CMakeLists.txt:
* GNUmakefile.list.am:
* Target.pri:
* WebCore.gypi:
* WebCore.xcodeproj/project.pbxproj:
* svg/SVGAllInOne.cpp:
* svg/SVGAnimateElement.cpp:
(WebCore::SVGAnimateElement::determineAnimatedPropertyType):
(WebCore::SVGAnimateElement::calculateAnimatedValue):
(WebCore::propertyTypesAreConsistent):
(WebCore::SVGAnimateElement::applyResultsToTarget):
* svg/SVGAnimatedAngle.cpp:
(WebCore::SVGAnimatedAngleAnimator::constructFromString):
(WebCore::SVGAnimatedAngleAnimator::startAnimValAnimation):
(WebCore::SVGAnimatedAngleAnimator::stopAnimValAnimation):
(WebCore::SVGAnimatedAngleAnimator::resetAnimValToBaseVal):
(WebCore::SVGAnimatedAngleAnimator::animValWillChange):
(WebCore::SVGAnimatedAngleAnimator::animValDidChange):
(WebCore::SVGAnimatedAngleAnimator::calculateFromAndByValues):
(WebCore::SVGAnimatedAngleAnimator::calculateAnimatedValue):
* svg/SVGAnimatedAngle.h:
(WebCore):
* svg/SVGAnimatedBoolean.cpp:
(WebCore::SVGAnimatedBooleanAnimator::startAnimValAnimation):
(WebCore::SVGAnimatedBooleanAnimator::stopAnimValAnimation):
(WebCore::SVGAnimatedBooleanAnimator::resetAnimValToBaseVal):
* svg/SVGAnimatedEnumeration.cpp: Added.
(WebCore):
(WebCore::enumerationValueForTargetAttribute):
(WebCore::SVGAnimatedEnumerationAnimator::SVGAnimatedEnumerationAnimator):
(WebCore::SVGAnimatedEnumerationAnimator::constructFromString):
(WebCore::SVGAnimatedEnumerationAnimator::startAnimValAnimation):
(WebCore::SVGAnimatedEnumerationAnimator::stopAnimValAnimation):
(WebCore::SVGAnimatedEnumerationAnimator::resetAnimValToBaseVal):
(WebCore::SVGAnimatedEnumerationAnimator::animValWillChange):
(WebCore::SVGAnimatedEnumerationAnimator::animValDidChange):
(WebCore::SVGAnimatedEnumerationAnimator::calculateFromAndToValues):
(WebCore::SVGAnimatedEnumerationAnimator::calculateFromAndByValues):
(WebCore::SVGAnimatedEnumerationAnimator::calculateAnimatedValue):
(WebCore::SVGAnimatedEnumerationAnimator::calculateDistance):
* svg/SVGAnimatedEnumeration.h:
(SVGAnimatedEnumerationAnimator):
(WebCore::SVGAnimatedEnumerationAnimator::~SVGAnimatedEnumerationAnimator):
(WebCore):
* svg/SVGAnimatedInteger.cpp:
(WebCore::SVGAnimatedIntegerAnimator::startAnimValAnimation):
(WebCore::SVGAnimatedIntegerAnimator::stopAnimValAnimation):
(WebCore::SVGAnimatedIntegerAnimator::resetAnimValToBaseVal):
* svg/SVGAnimatedIntegerOptionalInteger.cpp:
(WebCore::SVGAnimatedIntegerOptionalIntegerAnimator::startAnimValAnimation):
(WebCore::SVGAnimatedIntegerOptionalIntegerAnimator::stopAnimValAnimation):
(WebCore::SVGAnimatedIntegerOptionalIntegerAnimator::resetAnimValToBaseVal):
(WebCore::SVGAnimatedIntegerOptionalIntegerAnimator::animValWillChange):
(WebCore::SVGAnimatedIntegerOptionalIntegerAnimator::animValDidChange):
* svg/SVGAnimatedLength.cpp:
(WebCore::SVGAnimatedLengthAnimator::startAnimValAnimation):
(WebCore::SVGAnimatedLengthAnimator::stopAnimValAnimation):
(WebCore::SVGAnimatedLengthAnimator::resetAnimValToBaseVal):
* svg/SVGAnimatedLengthList.cpp:
(WebCore::SVGAnimatedLengthListAnimator::startAnimValAnimation):
(WebCore::SVGAnimatedLengthListAnimator::stopAnimValAnimation):
(WebCore::SVGAnimatedLengthListAnimator::resetAnimValToBaseVal):
* svg/SVGAnimatedNumber.cpp:
(WebCore::SVGAnimatedNumberAnimator::startAnimValAnimation):
(WebCore::SVGAnimatedNumberAnimator::stopAnimValAnimation):
(WebCore::SVGAnimatedNumberAnimator::resetAnimValToBaseVal):
* svg/SVGAnimatedNumberList.cpp:
(WebCore::SVGAnimatedNumberListAnimator::startAnimValAnimation):
(WebCore::SVGAnimatedNumberListAnimator::stopAnimValAnimation):
(WebCore::SVGAnimatedNumberListAnimator::resetAnimValToBaseVal):
* svg/SVGAnimatedNumberOptionalNumber.cpp:
(WebCore::SVGAnimatedNumberOptionalNumberAnimator::startAnimValAnimation):
(WebCore::SVGAnimatedNumberOptionalNumberAnimator::stopAnimValAnimation):
(WebCore::SVGAnimatedNumberOptionalNumberAnimator::resetAnimValToBaseVal):
(WebCore::SVGAnimatedNumberOptionalNumberAnimator::animValWillChange):
(WebCore::SVGAnimatedNumberOptionalNumberAnimator::animValDidChange):
* svg/SVGAnimatedPreserveAspectRatio.cpp:
(WebCore::SVGAnimatedPreserveAspectRatioAnimator::startAnimValAnimation):
(WebCore::SVGAnimatedPreserveAspectRatioAnimator::stopAnimValAnimation):
(WebCore::SVGAnimatedPreserveAspectRatioAnimator::resetAnimValToBaseVal):
* svg/SVGAnimatedRect.cpp:
(WebCore::SVGAnimatedRectAnimator::startAnimValAnimation):
(WebCore::SVGAnimatedRectAnimator::stopAnimValAnimation):
(WebCore::SVGAnimatedRectAnimator::resetAnimValToBaseVal):
* svg/SVGAnimatedString.cpp:
(WebCore::SVGAnimatedStringAnimator::startAnimValAnimation):
(WebCore::SVGAnimatedStringAnimator::stopAnimValAnimation):
(WebCore::SVGAnimatedStringAnimator::resetAnimValToBaseVal):
* svg/SVGAnimatedTransformList.cpp:
(WebCore::SVGAnimatedTransformListAnimator::startAnimValAnimation):
(WebCore::SVGAnimatedTransformListAnimator::stopAnimValAnimation):
(WebCore::SVGAnimatedTransformListAnimator::resetAnimValToBaseVal):
* svg/SVGAnimatedType.cpp:
(WebCore::SVGAnimatedType::~SVGAnimatedType):
(WebCore::SVGAnimatedType::createAngleAndEnumeration):
(WebCore::SVGAnimatedType::createEnumeration):
(WebCore):
(WebCore::SVGAnimatedType::angleAndEnumeration):
(WebCore::SVGAnimatedType::enumeration):
(WebCore::SVGAnimatedType::valueAsString):
(WebCore::SVGAnimatedType::setValueAsString):
(WebCore::SVGAnimatedType::supportsAnimVal):
* svg/SVGAnimatedType.h:
(SVGAnimatedType):
* svg/SVGAnimatedTypeAnimator.h:
(WebCore::SVGAnimatedTypeAnimator::findAnimatedPropertiesForAttributeName):
(SVGAnimatedTypeAnimator):
(WebCore::SVGAnimatedTypeAnimator::constructFromBaseValue):
(WebCore::SVGAnimatedTypeAnimator::resetFromBaseValue):
(WebCore::SVGAnimatedTypeAnimator::stopAnimValAnimationForType):
(WebCore::SVGAnimatedTypeAnimator::animValDidChangeForType):
(WebCore::SVGAnimatedTypeAnimator::animValWillChangeForType):
(WebCore::SVGAnimatedTypeAnimator::constructFromBaseValues):
(WebCore::SVGAnimatedTypeAnimator::resetFromBaseValues):
(WebCore::SVGAnimatedTypeAnimator::stopAnimValAnimationForTypes):
(WebCore::SVGAnimatedTypeAnimator::animValDidChangeForTypes):
(WebCore::SVGAnimatedTypeAnimator::animValWillChangeForTypes):
(WebCore::SVGAnimatedTypeAnimator::castAnimatedPropertyToActualType):
(WebCore::SVGAnimatedTypeAnimator::executeAction):
* svg/SVGAnimatorFactory.h:
(WebCore::SVGAnimatorFactory::create):
* svg/SVGMarkerElement.cpp:
(WebCore):
* svg/properties/SVGAnimatedListPropertyTearOff.h:
(SVGAnimatedListPropertyTearOff):
* svg/properties/SVGAnimatedPropertyTearOff.h:
(SVGAnimatedPropertyTearOff):
* svg/properties/SVGAnimatedStaticPropertyTearOff.h:
(SVGAnimatedStaticPropertyTearOff):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@113003 268f45cc-cd09-0410-ab3c-d52691b4dbfc
96 files changed