8000 [SVG] Handle animation freeze when 'repeatDur' is not a multiple of '… · WebKit/WebKit@72c7fe6 · GitHub
[go: up one dir, main page]

Skip to content

Commit 72c7fe6

Browse files
Ahmad-S792Ahmad Saleem
authored andcommitted
[SVG] Handle animation freeze when 'repeatDur' is not a multiple of 'dur'
[SVG] Handle animation freeze when 'repeatDur' is not a multiple of 'dur' https://bugs.webkit.org/show_bug.cgi?id=250977 Reviewed by Simon Fraser. This patch is to align WebKit with Blink / Chromium and Gecko / Firefox. Merge - https://src.chromium.org/viewvc/blink?view=revision&revision=154777 This patch reinstate the logic which was present originally in WebKit but later remove, it is meant to handle the scenario 'repeatingDuration' is not a multiple of 'simpleDuration'. * Source/WebCore/svg/animation/SVGSMILElement.cpp: (SVGSMILElement::calculateAnimationPercentAndRepeat): Update to handle multiple of 'simpleDuration' * LayoutTests/imported/w3c/web-platform-tests/svg/animations/animate-fill-freeze-with-repeatDur-expected.txt: Rebaselined Canonical link: https://commits.webkit.org/259212@main
1 parent 66b2832 commit 72c7fe6

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11

2-
FAIL Test for animation freeze when repeatDur is not a multiple of dur assert_approx_equals: expected 150 +/- 1 but got 50
2+
PASS Test for animation freeze when repeatDur is not a multiple of dur
33

Source/WebCore/svg/animation/SVGSMILElement.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* Copyright (C) 2008-2023 Apple Inc. All rights reserved.
3-
* Copyright (C) 2014 Google Inc. All rights reserved.
3+
* Copyright (C) 2013-2014 Google Inc. All rights reserved.
44
*
55
* Redistribution and use in source and binary forms, with or without
66
* modification, are permitted provided that the following conditions
@@ -1025,7 +1025,9 @@ float SVGSMILElement::calculateAnimationPercentAndRepeat(SMILTime elapsed, unsig
10251025
SMILTime activeTime = elapsed - m_intervalBegin;
10261026
SMILTime repeatingDuration = this->repeatingDuration();
10271027
if (elapsed >= m_intervalEnd || activeTime > repeatingDuration) {
1028-
repeat = static_cast<unsigned>(repeatingDuration.value() / simpleDuration.value()) - 1;
1028+
repeat = static_cast<unsigned>(repeatingDuration.value() / simpleDuration.value());
1029+
if (!fmod(repeatingDuration.value(), simpleDuration.value()))
1030+
--repeat;
10291031

10301032
double percent = (m_intervalEnd.value() - m_intervalBegin.value()) / simpleDuration.value();
10311033
percent = percent - floor(percent);

0 commit comments

Comments
 (0)
0