Title: [158612] branches/safari-537.60-branch/Source/WebCore

Diff

Modified: branches/safari-537.60-branch/Source/WebCore/ChangeLog (158611 => 158612)


--- branches/safari-537.60-branch/Source/WebCore/ChangeLog	2013-11-05 00:12:56 UTC (rev 158611)
+++ branches/safari-537.60-branch/Source/WebCore/ChangeLog	2013-11-05 00:15:32 UTC (rev 158612)
@@ -1,3 +1,29 @@
+2013-11-04  Lucas Forschler  <[email protected]>
+
+        Merge r157773
+
+    2013-10-21  Brent Fulgham  <[email protected]>
+
+            [WIN] Properly support reverse animations without needing software fallback.
+            https://bugs.webkit.org/show_bug.cgi?id=85121
+
+            Reviewed by Dean Jackson.
+
+            Testing is provided by existing animation tests.
+
+            * platform/animation/TimingFunction.h:
+            (WebCore::CubicBezierTimingFunction::createReversed): Added.
+            * platform/graphics/ca/GraphicsLayerCA.cpp:
+            (WebCore::GraphicsLayerCA::addAnimation): The early return when performing a reverse or
+            autoreverse animation is no longer needed.
+            * platform/graphics/ca/PlatformCAAnimation.h:
+            * platform/graphics/ca/mac/PlatformCAAnimationMac.mm:
+            (toCAMediaTimingFunction): Use new reversed function.
+            * platform/graphics/ca/win/PlatformCAAnimationWin.cpp:
+            (toCACFTimingFunction): Ditto.
+            (PlatformCAAnimation::setTimingFunction): Pass 'reverse' flag.
+            (PlatformCAAnimation::setTimingFunctions): Ditto.
+
 2013-11-01  Lucas Forschler  <[email protected]>
 
         Merge r158334

Modified: branches/safari-537.60-branch/Source/WebCore/platform/animation/TimingFunction.h (158611 => 158612)


--- branches/safari-537.60-branch/Source/WebCore/platform/animation/TimingFunction.h	2013-11-05 00:12:56 UTC (rev 158611)
+++ branches/safari-537.60-branch/Source/WebCore/platform/animation/TimingFunction.h	2013-11-05 00:15:32 UTC (rev 158612)
@@ -139,6 +139,11 @@
         static const CubicBezierTimingFunction* dtf = create().leakRef();
         return dtf;
     }
+
+    PassRefPtr<CubicBezierTimingFunction> createReversed() const
+    {
+        return create(1.0 - m_x2, 1.0 - m_y2, 1.0 - m_x1, 1.0 - m_y1);
+    }
     
 private:
     explicit CubicBezierTimingFunction(TimingFunctionPreset preset = Ease, double x1 = 0.25, double y1 = 0.1, double x2 = 0.25, double y2 = 1.0)

Modified: branches/safari-537.60-branch/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp (158611 => 158612)


--- branches/safari-537.60-branch/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp	2013-11-05 00:12:56 UTC (rev 158611)
+++ branches/safari-537.60-branch/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp	2013-11-05 00:15:32 UTC (rev 158612)
@@ -689,14 +689,6 @@
     if (animationHasStepsTimingFunction(valueList, anim))
         return false;
 
-#if PLATFORM(WIN)
-    // CoreAnimation on Windows does not handle a reverse direction. Fall
-    // back to software animation in that case.
-    // https://bugs.webkit.org/show_bug.cgi?id=85121
-    if (!anim->directionIsForwards())
-        return false;
-#endif
-
     bool createdAnimations = false;
     if (valueList.property() == AnimatedPropertyWebkitTransform)
         createdAnimations = createTransformAnimationsFromKeyframes(valueList, anim, animationName, timeOffset, boxSize);

Modified: branches/safari-537.60-branch/Source/WebCore/platform/graphics/ca/PlatformCAAnimation.h (158611 => 158612)


--- branches/safari-537.60-branch/Source/WebCore/platform/graphics/ca/PlatformCAAnimation.h	2013-11-05 00:12:56 UTC (rev 158611)
+++ branches/safari-537.60-branch/Source/WebCore/platform/graphics/ca/PlatformCAAnimation.h	2013-11-05 00:15:32 UTC (rev 158612)
@@ -149,7 +149,7 @@
         if (beginTime() <= 0)
             setBeginTime(t);
     }
-    
+
 private:
     AnimationType m_type;
     

Modified: branches/safari-537.60-branch/Source/WebCore/platform/graphics/ca/mac/PlatformCAAnimationMac.mm (158611 => 158612)


--- branches/safari-537.60-branch/Source/WebCore/platform/graphics/ca/mac/PlatformCAAnimationMac.mm	2013-11-05 00:12:56 UTC (rev 158611)
+++ branches/safari-537.60-branch/Source/WebCore/platform/graphics/ca/mac/PlatformCAAnimationMac.mm	2013-11-05 00:15:32 UTC (rev 158612)
@@ -133,15 +133,19 @@
 {
     ASSERT(timingFunction);
     if (timingFunction->isCubicBezierTimingFunction()) {
+        RefPtr<CubicBezierTimingFunction> reversed;
         const CubicBezierTimingFunction* ctf = static_cast<const CubicBezierTimingFunction*>(timingFunction);
+
+        if (reverse) {
+            reversed = ctf->createReversed();
+            ctf = reversed.get();
+        }
+
         float x1 = static_cast<float>(ctf->x1());
         float y1 = static_cast<float>(ctf->y1());
         float x2 = static_cast<float>(ctf->x2());
         float y2 = static_cast<float>(ctf->y2());
-        return [CAMediaTimingFunction functionWithControlPoints:(reverse ? 1 - x2 : x1)
-                                                               :(reverse ? 1 - y2 : y1)
-                                                               :(reverse ? 1 - x1 : x2)
-                                                               :(reverse ? 1 - y1 : y2)];
+        return [CAMediaTimingFunction functionWithControlPoints: x1 : y1 : x2 : y2];
     }
     
     return [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear];

Modified: branches/safari-537.60-branch/Source/WebCore/platform/graphics/ca/win/PlatformCAAnimationWin.cpp (158611 => 158612)


--- branches/safari-537.60-branch/Source/WebCore/platform/graphics/ca/win/PlatformCAAnimationWin.cpp	2013-11-05 00:12:56 UTC (rev 158611)
+++ branches/safari-537.60-branch/Source/WebCore/platform/graphics/ca/win/PlatformCAAnimationWin.cpp	2013-11-05 00:15:32 UTC (rev 158612)
@@ -121,12 +121,23 @@
     return PlatformCAAnimation::NoValueFunction;
 }
 
-static RetainPtr<CACFTimingFunctionRef> toCACFTimingFunction(const TimingFunction* timingFunction)
+static RetainPtr<CACFTimingFunctionRef> toCACFTimingFunction(const TimingFunction* timingFunction, bool reverse)
 {
     ASSERT(timingFunction);
     if (timingFunction->isCubicBezierTimingFunction()) {
+        RefPtr<CubicBezierTimingFunction> reversed;
         const CubicBezierTimingFunction* ctf = static_cast<const CubicBezierTimingFunction*>(timingFunction);
-        return adoptCF(CACFTimingFunctionCreate(static_cast<float>(ctf->x1()), static_cast<float>(ctf->y1()), static_cast<float>(ctf->x2()), static_cast<float>(ctf->y2())));
+
+        if (reverse) {
+            reversed = ctf->createReversed();
+            ctf = reversed.get();
+        }
+
+        float x1 = static_cast<float>(ctf->x1());
+        float y1 = static_cast<float>(ctf->y1());
+        float x2 = static_cast<float>(ctf->x2());
+        float y2 = static_cast<float>(ctf->y2());
+        return adoptCF(CACFTimingFunctionCreate(x1, y1, x2, y2));
     }
     
     return CACFTimingFunctionGetFunctionWithName(kCACFTimingFunctionLinear);
@@ -289,7 +300,7 @@
 void PlatformCAAnimation::setTimingFunction(const TimingFunction* value, bool reverse)
 {
     UNUSED_PARAM(reverse);
-    CACFAnimationSetTimingFunction(m_animation.get(), toCACFTimingFunction(value).get());
+    CACFAnimationSetTimingFunction(m_animation.get(), toCACFTimingFunction(value, reverse).get());
 }
 
 void PlatformCAAnimation::copyTimingFunctionFrom(const PlatformCAAnimation* value)
@@ -543,7 +554,7 @@
     RetainPtr<CFMutableArrayRef> array = adoptCF(CFArrayCreateMutable(0, value.size(), &kCFTypeArrayCallBacks));
     for (size_t i = 0; i < value.size(); ++i) {
         RetainPtr<CFNumberRef> v = adoptCF(CFNumberCreate(0, kCFNumberFloatType, &value[i]));
-        CFArrayAppendValue(array.get(), toCACFTimingFunction(value[i]).get());
+        CFArrayAppendValue(array.get(), toCACFTimingFunction(value[i], reverse).get());
     }
 
     CACFAnimationSetTimingFunctions(m_animation.get(), array.get());
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to