Changeset 56685 in webkit


Ignore:
Timestamp:
Mar 28, 2010 2:46:06 AM (14 years ago)
Author:
eric@webkit.org
Message:

2010-03-28 Kim Grönholm <kim.gronholm@nomovok.com>

Reviewed by Simon Hausmann.

[Qt] GraphicsLayer: Timing functions don't work with transitions
https://bugs.webkit.org/show_bug.cgi?id=36589

If the animation value doesn't have timing function set, we need to
use the animation's timing function.

Fixed also a bug in passing the duration to solveCubicBezierFunction.
The duration was divided two times by 1000 and meanwhile casted to int.
It needs to be kept as double and divided by 1000 only once.

Test case: https://bugs.webkit.org/attachment.cgi?id=51619

  • platform/graphics/qt/GraphicsLayerQt.cpp: (WebCore::applyTimingFunction): (WebCore::AnimationQt:::AnimationQtBase): (WebCore::AnimationQt::updateCurrentTime):
Location:
trunk/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r56684 r56685  
     12010-03-28  Kim Grönholm  <kim.gronholm@nomovok.com>
     2
     3        Reviewed by Simon Hausmann.
     4
     5        [Qt] GraphicsLayer: Timing functions don't work with transitions
     6        https://bugs.webkit.org/show_bug.cgi?id=36589
     7
     8        If the animation value doesn't have timing function set, we need to
     9        use the animation's timing function.
     10       
     11        Fixed also a bug in passing the duration to solveCubicBezierFunction.
     12        The duration was divided two times by 1000 and meanwhile casted to int.
     13        It needs to be kept as double and divided by 1000 only once.
     14
     15        Test case: https://bugs.webkit.org/attachment.cgi?id=51619
     16
     17        * platform/graphics/qt/GraphicsLayerQt.cpp:
     18        (WebCore::applyTimingFunction):
     19        (WebCore::AnimationQt:::AnimationQtBase):
     20        (WebCore::AnimationQt::updateCurrentTime):
     21
    1222010-03-27  Joseph Pecoraro  <joepeck@webkit.org>
    223
  • trunk/WebCore/platform/graphics/qt/GraphicsLayerQt.cpp

    r56523 r56685  
    972972// we want the timing function to be as close as possible to what the web-developer intended, so we're using the same function used by WebCore when compositing is disabled
    973973// Using easing-curves would probably work for some of the cases, but wouldn't really buy us anything as we'd have to convert the bezier function back to an easing curve
    974 static inline qreal applyTimingFunction(const TimingFunction& timingFunction, qreal progress, int duration)
    975 {
    976         if (timingFunction.type() == LinearTimingFunction)
    977             return progress;
    978         if (timingFunction.type() == CubicBezierTimingFunction) {
    979             return solveCubicBezierFunction(timingFunction.x1(),
    980                                             timingFunction.y1(),
    981                                             timingFunction.x2(),
    982                                             timingFunction.y2(),
    983                                             double(progress), double(duration) / 1000);
    984         }
     974static inline qreal applyTimingFunction(const TimingFunction& timingFunction, qreal progress, double duration)
     975{
     976    if (timingFunction.type() == LinearTimingFunction)
    985977        return progress;
     978    if (timingFunction.type() == CubicBezierTimingFunction) {
     979        return solveCubicBezierFunction(timingFunction.x1(),
     980                                        timingFunction.y1(),
     981                                        timingFunction.x2(),
     982                                        timingFunction.y2(),
     983                                        double(progress), double(duration) / 1000);
     984    }
     985    return progress;
    986986}
    987987
     
    10561056            if (animationValue->timingFunction())
    10571057                keyframeValue.timingFunction = *animationValue->timingFunction();
     1058            else
     1059                keyframeValue.timingFunction = anim->timingFunction();
    10581060            webkitAnimationToQtAnimationValue(animationValue, keyframeValue.value);
    10591061            m_keyframeValues[animationValue->keyTime()] = keyframeValue;
     
    11041106        progress = (!progress || progress == 1 || it.key() == it2.key())
    11051107                                         ? progress
    1106                                          : applyTimingFunction(timingFunc, (progress - it.key()) / (it2.key() - it.key()), duration() / 1000);
     1108                                         : applyTimingFunction(timingFunc, (progress - it.key()) / (it2.key() - it.key()), duration());
    11071109        applyFrame(fromValue, toValue, progress);
    11081110    }
Note: See TracChangeset for help on using the changeset viewer.