Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(362)

Side by Side Diff: sky/engine/core/animation/animatable/AnimatableValueTestHelper.cpp

Issue 1229273004: Remove Animations and Transitions. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 /*
2 * Copyright (c) 2013, Google Inc. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
6 * met:
7 *
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above
11 * copyright notice, this list of conditions and the following disclaimer
12 * in the documentation and/or other materials provided with the
13 * distribution.
14 * * Neither the name of Google Inc. nor the names of its
15 * contributors may be used to endorse or promote products derived from
16 * this software without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30
31
32 #include "sky/engine/core/animation/animatable/AnimatableValueTestHelper.h"
33
34 namespace blink {
35
36 bool operator==(const AnimatableValue& a, const AnimatableValue& b)
37 {
38 return a.equals(b);
39 }
40
41 void PrintTo(const AnimatableClipPathOperation& animValue, ::std::ostream* os)
42 {
43 *os << "AnimatableClipPathOperation@" << &animValue;
44 }
45
46 void PrintTo(const AnimatableColor& animColor, ::std::ostream* os)
47 {
48 *os << "AnimatableColor("
49 << animColor.color().serialized().utf8().data() << ")";
50 }
51
52 void PrintTo(const AnimatableNeutral& animValue, ::std::ostream* os)
53 {
54 *os << "AnimatableNeutral@" << &animValue;
55 }
56
57 void PrintTo(const AnimatableRepeatable& animValue, ::std::ostream* os)
58 {
59 *os << "AnimatableRepeatable(";
60
61 const Vector<RefPtr<AnimatableValue> > v = animValue.values();
62 for (Vector<RefPtr<AnimatableValue> >::const_iterator it = v.begin(); it != v.end(); ++it) {
63 PrintTo(*(it->get()), os);
64 if (it+1 != v.end())
65 *os << ", ";
66 }
67 *os << ")";
68 }
69
70 void PrintTo(const AnimatableShapeValue& animValue, ::std::ostream* os)
71 {
72 *os << "AnimatableShapeValue@" << &animValue;
73 }
74
75 void PrintTo(const AnimatableTransform& animTransform, ::std::ostream* os)
76 {
77 TransformOperations ops = animTransform.transformOperations();
78
79 *os << "AnimatableTransform(";
80 // FIXME: TransformOperations should really have it's own pretty-printer
81 // then we could just call that.
82 // FIXME: Output useful names not just the raw matrixes.
83 for (unsigned i = 0; i < ops.size(); i++) {
84 const TransformOperation* op = ops.at(i);
85
86 TransformationMatrix matrix;
87 op->apply(matrix, FloatSize(1.0, 1.0));
88
89 *os << "[";
90 if (matrix.isAffine()) {
91 *os << matrix.a();
92 *os << " " << matrix.b();
93 *os << " " << matrix.c();
94 *os << " " << matrix.d();
95 *os << " " << matrix.e();
96 *os << " " << matrix.f();
97 } else {
98 *os << matrix.m11();
99 *os << " " << matrix.m12();
100 *os << " " << matrix.m13();
101 *os << " " << matrix.m14();
102 *os << " ";
103 *os << " " << matrix.m21();
104 *os << " " << matrix.m22();
105 *os << " " << matrix.m23();
106 *os << " " << matrix.m24();
107 *os << " ";
108 *os << " " << matrix.m31();
109 *os << " " << matrix.m32();
110 *os << " " << matrix.m33();
111 *os << " " << matrix.m34();
112 *os << " ";
113 *os << " " << matrix.m41();
114 *os << " " << matrix.m42();
115 *os << " " << matrix.m43();
116 *os << " " << matrix.m44();
117 }
118 *os << "]";
119 if (i < ops.size() - 1)
120 *os << ", ";
121 }
122 *os << ")";
123 }
124
125 void PrintTo(const AnimatableUnknown& animUnknown, ::std::ostream* os)
126 {
127 PrintTo(*(animUnknown.toCSSValue().get()), os, "AnimatableUnknown");
128 }
129
130 void PrintTo(const AnimatableValue& animValue, ::std::ostream* os)
131 {
132 if (animValue.isClipPathOperation())
133 PrintTo(toAnimatableClipPathOperation(animValue), os);
134 else if (animValue.isColor())
135 PrintTo(toAnimatableColor(animValue), os);
136 else if (animValue.isNeutral())
137 PrintTo(static_cast<const AnimatableNeutral&>(animValue), os);
138 else if (animValue.isRepeatable())
139 PrintTo(toAnimatableRepeatable(animValue), os);
140 else if (animValue.isShapeValue())
141 PrintTo(toAnimatableShapeValue(animValue), os);
142 else if (animValue.isStrokeDasharrayList())
143 PrintTo(toAnimatableStrokeDasharrayList(animValue), os);
144 else if (animValue.isTransform())
145 PrintTo(toAnimatableTransform(animValue), os);
146 else if (animValue.isUnknown())
147 PrintTo(toAnimatableUnknown(animValue), os);
148 else
149 *os << "Unknown AnimatableValue - update ifelse chain in AnimatableValue TestHelper.h";
150 }
151
152 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698