OLD | NEW |
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 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 lastOffset = offset; | 234 lastOffset = offset; |
235 | 235 |
236 keyframe->setOffset(offset); | 236 keyframe->setOffset(offset); |
237 } | 237 } |
238 keyframes.append(keyframe); | 238 keyframes.append(keyframe); |
239 | 239 |
240 String compositeString; | 240 String compositeString; |
241 DictionaryHelper::get(keyframeDictionary, "composite", compositeString); | 241 DictionaryHelper::get(keyframeDictionary, "composite", compositeString); |
242 if (compositeString == "add") | 242 if (compositeString == "add") |
243 keyframe->setComposite(EffectModel::CompositeAdd); | 243 keyframe->setComposite(EffectModel::CompositeAdd); |
| 244 // TODO(alancutter): Support "accumulate" keyframe composition. |
244 | 245 |
245 String timingFunctionString; | 246 String timingFunctionString; |
246 if (DictionaryHelper::get(keyframeDictionary, "easing", timingFunctionSt
ring)) { | 247 if (DictionaryHelper::get(keyframeDictionary, "easing", timingFunctionSt
ring)) { |
247 if (RefPtr<TimingFunction> timingFunction = AnimationInputHelpers::p
arseTimingFunction(timingFunctionString)) | 248 if (RefPtr<TimingFunction> timingFunction = AnimationInputHelpers::p
arseTimingFunction(timingFunctionString)) |
248 keyframe->setEasing(timingFunction); | 249 keyframe->setEasing(timingFunction); |
249 } | 250 } |
250 | 251 |
251 Vector<String> keyframeProperties; | 252 Vector<String> keyframeProperties; |
252 keyframeDictionary.getPropertyNames(keyframeProperties); | 253 keyframeDictionary.getPropertyNames(keyframeProperties); |
253 for (const auto& property : keyframeProperties) { | 254 for (const auto& property : keyframeProperties) { |
(...skipping 16 matching lines...) Expand all Loading... |
270 | 271 |
271 SVGElement* svgElement = toSVGElement(element); | 272 SVGElement* svgElement = toSVGElement(element); |
272 const QualifiedName* qualifiedName = supportedSVGAttribute(property,
svgElement); | 273 const QualifiedName* qualifiedName = supportedSVGAttribute(property,
svgElement); |
273 | 274 |
274 if (qualifiedName) | 275 if (qualifiedName) |
275 keyframe->setPropertyValue(*qualifiedName, value, svgElement); | 276 keyframe->setPropertyValue(*qualifiedName, value, svgElement); |
276 } | 277 } |
277 } | 278 } |
278 | 279 |
279 StringKeyframeEffectModel* keyframeEffectModel = StringKeyframeEffectModel::
create(keyframes); | 280 StringKeyframeEffectModel* keyframeEffectModel = StringKeyframeEffectModel::
create(keyframes); |
280 if (keyframeEffectModel->hasSyntheticKeyframes()) { | 281 if (!RuntimeEnabledFeatures::additiveAnimationsEnabled()) { |
281 exceptionState.throwDOMException(NotSupportedError, "Partial keyframes a
re not supported."); | 282 if (keyframeEffectModel->hasSyntheticKeyframes()) { |
282 return nullptr; | 283 exceptionState.throwDOMException(NotSupportedError, "Partial keyfram
es are not supported."); |
283 } | 284 return nullptr; |
284 if (!keyframeEffectModel->isReplaceOnly()) { | 285 } |
285 exceptionState.throwDOMException(NotSupportedError, "Additive animations
are not supported."); | 286 if (!keyframeEffectModel->isReplaceOnly()) { |
286 return nullptr; | 287 exceptionState.throwDOMException(NotSupportedError, "Additive animat
ions are not supported."); |
| 288 return nullptr; |
| 289 } |
287 } | 290 } |
288 keyframeEffectModel->forceConversionsToAnimatableValues(*element, element->c
omputedStyle()); | 291 keyframeEffectModel->forceConversionsToAnimatableValues(*element, element->c
omputedStyle()); |
289 | 292 |
290 return keyframeEffectModel; | 293 return keyframeEffectModel; |
291 } | 294 } |
292 | 295 |
293 EffectModel* EffectInput::convert(Element* element, const EffectModelOrDictionar
ySequence& effectInput, ExceptionState& exceptionState) | 296 EffectModel* EffectInput::convert(Element* element, const EffectModelOrDictionar
ySequenceOrDictionary& effectInput, ExceptionState& exceptionState) |
294 { | 297 { |
295 if (effectInput.isEffectModel()) | 298 if (effectInput.isEffectModel()) |
296 return effectInput.getAsEffectModel(); | 299 return effectInput.getAsEffectModel(); |
297 if (effectInput.isDictionarySequence()) | 300 if (effectInput.isDictionarySequence()) |
298 return convert(element, effectInput.getAsDictionarySequence(), exception
State); | 301 return convert(element, effectInput.getAsDictionarySequence(), exception
State); |
| 302 if (effectInput.isDictionary()) { |
| 303 Vector<Dictionary> keyframes; |
| 304 keyframes.append(effectInput.getAsDictionary()); |
| 305 return convert(element, keyframes, exceptionState); |
| 306 } |
299 return nullptr; | 307 return nullptr; |
300 } | 308 } |
301 | 309 |
302 } // namespace blink | 310 } // namespace blink |
OLD | NEW |