+2012-07-01 Keishi Hattori <keishi@webkit.org>
+
+ Unreviewed, rolling out r121650.
+ http://trac.webkit.org/changeset/121650
+ https://bugs.webkit.org/show_bug.cgi?id=90303
+
+ runhooks is failing for chromium win bots and
+ WebAnimationTest.DefaultSettings is crashing
+
+ * Platform.gypi:
+ * chromium/public/WebAnimation.h: Removed.
+ * chromium/public/WebAnimationCurve.h: Removed.
+ * chromium/public/WebFloatAnimationCurve.h: Removed.
+ * chromium/public/WebFloatKeyframe.h: Removed.
+ * chromium/public/WebTransformAnimationCurve.h: Removed.
+ * chromium/public/WebTransformKeyframe.h: Removed.
+
2012-07-01 Ian Vollick <vollick@chromium.org>
[chromium] Create a WebKit::Web* wrapper for the cc animation classes
'variables': {
'platform_files': [
'chromium/public/Platform.h',
- 'chromium/public/WebAnimation.h'
- 'chromium/public/WebAnimationCurve.h',
'chromium/public/WebAudioBus.h',
'chromium/public/WebAudioDevice.h',
'chromium/public/WebBlobData.h',
'chromium/public/WebFileUtilities.h',
'chromium/public/WebFilterOperation.h',
'chromium/public/WebFilterOperations.h',
- 'chromium/public/WebFloatAnimationCurve.h',
- 'chromium/public/WebFloatKeyframe.h',
'chromium/public/WebFloatPoint.h',
'chromium/public/WebFloatQuad.h',
'chromium/public/WebFloatRect.h',
'chromium/public/WebThread.h',
'chromium/public/WebThreadSafeData.h',
'chromium/public/WebTransformationMatrix.h',
- 'chromium/public/WebTransformAnimationCurve.h',
- 'chromium/public/WebTransformKeyframe.h',
'chromium/public/WebTransformOperations.h',
'chromium/public/WebPrerender.h',
'chromium/public/WebURL.h',
+++ /dev/null
-/*
- * Copyright (C) 2012 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef WebAnimation_h
-#define WebAnimation_h
-
-#include "WebCommon.h"
-#include "WebNonCopyable.h"
-#include "WebPrivateOwnPtr.h"
-
-#if WEBKIT_IMPLEMENTATION
-#include <wtf/Forward.h>
-#endif
-
-namespace WebCore {
-class CCActiveAnimation;
-}
-
-namespace WebKit {
-
-class WebAnimationCurve;
-
-// A compositor driven animation.
-class WebAnimation : public WebNonCopyable {
-public:
- enum TargetProperty {
- WebAnimationTransform = 1,
- WebAnimationOpacity
- };
-
- WebAnimation(const WebAnimationCurve& curve, TargetProperty targetProperty)
- {
- initialize(curve, targetProperty);
- }
-
- ~WebAnimation()
- {
- destroy();
- }
-
- // This is the number of times that the animation will play. If this
- // value is zero the animation will not play. If it is negative, then
- // the animation will loop indefinitely.
- WEBKIT_EXPORT int iterations() const;
- WEBKIT_EXPORT void setIterations(int);
-
- WEBKIT_EXPORT double startTime() const;
- WEBKIT_EXPORT void setStartTime(double monotonicTime);
- WEBKIT_EXPORT bool hasSetStartTime() const;
-
- WEBKIT_EXPORT double timeOffset() const;
- WEBKIT_EXPORT void setTimeOffset(double monotonicTime);
-
- // If alternatesDirection is true, on odd numbered iterations we reverse the curve.
- WEBKIT_EXPORT bool alternatesDirection() const;
- WEBKIT_EXPORT void setAlternatesDirection(bool);
-
-#if WEBKIT_IMPLEMENTATION
- operator PassOwnPtr<WebCore::CCActiveAnimation>() const;
-#endif
-
-private:
- WEBKIT_EXPORT void initialize(const WebAnimationCurve&, TargetProperty);
- WEBKIT_EXPORT void initialize(const WebAnimation&);
- WEBKIT_EXPORT void destroy();
-
- WebPrivateOwnPtr<WebCore::CCActiveAnimation> m_private;
-};
-
-} // namespace WebKit
-
-#endif // WebAnimation_h
+++ /dev/null
-/*
- * Copyright (C) 2012 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef WebAnimationCurve_h
-#define WebAnimationCurve_h
-
-#include "WebCommon.h"
-#include "WebNonCopyable.h"
-
-#if WEBKIT_IMPLEMENTATION
-#include <wtf/Forward.h>
-#endif
-
-namespace WebCore {
-class CCAnimationCurve;
-}
-
-namespace WebKit {
-
-class WebAnimationCurve : public WebNonCopyable {
-public:
- virtual ~WebAnimationCurve() { }
-
- enum TimingFunctionType {
- TimingFunctionTypeEase,
- TimingFunctionTypeEaseIn,
- TimingFunctionTypeEaseOut,
- TimingFunctionTypeEaseInOut,
- TimingFunctionTypeLinear
- };
-
-#if WEBKIT_IMPLEMENTATION
- virtual operator PassOwnPtr<WebCore::CCAnimationCurve>() const = 0;
-#endif
-
-protected:
- WebAnimationCurve() { }
-};
-
-} // namespace WebKit
-
-#endif // WebAnimationCurve_h
-
+++ /dev/null
-/*
- * Copyright (C) 2012 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef WebFloatAnimationCurve_h
-#define WebFloatAnimationCurve_h
-
-#include "WebAnimationCurve.h"
-
-#include "WebCommon.h"
-#include "WebFloatKeyframe.h"
-#include "WebPrivateOwnPtr.h"
-
-#if WEBKIT_IMPLEMENTATION
-#include <wtf/Forward.h>
-#endif
-
-namespace WebCore {
-class CCAnimationCurve;
-class CCKeyframedFloatAnimationCurve;
-}
-
-namespace WebKit {
-
-// A keyframed float animation curve.
-class WebFloatAnimationCurve : public WebAnimationCurve {
-public:
- WebFloatAnimationCurve() { initialize(); }
- virtual ~WebFloatAnimationCurve() { destroy(); }
-
- // Adds the keyframe with the default timing function (ease).
- WEBKIT_EXPORT void add(const WebFloatKeyframe&);
- WEBKIT_EXPORT void add(const WebFloatKeyframe&, TimingFunctionType);
- // Adds the keyframe with a custom, bezier timing function. Note, it is
- // assumed that x0 = y0 = 0, and x3 = y3 = 1.
- WEBKIT_EXPORT void add(const WebFloatKeyframe&, double x1, double y1, double x2, double y2);
-
- WEBKIT_EXPORT float getValue(double time) const;
-
-#if WEBKIT_IMPLEMENTATION
- virtual operator PassOwnPtr<WebCore::CCAnimationCurve>() const;
-#endif
-
-private:
- WEBKIT_EXPORT void initialize();
- WEBKIT_EXPORT void destroy();
-
- WebPrivateOwnPtr<WebCore::CCKeyframedFloatAnimationCurve> m_private;
-};
-
-} // namespace WebKit
-
-#endif // WebFloatAnimationCurve_h
+++ /dev/null
-/*
- * Copyright (C) 2012 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef WebFloatKeyframe_h
-#define WebFloatKeyframe_h
-
-namespace WebKit {
-
-struct WebFloatKeyframe {
- WebFloatKeyframe(double time, float value)
- : time(time)
- , value(value)
- {
- }
-
- double time;
- float value;
-};
-
-} // namespace WebKit
-
-#endif // WebFloatKeyframe_h
+++ /dev/null
-/*
- * Copyright (C) 2012 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef WebTransformAnimationCurve_h
-#define WebTransformAnimationCurve_h
-
-#include "WebAnimationCurve.h"
-
-#include "WebCommon.h"
-#include "WebPrivateOwnPtr.h"
-#include "WebTransformKeyframe.h"
-#include "WebTransformationMatrix.h"
-
-#if WEBKIT_IMPLEMENTATION
-#include <wtf/Forward.h>
-#endif
-
-namespace WebCore {
-class CCAnimationCurve;
-class CCKeyframedTransformAnimationCurve;
-}
-
-namespace WebKit {
-
-// A keyframed transform animation curve.
-class WebTransformAnimationCurve : public WebAnimationCurve {
-public:
- WebTransformAnimationCurve() { initialize(); }
- virtual ~WebTransformAnimationCurve() { destroy(); }
-
- // Adds the keyframe with the default timing function (ease).
- WEBKIT_EXPORT void add(const WebTransformKeyframe&);
- WEBKIT_EXPORT void add(const WebTransformKeyframe&, TimingFunctionType);
- // Adds the keyframe with a custom, bezier timing function. Note, it is
- // assumed that x0 = y0 = 0, and x3 = y3 = 1.
- WEBKIT_EXPORT void add(const WebTransformKeyframe&, double x1, double y1, double x2, double y2);
-
- WEBKIT_EXPORT WebTransformationMatrix getValue(double time) const;
-
-#if WEBKIT_IMPLEMENTATION
- virtual operator PassOwnPtr<WebCore::CCAnimationCurve>() const;
-#endif
-
-protected:
- WEBKIT_EXPORT void initialize();
- WEBKIT_EXPORT void destroy();
-
- WebPrivateOwnPtr<WebCore::CCKeyframedTransformAnimationCurve> m_private;
-};
-
-} // namespace WebKit
-
-#endif // WebTransformAnimationCurve_h
+++ /dev/null
-/*
- * Copyright (C) 2012 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef WebTransformKeyframe_h
-#define WebTransformKeyframe_h
-
-#include "WebTransformOperations.h"
-
-namespace WebKit {
-
-struct WebTransformKeyframe {
- WebTransformKeyframe(double time, const WebTransformOperations& value)
- : time(time)
- , value(value)
- {
- }
-
- double time;
- WebTransformOperations value;
-};
-
-} // namespace WebKit
-
-#endif // WebTransformKeyframe_h
+2012-07-01 Keishi Hattori <keishi@webkit.org>
+
+ Unreviewed, rolling out r121650.
+ http://trac.webkit.org/changeset/121650
+ https://bugs.webkit.org/show_bug.cgi?id=90303
+
+ runhooks is failing for chromium win bots and
+ WebAnimationTest.DefaultSettings is crashing
+
+ * WebKit.gyp:
+ * WebKit.gypi:
+ * src/WebAnimation.cpp: Removed.
+ * src/WebAnimationCurveCommon.cpp: Removed.
+ * src/WebAnimationCurveCommon.h: Removed.
+ * src/WebFloatAnimationCurve.cpp: Removed.
+ * src/WebTransformAnimationCurve.cpp: Removed.
+ * tests/WebAnimationTest.cpp: Removed.
+ * tests/WebFloatAnimationCurveTest.cpp: Removed.
+ * tests/WebTransformAnimationCurveTest.cpp: Removed.
+
2012-07-01 Ian Vollick <vollick@chromium.org>
[chromium] Create a WebKit::Web* wrapper for the cc animation classes
'src/WebTextCheckingCompletionImpl.cpp',
'src/WebTextCheckingResult.cpp',
'src/WebAccessibilityObject.cpp',
- 'src/WebAnimation.cpp',
'src/WebAnimationControllerImpl.cpp',
'src/WebAnimationControllerImpl.h',
- 'src/WebAnimationCurveCommon.cpp',
- 'src/WebAnimationCurveCommon.h',
'src/WebArrayBuffer.cpp',
'src/WebArrayBufferView.cpp',
'src/WebBindings.cpp',
'src/WebFileChooserCompletionImpl.h',
'src/WebFileSystemCallbacksImpl.cpp',
'src/WebFileSystemCallbacksImpl.h',
- 'src/WebFloatAnimationCurve.cpp',
'src/WebFontCache.cpp',
'src/WebFontDescription.cpp',
'src/WebFontImpl.cpp',
'src/WebSurroundingText.cpp',
'src/WebTextInputInfo.cpp',
'src/WebTextRun.cpp',
- 'src/WebTransformAnimationCurve.cpp',
'src/WebURLLoadTiming.cpp',
'src/WebScopedUserGesture.cpp',
'src/WebTextFieldDecoratorClient.cpp',
'tests/TreeSynchronizerTest.cpp',
'tests/TreeTestHelpers.cpp',
'tests/TreeTestHelpers.h',
- 'tests/WebAnimationTest.cpp',
'tests/WebCompositorInputHandlerImplTest.cpp',
- 'tests/WebFloatAnimationCurveTest.cpp',
'tests/WebFrameTest.cpp',
'tests/WebLayerTest.cpp',
'tests/WebLayerTreeViewTest.cpp',
'tests/WebPageSerializerTest.cpp',
'tests/WebSocketDeflaterTest.cpp',
'tests/WebSocketExtensionDispatcherTest.cpp',
- 'tests/WebTransformAnimationCurveTest.cpp',
'tests/WebTransformationMatrixTest.cpp',
'tests/WebTransformOperationsTest.cpp',
'tests/WebURLRequestTest.cpp',
+++ /dev/null
-/*
- * Copyright (C) 2012 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-
-#include <public/WebAnimation.h>
-
-#include "AnimationIdVendor.h"
-#include "cc/CCActiveAnimation.h"
-#include "cc/CCAnimationCurve.h"
-#include <public/WebAnimationCurve.h>
-#include <wtf/OwnPtr.h>
-#include <wtf/PassOwnPtr.h>
-
-using WebCore::AnimationIdVendor;
-using WebCore::CCActiveAnimation;
-
-namespace WebKit {
-
-int WebAnimation::iterations() const
-{
- return m_private->iterations();
-}
-
-void WebAnimation::setIterations(int n)
-{
- m_private->setIterations(n);
-}
-
-double WebAnimation::startTime() const
-{
- return m_private->startTime();
-}
-
-void WebAnimation::setStartTime(double monotonicTime)
-{
- m_private->setStartTime(monotonicTime);
-}
-
-double WebAnimation::timeOffset() const
-{
- return m_private->timeOffset();
-}
-
-void WebAnimation::setTimeOffset(double monotonicTime)
-{
- m_private->setTimeOffset(monotonicTime);
-}
-
-bool WebAnimation::alternatesDirection() const
-{
- return m_private->alternatesDirection();
-}
-
-void WebAnimation::setAlternatesDirection(bool alternates)
-{
- m_private->setAlternatesDirection(alternates);
-}
-
-WebAnimation::operator PassOwnPtr<WebCore::CCActiveAnimation>() const
-{
- OwnPtr<WebCore::CCActiveAnimation> toReturn(m_private->cloneForImplThread());
- toReturn->setNeedsSynchronizedStartTime(true);
- return toReturn.release();
-}
-
-void WebAnimation::initialize(const WebAnimationCurve& curve, TargetProperty targetProperty)
-{
- m_private.reset(CCActiveAnimation::create(curve,
- AnimationIdVendor::getNextAnimationId(),
- AnimationIdVendor::getNextGroupId(),
- static_cast<WebCore::CCActiveAnimation::TargetProperty>(targetProperty)).leakPtr());
-}
-
-void WebAnimation::destroy()
-{
- m_private.reset(0);
-}
-
-} // namespace WebKit
+++ /dev/null
-/*
- * Copyright (C) 2012 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-
-#include "WebAnimationCurveCommon.h"
-
-#include "cc/CCTimingFunction.h"
-
-#include <wtf/OwnPtr.h>
-#include <wtf/PassOwnPtr.h>
-
-namespace WebKit {
-
-PassOwnPtr<WebCore::CCTimingFunction> createTimingFunction(WebAnimationCurve::TimingFunctionType type)
-{
- switch (type) {
- case WebAnimationCurve::TimingFunctionTypeEase:
- return WebCore::CCEaseTimingFunction::create();
- case WebAnimationCurve::TimingFunctionTypeEaseIn:
- return WebCore::CCEaseInTimingFunction::create();
- case WebAnimationCurve::TimingFunctionTypeEaseOut:
- return WebCore::CCEaseOutTimingFunction::create();
- case WebAnimationCurve::TimingFunctionTypeEaseInOut:
- return WebCore::CCEaseInOutTimingFunction::create();
- case WebAnimationCurve::TimingFunctionTypeLinear:
- return nullptr;
- }
- return nullptr;
-}
-
-} // namespace WebKit
+++ /dev/null
-/*
- * Copyright (C) 2012 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef WebAnimationCurveCommon_h
-#define WebAnimationCurveCommon_h
-
-#include <public/WebAnimationCurve.h>
-#include <wtf/Forward.h>
-
-namespace WebCore {
-class CCTimingFunction;
-}
-
-namespace WebKit {
-PassOwnPtr<WebCore::CCTimingFunction> createTimingFunction(WebAnimationCurve::TimingFunctionType);
-}
-
-#endif // WebAnimationCurveCommon_h
+++ /dev/null
-/*
- * Copyright (C) 2012 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-
-#include <public/WebFloatAnimationCurve.h>
-
-#include "WebAnimationCurveCommon.h"
-#include "cc/CCKeyframedAnimationCurve.h"
-#include "cc/CCTimingFunction.h"
-#include <wtf/OwnPtr.h>
-#include <wtf/PassOwnPtr.h>
-
-namespace WebKit {
-
-void WebFloatAnimationCurve::add(const WebFloatKeyframe& keyframe)
-{
- add(keyframe, TimingFunctionTypeEase);
-}
-
-void WebFloatAnimationCurve::add(const WebFloatKeyframe& keyframe, TimingFunctionType type)
-{
- m_private->addKeyframe(WebCore::CCFloatKeyframe::create(keyframe.time, keyframe.value, createTimingFunction(type)));
-}
-
-void WebFloatAnimationCurve::add(const WebFloatKeyframe& keyframe, double x1, double y1, double x2, double y2)
-{
- m_private->addKeyframe(WebCore::CCFloatKeyframe::create(keyframe.time, keyframe.value, WebCore::CCCubicBezierTimingFunction::create(x1, y1, x2, y2)));
-}
-
-float WebFloatAnimationCurve::getValue(double time) const
-{
- return m_private->getValue(time);
-}
-
-WebFloatAnimationCurve::operator PassOwnPtr<WebCore::CCAnimationCurve>() const
-{
- return m_private->clone();
-}
-
-void WebFloatAnimationCurve::initialize()
-{
- m_private.reset(WebCore::CCKeyframedFloatAnimationCurve::create().leakPtr());
-}
-
-void WebFloatAnimationCurve::destroy()
-{
- m_private.reset(0);
-}
-
-} // namespace WebKit
+++ /dev/null
-/*
- * Copyright (C) 2012 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-
-#include <public/WebTransformAnimationCurve.h>
-
-#include "WebAnimationCurveCommon.h"
-#include "cc/CCKeyframedAnimationCurve.h"
-#include "cc/CCTimingFunction.h"
-#include <wtf/OwnPtr.h>
-#include <wtf/PassOwnPtr.h>
-
-namespace WebKit {
-
-void WebTransformAnimationCurve::add(const WebTransformKeyframe& keyframe)
-{
- add(keyframe, TimingFunctionTypeEase);
-}
-
-void WebTransformAnimationCurve::add(const WebTransformKeyframe& keyframe, TimingFunctionType type)
-{
- m_private->addKeyframe(WebCore::CCTransformKeyframe::create(keyframe.time, keyframe.value, createTimingFunction(type)));
-}
-
-void WebTransformAnimationCurve::add(const WebTransformKeyframe& keyframe, double x1, double y1, double x2, double y2)
-{
- m_private->addKeyframe(WebCore::CCTransformKeyframe::create(keyframe.time, keyframe.value, WebCore::CCCubicBezierTimingFunction::create(x1, y1, x2, y2)));
-}
-
-WebTransformationMatrix WebTransformAnimationCurve::getValue(double time) const
-{
- return m_private->getValue(time);
-}
-
-WebTransformAnimationCurve::operator PassOwnPtr<WebCore::CCAnimationCurve>() const
-{
- return m_private->clone();
-}
-
-void WebTransformAnimationCurve::initialize()
-{
- m_private.reset(WebCore::CCKeyframedTransformAnimationCurve::create().leakPtr());
-}
-
-void WebTransformAnimationCurve::destroy()
-{
- m_private.reset(0);
-}
-
-} // namespace WebKit
+++ /dev/null
-/*
- * Copyright (C) 2012 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-
-#include <public/WebAnimation.h>
-
-#include <gtest/gtest.h>
-#include <public/WebFloatAnimationCurve.h>
-#include <wtf/OwnPtr.h>
-#include <wtf/PassOwnPtr.h>
-
-using namespace WebKit;
-
-namespace {
-
-TEST(WebAnimationTest, DefaultSettings)
-{
- WebFloatAnimationCurve curve;
- WebAnimation animation(curve, WebAnimation::WebAnimationOpacity);
-
- // Ensure that the defaults are correct.
- EXPECT_EQ(1, animation.iterations());
- EXPECT_EQ(0, animation.startTime());
- EXPECT_EQ(0, animation.timeOffset());
- EXPECT_FALSE(animation.alternatesDirection());
-}
-
-TEST(WebAnimationTest, ModifiedSettings)
-{
- WebFloatAnimationCurve curve;
- WebAnimation animation(curve, WebAnimation::WebAnimationOpacity);
- animation.setIterations(2);
- animation.setStartTime(2);
- animation.setTimeOffset(2);
- animation.setAlternatesDirection(true);
-
- EXPECT_EQ(2, animation.iterations());
- EXPECT_EQ(2, animation.startTime());
- EXPECT_EQ(2, animation.timeOffset());
- EXPECT_TRUE(animation.alternatesDirection());
-}
-
-} // namespace
+++ /dev/null
-/*
- * Copyright (C) 2012 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-
-#include <public/WebFloatAnimationCurve.h>
-
-#include "cc/CCTimingFunction.h"
-
-#include <gtest/gtest.h>
-#include <wtf/OwnPtr.h>
-#include <wtf/PassOwnPtr.h>
-
-using namespace WebKit;
-
-namespace {
-
-// Tests that a float animation with one keyframe works as expected.
-TEST(WebFloatAnimationCurveTest, OneFloatKeyframe)
-{
- WebFloatAnimationCurve curve;
- curve.add(WebFloatKeyframe(0, 2), WebAnimationCurve::TimingFunctionTypeLinear);
- EXPECT_FLOAT_EQ(2, curve.getValue(-1));
- EXPECT_FLOAT_EQ(2, curve.getValue(0));
- EXPECT_FLOAT_EQ(2, curve.getValue(0.5));
- EXPECT_FLOAT_EQ(2, curve.getValue(1));
- EXPECT_FLOAT_EQ(2, curve.getValue(2));
-}
-
-// Tests that a float animation with two keyframes works as expected.
-TEST(WebFloatAnimationCurveTest, TwoFloatKeyframe)
-{
- WebFloatAnimationCurve curve;
- curve.add(WebFloatKeyframe(0, 2), WebAnimationCurve::TimingFunctionTypeLinear);
- curve.add(WebFloatKeyframe(1, 4), WebAnimationCurve::TimingFunctionTypeLinear);
- EXPECT_FLOAT_EQ(2, curve.getValue(-1));
- EXPECT_FLOAT_EQ(2, curve.getValue(0));
- EXPECT_FLOAT_EQ(3, curve.getValue(0.5));
- EXPECT_FLOAT_EQ(4, curve.getValue(1));
- EXPECT_FLOAT_EQ(4, curve.getValue(2));
-}
-
-// Tests that a float animation with three keyframes works as expected.
-TEST(WebFloatAnimationCurveTest, ThreeFloatKeyframe)
-{
- WebFloatAnimationCurve curve;
- curve.add(WebFloatKeyframe(0, 2), WebAnimationCurve::TimingFunctionTypeLinear);
- curve.add(WebFloatKeyframe(1, 4), WebAnimationCurve::TimingFunctionTypeLinear);
- curve.add(WebFloatKeyframe(2, 8), WebAnimationCurve::TimingFunctionTypeLinear);
- EXPECT_FLOAT_EQ(2, curve.getValue(-1));
- EXPECT_FLOAT_EQ(2, curve.getValue(0));
- EXPECT_FLOAT_EQ(3, curve.getValue(0.5));
- EXPECT_FLOAT_EQ(4, curve.getValue(1));
- EXPECT_FLOAT_EQ(6, curve.getValue(1.5));
- EXPECT_FLOAT_EQ(8, curve.getValue(2));
- EXPECT_FLOAT_EQ(8, curve.getValue(3));
-}
-
-// Tests that a float animation with multiple keys at a given time works sanely.
-TEST(WebFloatAnimationCurveTest, RepeatedFloatKeyTimes)
-{
- WebFloatAnimationCurve curve;
- curve.add(WebFloatKeyframe(0, 4), WebAnimationCurve::TimingFunctionTypeLinear);
- curve.add(WebFloatKeyframe(1, 4), WebAnimationCurve::TimingFunctionTypeLinear);
- curve.add(WebFloatKeyframe(1, 6), WebAnimationCurve::TimingFunctionTypeLinear);
- curve.add(WebFloatKeyframe(2, 6), WebAnimationCurve::TimingFunctionTypeLinear);
-
- EXPECT_FLOAT_EQ(4, curve.getValue(-1));
- EXPECT_FLOAT_EQ(4, curve.getValue(0));
- EXPECT_FLOAT_EQ(4, curve.getValue(0.5));
-
- // There is a discontinuity at 1. Any value between 4 and 6 is valid.
- float value = curve.getValue(1);
- EXPECT_TRUE(value >= 4 && value <= 6);
-
- EXPECT_FLOAT_EQ(6, curve.getValue(1.5));
- EXPECT_FLOAT_EQ(6, curve.getValue(2));
- EXPECT_FLOAT_EQ(6, curve.getValue(3));
-}
-
-// Tests that the keyframes may be added out of order.
-TEST(WebFloatAnimationCurveTest, UnsortedKeyframes)
-{
- WebFloatAnimationCurve curve;
- curve.add(WebFloatKeyframe(2, 8), WebAnimationCurve::TimingFunctionTypeLinear);
- curve.add(WebFloatKeyframe(0, 2), WebAnimationCurve::TimingFunctionTypeLinear);
- curve.add(WebFloatKeyframe(1, 4), WebAnimationCurve::TimingFunctionTypeLinear);
-
- EXPECT_FLOAT_EQ(2, curve.getValue(-1));
- EXPECT_FLOAT_EQ(2, curve.getValue(0));
- EXPECT_FLOAT_EQ(3, curve.getValue(0.5));
- EXPECT_FLOAT_EQ(4, curve.getValue(1));
- EXPECT_FLOAT_EQ(6, curve.getValue(1.5));
- EXPECT_FLOAT_EQ(8, curve.getValue(2));
- EXPECT_FLOAT_EQ(8, curve.getValue(3));
-}
-
-// Tests that a cubic bezier timing function works as expected.
-TEST(WebFloatAnimationCurveTest, CubicBezierTimingFunction)
-{
- WebFloatAnimationCurve curve;
- curve.add(WebFloatKeyframe(0, 0), 0.25, 0, 0.75, 1);
- curve.add(WebFloatKeyframe(1, 1), WebAnimationCurve::TimingFunctionTypeLinear);
-
- EXPECT_FLOAT_EQ(0, curve.getValue(0));
- EXPECT_LT(0, curve.getValue(0.25));
- EXPECT_GT(0.25, curve.getValue(0.25));
- EXPECT_FLOAT_EQ(0.5, curve.getValue(0.5));
- EXPECT_LT(0.75, curve.getValue(0.75));
- EXPECT_GT(1, curve.getValue(0.75));
- EXPECT_FLOAT_EQ(1, curve.getValue(1));
-}
-
-// Tests that an ease timing function works as expected.
-TEST(WebFloatAnimationCurveTest, EaseTimingFunction)
-{
- WebFloatAnimationCurve curve;
- curve.add(WebFloatKeyframe(0, 0), WebAnimationCurve::TimingFunctionTypeEase);
- curve.add(WebFloatKeyframe(1, 1), WebAnimationCurve::TimingFunctionTypeLinear);
-
- OwnPtr<WebCore::CCTimingFunction> timingFunction(WebCore::CCEaseTimingFunction::create());
- for (int i = 0; i <= 4; ++i) {
- const double time = i * 0.25;
- EXPECT_FLOAT_EQ(timingFunction->getValue(time), curve.getValue(time));
- }
-}
-
-// Tests using a linear timing function.
-TEST(WebFloatAnimationCurveTest, LinearTimingFunction)
-{
- WebFloatAnimationCurve curve;
- curve.add(WebFloatKeyframe(0, 0), WebAnimationCurve::TimingFunctionTypeLinear);
- curve.add(WebFloatKeyframe(1, 1), WebAnimationCurve::TimingFunctionTypeLinear);
-
- for (int i = 0; i <= 4; ++i) {
- const double time = i * 0.25;
- EXPECT_FLOAT_EQ(time, curve.getValue(time));
- }
-}
-
-// Tests that an ease in timing function works as expected.
-TEST(WebFloatAnimationCurveTest, EaseInTimingFunction)
-{
- WebFloatAnimationCurve curve;
- curve.add(WebFloatKeyframe(0, 0), WebAnimationCurve::TimingFunctionTypeEaseIn);
- curve.add(WebFloatKeyframe(1, 1), WebAnimationCurve::TimingFunctionTypeLinear);
-
- OwnPtr<WebCore::CCTimingFunction> timingFunction(WebCore::CCEaseInTimingFunction::create());
- for (int i = 0; i <= 4; ++i) {
- const double time = i * 0.25;
- EXPECT_FLOAT_EQ(timingFunction->getValue(time), curve.getValue(time));
- }
-}
-
-// Tests that an ease in timing function works as expected.
-TEST(WebFloatAnimationCurveTest, EaseOutTimingFunction)
-{
- WebFloatAnimationCurve curve;
- curve.add(WebFloatKeyframe(0, 0), WebAnimationCurve::TimingFunctionTypeEaseOut);
- curve.add(WebFloatKeyframe(1, 1), WebAnimationCurve::TimingFunctionTypeLinear);
-
- OwnPtr<WebCore::CCTimingFunction> timingFunction(WebCore::CCEaseOutTimingFunction::create());
- for (int i = 0; i <= 4; ++i) {
- const double time = i * 0.25;
- EXPECT_FLOAT_EQ(timingFunction->getValue(time), curve.getValue(time));
- }
-}
-
-// Tests that an ease in timing function works as expected.
-TEST(WebFloatAnimationCurveTest, EaseInOutTimingFunction)
-{
- WebFloatAnimationCurve curve;
- curve.add(WebFloatKeyframe(0, 0), WebAnimationCurve::TimingFunctionTypeEaseInOut);
- curve.add(WebFloatKeyframe(1, 1), WebAnimationCurve::TimingFunctionTypeLinear);
-
- OwnPtr<WebCore::CCTimingFunction> timingFunction(WebCore::CCEaseInOutTimingFunction::create());
- for (int i = 0; i <= 4; ++i) {
- const double time = i * 0.25;
- EXPECT_FLOAT_EQ(timingFunction->getValue(time), curve.getValue(time));
- }
-}
-
-// Tests that an ease in timing function works as expected.
-TEST(WebFloatAnimationCurveTest, CustomBezierTimingFunction)
-{
- WebFloatAnimationCurve curve;
- double x1 = 0.3;
- double y1 = 0.2;
- double x2 = 0.8;
- double y2 = 0.7;
- curve.add(WebFloatKeyframe(0, 0), x1, y1, x2, y2);
- curve.add(WebFloatKeyframe(1, 1), WebAnimationCurve::TimingFunctionTypeLinear);
-
- OwnPtr<WebCore::CCTimingFunction> timingFunction(WebCore::CCCubicBezierTimingFunction::create(x1, y1, x2, y2));
- for (int i = 0; i <= 4; ++i) {
- const double time = i * 0.25;
- EXPECT_FLOAT_EQ(timingFunction->getValue(time), curve.getValue(time));
- }
-}
-
-// Tests that the default timing function is indeed ease.
-TEST(WebFloatAnimationCurveTest, DefaultTimingFunction)
-{
- WebFloatAnimationCurve curve;
- curve.add(WebFloatKeyframe(0, 0));
- curve.add(WebFloatKeyframe(1, 1), WebAnimationCurve::TimingFunctionTypeLinear);
-
- OwnPtr<WebCore::CCTimingFunction> timingFunction(WebCore::CCEaseTimingFunction::create());
- for (int i = 0; i <= 4; ++i) {
- const double time = i * 0.25;
- EXPECT_FLOAT_EQ(timingFunction->getValue(time), curve.getValue(time));
- }
-}
-
-} // namespace
+++ /dev/null
-/*
- * Copyright (C) 2012 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-
-#include <public/WebTransformAnimationCurve.h>
-
-#include "cc/CCTimingFunction.h"
-
-#include <gtest/gtest.h>
-#include <public/WebTransformOperations.h>
-#include <public/WebTransformationMatrix.h>
-#include <wtf/OwnPtr.h>
-#include <wtf/PassOwnPtr.h>
-
-using namespace WebKit;
-
-namespace {
-
-// Tests that a transform animation with one keyframe works as expected.
-TEST(WebTransformAnimationCurveTest, OneTransformKeyframe)
-{
- WebTransformAnimationCurve curve;
- WebKit::WebTransformOperations operations;
- operations.appendTranslate(2, 0, 0);
- curve.add(WebTransformKeyframe(0, operations), WebAnimationCurve::TimingFunctionTypeLinear);
-
- EXPECT_FLOAT_EQ(2, curve.getValue(-1).m41());
- EXPECT_FLOAT_EQ(2, curve.getValue(0).m41());
- EXPECT_FLOAT_EQ(2, curve.getValue(0.5).m41());
- EXPECT_FLOAT_EQ(2, curve.getValue(1).m41());
- EXPECT_FLOAT_EQ(2, curve.getValue(2).m41());
-}
-
-// Tests that a transform animation with two keyframes works as expected.
-TEST(WebTransformAnimationCurveTest, TwoTransformKeyframe)
-{
- WebTransformAnimationCurve curve;
- WebKit::WebTransformOperations operations1;
- operations1.appendTranslate(2, 0, 0);
- WebKit::WebTransformOperations operations2;
- operations2.appendTranslate(4, 0, 0);
- curve.add(WebTransformKeyframe(0, operations1), WebAnimationCurve::TimingFunctionTypeLinear);
- curve.add(WebTransformKeyframe(1, operations2), WebAnimationCurve::TimingFunctionTypeLinear);
- EXPECT_FLOAT_EQ(2, curve.getValue(-1).m41());
- EXPECT_FLOAT_EQ(2, curve.getValue(0).m41());
- EXPECT_FLOAT_EQ(3, curve.getValue(0.5).m41());
- EXPECT_FLOAT_EQ(4, curve.getValue(1).m41());
- EXPECT_FLOAT_EQ(4, curve.getValue(2).m41());
-}
-
-// Tests that a transform animation with three keyframes works as expected.
-TEST(WebTransformAnimationCurveTest, ThreeTransformKeyframe)
-{
- WebTransformAnimationCurve curve;
- WebKit::WebTransformOperations operations1;
- operations1.appendTranslate(2, 0, 0);
- WebKit::WebTransformOperations operations2;
- operations2.appendTranslate(4, 0, 0);
- WebKit::WebTransformOperations operations3;
- operations3.appendTranslate(8, 0, 0);
- curve.add(WebTransformKeyframe(0, operations1), WebAnimationCurve::TimingFunctionTypeLinear);
- curve.add(WebTransformKeyframe(1, operations2), WebAnimationCurve::TimingFunctionTypeLinear);
- curve.add(WebTransformKeyframe(2, operations3), WebAnimationCurve::TimingFunctionTypeLinear);
- EXPECT_FLOAT_EQ(2, curve.getValue(-1).m41());
- EXPECT_FLOAT_EQ(2, curve.getValue(0).m41());
- EXPECT_FLOAT_EQ(3, curve.getValue(0.5).m41());
- EXPECT_FLOAT_EQ(4, curve.getValue(1).m41());
- EXPECT_FLOAT_EQ(6, curve.getValue(1.5).m41());
- EXPECT_FLOAT_EQ(8, curve.getValue(2).m41());
- EXPECT_FLOAT_EQ(8, curve.getValue(3).m41());
-}
-
-// Tests that a transform animation with multiple keys at a given time works sanely.
-TEST(WebTransformAnimationCurveTest, RepeatedTransformKeyTimes)
-{
- // A step function.
- WebTransformAnimationCurve curve;
- WebKit::WebTransformOperations operations1;
- operations1.appendTranslate(4, 0, 0);
- WebKit::WebTransformOperations operations2;
- operations2.appendTranslate(4, 0, 0);
- WebKit::WebTransformOperations operations3;
- operations3.appendTranslate(6, 0, 0);
- WebKit::WebTransformOperations operations4;
- operations4.appendTranslate(6, 0, 0);
- curve.add(WebTransformKeyframe(0, operations1), WebAnimationCurve::TimingFunctionTypeLinear);
- curve.add(WebTransformKeyframe(1, operations2), WebAnimationCurve::TimingFunctionTypeLinear);
- curve.add(WebTransformKeyframe(1, operations3), WebAnimationCurve::TimingFunctionTypeLinear);
- curve.add(WebTransformKeyframe(2, operations4), WebAnimationCurve::TimingFunctionTypeLinear);
-
- EXPECT_FLOAT_EQ(4, curve.getValue(-1).m41());
- EXPECT_FLOAT_EQ(4, curve.getValue(0).m41());
- EXPECT_FLOAT_EQ(4, curve.getValue(0.5).m41());
-
- // There is a discontinuity at 1. Any value between 4 and 6 is valid.
- WebTransformationMatrix value = curve.getValue(1);
- EXPECT_TRUE(value.m41() >= 4 && value.m41() <= 6);
-
- EXPECT_FLOAT_EQ(6, curve.getValue(1.5).m41());
- EXPECT_FLOAT_EQ(6, curve.getValue(2).m41());
- EXPECT_FLOAT_EQ(6, curve.getValue(3).m41());
-}
-
-// Tests that the keyframes may be added out of order.
-TEST(WebTransformAnimationCurveTest, UnsortedKeyframes)
-{
- WebTransformAnimationCurve curve;
- WebKit::WebTransformOperations operations1;
- operations1.appendTranslate(2, 0, 0);
- WebKit::WebTransformOperations operations2;
- operations2.appendTranslate(4, 0, 0);
- WebKit::WebTransformOperations operations3;
- operations3.appendTranslate(8, 0, 0);
- curve.add(WebTransformKeyframe(2, operations3), WebAnimationCurve::TimingFunctionTypeLinear);
- curve.add(WebTransformKeyframe(0, operations1), WebAnimationCurve::TimingFunctionTypeLinear);
- curve.add(WebTransformKeyframe(1, operations2), WebAnimationCurve::TimingFunctionTypeLinear);
-
- EXPECT_FLOAT_EQ(2, curve.getValue(-1).m41());
- EXPECT_FLOAT_EQ(2, curve.getValue(0).m41());
- EXPECT_FLOAT_EQ(3, curve.getValue(0.5).m41());
- EXPECT_FLOAT_EQ(4, curve.getValue(1).m41());
- EXPECT_FLOAT_EQ(6, curve.getValue(1.5).m41());
- EXPECT_FLOAT_EQ(8, curve.getValue(2).m41());
- EXPECT_FLOAT_EQ(8, curve.getValue(3).m41());
-}
-
-// Tests that a cubic bezier timing function works as expected.
-TEST(WebTransformAnimationCurveTest, CubicBezierTimingFunction)
-{
- WebTransformAnimationCurve curve;
- WebKit::WebTransformOperations operations1;
- operations1.appendTranslate(0, 0, 0);
- WebKit::WebTransformOperations operations2;
- operations2.appendTranslate(1, 0, 0);
- curve.add(WebTransformKeyframe(0, operations1), 0.25, 0, 0.75, 1);
- curve.add(WebTransformKeyframe(1, operations2), WebAnimationCurve::TimingFunctionTypeLinear);
- EXPECT_FLOAT_EQ(0, curve.getValue(0).m41());
- EXPECT_LT(0, curve.getValue(0.25).m41());
- EXPECT_GT(0.25, curve.getValue(0.25).m41());
- EXPECT_FLOAT_EQ(0.5, curve.getValue(0.5).m41());
- EXPECT_LT(0.75, curve.getValue(0.75).m41());
- EXPECT_GT(1, curve.getValue(0.75).m41());
- EXPECT_FLOAT_EQ(1, curve.getValue(1).m41());
-}
-
-// Tests that an ease timing function works as expected.
-TEST(WebTransformAnimationCurveTest, EaseTimingFunction)
-{
- WebTransformAnimationCurve curve;
- WebKit::WebTransformOperations operations1;
- operations1.appendTranslate(0, 0, 0);
- WebKit::WebTransformOperations operations2;
- operations2.appendTranslate(1, 0, 0);
- curve.add(WebTransformKeyframe(0, operations1), WebAnimationCurve::TimingFunctionTypeEase);
- curve.add(WebTransformKeyframe(1, operations2), WebAnimationCurve::TimingFunctionTypeLinear);
-
- OwnPtr<WebCore::CCTimingFunction> timingFunction(WebCore::CCEaseTimingFunction::create());
- for (int i = 0; i <= 4; ++i) {
- const double time = i * 0.25;
- EXPECT_FLOAT_EQ(timingFunction->getValue(time), curve.getValue(time).m41());
- }
-}
-
-// Tests using a linear timing function.
-TEST(WebTransformAnimationCurveTest, LinearTimingFunction)
-{
- WebTransformAnimationCurve curve;
- WebKit::WebTransformOperations operations1;
- operations1.appendTranslate(0, 0, 0);
- WebKit::WebTransformOperations operations2;
- operations2.appendTranslate(1, 0, 0);
- curve.add(WebTransformKeyframe(0, operations1), WebAnimationCurve::TimingFunctionTypeLinear);
- curve.add(WebTransformKeyframe(1, operations2), WebAnimationCurve::TimingFunctionTypeLinear);
-
- for (int i = 0; i <= 4; ++i) {
- const double time = i * 0.25;
- EXPECT_FLOAT_EQ(time, curve.getValue(time).m41());
- }
-}
-
-// Tests that an ease in timing function works as expected.
-TEST(WebTransformAnimationCurveTest, EaseInTimingFunction)
-{
- WebTransformAnimationCurve curve;
- WebKit::WebTransformOperations operations1;
- operations1.appendTranslate(0, 0, 0);
- WebKit::WebTransformOperations operations2;
- operations2.appendTranslate(1, 0, 0);
- curve.add(WebTransformKeyframe(0, operations1), WebAnimationCurve::TimingFunctionTypeEaseIn);
- curve.add(WebTransformKeyframe(1, operations2), WebAnimationCurve::TimingFunctionTypeLinear);
-
- OwnPtr<WebCore::CCTimingFunction> timingFunction(WebCore::CCEaseInTimingFunction::create());
- for (int i = 0; i <= 4; ++i) {
- const double time = i * 0.25;
- EXPECT_FLOAT_EQ(timingFunction->getValue(time), curve.getValue(time).m41());
- }
-}
-
-// Tests that an ease in timing function works as expected.
-TEST(WebTransformAnimationCurveTest, EaseOutTimingFunction)
-{
- WebTransformAnimationCurve curve;
- WebKit::WebTransformOperations operations1;
- operations1.appendTranslate(0, 0, 0);
- WebKit::WebTransformOperations operations2;
- operations2.appendTranslate(1, 0, 0);
- curve.add(WebTransformKeyframe(0, operations1), WebAnimationCurve::TimingFunctionTypeEaseOut);
- curve.add(WebTransformKeyframe(1, operations2), WebAnimationCurve::TimingFunctionTypeLinear);
-
- OwnPtr<WebCore::CCTimingFunction> timingFunction(WebCore::CCEaseOutTimingFunction::create());
- for (int i = 0; i <= 4; ++i) {
- const double time = i * 0.25;
- EXPECT_FLOAT_EQ(timingFunction->getValue(time), curve.getValue(time).m41());
- }
-}
-
-// Tests that an ease in timing function works as expected.
-TEST(WebTransformAnimationCurveTest, EaseInOutTimingFunction)
-{
- WebTransformAnimationCurve curve;
- WebKit::WebTransformOperations operations1;
- operations1.appendTranslate(0, 0, 0);
- WebKit::WebTransformOperations operations2;
- operations2.appendTranslate(1, 0, 0);
- curve.add(WebTransformKeyframe(0, operations1), WebAnimationCurve::TimingFunctionTypeEaseInOut);
- curve.add(WebTransformKeyframe(1, operations2), WebAnimationCurve::TimingFunctionTypeLinear);
-
- OwnPtr<WebCore::CCTimingFunction> timingFunction(WebCore::CCEaseInOutTimingFunction::create());
- for (int i = 0; i <= 4; ++i) {
- const double time = i * 0.25;
- EXPECT_FLOAT_EQ(timingFunction->getValue(time), curve.getValue(time).m41());
- }
-}
-
-// Tests that an ease in timing function works as expected.
-TEST(WebTransformAnimationCurveTest, CustomBezierTimingFunction)
-{
- WebTransformAnimationCurve curve;
- double x1 = 0.3;
- double y1 = 0.2;
- double x2 = 0.8;
- double y2 = 0.7;
- WebKit::WebTransformOperations operations1;
- operations1.appendTranslate(0, 0, 0);
- WebKit::WebTransformOperations operations2;
- operations2.appendTranslate(1, 0, 0);
- curve.add(WebTransformKeyframe(0, operations1), x1, y1, x2, y2);
- curve.add(WebTransformKeyframe(1, operations2), WebAnimationCurve::TimingFunctionTypeLinear);
-
- OwnPtr<WebCore::CCTimingFunction> timingFunction(WebCore::CCCubicBezierTimingFunction::create(x1, y1, x2, y2));
- for (int i = 0; i <= 4; ++i) {
- const double time = i * 0.25;
- EXPECT_FLOAT_EQ(timingFunction->getValue(time), curve.getValue(time).m41());
- }
-}
-
-// Tests that the default timing function is indeed ease.
-TEST(WebTransformAnimationCurveTest, DefaultTimingFunction)
-{
- WebTransformAnimationCurve curve;
- WebKit::WebTransformOperations operations1;
- operations1.appendTranslate(0, 0, 0);
- WebKit::WebTransformOperations operations2;
- operations2.appendTranslate(1, 0, 0);
- curve.add(WebTransformKeyframe(0, operations1));
- curve.add(WebTransformKeyframe(1, operations2), WebAnimationCurve::TimingFunctionTypeLinear);
-
- OwnPtr<WebCore::CCTimingFunction> timingFunction(WebCore::CCEaseTimingFunction::create());
- for (int i = 0; i <= 4; ++i) {
- const double time = i * 0.25;
- EXPECT_FLOAT_EQ(timingFunction->getValue(time), curve.getValue(time).m41());
- }
-}
-
-} // namespace