[TexMap] Make GraphicsLayerAnimation choose a proper timing function.

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

Patch by Huang Dongsung <luxtella@company100.net> on 2012-10-29
Reviewed by Noam Rosenthal.

Currently, GraphicsLayerAnimation chooses a timing function in the wrong
way. Other GraphicsLayers choose a timing function in the similar way to
GraphicsLayerCA::timingFunctionForAnimationValue(). The way consists of
the following steps.
1. Try to query the timing function of the current keyframe animation value.
2. If the timing function of #1 is null, try to query the timing function of Animation.
3. If the timing function of #2 is null, return CubicBezierTimingFunction::defaultTimingFunction().

This patch makes GraphicsLayerAnimation choose a timing function in the same way
to other implementations.

Covered by existing animations tests.

* platform/graphics/GraphicsLayerAnimation.cpp:
(WebCore::timingFunctionForAnimationValue):
(WebCore::GraphicsLayerAnimation::apply):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@132798 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent bc0112ac
2012-10-29 Huang Dongsung <luxtella@company100.net>
[TexMap] Make GraphicsLayerAnimation choose a proper timing function.
https://bugs.webkit.org/show_bug.cgi?id=100623
Reviewed by Noam Rosenthal.
Currently, GraphicsLayerAnimation chooses a timing function in the wrong
way. Other GraphicsLayers choose a timing function in the similar way to
GraphicsLayerCA::timingFunctionForAnimationValue(). The way consists of
the following steps.
1. Try to query the timing function of the current keyframe animation value.
2. If the timing function of #1 is null, try to query the timing function of Animation.
3. If the timing function of #2 is null, return CubicBezierTimingFunction::defaultTimingFunction().
This patch makes GraphicsLayerAnimation choose a timing function in the same way
to other implementations.
Covered by existing animations tests.
* platform/graphics/GraphicsLayerAnimation.cpp:
(WebCore::timingFunctionForAnimationValue):
(WebCore::GraphicsLayerAnimation::apply):
2012-10-29 Patrick Dubroy <dubroy@chromium.org>
Web Inspector: Toolbar overflow appears outside window
......@@ -155,6 +155,15 @@ static TransformationMatrix applyTransformAnimation(const TransformOperations* f
return matrix;
}
static const TimingFunction* timingFunctionForAnimationValue(const AnimationValue* animValue, const Animation* anim)
{
if (animValue->timingFunction())
return animValue->timingFunction();
if (anim->timingFunction())
return anim->timingFunction().get();
return CubicBezierTimingFunction::defaultTimingFunction();
}
GraphicsLayerAnimation::GraphicsLayerAnimation(const String& name, const KeyframeValueList& keyframes, const IntSize& boxSize, const Animation* animation, double startTime, bool listsMatch)
: m_keyframes(keyframes)
......@@ -233,7 +242,8 @@ void GraphicsLayerAnimation::apply(Client* client)
return;
}
if (m_keyframes.size() == 2) {
normalizedValue = applyTimingFunction(m_animation->timingFunction().get(), normalizedValue, m_animation->duration());
const TimingFunction* timingFunction = timingFunctionForAnimationValue(m_keyframes.at(0), m_animation.get());
normalizedValue = applyTimingFunction(timingFunction, normalizedValue, m_animation->duration());
applyInternal(client, m_keyframes.at(0), m_keyframes.at(1), normalizedValue);
return;
}
......@@ -245,7 +255,8 @@ void GraphicsLayerAnimation::apply(Client* client)
continue;
normalizedValue = (normalizedValue - from->keyTime()) / (to->keyTime() - from->keyTime());
normalizedValue = applyTimingFunction(from->timingFunction(), normalizedValue, m_animation->duration());
const TimingFunction* timingFunction = timingFunctionForAnimationValue(from, m_animation.get());
normalizedValue = applyTimingFunction(timingFunction, normalizedValue, m_animation->duration());
applyInternal(client, from, to, normalizedValue);
break;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment