haikuwebkit/LayoutTests/svg/animations/fill-remove-support-expecte...

61 lines
2.0 KiB
Plaintext
Raw Permalink Normal View History

SVG <animateMotion> does not reset the element to its first animation frame if its fill is "remove" https://bugs.webkit.org/show_bug.cgi?id=201565 Reviewed by Said Abou-Hallawa. Source/WebCore: Fix fill="remove" support for <animateMotion>: properly trigger visual updates. Motion animations are implemented by provding an additional transformation on SVGGraphicsElements: the supplementalTransform(). When an <animateMotion> element specifies fill="remove" the supplemental transform is correctly reset, when the animation is finished. However, nobody is notified about the change of transformation matrix. Fix by marking the target elements renderer as setNeedsTransformUpdate() and call markForLayoutAndParentResourceInvalidation(). <animate> elements are not affected by the bug: SVGAnimateElementBase::clearAnimatedType() -> invokes SVGAttributeAnimator::stop() -> invokes applyAnimatedPropertyChange() [via SVGAnimatedPropertyAnimator] -> invokes SVGXXXElement::svgAttributeChanged(). When animating e.g. the 'transform' attribute SVGGraphicsElement::svgAttributeChanged() will use exactly the same mechanism to trigger visul updates: first call setNeedsTransformUpdate() on the associated renderer, followd by a call to markForLayoutAndParentResourceInvalidation(). --> Both code paths are now consistent. Also fixes http://web-platform-tests.live/svg/animations/animateMotion-fill-remove.html. Tests: svg/animations/fill-remove-support.html svg/animations/animateMotion-remove-freeze-use.svg * svg/SVGAnimateMotionElement.cpp: (WebCore::SVGAnimateMotionElement::clearAnimatedType): Call applyResultsToTarget(). (WebCore::SVGAnimateMotionElement::calculateAnimatedValue): Stop calling setNeedsTransformUpdate() on the target elements renderer, since applyResultsToTarget() is responsible for modifications of the renderer state. (WebCore::SVGAnimateMotionElement::applyResultsToTarget): Always mark the renderer as setNeedsTransformUpdate() when applying the results, before the call to RenderSVGResource::markForLayoutAndParentResourceInvalidation(). This is more consistent with respect to the code path that updates the SVGElements instances (<use> support). LayoutTests: Add a layout test covering fill="remove" support <animate> and <animateMotion>. Add another layout test covering both fill="remove" and fill="freeze" for <animateMotion> on SVG elements and their instances (<use>). * svg/animations/animateMotion-remove-freeze-use-expected.svg: Added. * svg/animations/animateMotion-remove-freeze-use.svg: Added. * svg/animations/fill-remove-support-expected.txt: Added. * svg/animations/fill-remove-support.html: Added. * svg/animations/resources/fill-remove-support.svg: Added. Canonical link: https://commits.webkit.org/215523@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@249974 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-09-17 19:23:56 +00:00
SVG 1.1 dynamic animation tests
This tests fill=remove for animate and animateMotion
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
Check state before/after animation
PASS animateMotionRect.getBoundingClientRect().x is 10
PASS animateMotionRect.getBBox().x is 10
PASS animateRect.getBBox().x is 10
PASS animateRect.getBoundingClientRect().x is 10
PASS animateRect.x.animVal.value is 10
PASS animateRect.x.baseVal.value is 10
Check state right after the beginning of the animation
PASS animateMotionRect.getBoundingClientRect().x is 20
PASS animateMotionRect.getBBox().x is 10
PASS animateRect.getBBox().x is 20
PASS animateRect.getBoundingClientRect().x is 20
PASS animateRect.x.animVal.value is 20
PASS animateRect.x.baseVal.value is 10
Check state in the middle of the animation
PASS animateMotionRect.getBoundingClientRect().x is 115
PASS animateMotionRect.getBBox().x is 10
PASS animateRect.getBBox().x is 115
PASS animateRect.getBoundingClientRect().x is 115
PASS animateRect.x.animVal.value is 115
PASS animateRect.x.baseVal.value is 10
Check state just before the end of the animation
PASS animateMotionRect.getBoundingClientRect().x is 210
PASS animateMotionRect.getBBox().x is 10
PASS animateRect.getBBox().x is 210
PASS animateRect.getBoundingClientRect().x is 210
PASS animateRect.x.animVal.value is 210
PASS animateRect.x.baseVal.value is 10
Check state before/after animation
PASS animateMotionRect.getBoundingClientRect().x is 10
PASS animateMotionRect.getBBox().x is 10
PASS animateRect.getBBox().x is 10
PASS animateRect.getBoundingClientRect().x is 10
PASS animateRect.x.animVal.value is 10
PASS animateRect.x.baseVal.value is 10
Check state before/after animation
PASS animateMotionRect.getBoundingClientRect().x is 10
PASS animateMotionRect.getBBox().x is 10
PASS animateRect.getBBox().x is 10
PASS animateRect.getBoundingClientRect().x is 10
PASS animateRect.x.animVal.value is 10
PASS animateRect.x.baseVal.value is 10
PASS successfullyParsed is true
TEST COMPLETE