Implement animatedPathSegList support for SVGPathElement
authorzimmermann@webkit.org <zimmermann@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 4 Apr 2012 13:52:46 +0000 (13:52 +0000)
committerzimmermann@webkit.org <zimmermann@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 4 Apr 2012 13:52:46 +0000 (13:52 +0000)
commite48843b03621f3a2e2f385b32fb8b04d2a821387
tree57cfc6aebfc88d83a88ff4d8c46b3272f0e3625a
parent9dbf283b121b83ce411adb9c98fcaf4681880c69
Implement animatedPathSegList support for SVGPathElement
https://bugs.webkit.org/show_bug.cgi?id=83140

Reviewed by Zoltan Herczeg.

Source/WebCore:

Add the last missing piece of animVal support: animations of the SVGPathElement's 'd' attribute
should be reflected in the 'animatedPathSegList' not the 'pathSegList'.

The SVGAnimatedPathAnimator is special as it doesn't operate on the SVGPathSegList types
directly, but on the SVGPathByteStreams for performance reasons. The SVGPathSegLists
are refcounted and exposed to JS, thus require lots of memory, compared to a simple
byte stream, which SVGPathByteStream is. Only build an 'animatedPathSegList' while
animating if its actually observed by the bindings, as this operation is heavy.

This marks the finish of the animVal patch series: no more string round trips during
animation. Previously paths were animated as byte streams, then converted to a String
passed to pathElement->setAttribute("d", "newString"), parsed again to a byte stream, etc.

A follow-up patch will remove the last crufts of direct setAttribute() animation.

Extend all existing animated SVGPathElement tests to cover animatedPathSegList.

* svg/SVGAnimatedColor.h:
(WebCore::SVGAnimatedColorAnimator::startAnimValAnimation):
(WebCore::SVGAnimatedColorAnimator::stopAnimValAnimation):
(WebCore::SVGAnimatedColorAnimator::resetAnimValToBaseVal):
(WebCore::SVGAnimatedColorAnimator::animValWillChange):
(WebCore::SVGAnimatedColorAnimator::animValDidChange):
(SVGAnimatedColorAnimator):
* svg/SVGAnimatedPath.cpp:
(WebCore::SVGAnimatedPathAnimator::constructFromString):
(WebCore::SVGAnimatedPathAnimator::startAnimValAnimation):
(WebCore):
(WebCore::SVGAnimatedPathAnimator::stopAnimValAnimation):
(WebCore::SVGAnimatedPathAnimator::resetAnimValToBaseVal):
(WebCore::SVGAnimatedPathAnimator::animValWillChange):
(WebCore::SVGAnimatedPathAnimator::animValDidChange):
(WebCore::SVGAnimatedPathAnimator::calculateAnimatedValue):
* svg/SVGAnimatedPath.h:
(SVGAnimatedPathAnimator):
* svg/SVGAnimatedType.cpp:
(WebCore::SVGAnimatedType::valueAsString):
(WebCore::SVGAnimatedType::setValueAsString):
(WebCore::SVGAnimatedType::supportsAnimVal):
* svg/SVGAnimatedTypeAnimator.h:
(SVGAnimatedTypeAnimator):
(WebCore::SVGAnimatedTypeAnimator::findAnimatedPropertiesForAttributeName):
* svg/SVGPathElement.cpp:
(WebCore::SVGPathElement::SVGPathElement):
(WebCore::SVGPathElement::getTotalLength):
(WebCore::SVGPathElement::getPointAtLength):
(WebCore::SVGPathElement::getPathSegAtLength):
(WebCore::SVGPathElement::parseAttribute):
(WebCore::SVGPathElement::svgAttributeChanged):
(WebCore::SVGPathElement::pathByteStream):
(WebCore):
(WebCore::SVGPathElement::lookupOrCreateDWrapper):
(WebCore::SVGPathElement::pathSegList):
(WebCore::SVGPathElement::animatedPathSegList):
(WebCore::SVGPathElement::pathSegListChanged):
* svg/SVGPathElement.h:
(WebCore):
(SVGPathElement):
(WebCore::SVGPathElement::isAnimValObserved):
* svg/SVGPathParserFactory.cpp:
(WebCore::SVGPathParserFactory::buildSVGPathByteStreamFromSVGPathSegList):
(WebCore::SVGPathParserFactory::buildSVGPathByteStreamFromString):
(WebCore::SVGPathParserFactory::buildAnimatedSVGPathByteStream):
* svg/SVGPathParserFactory.h:
(SVGPathParserFactory):
* svg/SVGPathSegWithContext.h:
* svg/properties/SVGAnimatedListPropertyTearOff.h:
(SVGAnimatedListPropertyTearOff):
(WebCore::SVGAnimatedListPropertyTearOff::baseVal):
(WebCore::SVGAnimatedListPropertyTearOff::animVal):
(WebCore::SVGAnimatedListPropertyTearOff::removeItemFromList):
(WebCore::SVGAnimatedListPropertyTearOff::detachListWrappers):
(WebCore::SVGAnimatedListPropertyTearOff::currentAnimatedValue):
(WebCore::SVGAnimatedListPropertyTearOff::animationStarted):
(WebCore::SVGAnimatedListPropertyTearOff::animationEnded):
(WebCore::SVGAnimatedListPropertyTearOff::synchronizeWrappersIfNeeded):
* svg/properties/SVGAnimatedPathSegListPropertyTearOff.h:
(WebCore::SVGAnimatedPathSegListPropertyTearOff::baseVal):
(WebCore::SVGAnimatedPathSegListPropertyTearOff::animVal):
(WebCore::SVGAnimatedPathSegListPropertyTearOff::removeItemFromList):
(SVGAnimatedPathSegListPropertyTearOff):
(WebCore::SVGAnimatedPathSegListPropertyTearOff::animationStarted):
(WebCore::SVGAnimatedPathSegListPropertyTearOff::animationEnded):
(WebCore::SVGAnimatedPathSegListPropertyTearOff::animValDidChange):
(WebCore::SVGAnimatedPathSegListPropertyTearOff::animatedPathByteStream):
(WebCore::SVGAnimatedPathSegListPropertyTearOff::SVGAnimatedPathSegListPropertyTearOff):
* svg/properties/SVGAnimatedTransformListPropertyTearOff.h:
(WebCore::SVGAnimatedTransformListPropertyTearOff::baseVal):
(WebCore::SVGAnimatedTransformListPropertyTearOff::animVal):
* svg/properties/SVGListProperty.h:
(WebCore::SVGListProperty::setValuesAndWrappers):
(WebCore::SVGListProperty::SVGListProperty):
(WebCore::SVGListProperty::~SVGListProperty):
(SVGListProperty):

LayoutTests:

Update all tests animating the SVGPathElement's 'd' attribute to verify 'animatedPathSegList' now gets animated, not 'pathSegList'.

* svg/animations/animate-path-animation-Cc-Ss-expected.txt:
* svg/animations/animate-path-animation-Ll-Vv-Hh-expected.txt:
* svg/animations/animate-path-animation-Qq-Tt-expected.txt:
* svg/animations/animate-path-animation-cC-sS-inverse-expected.txt:
* svg/animations/animate-path-animation-lL-vV-hH-inverse-expected.txt:
* svg/animations/animate-path-animation-qQ-tT-inverse-expected.txt:
* svg/animations/animate-path-to-animation-expected.txt:
* svg/animations/script-tests/animate-path-animation-Cc-Ss.js:
(checkBaseVal):
(sample1):
(sample2):
(sample3):
(sample4):
* svg/animations/script-tests/animate-path-animation-Ll-Vv-Hh.js:
(checkBaseVal):
(sample1):
(sample2):
(sample3):
(sample4):
* svg/animations/script-tests/animate-path-animation-Qq-Tt.js:
(checkBaseVal):
(sample1):
(sample2):
(sample3):
(sample4):
* svg/animations/script-tests/animate-path-animation-cC-sS-inverse.js:
(checkBaseVal):
(sample1):
(sample2):
(sample3):
(sample4):
* svg/animations/script-tests/animate-path-animation-lL-vV-hH-inverse.js:
(checkBaseVal):
(sample1):
(sample2):
(sample3):
(sample4):
* svg/animations/script-tests/animate-path-animation-qQ-tT-inverse.js:
(checkBaseVal):
(sample1):
(sample2):
(sample3):
(sample4):
* svg/animations/script-tests/animate-path-to-animation.js:
(checkBaseVal):
(sample1):
(sample2):
(sample3):
* svg/animations/script-tests/svgpath-animation-1.js:
(checkBaseVal):
(sample1):
(sample2):
(sample3):
* svg/animations/script-tests/svgtransform-animation-1.js:
* svg/animations/svgpath-animation-1-expected.txt:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@113184 268f45cc-cd09-0410-ab3c-d52691b4dbfc
33 files changed:
LayoutTests/ChangeLog
LayoutTests/svg/animations/animate-path-animation-Cc-Ss-expected.txt
LayoutTests/svg/animations/animate-path-animation-Ll-Vv-Hh-expected.txt
LayoutTests/svg/animations/animate-path-animation-Qq-Tt-expected.txt
LayoutTests/svg/animations/animate-path-animation-cC-sS-inverse-expected.txt
LayoutTests/svg/animations/animate-path-animation-lL-vV-hH-inverse-expected.txt
LayoutTests/svg/animations/animate-path-animation-qQ-tT-inverse-expected.txt
LayoutTests/svg/animations/animate-path-to-animation-expected.txt
LayoutTests/svg/animations/script-tests/animate-path-animation-Cc-Ss.js
LayoutTests/svg/animations/script-tests/animate-path-animation-Ll-Vv-Hh.js
LayoutTests/svg/animations/script-tests/animate-path-animation-Qq-Tt.js
LayoutTests/svg/animations/script-tests/animate-path-animation-cC-sS-inverse.js
LayoutTests/svg/animations/script-tests/animate-path-animation-lL-vV-hH-inverse.js
LayoutTests/svg/animations/script-tests/animate-path-animation-qQ-tT-inverse.js
LayoutTests/svg/animations/script-tests/animate-path-to-animation.js
LayoutTests/svg/animations/script-tests/svgpath-animation-1.js
LayoutTests/svg/animations/script-tests/svgtransform-animation-1.js
LayoutTests/svg/animations/svgpath-animation-1-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/svg/SVGAnimatedColor.h
Source/WebCore/svg/SVGAnimatedPath.cpp
Source/WebCore/svg/SVGAnimatedPath.h
Source/WebCore/svg/SVGAnimatedType.cpp
Source/WebCore/svg/SVGAnimatedTypeAnimator.h
Source/WebCore/svg/SVGPathElement.cpp
Source/WebCore/svg/SVGPathElement.h
Source/WebCore/svg/SVGPathParserFactory.cpp
Source/WebCore/svg/SVGPathParserFactory.h
Source/WebCore/svg/SVGPathSegWithContext.h
Source/WebCore/svg/properties/SVGAnimatedListPropertyTearOff.h
Source/WebCore/svg/properties/SVGAnimatedPathSegListPropertyTearOff.h
Source/WebCore/svg/properties/SVGAnimatedTransformListPropertyTearOff.h
Source/WebCore/svg/properties/SVGListProperty.h