OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "platform/animation/TimingFunction.h" | 5 #include "platform/animation/TimingFunction.h" |
6 | 6 |
7 #include "wtf/text/StringBuilder.h" | 7 #include "wtf/text/StringBuilder.h" |
8 | 8 |
9 namespace blink { | 9 namespace blink { |
10 | 10 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 { | 79 { |
80 const char* positionString = nullptr; | 80 const char* positionString = nullptr; |
81 switch (getStepPosition()) { | 81 switch (getStepPosition()) { |
82 case StepPosition::START: | 82 case StepPosition::START: |
83 positionString = "start"; | 83 positionString = "start"; |
84 break; | 84 break; |
85 case StepPosition::MIDDLE: | 85 case StepPosition::MIDDLE: |
86 positionString = "middle"; | 86 positionString = "middle"; |
87 break; | 87 break; |
88 case StepPosition::END: | 88 case StepPosition::END: |
89 positionString = "end"; | 89 // do not specify step position in output |
90 break; | 90 break; |
91 } | 91 } |
92 | 92 |
93 StringBuilder builder; | 93 StringBuilder builder; |
94 if (this->numberOfSteps() == 1) { | 94 builder.append("steps("); |
95 builder.append("step-"); | 95 builder.append(String::numberToStringECMAScript(this->numberOfSteps())); |
96 builder.append(positionString); | 96 if (positionString) { |
97 } else { | |
98 builder.append("steps("); | |
99 builder.append(String::numberToStringECMAScript(this->numberOfSteps())); | |
100 builder.append(", "); | 97 builder.append(", "); |
101 builder.append(positionString); | 98 builder.append(positionString); |
102 builder.append(')'); | |
103 } | 99 } |
| 100 builder.append(')'); |
104 return builder.toString(); | 101 return builder.toString(); |
105 } | 102 } |
106 | 103 |
107 void StepsTimingFunction::range(double* minValue, double* maxValue) const | 104 void StepsTimingFunction::range(double* minValue, double* maxValue) const |
108 { | 105 { |
109 *minValue = 0; | 106 *minValue = 0; |
110 *maxValue = 1; | 107 *maxValue = 1; |
111 } | 108 } |
112 | 109 |
113 double StepsTimingFunction::evaluate(double fraction, double) const | 110 double StepsTimingFunction::evaluate(double fraction, double) const |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 return false; | 195 return false; |
199 } | 196 } |
200 | 197 |
201 // No need to define specific operator!= as they can all come via this function. | 198 // No need to define specific operator!= as they can all come via this function. |
202 bool operator!=(const TimingFunction& lhs, const TimingFunction& rhs) | 199 bool operator!=(const TimingFunction& lhs, const TimingFunction& rhs) |
203 { | 200 { |
204 return !(lhs == rhs); | 201 return !(lhs == rhs); |
205 } | 202 } |
206 | 203 |
207 } // namespace blink | 204 } // namespace blink |
OLD | NEW |