[Webkit-unassigned] [Bug 140164] New: Animation is stopped not at the destination position sometimes.

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Jan 6 18:55:27 PST 2015


https://bugs.webkit.org/show_bug.cgi?id=140164

            Bug ID: 140164
           Summary: Animation is stopped not at the destination position
                    sometimes.
    Classification: Unclassified
           Product: WebKit
           Version: 528+ (Nightly build)
          Hardware: All
                OS: Linux
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: Animations
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: mwang at opentv.com
                CC: dino at apple.com

If -webkit-animation-iteration-count of an animation is not infinite, the animation should stop at the destination. But if CPU is low and very busy, the animation could stop in the middle of the origination and the destination.

The problem is in normalizedAnimationValue() of GraphicsLayerAnimation.cpp:
static double normalizedAnimationValue(double runningTime, double duration, Animation::AnimationDirection direction, double iterationCount)
{
    if (!duration)
        return 0;

    const int loopCount = runningTime / duration;
    const double lastFullLoop = duration * double(loopCount);
    const double remainder = runningTime - lastFullLoop;
    // Ignore remainder when we've reached the end of animation.
    const double normalized = (loopCount == iterationCount) ? 1.0 : (remainder / duration);

    return shouldReverseAnimationValue(direction, loopCount) ? 1 - normalized : normalized;
} 

if CPU is busy and low, loopCount could be bigger than iterationCount, for example iterationCount is 1.0 and loopCount is 2. For such case (iterationCount is 1.0 and loopCount is 2), normalized  should be 1.0, not remainder/duration which causes that animations stop in the middle of the origination and the destination. 

So the possible fix is:
    const double normalized = (loopCount >= iterationCount && iterationCount > 0) ? 1.0 : (remainder / duration);

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20150107/5ac694d9/attachment-0002.html>


More information about the webkit-unassigned mailing list