Title: [132798] trunk/Source/WebCore
Revision
132798
Author
[email protected]
Date
2012-10-29 07:26:46 -0700 (Mon, 29 Oct 2012)

Log Message

[TexMap] Make GraphicsLayerAnimation choose a proper timing function.
https://bugs.webkit.org/show_bug.cgi?id=100623

Patch by Huang Dongsung <[email protected]> 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):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (132797 => 132798)


--- trunk/Source/WebCore/ChangeLog	2012-10-29 14:23:44 UTC (rev 132797)
+++ trunk/Source/WebCore/ChangeLog	2012-10-29 14:26:46 UTC (rev 132798)
@@ -1,3 +1,27 @@
+2012-10-29  Huang Dongsung  <[email protected]>
+
+        [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  <[email protected]>
 
         Web Inspector: Toolbar overflow appears outside window

Modified: trunk/Source/WebCore/platform/graphics/GraphicsLayerAnimation.cpp (132797 => 132798)


--- trunk/Source/WebCore/platform/graphics/GraphicsLayerAnimation.cpp	2012-10-29 14:23:44 UTC (rev 132797)
+++ trunk/Source/WebCore/platform/graphics/GraphicsLayerAnimation.cpp	2012-10-29 14:26:46 UTC (rev 132798)
@@ -155,7 +155,16 @@
     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)
     , m_boxSize(boxSize)
@@ -233,7 +242,8 @@
         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 @@
             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;
     }
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to