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

Side by Side Diff: Source/platform/animation/TimingFunctionTestHelper.cpp

Issue 149363002: Web Animations API: Implement step-middle and steps(x, middle) timing functions. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Remove class in BisonCSSParserTest and change to new license text Created 6 years, 10 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
1 /* 1 /*
2 * Copyright (c) 2013, Google Inc. All rights reserved. 2 * Copyright (c) 2013, Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 *os << ")"; 127 *os << ")";
128 } 128 }
129 129
130 void PrintTo(const StepsTimingFunction& timingFunction, ::std::ostream* os) 130 void PrintTo(const StepsTimingFunction& timingFunction, ::std::ostream* os)
131 { 131 {
132 *os << "StepsTimingFunction@" << &timingFunction << "("; 132 *os << "StepsTimingFunction@" << &timingFunction << "(";
133 switch (timingFunction.subType()) { 133 switch (timingFunction.subType()) {
134 case StepsTimingFunction::Start: 134 case StepsTimingFunction::Start:
135 *os << "Start"; 135 *os << "Start";
136 break; 136 break;
137 case StepsTimingFunction::Middle:
138 *os << "Middle";
139 break;
137 case StepsTimingFunction::End: 140 case StepsTimingFunction::End:
138 *os << "End"; 141 *os << "End";
139 break; 142 break;
140 case StepsTimingFunction::Custom: 143 case StepsTimingFunction::Custom:
141 *os << "Custom"; 144 *os << "Custom";
142 break; 145 break;
143 default: 146 default:
144 ASSERT_NOT_REACHED(); 147 ASSERT_NOT_REACHED();
145 } 148 }
146 *os << ", " << timingFunction.numberOfSteps(); 149 *os << ", " << timingFunction.numberOfSteps();
147 *os << ", " << (timingFunction.stepAtStart() ? "true" : "false"); 150 *os << ", ";
151
152 switch (timingFunction.stepAtPosition()) {
153 case StepsTimingFunction::StepAtStart:
154 *os << "StepAtStart";
155 break;
156 case StepsTimingFunction::StepAtMiddle:
157 *os << "StepAtMiddle";
158 break;
159 case StepsTimingFunction::StepAtEnd:
160 *os << "StepAtEnd";
161 break;
162 default:
163 ASSERT_NOT_REACHED();
164 }
148 *os << ")"; 165 *os << ")";
149 } 166 }
150 167
151 void PrintTo(const ChainedTimingFunction& timingFunction, ::std::ostream* os) 168 void PrintTo(const ChainedTimingFunction& timingFunction, ::std::ostream* os)
152 { 169 {
153 ChainedTimingFunctionTestHelper::PrintTo(timingFunction, os); 170 ChainedTimingFunctionTestHelper::PrintTo(timingFunction, os);
154 } 171 }
155 172
156 // The generic PrintTo *must* come after the non-generic PrintTo otherwise it 173 // The generic PrintTo *must* come after the non-generic PrintTo otherwise it
157 // will end up calling itself. 174 // will end up calling itself.
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 return lhs.subType() == ctf.subType(); 217 return lhs.subType() == ctf.subType();
201 } 218 }
202 219
203 bool operator==(const StepsTimingFunction& lhs, const TimingFunction& rhs) 220 bool operator==(const StepsTimingFunction& lhs, const TimingFunction& rhs)
204 { 221 {
205 if (rhs.type() != TimingFunction::StepsFunction) 222 if (rhs.type() != TimingFunction::StepsFunction)
206 return false; 223 return false;
207 224
208 const StepsTimingFunction& stf = toStepsTimingFunction(rhs); 225 const StepsTimingFunction& stf = toStepsTimingFunction(rhs);
209 if ((lhs.subType() == StepsTimingFunction::Custom) && (stf.subType() == Step sTimingFunction::Custom)) 226 if ((lhs.subType() == StepsTimingFunction::Custom) && (stf.subType() == Step sTimingFunction::Custom))
210 return (lhs.numberOfSteps() == stf.numberOfSteps()) && (lhs.stepAtStart( ) == stf.stepAtStart()); 227 return (lhs.numberOfSteps() == stf.numberOfSteps()) && (lhs.stepAtPositi on() == stf.stepAtPosition());
211 228
212 return lhs.subType() == stf.subType(); 229 return lhs.subType() == stf.subType();
213 } 230 }
214 231
215 bool operator==(const ChainedTimingFunction& lhs, const TimingFunction& rhs) 232 bool operator==(const ChainedTimingFunction& lhs, const TimingFunction& rhs)
216 { 233 {
217 return ChainedTimingFunctionTestHelper::equals(lhs, rhs); 234 return ChainedTimingFunctionTestHelper::equals(lhs, rhs);
218 } 235 }
219 236
220 // Like in the PrintTo case, the generic operator== *must* come after the 237 // Like in the PrintTo case, the generic operator== *must* come after the
(...skipping 23 matching lines...) Expand all
244 return false; 261 return false;
245 } 262 }
246 263
247 // No need to define specific operator!= as they can all come via this function. 264 // No need to define specific operator!= as they can all come via this function.
248 bool operator!=(const TimingFunction& lhs, const TimingFunction& rhs) 265 bool operator!=(const TimingFunction& lhs, const TimingFunction& rhs)
249 { 266 {
250 return !(lhs == rhs); 267 return !(lhs == rhs);
251 } 268 }
252 269
253 } // namespace WebCore 270 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698