Diff
Modified: trunk/Source/WebCore/ChangeLog (111526 => 111527)
--- trunk/Source/WebCore/ChangeLog 2012-03-21 12:21:01 UTC (rev 111526)
+++ trunk/Source/WebCore/ChangeLog 2012-03-21 12:22:30 UTC (rev 111527)
@@ -1,3 +1,14 @@
+2012-03-21 Ian Vollick <[email protected]>
+
+ [chromium] timing functions are getting incorrectly applied for accelerated css transitions
+ https://bugs.webkit.org/show_bug.cgi?id=81692
+
+ Reviewed by Adrienne Walker.
+
+ Tested in CCLayerTreeHostTestAddAnimationWithTimingFunction
+
+ * platform/graphics/chromium/cc/CCLayerAnimationController.cpp:
+
2012-03-21 Allan Sandfeld Jensen <[email protected]>
[Qt] Cookie Jar blocks on fsync in SQLITE
Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerAnimationController.cpp (111526 => 111527)
--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerAnimationController.cpp 2012-03-21 12:21:01 UTC (rev 111526)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerAnimationController.cpp 2012-03-21 12:22:30 UTC (rev 111527)
@@ -67,8 +67,15 @@
const Value* originalValue = static_cast<const Value*>(valueList.at(i));
OwnPtr<CCTimingFunction> timingFunction;
- if (originalValue->timingFunction()) {
- switch (originalValue->timingFunction()->type()) {
+ const TimingFunction* originalTimingFunction = originalValue->timingFunction();
+
+ // If there hasn't been a timing function associated with this keyframe, use the
+ // animation's timing function, if we have one.
+ if (!originalTimingFunction && animation->isTimingFunctionSet())
+ originalTimingFunction = animation->timingFunction().get();
+
+ if (originalTimingFunction) {
+ switch (originalTimingFunction->type()) {
case TimingFunction::StepsFunction:
// FIXME: add support for steps timing function.
return nullptr;
@@ -76,8 +83,8 @@
// Don't set the timing function. Keyframes are interpolated linearly if there is no timing function.
break;
case TimingFunction::CubicBezierFunction:
- const CubicBezierTimingFunction* originalTimingFunction = static_cast<const CubicBezierTimingFunction*>(originalValue->timingFunction());
- timingFunction = CCCubicBezierTimingFunction::create(originalTimingFunction->x1(), originalTimingFunction->y1(), originalTimingFunction->x2(), originalTimingFunction->y2());
+ const CubicBezierTimingFunction* originalBezierTimingFunction = static_cast<const CubicBezierTimingFunction*>(originalTimingFunction);
+ timingFunction = CCCubicBezierTimingFunction::create(originalBezierTimingFunction->x1(), originalBezierTimingFunction->y1(), originalBezierTimingFunction->x2(), originalBezierTimingFunction->y2());
break;
} // switch
} else
Modified: trunk/Source/WebKit/chromium/ChangeLog (111526 => 111527)
--- trunk/Source/WebKit/chromium/ChangeLog 2012-03-21 12:21:01 UTC (rev 111526)
+++ trunk/Source/WebKit/chromium/ChangeLog 2012-03-21 12:22:30 UTC (rev 111527)
@@ -1,5 +1,31 @@
2012-03-21 Ian Vollick <[email protected]>
+ [chromium] timing functions are getting incorrectly applied for accelerated css transitions
+ https://bugs.webkit.org/show_bug.cgi?id=81692
+
+ Reviewed by Adrienne Walker.
+
+ * tests/CCAnimationTestCommon.cpp:
+ (WebCore::addOpacityTransition):
+ (WebKitTests::addOpacityTransitionToController):
+ (WebKitTests::addOpacityTransitionToLayer):
+ * tests/CCAnimationTestCommon.h:
+ (WebKitTests):
+ * tests/CCLayerAnimationControllerTest.cpp:
+ (WebKitTests::TEST):
+ * tests/CCLayerTreeHostTest.cpp:
+ (WTF::CCLayerTreeHostTest::dispatchAddInstantAnimation):
+ (WTF::CCLayerTreeHostTest::dispatchAddAnimation):
+ (WTF::TEST_F):
+ (WTF):
+ (CCLayerTreeHostTestAddAnimationWithTimingFunction):
+ (WTF::CCLayerTreeHostTestAddAnimationWithTimingFunction::CCLayerTreeHostTestAddAnimationWithTimingFunction):
+ (WTF::CCLayerTreeHostTestAddAnimationWithTimingFunction::beginTest):
+ (WTF::CCLayerTreeHostTestAddAnimationWithTimingFunction::animateLayers):
+ (WTF::CCLayerTreeHostTestAddAnimationWithTimingFunction::afterTest):
+
+2012-03-21 Ian Vollick <[email protected]>
+
[chromium] Animation events should only be used for synchronizing animation start times
https://bugs.webkit.org/show_bug.cgi?id=81484
Modified: trunk/Source/WebKit/chromium/tests/CCAnimationTestCommon.cpp (111526 => 111527)
--- trunk/Source/WebKit/chromium/tests/CCAnimationTestCommon.cpp 2012-03-21 12:21:01 UTC (rev 111526)
+++ trunk/Source/WebKit/chromium/tests/CCAnimationTestCommon.cpp 2012-03-21 12:22:30 UTC (rev 111527)
@@ -35,7 +35,7 @@
namespace {
template <class Target>
-void addOpacityTransition(Target& target, double duration, float startOpacity, float endOpacity)
+void addOpacityTransition(Target& target, double duration, float startOpacity, float endOpacity, bool useTimingFunction)
{
WebCore::KeyframeValueList values(AnimatedPropertyOpacity);
if (duration > 0)
@@ -45,6 +45,9 @@
RefPtr<Animation> animation = Animation::create();
animation->setDuration(duration);
+ if (useTimingFunction)
+ animation->setTimingFunction(LinearTimingFunction::create());
+
IntSize boxSize;
target.addAnimation(values, boxSize, animation.get(), 0, 0, 0);
@@ -120,14 +123,14 @@
return adoptPtr(new FakeFloatTransition(*this));
}
-void addOpacityTransitionToController(WebCore::CCLayerAnimationController& controller, double duration, float startOpacity, float endOpacity)
+void addOpacityTransitionToController(WebCore::CCLayerAnimationController& controller, double duration, float startOpacity, float endOpacity, bool useTimingFunction)
{
- addOpacityTransition(controller, duration, startOpacity, endOpacity);
+ addOpacityTransition(controller, duration, startOpacity, endOpacity, useTimingFunction);
}
-void addOpacityTransitionToLayer(WebCore::LayerChromium& layer, double duration, float startOpacity, float endOpacity)
+void addOpacityTransitionToLayer(WebCore::LayerChromium& layer, double duration, float startOpacity, float endOpacity, bool useTimingFunction)
{
- addOpacityTransition(layer, duration, startOpacity, endOpacity);
+ addOpacityTransition(layer, duration, startOpacity, endOpacity, useTimingFunction);
}
} // namespace WebKitTests
Modified: trunk/Source/WebKit/chromium/tests/CCAnimationTestCommon.h (111526 => 111527)
--- trunk/Source/WebKit/chromium/tests/CCAnimationTestCommon.h 2012-03-21 12:21:01 UTC (rev 111526)
+++ trunk/Source/WebKit/chromium/tests/CCAnimationTestCommon.h 2012-03-21 12:22:30 UTC (rev 111527)
@@ -95,9 +95,9 @@
WebCore::IntSize m_bounds;
};
-void addOpacityTransitionToController(WebCore::CCLayerAnimationController&, double duration, float startOpacity, float endOpacity);
+void addOpacityTransitionToController(WebCore::CCLayerAnimationController&, double duration, float startOpacity, float endOpacity, bool useTimingFunction);
-void addOpacityTransitionToLayer(WebCore::LayerChromium&, double duration, float startOpacity, float endOpacity);
+void addOpacityTransitionToLayer(WebCore::LayerChromium&, double duration, float startOpacity, float endOpacity, bool useTimingFunction);
} // namespace WebKitTests
Modified: trunk/Source/WebKit/chromium/tests/CCLayerAnimationControllerTest.cpp (111526 => 111527)
--- trunk/Source/WebKit/chromium/tests/CCLayerAnimationControllerTest.cpp 2012-03-21 12:21:01 UTC (rev 111526)
+++ trunk/Source/WebKit/chromium/tests/CCLayerAnimationControllerTest.cpp 2012-03-21 12:22:30 UTC (rev 111527)
@@ -133,7 +133,7 @@
EXPECT_FALSE(controllerImpl->getActiveAnimation(0, CCActiveAnimation::Opacity));
- addOpacityTransitionToController(*controller, 1, 0, 1);
+ addOpacityTransitionToController(*controller, 1, 0, 1, false);
controller->pushAnimationUpdatesTo(controllerImpl.get());
Modified: trunk/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp (111526 => 111527)
--- trunk/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp 2012-03-21 12:21:01 UTC (rev 111526)
+++ trunk/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp 2012-03-21 12:22:30 UTC (rev 111527)
@@ -356,7 +356,7 @@
CCLayerTreeHostTest* test = static_cast<CCLayerTreeHostTest*>(self);
ASSERT(test);
if (test->m_layerTreeHost && test->m_layerTreeHost->rootLayer())
- addOpacityTransitionToLayer(*test->m_layerTreeHost->rootLayer(), 0, 0, 0.5);
+ addOpacityTransitionToLayer(*test->m_layerTreeHost->rootLayer(), 0, 0, 0.5, false);
}
static void dispatchAddAnimation(void* self)
@@ -365,7 +365,7 @@
CCLayerTreeHostTest* test = static_cast<CCLayerTreeHostTest*>(self);
ASSERT(test);
if (test->m_layerTreeHost && test->m_layerTreeHost->rootLayer())
- addOpacityTransitionToLayer(*test->m_layerTreeHost->rootLayer(), 10, 0, 0.5);
+ addOpacityTransitionToLayer(*test->m_layerTreeHost->rootLayer(), 10, 0, 0.5, true);
}
static void dispatchSetNeedsAnimateAndCommit(void* self)
@@ -977,6 +977,44 @@
runTestThreaded();
}
+// Ensures that animations continue to be ticked when we are backgrounded.
+class CCLayerTreeHostTestAddAnimationWithTimingFunction : public CCLayerTreeHostTestThreadOnly {
+public:
+ CCLayerTreeHostTestAddAnimationWithTimingFunction()
+ {
+ }
+
+ virtual void beginTest()
+ {
+ postAddAnimationToMainThread();
+ }
+
+ virtual void animateLayers(CCLayerTreeHostImpl* layerTreeHostImpl, double monotonicTime)
+ {
+ const CCFloatAnimationCurve* curve = m_layerTreeHost->rootLayer()->layerAnimationController()->getActiveAnimation(0, CCActiveAnimation::Opacity)->curve()->toFloatAnimationCurve();
+ float startOpacity = curve->getValue(0);
+ float endOpacity = curve->getValue(curve->duration());
+ float linearlyInterpolatedOpacity = 0.25 * endOpacity + 0.75 * startOpacity;
+ double time = curve->duration() * 0.25;
+ // If the linear timing function associated with this animation was not picked up,
+ // then the linearly interpolated opacity would be different because of the
+ // default ease timing function.
+ EXPECT_FLOAT_EQ(linearlyInterpolatedOpacity, curve->getValue(time));
+ endTest();
+ }
+
+ virtual void afterTest()
+ {
+ }
+
+private:
+};
+
+TEST_F(CCLayerTreeHostTestAddAnimationWithTimingFunction, runMultiThread)
+{
+ runTestThreaded();
+}
+
// Ensures that when opacity is being animated, this value does not cause the subtree to be skipped.
class CCLayerTreeHostTestDoNotSkipLayersWithAnimatedOpacity : public CCLayerTreeHostTestThreadOnly {
public: