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

Side by Side Diff: third_party/WebKit/Source/core/animation/TimingInput.cpp

Issue 2875673005: Move "id" from KeyframeEffectOptions to KeyframeAnimationOptions and (Closed)
Patch Set: Make const ptr. Created 3 years, 7 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 // 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 "core/animation/TimingInput.h" 5 #include "core/animation/TimingInput.h"
6 6
7 #include "bindings/core/v8/ExceptionState.h" 7 #include "bindings/core/v8/ExceptionState.h"
8 #include "bindings/core/v8/UnrestrictedDoubleOrKeyframeAnimationOptions.h"
8 #include "bindings/core/v8/UnrestrictedDoubleOrKeyframeEffectOptions.h" 9 #include "bindings/core/v8/UnrestrictedDoubleOrKeyframeEffectOptions.h"
9 #include "core/animation/AnimationInputHelpers.h" 10 #include "core/animation/AnimationInputHelpers.h"
10 #include "core/animation/KeyframeEffectOptions.h" 11 #include "core/animation/KeyframeEffectOptions.h"
11 12
12 namespace blink { 13 namespace blink {
13 14
14 void TimingInput::SetStartDelay(Timing& timing, double start_delay) { 15 void TimingInput::SetStartDelay(Timing& timing, double start_delay) {
15 if (std::isfinite(start_delay)) 16 if (std::isfinite(start_delay))
16 timing.start_delay = start_delay / 1000; 17 timing.start_delay = start_delay / 1000;
17 else 18 else
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 } else if (options.isUnrestrictedDouble()) { 132 } else if (options.isUnrestrictedDouble()) {
132 return Convert(options.getAsUnrestrictedDouble(), timing_output, 133 return Convert(options.getAsUnrestrictedDouble(), timing_output,
133 exception_state); 134 exception_state);
134 } else if (options.isNull()) { 135 } else if (options.isNull()) {
135 return true; 136 return true;
136 } 137 }
137 NOTREACHED(); 138 NOTREACHED();
138 return false; 139 return false;
139 } 140 }
140 141
142 bool TimingInput::Convert(
143 const UnrestrictedDoubleOrKeyframeAnimationOptions& options,
144 Timing& timing_output,
145 Document* document,
146 ExceptionState& exception_state) {
147 if (options.isKeyframeAnimationOptions()) {
148 return Convert(options.getAsKeyframeAnimationOptions(), timing_output,
149 document, exception_state);
150 } else if (options.isUnrestrictedDouble()) {
151 return Convert(options.getAsUnrestrictedDouble(), timing_output,
152 exception_state);
153 } else if (options.isNull()) {
154 return true;
155 }
156 NOTREACHED();
157 return false;
158 }
159
141 bool TimingInput::Convert(const KeyframeEffectOptions& timing_input, 160 bool TimingInput::Convert(const KeyframeEffectOptions& timing_input,
142 Timing& timing_output, 161 Timing& timing_output,
143 Document* document, 162 Document* document,
144 ExceptionState& exception_state) { 163 ExceptionState& exception_state) {
145 SetStartDelay(timing_output, timing_input.delay()); 164 SetStartDelay(timing_output, timing_input.delay());
146 SetEndDelay(timing_output, timing_input.endDelay()); 165 SetEndDelay(timing_output, timing_input.endDelay());
147 SetFillMode(timing_output, timing_input.fill()); 166 SetFillMode(timing_output, timing_input.fill());
148 167
149 if (!SetIterationStart(timing_output, timing_input.iterationStart(), 168 if (!SetIterationStart(timing_output, timing_input.iterationStart(),
150 exception_state)) 169 exception_state))
(...skipping 12 matching lines...) Expand all
163 182
164 if (!SetTimingFunction(timing_output, timing_input.easing(), document, 183 if (!SetTimingFunction(timing_output, timing_input.easing(), document,
165 exception_state)) 184 exception_state))
166 return false; 185 return false;
167 186
168 timing_output.AssertValid(); 187 timing_output.AssertValid();
169 188
170 return true; 189 return true;
171 } 190 }
172 191
192 bool TimingInput::Convert(const KeyframeAnimationOptions& timing_input,
193 Timing& timing_output,
194 Document* document,
195 ExceptionState& exception_state) {
196 // The "id" field isn't used, so upcast to KeyframeEffectOptions.
197 const KeyframeEffectOptions* const timing_input_ptr = &timing_input;
198 return Convert(*timing_input_ptr, timing_output, document, exception_state);
199 }
200
173 bool TimingInput::Convert(double duration, 201 bool TimingInput::Convert(double duration,
174 Timing& timing_output, 202 Timing& timing_output,
175 ExceptionState& exception_state) { 203 ExceptionState& exception_state) {
176 DCHECK(timing_output == Timing::Defaults()); 204 DCHECK(timing_output == Timing::Defaults());
177 return SetIterationDuration( 205 return SetIterationDuration(
178 timing_output, 206 timing_output,
179 UnrestrictedDoubleOrString::fromUnrestrictedDouble(duration), 207 UnrestrictedDoubleOrString::fromUnrestrictedDouble(duration),
180 exception_state); 208 exception_state);
181 } 209 }
182 210
183 } // namespace blink 211 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/animation/TimingInput.h ('k') | third_party/WebKit/Source/core/animation/TimingInputTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698