Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: ea32b77b2786ebbe88c58a70fe96072b47a405da
      
https://github.com/WebKit/WebKit/commit/ea32b77b2786ebbe88c58a70fe96072b47a405da
  Author: Ahmad Saleem <[email protected]>
  Date:   2026-08-11 (Tue, 11 Aug 2026)

  Changed paths:
    A 
LayoutTests/imported/w3c/web-platform-tests/svg/animations/animateMotion-path-moveto-only-expected.txt
    A 
LayoutTests/imported/w3c/web-platform-tests/svg/animations/animateMotion-path-moveto-only.html
    A 
LayoutTests/imported/w3c/web-platform-tests/svg/animations/animateMotion-path-zero-length-subpaths-expected.txt
    A 
LayoutTests/imported/w3c/web-platform-tests/svg/animations/animateMotion-path-zero-length-subpaths.html
    M Source/WebCore/svg/SVGAnimateMotionElement.cpp

  Log Message:
  -----------
  <animateMotion> ignores a zero-length motion path
https://bugs.webkit.org/show_bug.cgi?id=321478
rdar://184569273

Reviewed by Nikolas
Zimmermann.

This patch aligns WebKit with Gecko / Firefox and Blink / Chromium.

path="M 100 100" is a legal motion path of length 0, so every t/dur distance
along it resolves to its initial point and the element should sit at (100,100)
for the whole animation. Instead it never moves.

calculateAnimatedValue() translated only when PathTraversalState::success() was
set, and a zero-length path never sets it: the traversal marks a zero vector on
the first element and waits for a second one to resolve it, which a lone moveto
never provides. Both the position and the accumulated repeats were skipped, so
the result depended on spelling -- "M 100 100 L 100 100" and "M 100 100 Z" have
a second element and do translate to (100,100).

Translate by current() unconditionally. It already holds the initial point in
the failing case, and it is what successful traversals were reading anyway, so
those are unaffected. The angle does not change either: normalAngle() is 0 here,
which
is what rotate="auto" already resolved to.

Chrome and Firefox both place the element at the initial point, and
accumulate="sum" now steps (100,100) -> (200,200), as all three engines already
do for the two-element spelling.

Tests: 
imported/w3c/web-platform-tests/svg/animations/animateMotion-path-moveto-only.html
 
imported/w3c/web-platform-tests/svg/animations/animateMotion-path-zero-length-subpaths.html

* 
LayoutTests/imported/w3c/web-platform-tests/svg/animations/animateMotion-path-moveto-only-expected.txt:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/svg/animations/animateMotion-path-moveto-only.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/svg/animations/animateMotion-path-zero-length-subpaths-expected.txt:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/svg/animations/animateMotion-path-zero-length-subpaths.html:
 Added.
*
Source/WebCore/svg/SVGAnimateMotionElement.cpp:
(WebCore::SVGAnimateMotionElement::calculateAnimatedValue):

Canonical link: 
https://flagged.apple.com:443/proxy?t2=DC0W8B4EV1&o=aHR0cHM6Ly9jb21taXRzLndlYmtpdC5vcmcvMzE4OTYzQG1haW4=&emid=ff429f62-7858-4129-9951-5c6211b7ecbb&c=11



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to