summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorajuma@chromium.org <ajuma@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-21 23:33:35 +0000
committerajuma@chromium.org <ajuma@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-21 23:33:35 +0000
commit6348de6823c1ec7a1eafd7f692508493dc072a90 (patch)
tree27c3b591057617e600f9be6001bbee028c94bfe1
parent4e270df806be89ac53b0a4adb6f26b20d38eabe8 (diff)
downloadchromium_src-6348de6823c1ec7a1eafd7f692508493dc072a90.zip
chromium_src-6348de6823c1ec7a1eafd7f692508493dc072a90.tar.gz
chromium_src-6348de6823c1ec7a1eafd7f692508493dc072a90.tar.bz2
Remove old code that uses non-virtual WebTransformOperations
Now that WebTransformOperations is virtual, this removes code behind the #else branches of "#if WEB_TRANSFORM_OPERATIONS_IS_VIRTUAL". This is step 3 of the 3-step plan outlined at https://chromiumcodereview.appspot.com/11745018 for moving the implementation of WebTransformOperations into chromium. BUG=166640 Review URL: https://chromiumcodereview.appspot.com/12047006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@177962 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--cc/keyframed_animation_curve.cc33
-rw-r--r--cc/keyframed_animation_curve.h18
-rw-r--r--cc/keyframed_animation_curve_unittest.cc33
-rw-r--r--cc/test/animation_test_common.cc12
-rw-r--r--webkit/compositor_bindings/compositor_bindings_tests.gyp1
-rw-r--r--webkit/compositor_bindings/web_compositor_support_impl.cc2
-rw-r--r--webkit/compositor_bindings/web_compositor_support_impl.h2
-rw-r--r--webkit/compositor_bindings/web_transform_animation_curve_impl.cc8
-rw-r--r--webkit/compositor_bindings/web_transform_animation_curve_unittest.cc126
-rw-r--r--webkit/compositor_bindings/web_transform_operations_impl.cc2
-rw-r--r--webkit/compositor_bindings/web_transform_operations_impl.h2
-rw-r--r--webkit/compositor_bindings/web_transform_operations_unittest.cc614
12 files changed, 0 insertions, 853 deletions
diff --git a/cc/keyframed_animation_curve.cc b/cc/keyframed_animation_curve.cc
index 90f9315..579d787 100644
--- a/cc/keyframed_animation_curve.cc
+++ b/cc/keyframed_animation_curve.cc
@@ -84,7 +84,6 @@ scoped_ptr<FloatKeyframe> FloatKeyframe::clone() const
return FloatKeyframe::create(time(), value(), func.Pass());
}
-#if WEB_TRANSFORM_OPERATIONS_IS_VIRTUAL
scoped_ptr<TransformKeyframe> TransformKeyframe::create(double time, const TransformOperations& value, scoped_ptr<TimingFunction> timingFunction)
{
return make_scoped_ptr(new TransformKeyframe(time, value, timingFunction.Pass()));
@@ -95,34 +94,15 @@ TransformKeyframe::TransformKeyframe(double time, const TransformOperations& val
, m_value(value)
{
}
-#else
-scoped_ptr<TransformKeyframe> TransformKeyframe::create(double time, const WebKit::WebTransformOperations& value, scoped_ptr<TimingFunction> timingFunction)
-{
- return make_scoped_ptr(new TransformKeyframe(time, value, timingFunction.Pass()));
-}
-
-TransformKeyframe::TransformKeyframe(double time, const WebKit::WebTransformOperations& value, scoped_ptr<TimingFunction> timingFunction)
- : Keyframe(time, timingFunction.Pass())
- , m_value(value)
-{
-}
-#endif
TransformKeyframe::~TransformKeyframe()
{
}
-#if WEB_TRANSFORM_OPERATIONS_IS_VIRTUAL
const TransformOperations& TransformKeyframe::value() const
{
return m_value;
}
-#else
-const WebKit::WebTransformOperations& TransformKeyframe::value() const
-{
- return m_value;
-}
-#endif
scoped_ptr<TransformKeyframe> TransformKeyframe::clone() const
{
@@ -218,20 +198,11 @@ scoped_ptr<AnimationCurve> KeyframedTransformAnimationCurve::clone() const
WebTransformationMatrix KeyframedTransformAnimationCurve::getValue(double t) const
{
-#if WEB_TRANSFORM_OPERATIONS_IS_VIRTUAL
if (t <= m_keyframes.front()->time())
return m_keyframes.front()->value().Apply();
if (t >= m_keyframes.back()->time())
return m_keyframes.back()->value().Apply();
-#else
- if (t <= m_keyframes.front()->time())
- return m_keyframes.front()->value().apply();
-
- if (t >= m_keyframes.back()->time())
- return m_keyframes.back()->value().apply();
-
-#endif
size_t i = 0;
for (; i < m_keyframes.size() - 1; ++i) {
@@ -244,11 +215,7 @@ WebTransformationMatrix KeyframedTransformAnimationCurve::getValue(double t) con
if (m_keyframes[i]->timingFunction())
progress = m_keyframes[i]->timingFunction()->getValue(progress);
-#if WEB_TRANSFORM_OPERATIONS_IS_VIRTUAL
return m_keyframes[i+1]->value().Blend(m_keyframes[i]->value(), progress);
-#else
- return m_keyframes[i+1]->value().blend(m_keyframes[i]->value(), progress);
-#endif
}
} // namespace cc
diff --git a/cc/keyframed_animation_curve.h b/cc/keyframed_animation_curve.h
index 02136d1..cfd1915 100644
--- a/cc/keyframed_animation_curve.h
+++ b/cc/keyframed_animation_curve.h
@@ -10,7 +10,6 @@
#include "cc/scoped_ptr_vector.h"
#include "cc/timing_function.h"
#include "cc/transform_operations.h"
-#include "third_party/WebKit/Source/Platform/chromium/public/WebTransformOperations.h"
namespace cc {
@@ -45,7 +44,6 @@ private:
float m_value;
};
-#if WEB_TRANSFORM_OPERATIONS_IS_VIRTUAL
class CC_EXPORT TransformKeyframe : public Keyframe {
public:
static scoped_ptr<TransformKeyframe> create(double time, const TransformOperations& value, scoped_ptr<TimingFunction>);
@@ -60,22 +58,6 @@ private:
TransformOperations m_value;
};
-#else
-class CC_EXPORT TransformKeyframe : public Keyframe {
-public:
- static scoped_ptr<TransformKeyframe> create(double time, const WebKit::WebTransformOperations& value, scoped_ptr<TimingFunction>);
- virtual ~TransformKeyframe();
-
- const WebKit::WebTransformOperations& value() const;
-
- scoped_ptr<TransformKeyframe> clone() const;
-
-private:
- TransformKeyframe(double time, const WebKit::WebTransformOperations& value, scoped_ptr<TimingFunction>);
-
- WebKit::WebTransformOperations m_value;
-};
-#endif // WEB_TRANSFORM_OPERATIONS_IS_VIRTUAL
class CC_EXPORT KeyframedFloatAnimationCurve : public FloatAnimationCurve {
public:
diff --git a/cc/keyframed_animation_curve_unittest.cc b/cc/keyframed_animation_curve_unittest.cc
index b520dca4..a08ada6 100644
--- a/cc/keyframed_animation_curve_unittest.cc
+++ b/cc/keyframed_animation_curve_unittest.cc
@@ -7,7 +7,6 @@
#include "cc/transform_operations.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
-#include "third_party/WebKit/Source/Platform/chromium/public/WebTransformOperations.h"
#include "third_party/WebKit/Source/Platform/chromium/public/WebTransformationMatrix.h"
using WebKit::WebTransformationMatrix;
@@ -88,13 +87,8 @@ TEST(KeyframedAnimationCurveTest, RepeatedFloatKeyTimes)
TEST(KeyframedAnimationCurveTest, OneTransformKeyframe)
{
scoped_ptr<KeyframedTransformAnimationCurve> curve(KeyframedTransformAnimationCurve::create());
-#if WEB_TRANSFORM_OPERATIONS_IS_VIRTUAL
TransformOperations operations;
operations.AppendTranslate(2, 0, 0);
-#else
- WebKit::WebTransformOperations operations;
- operations.appendTranslate(2, 0, 0);
-#endif
curve->addKeyframe(TransformKeyframe::create(0, operations, scoped_ptr<TimingFunction>()));
expectTranslateX(2, curve->getValue(-1));
@@ -108,17 +102,10 @@ TEST(KeyframedAnimationCurveTest, OneTransformKeyframe)
TEST(KeyframedAnimationCurveTest, TwoTransformKeyframe)
{
scoped_ptr<KeyframedTransformAnimationCurve> curve(KeyframedTransformAnimationCurve::create());
-#if WEB_TRANSFORM_OPERATIONS_IS_VIRTUAL
TransformOperations operations1;
operations1.AppendTranslate(2, 0, 0);
TransformOperations operations2;
operations2.AppendTranslate(4, 0, 0);
-#else
- WebKit::WebTransformOperations operations1;
- operations1.appendTranslate(2, 0, 0);
- WebKit::WebTransformOperations operations2;
- operations2.appendTranslate(4, 0, 0);
-#endif
curve->addKeyframe(TransformKeyframe::create(0, operations1, scoped_ptr<TimingFunction>()));
curve->addKeyframe(TransformKeyframe::create(1, operations2, scoped_ptr<TimingFunction>()));
@@ -133,21 +120,12 @@ TEST(KeyframedAnimationCurveTest, TwoTransformKeyframe)
TEST(KeyframedAnimationCurveTest, ThreeTransformKeyframe)
{
scoped_ptr<KeyframedTransformAnimationCurve> curve(KeyframedTransformAnimationCurve::create());
-#if WEB_TRANSFORM_OPERATIONS_IS_VIRTUAL
TransformOperations operations1;
operations1.AppendTranslate(2, 0, 0);
TransformOperations operations2;
operations2.AppendTranslate(4, 0, 0);
TransformOperations operations3;
operations3.AppendTranslate(8, 0, 0);
-#else
- WebKit::WebTransformOperations operations1;
- operations1.appendTranslate(2, 0, 0);
- WebKit::WebTransformOperations operations2;
- operations2.appendTranslate(4, 0, 0);
- WebKit::WebTransformOperations operations3;
- operations3.appendTranslate(8, 0, 0);
-#endif
curve->addKeyframe(TransformKeyframe::create(0, operations1, scoped_ptr<TimingFunction>()));
curve->addKeyframe(TransformKeyframe::create(1, operations2, scoped_ptr<TimingFunction>()));
curve->addKeyframe(TransformKeyframe::create(2, operations3, scoped_ptr<TimingFunction>()));
@@ -165,7 +143,6 @@ TEST(KeyframedAnimationCurveTest, RepeatedTransformKeyTimes)
{
scoped_ptr<KeyframedTransformAnimationCurve> curve(KeyframedTransformAnimationCurve::create());
// A step function.
-#if WEB_TRANSFORM_OPERATIONS_IS_VIRTUAL
TransformOperations operations1;
operations1.AppendTranslate(4, 0, 0);
TransformOperations operations2;
@@ -174,16 +151,6 @@ TEST(KeyframedAnimationCurveTest, RepeatedTransformKeyTimes)
operations3.AppendTranslate(6, 0, 0);
TransformOperations operations4;
operations4.AppendTranslate(6, 0, 0);
-#else
- 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);
-#endif
curve->addKeyframe(TransformKeyframe::create(0, operations1, scoped_ptr<TimingFunction>()));
curve->addKeyframe(TransformKeyframe::create(1, operations2, scoped_ptr<TimingFunction>()));
curve->addKeyframe(TransformKeyframe::create(1, operations3, scoped_ptr<TimingFunction>()));
diff --git a/cc/test/animation_test_common.cc b/cc/test/animation_test_common.cc
index 13af91d..9cce327 100644
--- a/cc/test/animation_test_common.cc
+++ b/cc/test/animation_test_common.cc
@@ -9,7 +9,6 @@
#include "cc/layer_animation_controller.h"
#include "cc/layer_impl.h"
#include "cc/transform_operations.h"
-#include "third_party/WebKit/Source/Platform/chromium/public/WebTransformOperations.h"
using cc::Animation;
using cc::AnimationCurve;
@@ -50,7 +49,6 @@ int addAnimatedTransform(Target& target, double duration, int deltaX, int deltaY
{
scoped_ptr<KeyframedTransformAnimationCurve> curve(KeyframedTransformAnimationCurve::create());
-#if WEB_TRANSFORM_OPERATIONS_IS_VIRTUAL
if (duration > 0) {
TransformOperations startOperations;
startOperations.AppendTranslate(deltaX, deltaY, 0);
@@ -59,16 +57,6 @@ int addAnimatedTransform(Target& target, double duration, int deltaX, int deltaY
TransformOperations operations;
operations.AppendTranslate(deltaX, deltaY, 0);
-#else
- if (duration > 0) {
- WebKit::WebTransformOperations startOperations;
- startOperations.appendTranslate(deltaX, deltaY, 0);
- curve->addKeyframe(TransformKeyframe::create(0, startOperations, scoped_ptr<cc::TimingFunction>()));
- }
-
- WebKit::WebTransformOperations operations;
- operations.appendTranslate(deltaX, deltaY, 0);
-#endif
curve->addKeyframe(TransformKeyframe::create(duration, operations, scoped_ptr<cc::TimingFunction>()));
int id = nextAnimationId++;
diff --git a/webkit/compositor_bindings/compositor_bindings_tests.gyp b/webkit/compositor_bindings/compositor_bindings_tests.gyp
index e26474d..b4016bd 100644
--- a/webkit/compositor_bindings/compositor_bindings_tests.gyp
+++ b/webkit/compositor_bindings/compositor_bindings_tests.gyp
@@ -11,7 +11,6 @@
'web_layer_unittest.cc',
'web_layer_tree_view_unittest.cc',
'web_transform_animation_curve_unittest.cc',
- 'web_transform_operations_unittest.cc',
'web_transformation_matrix_unittest.cc',
'test/web_layer_tree_view_test_common.h',
],
diff --git a/webkit/compositor_bindings/web_compositor_support_impl.cc b/webkit/compositor_bindings/web_compositor_support_impl.cc
index 4b29d73..067f384 100644
--- a/webkit/compositor_bindings/web_compositor_support_impl.cc
+++ b/webkit/compositor_bindings/web_compositor_support_impl.cc
@@ -167,10 +167,8 @@ WebTransformAnimationCurve*
return new WebKit::WebTransformAnimationCurveImpl();
}
-#if WEB_TRANSFORM_OPERATIONS_IS_VIRTUAL
WebTransformOperations* WebCompositorSupportImpl::createTransformOperations() {
return new WebTransformOperationsImpl();
}
-#endif
} // namespace webkit
diff --git a/webkit/compositor_bindings/web_compositor_support_impl.h b/webkit/compositor_bindings/web_compositor_support_impl.h
index a01b24c..d964613 100644
--- a/webkit/compositor_bindings/web_compositor_support_impl.h
+++ b/webkit/compositor_bindings/web_compositor_support_impl.h
@@ -59,10 +59,8 @@ class WebCompositorSupportImpl : public WebKit::WebCompositorSupport {
createFloatAnimationCurve();
virtual WebKit::WebTransformAnimationCurve*
createTransformAnimationCurve();
-#if WEB_TRANSFORM_OPERATIONS_IS_VIRTUAL
virtual WebKit::WebTransformOperations*
createTransformOperations();
-#endif
private:
scoped_refptr<base::MessageLoopProxy> impl_thread_message_loop_proxy_;
diff --git a/webkit/compositor_bindings/web_transform_animation_curve_impl.cc b/webkit/compositor_bindings/web_transform_animation_curve_impl.cc
index 6525c23..3affd5a 100644
--- a/webkit/compositor_bindings/web_transform_animation_curve_impl.cc
+++ b/webkit/compositor_bindings/web_transform_animation_curve_impl.cc
@@ -33,24 +33,16 @@ void WebTransformAnimationCurveImpl::add(const WebTransformKeyframe& keyframe)
void WebTransformAnimationCurveImpl::add(const WebTransformKeyframe& keyframe, TimingFunctionType type)
{
-#if WEB_TRANSFORM_OPERATIONS_IS_VIRTUAL
const cc::TransformOperations& transformOperations =
static_cast<const webkit::WebTransformOperationsImpl&>(keyframe.value()).AsTransformOperations();
m_curve->addKeyframe(cc::TransformKeyframe::create(keyframe.time(), transformOperations, createTimingFunction(type)));
-#else
- m_curve->addKeyframe(cc::TransformKeyframe::create(keyframe.time, keyframe.value, createTimingFunction(type)));
-#endif
}
void WebTransformAnimationCurveImpl::add(const WebTransformKeyframe& keyframe, double x1, double y1, double x2, double y2)
{
-#if WEB_TRANSFORM_OPERATIONS_IS_VIRTUAL
const cc::TransformOperations& transformOperations =
static_cast<const webkit::WebTransformOperationsImpl&>(keyframe.value()).AsTransformOperations();
m_curve->addKeyframe(cc::TransformKeyframe::create(keyframe.time(), transformOperations, cc::CubicBezierTimingFunction::create(x1, y1, x2, y2).PassAs<cc::TimingFunction>()));
-#else
- m_curve->addKeyframe(cc::TransformKeyframe::create(keyframe.time, keyframe.value, cc::CubicBezierTimingFunction::create(x1, y1, x2, y2).PassAs<cc::TimingFunction>()));
-#endif
}
WebTransformationMatrix WebTransformAnimationCurveImpl::getValue(double time) const
diff --git a/webkit/compositor_bindings/web_transform_animation_curve_unittest.cc b/webkit/compositor_bindings/web_transform_animation_curve_unittest.cc
index 6712f78..d00ab9c 100644
--- a/webkit/compositor_bindings/web_transform_animation_curve_unittest.cc
+++ b/webkit/compositor_bindings/web_transform_animation_curve_unittest.cc
@@ -22,15 +22,9 @@ namespace {
TEST(WebTransformAnimationCurveTest, OneTransformKeyframe)
{
scoped_ptr<WebTransformAnimationCurve> curve(new WebTransformAnimationCurveImpl);
-#if WEB_TRANSFORM_OPERATIONS_IS_VIRTUAL
scoped_ptr<WebTransformOperations> operations(new WebTransformOperationsImpl());
operations->appendTranslate(2, 0, 0);
curve->add(WebTransformKeyframe(0, operations.release()), WebAnimationCurve::TimingFunctionTypeLinear);
-#else
- WebTransformOperations operations;
- operations.appendTranslate(2, 0, 0);
- curve->add(WebTransformKeyframe(0, operations), WebAnimationCurve::TimingFunctionTypeLinear);
-#endif
EXPECT_FLOAT_EQ(2, curve->getValue(-1).m41());
EXPECT_FLOAT_EQ(2, curve->getValue(0).m41());
@@ -43,21 +37,12 @@ TEST(WebTransformAnimationCurveTest, OneTransformKeyframe)
TEST(WebTransformAnimationCurveTest, TwoTransformKeyframe)
{
scoped_ptr<WebTransformAnimationCurve> curve(new WebTransformAnimationCurveImpl);
-#if WEB_TRANSFORM_OPERATIONS_IS_VIRTUAL
scoped_ptr<WebTransformOperations> operations1(new WebTransformOperationsImpl());
operations1->appendTranslate(2, 0, 0);
scoped_ptr<WebTransformOperations> operations2(new WebTransformOperationsImpl());
operations2->appendTranslate(4, 0, 0);
curve->add(WebTransformKeyframe(0, operations1.release()), WebAnimationCurve::TimingFunctionTypeLinear);
curve->add(WebTransformKeyframe(1, operations2.release()), WebAnimationCurve::TimingFunctionTypeLinear);
-#else
- WebTransformOperations operations1;
- operations1.appendTranslate(2, 0, 0);
- WebTransformOperations operations2;
- operations2.appendTranslate(4, 0, 0);
- curve->add(WebTransformKeyframe(0, operations1), WebAnimationCurve::TimingFunctionTypeLinear);
- curve->add(WebTransformKeyframe(1, operations2), WebAnimationCurve::TimingFunctionTypeLinear);
-#endif
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());
@@ -69,7 +54,6 @@ TEST(WebTransformAnimationCurveTest, TwoTransformKeyframe)
TEST(WebTransformAnimationCurveTest, ThreeTransformKeyframe)
{
scoped_ptr<WebTransformAnimationCurve> curve(new WebTransformAnimationCurveImpl);
-#if WEB_TRANSFORM_OPERATIONS_IS_VIRTUAL
scoped_ptr<WebTransformOperations> operations1(new WebTransformOperationsImpl());
operations1->appendTranslate(2, 0, 0);
scoped_ptr<WebTransformOperations> operations2(new WebTransformOperationsImpl());
@@ -79,17 +63,6 @@ TEST(WebTransformAnimationCurveTest, ThreeTransformKeyframe)
curve->add(WebTransformKeyframe(0, operations1.release()), WebAnimationCurve::TimingFunctionTypeLinear);
curve->add(WebTransformKeyframe(1, operations2.release()), WebAnimationCurve::TimingFunctionTypeLinear);
curve->add(WebTransformKeyframe(2, operations3.release()), WebAnimationCurve::TimingFunctionTypeLinear);
-#else
- WebTransformOperations operations1;
- operations1.appendTranslate(2, 0, 0);
- WebTransformOperations operations2;
- operations2.appendTranslate(4, 0, 0);
- 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);
-#endif
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());
@@ -104,7 +77,6 @@ TEST(WebTransformAnimationCurveTest, RepeatedTransformKeyTimes)
{
// A step function.
scoped_ptr<WebTransformAnimationCurve> curve(new WebTransformAnimationCurveImpl);
-#if WEB_TRANSFORM_OPERATIONS_IS_VIRTUAL
scoped_ptr<WebTransformOperations> operations1(new WebTransformOperationsImpl());
operations1->appendTranslate(4, 0, 0);
scoped_ptr<WebTransformOperations> operations2(new WebTransformOperationsImpl());
@@ -117,20 +89,6 @@ TEST(WebTransformAnimationCurveTest, RepeatedTransformKeyTimes)
curve->add(WebTransformKeyframe(1, operations2.release()), WebAnimationCurve::TimingFunctionTypeLinear);
curve->add(WebTransformKeyframe(1, operations3.release()), WebAnimationCurve::TimingFunctionTypeLinear);
curve->add(WebTransformKeyframe(2, operations4.release()), WebAnimationCurve::TimingFunctionTypeLinear);
-#else
- WebTransformOperations operations1;
- operations1.appendTranslate(4, 0, 0);
- WebTransformOperations operations2;
- operations2.appendTranslate(4, 0, 0);
- WebTransformOperations operations3;
- operations3.appendTranslate(6, 0, 0);
- 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);
-#endif
EXPECT_FLOAT_EQ(4, curve->getValue(-1).m41());
EXPECT_FLOAT_EQ(4, curve->getValue(0).m41());
@@ -149,7 +107,6 @@ TEST(WebTransformAnimationCurveTest, RepeatedTransformKeyTimes)
TEST(WebTransformAnimationCurveTest, UnsortedKeyframes)
{
scoped_ptr<WebTransformAnimationCurve> curve(new WebTransformAnimationCurveImpl);
-#if WEB_TRANSFORM_OPERATIONS_IS_VIRTUAL
scoped_ptr<WebTransformOperations> operations1(new WebTransformOperationsImpl());
operations1->appendTranslate(2, 0, 0);
scoped_ptr<WebTransformOperations> operations2(new WebTransformOperationsImpl());
@@ -159,17 +116,6 @@ TEST(WebTransformAnimationCurveTest, UnsortedKeyframes)
curve->add(WebTransformKeyframe(2, operations3.release()), WebAnimationCurve::TimingFunctionTypeLinear);
curve->add(WebTransformKeyframe(0, operations1.release()), WebAnimationCurve::TimingFunctionTypeLinear);
curve->add(WebTransformKeyframe(1, operations2.release()), WebAnimationCurve::TimingFunctionTypeLinear);
-#else
- WebTransformOperations operations1;
- operations1.appendTranslate(2, 0, 0);
- WebTransformOperations operations2;
- operations2.appendTranslate(4, 0, 0);
- 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);
-#endif
EXPECT_FLOAT_EQ(2, curve->getValue(-1).m41());
EXPECT_FLOAT_EQ(2, curve->getValue(0).m41());
@@ -184,21 +130,12 @@ TEST(WebTransformAnimationCurveTest, UnsortedKeyframes)
TEST(WebTransformAnimationCurveTest, CubicBezierTimingFunction)
{
scoped_ptr<WebTransformAnimationCurve> curve(new WebTransformAnimationCurveImpl);
-#if WEB_TRANSFORM_OPERATIONS_IS_VIRTUAL
scoped_ptr<WebTransformOperations> operations1(new WebTransformOperationsImpl());
operations1->appendTranslate(0, 0, 0);
scoped_ptr<WebTransformOperations> operations2(new WebTransformOperationsImpl());
operations2->appendTranslate(1, 0, 0);
curve->add(WebTransformKeyframe(0, operations1.release()), 0.25, 0, 0.75, 1);
curve->add(WebTransformKeyframe(1, operations2.release()), WebAnimationCurve::TimingFunctionTypeLinear);
-#else
- WebTransformOperations operations1;
- operations1.appendTranslate(0, 0, 0);
- 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);
-#endif
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());
@@ -212,21 +149,12 @@ TEST(WebTransformAnimationCurveTest, CubicBezierTimingFunction)
TEST(WebTransformAnimationCurveTest, EaseTimingFunction)
{
scoped_ptr<WebTransformAnimationCurve> curve(new WebTransformAnimationCurveImpl);
-#if WEB_TRANSFORM_OPERATIONS_IS_VIRTUAL
scoped_ptr<WebTransformOperations> operations1(new WebTransformOperationsImpl());
operations1->appendTranslate(0, 0, 0);
scoped_ptr<WebTransformOperations> operations2(new WebTransformOperationsImpl());
operations2->appendTranslate(1, 0, 0);
curve->add(WebTransformKeyframe(0, operations1.release()), WebAnimationCurve::TimingFunctionTypeEase);
curve->add(WebTransformKeyframe(1, operations2.release()), WebAnimationCurve::TimingFunctionTypeLinear);
-#else
- WebTransformOperations operations1;
- operations1.appendTranslate(0, 0, 0);
- WebTransformOperations operations2;
- operations2.appendTranslate(1, 0, 0);
- curve->add(WebTransformKeyframe(0, operations1), WebAnimationCurve::TimingFunctionTypeEase);
- curve->add(WebTransformKeyframe(1, operations2), WebAnimationCurve::TimingFunctionTypeLinear);
-#endif
scoped_ptr<cc::TimingFunction> timingFunction(cc::EaseTimingFunction::create());
for (int i = 0; i <= 4; ++i) {
@@ -239,21 +167,12 @@ TEST(WebTransformAnimationCurveTest, EaseTimingFunction)
TEST(WebTransformAnimationCurveTest, LinearTimingFunction)
{
scoped_ptr<WebTransformAnimationCurve> curve(new WebTransformAnimationCurveImpl);
-#if WEB_TRANSFORM_OPERATIONS_IS_VIRTUAL
scoped_ptr<WebTransformOperations> operations1(new WebTransformOperationsImpl());
operations1->appendTranslate(0, 0, 0);
scoped_ptr<WebTransformOperations> operations2(new WebTransformOperationsImpl());
operations2->appendTranslate(1, 0, 0);
curve->add(WebTransformKeyframe(0, operations1.release()), WebAnimationCurve::TimingFunctionTypeLinear);
curve->add(WebTransformKeyframe(1, operations2.release()), WebAnimationCurve::TimingFunctionTypeLinear);
-#else
- WebTransformOperations operations1;
- operations1.appendTranslate(0, 0, 0);
- WebTransformOperations operations2;
- operations2.appendTranslate(1, 0, 0);
- curve->add(WebTransformKeyframe(0, operations1), WebAnimationCurve::TimingFunctionTypeLinear);
- curve->add(WebTransformKeyframe(1, operations2), WebAnimationCurve::TimingFunctionTypeLinear);
-#endif
for (int i = 0; i <= 4; ++i) {
const double time = i * 0.25;
@@ -265,21 +184,12 @@ TEST(WebTransformAnimationCurveTest, LinearTimingFunction)
TEST(WebTransformAnimationCurveTest, EaseInTimingFunction)
{
scoped_ptr<WebTransformAnimationCurve> curve(new WebTransformAnimationCurveImpl);
-#if WEB_TRANSFORM_OPERATIONS_IS_VIRTUAL
scoped_ptr<WebTransformOperations> operations1(new WebTransformOperationsImpl());
operations1->appendTranslate(0, 0, 0);
scoped_ptr<WebTransformOperations> operations2(new WebTransformOperationsImpl());
operations2->appendTranslate(1, 0, 0);
curve->add(WebTransformKeyframe(0, operations1.release()), WebAnimationCurve::TimingFunctionTypeEaseIn);
curve->add(WebTransformKeyframe(1, operations2.release()), WebAnimationCurve::TimingFunctionTypeLinear);
-#else
- WebTransformOperations operations1;
- operations1.appendTranslate(0, 0, 0);
- WebTransformOperations operations2;
- operations2.appendTranslate(1, 0, 0);
- curve->add(WebTransformKeyframe(0, operations1), WebAnimationCurve::TimingFunctionTypeEaseIn);
- curve->add(WebTransformKeyframe(1, operations2), WebAnimationCurve::TimingFunctionTypeLinear);
-#endif
scoped_ptr<cc::TimingFunction> timingFunction(cc::EaseInTimingFunction::create());
for (int i = 0; i <= 4; ++i) {
@@ -292,21 +202,12 @@ TEST(WebTransformAnimationCurveTest, EaseInTimingFunction)
TEST(WebTransformAnimationCurveTest, EaseOutTimingFunction)
{
scoped_ptr<WebTransformAnimationCurve> curve(new WebTransformAnimationCurveImpl);
-#if WEB_TRANSFORM_OPERATIONS_IS_VIRTUAL
scoped_ptr<WebTransformOperations> operations1(new WebTransformOperationsImpl());
operations1->appendTranslate(0, 0, 0);
scoped_ptr<WebTransformOperations> operations2(new WebTransformOperationsImpl());
operations2->appendTranslate(1, 0, 0);
curve->add(WebTransformKeyframe(0, operations1.release()), WebAnimationCurve::TimingFunctionTypeEaseOut);
curve->add(WebTransformKeyframe(1, operations2.release()), WebAnimationCurve::TimingFunctionTypeLinear);
-#else
- WebTransformOperations operations1;
- operations1.appendTranslate(0, 0, 0);
- WebTransformOperations operations2;
- operations2.appendTranslate(1, 0, 0);
- curve->add(WebTransformKeyframe(0, operations1), WebAnimationCurve::TimingFunctionTypeEaseOut);
- curve->add(WebTransformKeyframe(1, operations2), WebAnimationCurve::TimingFunctionTypeLinear);
-#endif
scoped_ptr<cc::TimingFunction> timingFunction(cc::EaseOutTimingFunction::create());
for (int i = 0; i <= 4; ++i) {
@@ -319,21 +220,12 @@ TEST(WebTransformAnimationCurveTest, EaseOutTimingFunction)
TEST(WebTransformAnimationCurveTest, EaseInOutTimingFunction)
{
scoped_ptr<WebTransformAnimationCurve> curve(new WebTransformAnimationCurveImpl);
-#if WEB_TRANSFORM_OPERATIONS_IS_VIRTUAL
scoped_ptr<WebTransformOperations> operations1(new WebTransformOperationsImpl());
operations1->appendTranslate(0, 0, 0);
scoped_ptr<WebTransformOperations> operations2(new WebTransformOperationsImpl());
operations2->appendTranslate(1, 0, 0);
curve->add(WebTransformKeyframe(0, operations1.release()), WebAnimationCurve::TimingFunctionTypeEaseInOut);
curve->add(WebTransformKeyframe(1, operations2.release()), WebAnimationCurve::TimingFunctionTypeLinear);
-#else
- WebTransformOperations operations1;
- operations1.appendTranslate(0, 0, 0);
- WebTransformOperations operations2;
- operations2.appendTranslate(1, 0, 0);
- curve->add(WebTransformKeyframe(0, operations1), WebAnimationCurve::TimingFunctionTypeEaseInOut);
- curve->add(WebTransformKeyframe(1, operations2), WebAnimationCurve::TimingFunctionTypeLinear);
-#endif
scoped_ptr<cc::TimingFunction> timingFunction(cc::EaseInOutTimingFunction::create());
for (int i = 0; i <= 4; ++i) {
@@ -350,21 +242,12 @@ TEST(WebTransformAnimationCurveTest, CustomBezierTimingFunction)
double y1 = 0.2;
double x2 = 0.8;
double y2 = 0.7;
-#if WEB_TRANSFORM_OPERATIONS_IS_VIRTUAL
scoped_ptr<WebTransformOperations> operations1(new WebTransformOperationsImpl());
operations1->appendTranslate(0, 0, 0);
scoped_ptr<WebTransformOperations> operations2(new WebTransformOperationsImpl());
operations2->appendTranslate(1, 0, 0);
curve->add(WebTransformKeyframe(0, operations1.release()), x1, y1, x2, y2);
curve->add(WebTransformKeyframe(1, operations2.release()), WebAnimationCurve::TimingFunctionTypeLinear);
-#else
- WebTransformOperations operations1;
- operations1.appendTranslate(0, 0, 0);
- WebTransformOperations operations2;
- operations2.appendTranslate(1, 0, 0);
- curve->add(WebTransformKeyframe(0, operations1), x1, y1, x2, y2);
- curve->add(WebTransformKeyframe(1, operations2), WebAnimationCurve::TimingFunctionTypeLinear);
-#endif
scoped_ptr<cc::TimingFunction> timingFunction(cc::CubicBezierTimingFunction::create(x1, y1, x2, y2));
for (int i = 0; i <= 4; ++i) {
@@ -377,21 +260,12 @@ TEST(WebTransformAnimationCurveTest, CustomBezierTimingFunction)
TEST(WebTransformAnimationCurveTest, DefaultTimingFunction)
{
scoped_ptr<WebTransformAnimationCurve> curve(new WebTransformAnimationCurveImpl);
-#if WEB_TRANSFORM_OPERATIONS_IS_VIRTUAL
scoped_ptr<WebTransformOperations> operations1(new WebTransformOperationsImpl());
operations1->appendTranslate(0, 0, 0);
scoped_ptr<WebTransformOperations> operations2(new WebTransformOperationsImpl());
operations2->appendTranslate(1, 0, 0);
curve->add(WebTransformKeyframe(0, operations1.release()));
curve->add(WebTransformKeyframe(1, operations2.release()), WebAnimationCurve::TimingFunctionTypeLinear);
-#else
- WebTransformOperations operations1;
- operations1.appendTranslate(0, 0, 0);
- WebTransformOperations operations2;
- operations2.appendTranslate(1, 0, 0);
- curve->add(WebTransformKeyframe(0, operations1));
- curve->add(WebTransformKeyframe(1, operations2), WebAnimationCurve::TimingFunctionTypeLinear);
-#endif
scoped_ptr<cc::TimingFunction> timingFunction(cc::EaseTimingFunction::create());
for (int i = 0; i <= 4; ++i) {
diff --git a/webkit/compositor_bindings/web_transform_operations_impl.cc b/webkit/compositor_bindings/web_transform_operations_impl.cc
index e505b07..fef43d0 100644
--- a/webkit/compositor_bindings/web_transform_operations_impl.cc
+++ b/webkit/compositor_bindings/web_transform_operations_impl.cc
@@ -6,7 +6,6 @@
namespace webkit {
-#if WEB_TRANSFORM_OPERATIONS_IS_VIRTUAL
WebTransformOperationsImpl::WebTransformOperationsImpl() {
}
@@ -58,6 +57,5 @@ bool WebTransformOperationsImpl::isIdentity() const {
WebTransformOperationsImpl::~WebTransformOperationsImpl() {
}
-#endif // WEB_TRANSFORM_OPERATIONS_IS_VIRTUAL
} // namespace webkit
diff --git a/webkit/compositor_bindings/web_transform_operations_impl.h b/webkit/compositor_bindings/web_transform_operations_impl.h
index f4138a95..1404010 100644
--- a/webkit/compositor_bindings/web_transform_operations_impl.h
+++ b/webkit/compositor_bindings/web_transform_operations_impl.h
@@ -12,7 +12,6 @@
namespace webkit {
-#if WEB_TRANSFORM_OPERATIONS_IS_VIRTUAL
class WebTransformOperationsImpl : public WebKit::WebTransformOperations {
public:
WEBKIT_COMPOSITOR_BINDINGS_EXPORT WebTransformOperationsImpl();
@@ -38,7 +37,6 @@ class WebTransformOperationsImpl : public WebKit::WebTransformOperations {
cc::TransformOperations transform_operations_;
};
-#endif // WEB_TRANSFORM_OPERATIONS_IS_VIRTUAL
} // namespace webkit
diff --git a/webkit/compositor_bindings/web_transform_operations_unittest.cc b/webkit/compositor_bindings/web_transform_operations_unittest.cc
deleted file mode 100644
index 8e99dae..0000000
--- a/webkit/compositor_bindings/web_transform_operations_unittest.cc
+++ /dev/null
@@ -1,614 +0,0 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "base/memory/scoped_vector.h"
-#include "cc/test/geometry_test_utils.h"
-#include "testing/gtest/include/gtest/gtest.h"
-#include "third_party/WebKit/Source/Platform/chromium/public/WebTransformOperations.h"
-#include "third_party/WebKit/Source/Platform/chromium/public/WebTransformationMatrix.h"
-
-using namespace WebKit;
-
-#ifndef WEB_TRANSFORM_OPERATIONS_IS_VIRTUAL
-
-TEST(WebTransformOperationTest, transformTypesAreUnique)
-{
- ScopedVector<WebTransformOperations> transforms;
-
- WebTransformOperations* toAdd = new WebTransformOperations();
- toAdd->appendTranslate(1, 0, 0);
- transforms.push_back(toAdd);
-
- toAdd = new WebTransformOperations();
- toAdd->appendRotate(0, 0, 1, 2);
- transforms.push_back(toAdd);
-
- toAdd = new WebTransformOperations();
- toAdd->appendScale(2, 2, 2);
- transforms.push_back(toAdd);
-
- toAdd = new WebTransformOperations();
- toAdd->appendSkew(1, 0);
- transforms.push_back(toAdd);
-
- toAdd = new WebTransformOperations();
- toAdd->appendPerspective(800);
- transforms.push_back(toAdd);
-
- for (size_t i = 0; i < transforms.size(); ++i) {
- for (size_t j = 0; j < transforms.size(); ++j) {
- bool matchesType = transforms[i]->matchesTypes(*transforms[j]);
- EXPECT_TRUE((i == j && matchesType) || !matchesType);
- }
- }
-}
-
-TEST(WebTransformOperationTest, matchTypesSameLength)
-{
- WebTransformOperations translates;
- translates.appendTranslate(1, 0, 0);
- translates.appendTranslate(1, 0, 0);
- translates.appendTranslate(1, 0, 0);
-
- WebTransformOperations skews;
- skews.appendSkew(0, 2);
- skews.appendSkew(0, 2);
- skews.appendSkew(0, 2);
-
- WebTransformOperations translates2;
- translates2.appendTranslate(0, 2, 0);
- translates2.appendTranslate(0, 2, 0);
- translates2.appendTranslate(0, 2, 0);
-
- WebTransformOperations translates3 = translates2;
-
- EXPECT_FALSE(translates.matchesTypes(skews));
- EXPECT_TRUE(translates.matchesTypes(translates2));
- EXPECT_TRUE(translates.matchesTypes(translates3));
-}
-
-TEST(WebTransformOperationTest, matchTypesDifferentLength)
-{
- WebTransformOperations translates;
- translates.appendTranslate(1, 0, 0);
- translates.appendTranslate(1, 0, 0);
- translates.appendTranslate(1, 0, 0);
-
- WebTransformOperations skews;
- skews.appendSkew(2, 0);
- skews.appendSkew(2, 0);
-
- WebTransformOperations translates2;
- translates2.appendTranslate(0, 2, 0);
- translates2.appendTranslate(0, 2, 0);
-
- EXPECT_FALSE(translates.matchesTypes(skews));
- EXPECT_FALSE(translates.matchesTypes(translates2));
-}
-
-void getIdentityOperations(ScopedVector<WebTransformOperations>* operations)
-{
- WebTransformOperations* toAdd = new WebTransformOperations();
- operations->push_back(toAdd);
-
- toAdd = new WebTransformOperations();
- toAdd->appendTranslate(0, 0, 0);
- operations->push_back(toAdd);
-
- toAdd = new WebTransformOperations();
- toAdd->appendTranslate(0, 0, 0);
- toAdd->appendTranslate(0, 0, 0);
- operations->push_back(toAdd);
-
- toAdd = new WebTransformOperations();
- toAdd->appendScale(1, 1, 1);
- operations->push_back(toAdd);
-
- toAdd = new WebTransformOperations();
- toAdd->appendScale(1, 1, 1);
- toAdd->appendScale(1, 1, 1);
- operations->push_back(toAdd);
-
- toAdd = new WebTransformOperations();
- toAdd->appendSkew(0, 0);
- operations->push_back(toAdd);
-
- toAdd = new WebTransformOperations();
- toAdd->appendSkew(0, 0);
- toAdd->appendSkew(0, 0);
- operations->push_back(toAdd);
-
- toAdd = new WebTransformOperations();
- toAdd->appendRotate(0, 0, 1, 0);
- operations->push_back(toAdd);
-
- toAdd = new WebTransformOperations();
- toAdd->appendRotate(0, 0, 1, 0);
- toAdd->appendRotate(0, 0, 1, 0);
- operations->push_back(toAdd);
-
- toAdd = new WebTransformOperations();
- toAdd->appendMatrix(WebTransformationMatrix());
- operations->push_back(toAdd);
-
- toAdd = new WebTransformOperations();
- toAdd->appendMatrix(WebTransformationMatrix());
- toAdd->appendMatrix(WebTransformationMatrix());
- operations->push_back(toAdd);
-}
-
-TEST(WebTransformOperationTest, identityAlwaysMatches)
-{
- ScopedVector<WebTransformOperations> operations;
- getIdentityOperations(&operations);
-
- for (size_t i = 0; i < operations.size(); ++i) {
- for (size_t j = 0; j < operations.size(); ++j)
- EXPECT_TRUE(operations[i]->matchesTypes(*operations[j]));
- }
-}
-
-TEST(WebTransformOperationTest, applyTranslate)
-{
- double x = 1;
- double y = 2;
- double z = 3;
- WebTransformOperations operations;
- operations.appendTranslate(x, y, z);
- WebTransformationMatrix expected;
- expected.translate3d(x, y, z);
- EXPECT_TRANSFORMATION_MATRIX_EQ(expected, operations.apply());
-}
-
-TEST(WebTransformOperationTest, applyRotate)
-{
- double x = 1;
- double y = 2;
- double z = 3;
- double degrees = 80;
- WebTransformOperations operations;
- operations.appendRotate(x, y, z, degrees);
- WebTransformationMatrix expected;
- expected.rotate3d(x, y, z, degrees);
- EXPECT_TRANSFORMATION_MATRIX_EQ(expected, operations.apply());
-}
-
-TEST(WebTransformOperationTest, applyScale)
-{
- double x = 1;
- double y = 2;
- double z = 3;
- WebTransformOperations operations;
- operations.appendScale(x, y, z);
- WebTransformationMatrix expected;
- expected.scale3d(x, y, z);
- EXPECT_TRANSFORMATION_MATRIX_EQ(expected, operations.apply());
-}
-
-TEST(WebTransformOperationTest, applySkew)
-{
- double x = 1;
- double y = 2;
- WebTransformOperations operations;
- operations.appendSkew(x, y);
- WebTransformationMatrix expected;
- expected.skewX(x);
- expected.skewY(y);
- EXPECT_TRANSFORMATION_MATRIX_EQ(expected, operations.apply());
-}
-
-TEST(WebTransformOperationTest, applyPerspective)
-{
- double depth = 800;
- WebTransformOperations operations;
- operations.appendPerspective(depth);
- WebTransformationMatrix expected;
- expected.applyPerspective(depth);
- EXPECT_TRANSFORMATION_MATRIX_EQ(expected, operations.apply());
-}
-
-TEST(WebTransformOperationTest, applyMatrix)
-{
- double dx = 1;
- double dy = 2;
- double dz = 3;
- WebTransformationMatrix expectedMatrix;
- expectedMatrix.translate3d(dx, dy, dz);
- WebTransformOperations matrixTransform;
- matrixTransform.appendMatrix(expectedMatrix);
- EXPECT_TRANSFORMATION_MATRIX_EQ(expectedMatrix, matrixTransform.apply());
-}
-
-TEST(WebTransformOperationTest, applyOrder)
-{
- double sx = 2;
- double sy = 4;
- double sz = 8;
-
- double dx = 1;
- double dy = 2;
- double dz = 3;
-
- WebTransformOperations operations;
- operations.appendScale(sx, sy, sz);
- operations.appendTranslate(dx, dy, dz);
-
- WebTransformationMatrix expectedScaleMatrix;
- expectedScaleMatrix.scale3d(sx, sy, sz);
-
- WebTransformationMatrix expectedTranslateMatrix;
- expectedTranslateMatrix.translate3d(dx, dy, dz);
-
- WebTransformationMatrix expectedCombinedMatrix = expectedScaleMatrix;
- expectedCombinedMatrix.multiply(expectedTranslateMatrix);
-
- EXPECT_TRANSFORMATION_MATRIX_EQ(expectedCombinedMatrix, operations.apply());
-}
-
-TEST(WebTransformOperationTest, blendOrder)
-{
- double sx1 = 2;
- double sy1 = 4;
- double sz1 = 8;
-
- double dx1 = 1;
- double dy1 = 2;
- double dz1 = 3;
-
- double sx2 = 4;
- double sy2 = 8;
- double sz2 = 16;
-
- double dx2 = 10;
- double dy2 = 20;
- double dz2 = 30;
-
- WebTransformOperations operationsFrom;
- operationsFrom.appendScale(sx1, sy1, sz1);
- operationsFrom.appendTranslate(dx1, dy1, dz1);
-
- WebTransformOperations operationsTo;
- operationsTo.appendScale(sx2, sy2, sz2);
- operationsTo.appendTranslate(dx2, dy2, dz2);
-
- WebTransformationMatrix scaleFrom;
- scaleFrom.scale3d(sx1, sy1, sz1);
- WebTransformationMatrix translateFrom;
- translateFrom.translate3d(dx1, dy1, dz1);
-
- WebTransformationMatrix scaleTo;
- scaleTo.scale3d(sx2, sy2, sz2);
- WebTransformationMatrix translateTo;
- translateTo.translate3d(dx2, dy2, dz2);
-
- double progress = 0.25;
-
- WebTransformationMatrix blendedScale = scaleTo;
- blendedScale.blend(scaleFrom, progress);
-
- WebTransformationMatrix blendedTranslate = translateTo;
- blendedTranslate.blend(translateFrom, progress);
-
- WebTransformationMatrix expected = blendedScale;
- expected.multiply(blendedTranslate);
-
- EXPECT_TRANSFORMATION_MATRIX_EQ(expected, operationsTo.blend(operationsFrom, progress));
-}
-
-static void checkProgress(double progress,
- const WebTransformationMatrix& fromMatrix,
- const WebTransformationMatrix& toMatrix,
- const WebTransformOperations& fromTransform,
- const WebTransformOperations& toTransform)
-{
- WebTransformationMatrix expectedMatrix = toMatrix;
- expectedMatrix.blend(fromMatrix, progress);
- EXPECT_TRANSFORMATION_MATRIX_EQ(expectedMatrix, toTransform.blend(fromTransform, progress));
-}
-
-TEST(WebTransformOperationTest, blendProgress)
-{
- double sx = 2;
- double sy = 4;
- double sz = 8;
- WebTransformOperations operationsFrom;
- operationsFrom.appendScale(sx, sy, sz);
-
- WebTransformationMatrix matrixFrom;
- matrixFrom.scale3d(sx, sy, sz);
-
- sx = 4;
- sy = 8;
- sz = 16;
- WebTransformOperations operationsTo;
- operationsTo.appendScale(sx, sy, sz);
-
- WebTransformationMatrix matrixTo;
- matrixTo.scale3d(sx, sy, sz);
-
- checkProgress(-1, matrixFrom, matrixTo, operationsFrom, operationsTo);
- checkProgress(0, matrixFrom, matrixTo, operationsFrom, operationsTo);
- checkProgress(0.25, matrixFrom, matrixTo, operationsFrom, operationsTo);
- checkProgress(0.5, matrixFrom, matrixTo, operationsFrom, operationsTo);
- checkProgress(1, matrixFrom, matrixTo, operationsFrom, operationsTo);
- checkProgress(2, matrixFrom, matrixTo, operationsFrom, operationsTo);
-}
-
-TEST(WebTransformOperationTest, blendWhenTypesDoNotMatch)
-{
- double sx1 = 2;
- double sy1 = 4;
- double sz1 = 8;
-
- double dx1 = 1;
- double dy1 = 2;
- double dz1 = 3;
-
- double sx2 = 4;
- double sy2 = 8;
- double sz2 = 16;
-
- double dx2 = 10;
- double dy2 = 20;
- double dz2 = 30;
-
- WebTransformOperations operationsFrom;
- operationsFrom.appendScale(sx1, sy1, sz1);
- operationsFrom.appendTranslate(dx1, dy1, dz1);
-
- WebTransformOperations operationsTo;
- operationsTo.appendTranslate(dx2, dy2, dz2);
- operationsTo.appendScale(sx2, sy2, sz2);
-
- WebTransformationMatrix from;
- from.scale3d(sx1, sy1, sz1);
- from.translate3d(dx1, dy1, dz1);
-
- WebTransformationMatrix to;
- to.translate3d(dx2, dy2, dz2);
- to.scale3d(sx2, sy2, sz2);
-
- double progress = 0.25;
-
- WebTransformationMatrix expected = to;
- expected.blend(from, progress);
-
- EXPECT_TRANSFORMATION_MATRIX_EQ(expected, operationsTo.blend(operationsFrom, progress));
-}
-
-TEST(WebTransformOperationTest, largeRotationsWithSameAxis)
-{
- WebTransformOperations operationsFrom;
- operationsFrom.appendRotate(0, 0, 1, 0);
-
- WebTransformOperations operationsTo;
- operationsTo.appendRotate(0, 0, 2, 360);
-
- double progress = 0.5;
-
- WebTransformationMatrix expected;
- expected.rotate3d(0, 0, 1, 180);
-
- EXPECT_TRANSFORMATION_MATRIX_EQ(expected, operationsTo.blend(operationsFrom, progress));
-}
-
-TEST(WebTransformOperationTest, largeRotationsWithSameAxisInDifferentDirection)
-{
- WebTransformOperations operationsFrom;
- operationsFrom.appendRotate(0, 0, 1, 180);
-
- WebTransformOperations operationsTo;
- operationsTo.appendRotate(0, 0, -1, 180);
-
- double progress = 0.5;
-
- WebTransformationMatrix expected;
-
- EXPECT_TRANSFORMATION_MATRIX_EQ(expected, operationsTo.blend(operationsFrom, progress));
-}
-
-TEST(WebTransformOperationTest, largeRotationsWithDifferentAxes)
-{
- WebTransformOperations operationsFrom;
- operationsFrom.appendRotate(0, 0, 1, 180);
-
- WebTransformOperations operationsTo;
- operationsTo.appendRotate(0, 1, 0, 180);
-
- double progress = 0.5;
- WebTransformationMatrix matrixFrom;
- matrixFrom.rotate3d(0, 0, 1, 180);
-
- WebTransformationMatrix matrixTo;
- matrixTo.rotate3d(0, 1, 0, 180);
-
- WebTransformationMatrix expected = matrixTo;
- expected.blend(matrixFrom, progress);
-
- EXPECT_TRANSFORMATION_MATRIX_EQ(expected, operationsTo.blend(operationsFrom, progress));
-}
-
-TEST(WebTransformOperationTest, blendRotationFromIdentity)
-{
- ScopedVector<WebTransformOperations> identityOperations;
- getIdentityOperations(&identityOperations);
-
- for (size_t i = 0; i < identityOperations.size(); ++i) {
- WebTransformOperations operations;
- operations.appendRotate(0, 0, 1, 360);
-
- double progress = 0.5;
-
- WebTransformationMatrix expected;
- expected.rotate3d(0, 0, 1, 180);
-
- EXPECT_TRANSFORMATION_MATRIX_EQ(expected, operations.blend(*identityOperations[i], progress));
- }
-}
-
-TEST(WebTransformOperationTest, blendTranslationFromIdentity)
-{
- ScopedVector<WebTransformOperations> identityOperations;
- getIdentityOperations(&identityOperations);
-
- for (size_t i = 0; i < identityOperations.size(); ++i) {
- WebTransformOperations operations;
- operations.appendTranslate(2, 2, 2);
-
- double progress = 0.5;
-
- WebTransformationMatrix expected;
- expected.translate3d(1, 1, 1);
-
- EXPECT_TRANSFORMATION_MATRIX_EQ(expected, operations.blend(*identityOperations[i], progress));
- }
-}
-
-TEST(WebTransformOperationTest, blendScaleFromIdentity)
-{
- ScopedVector<WebTransformOperations> identityOperations;
- getIdentityOperations(&identityOperations);
-
- for (size_t i = 0; i < identityOperations.size(); ++i) {
- WebTransformOperations operations;
- operations.appendScale(3, 3, 3);
-
- double progress = 0.5;
-
- WebTransformationMatrix expected;
- expected.scale3d(2, 2, 2);
-
- EXPECT_TRANSFORMATION_MATRIX_EQ(expected, operations.blend(*identityOperations[i], progress));
- }
-}
-
-TEST(WebTransformOperationTest, blendSkewFromIdentity)
-{
- ScopedVector<WebTransformOperations> identityOperations;
- getIdentityOperations(&identityOperations);
-
- for (size_t i = 0; i < identityOperations.size(); ++i) {
- WebTransformOperations operations;
- operations.appendSkew(2, 2);
-
- double progress = 0.5;
-
- WebTransformationMatrix expected;
- expected.skewX(1);
- expected.skewY(1);
-
- EXPECT_TRANSFORMATION_MATRIX_EQ(expected, operations.blend(*identityOperations[i], progress));
- }
-}
-
-TEST(WebTransformOperationTest, blendPerspectiveFromIdentity)
-{
- ScopedVector<WebTransformOperations> identityOperations;
- getIdentityOperations(&identityOperations);
-
- for (size_t i = 0; i < identityOperations.size(); ++i) {
- WebTransformOperations operations;
- operations.appendPerspective(1000);
-
- double progress = 0.5;
-
- WebTransformationMatrix expected;
- expected.applyPerspective(500 + 0.5 * std::numeric_limits<double>::max());
-
- EXPECT_TRANSFORMATION_MATRIX_EQ(expected, operations.blend(*identityOperations[i], progress));
- }
-}
-
-TEST(WebTransformOperationTest, blendRotationToIdentity)
-{
- ScopedVector<WebTransformOperations> identityOperations;
- getIdentityOperations(&identityOperations);
-
- for (size_t i = 0; i < identityOperations.size(); ++i) {
- WebTransformOperations operations;
- operations.appendRotate(0, 0, 1, 360);
-
- double progress = 0.5;
-
- WebTransformationMatrix expected;
- expected.rotate3d(0, 0, 1, 180);
-
- EXPECT_TRANSFORMATION_MATRIX_EQ(expected, identityOperations[i]->blend(operations, progress));
- }
-}
-
-TEST(WebTransformOperationTest, blendTranslationToIdentity)
-{
- ScopedVector<WebTransformOperations> identityOperations;
- getIdentityOperations(&identityOperations);
-
- for (size_t i = 0; i < identityOperations.size(); ++i) {
- WebTransformOperations operations;
- operations.appendTranslate(2, 2, 2);
-
- double progress = 0.5;
-
- WebTransformationMatrix expected;
- expected.translate3d(1, 1, 1);
-
- EXPECT_TRANSFORMATION_MATRIX_EQ(expected, identityOperations[i]->blend(operations, progress));
- }
-}
-
-TEST(WebTransformOperationTest, blendScaleToIdentity)
-{
- ScopedVector<WebTransformOperations> identityOperations;
- getIdentityOperations(&identityOperations);
-
- for (size_t i = 0; i < identityOperations.size(); ++i) {
- WebTransformOperations operations;
- operations.appendScale(3, 3, 3);
-
- double progress = 0.5;
-
- WebTransformationMatrix expected;
- expected.scale3d(2, 2, 2);
-
- EXPECT_TRANSFORMATION_MATRIX_EQ(expected, identityOperations[i]->blend(operations, progress));
- }
-}
-
-TEST(WebTransformOperationTest, blendSkewToIdentity)
-{
- ScopedVector<WebTransformOperations> identityOperations;
- getIdentityOperations(&identityOperations);
-
- for (size_t i = 0; i < identityOperations.size(); ++i) {
- WebTransformOperations operations;
- operations.appendSkew(2, 2);
-
- double progress = 0.5;
-
- WebTransformationMatrix expected;
- expected.skewX(1);
- expected.skewY(1);
-
- EXPECT_TRANSFORMATION_MATRIX_EQ(expected, identityOperations[i]->blend(operations, progress));
- }
-}
-
-TEST(WebTransformOperationTest, blendPerspectiveToIdentity)
-{
- ScopedVector<WebTransformOperations> identityOperations;
- getIdentityOperations(&identityOperations);
-
- for (size_t i = 0; i < identityOperations.size(); ++i) {
- WebTransformOperations operations;
- operations.appendPerspective(1000);
-
- double progress = 0.5;
-
- WebTransformationMatrix expected;
- expected.applyPerspective(500 + 0.5 * std::numeric_limits<double>::max());
-
- EXPECT_TRANSFORMATION_MATRIX_EQ(expected, identityOperations[i]->blend(operations, progress));
- }
-}
-
-#endif