| 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 17 matching lines...) Expand all Loading... |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #include "config.h" | 31 #include "config.h" |
| 32 #include "core/animation/EffectInput.h" | 32 #include "core/animation/EffectInput.h" |
| 33 | 33 |
| 34 #include "bindings/core/v8/Dictionary.h" | 34 #include "bindings/core/v8/Dictionary.h" |
| 35 #include "core/animation/AnimationHelpers.h" | 35 #include "core/animation/AnimationHelpers.h" |
| 36 #include "core/animation/KeyframeEffectModel.h" | 36 #include "core/animation/KeyframeEffectModel.h" |
| 37 #include "core/animation/StringKeyframe.h" | 37 #include "core/animation/StringKeyframe.h" |
| 38 #include "core/css/parser/CSSParser.h" | 38 #include "core/css/parser/BisonCSSParser.h" |
| 39 #include "core/css/resolver/CSSToStyleMap.h" | 39 #include "core/css/resolver/CSSToStyleMap.h" |
| 40 #include "core/css/resolver/StyleResolver.h" | 40 #include "core/css/resolver/StyleResolver.h" |
| 41 #include "core/dom/Document.h" | 41 #include "core/dom/Document.h" |
| 42 #include "core/dom/Element.h" | 42 #include "core/dom/Element.h" |
| 43 #include "wtf/NonCopyingSort.h" | 43 #include "wtf/NonCopyingSort.h" |
| 44 | 44 |
| 45 namespace blink { | 45 namespace blink { |
| 46 | 46 |
| 47 PassRefPtrWillBeRawPtr<AnimationEffect> EffectInput::convert(Element* element, c
onst Vector<Dictionary>& keyframeDictionaryVector, ExceptionState& exceptionStat
e) | 47 PassRefPtrWillBeRawPtr<AnimationEffect> EffectInput::convert(Element* element, c
onst Vector<Dictionary>& keyframeDictionaryVector, ExceptionState& exceptionStat
e) |
| 48 { | 48 { |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 } | 85 } |
| 86 keyframes.append(keyframe); | 86 keyframes.append(keyframe); |
| 87 | 87 |
| 88 String compositeString; | 88 String compositeString; |
| 89 DictionaryHelper::get(keyframeDictionaryVector[i], "composite", composit
eString); | 89 DictionaryHelper::get(keyframeDictionaryVector[i], "composite", composit
eString); |
| 90 if (compositeString == "add") | 90 if (compositeString == "add") |
| 91 keyframe->setComposite(AnimationEffect::CompositeAdd); | 91 keyframe->setComposite(AnimationEffect::CompositeAdd); |
| 92 | 92 |
| 93 String timingFunctionString; | 93 String timingFunctionString; |
| 94 if (DictionaryHelper::get(keyframeDictionaryVector[i], "easing", timingF
unctionString)) { | 94 if (DictionaryHelper::get(keyframeDictionaryVector[i], "easing", timingF
unctionString)) { |
| 95 if (RefPtrWillBeRawPtr<CSSValue> timingFunctionValue = CSSParser::pa
rseAnimationTimingFunctionValue(timingFunctionString)) | 95 if (RefPtrWillBeRawPtr<CSSValue> timingFunctionValue = BisonCSSParse
r::parseAnimationTimingFunctionValue(timingFunctionString)) |
| 96 keyframe->setEasing(CSSToStyleMap::mapAnimationTimingFunction(ti
mingFunctionValue.get(), true)); | 96 keyframe->setEasing(CSSToStyleMap::mapAnimationTimingFunction(ti
mingFunctionValue.get(), true)); |
| 97 } | 97 } |
| 98 | 98 |
| 99 Vector<String> keyframeProperties; | 99 Vector<String> keyframeProperties; |
| 100 keyframeDictionaryVector[i].getOwnPropertyNames(keyframeProperties); | 100 keyframeDictionaryVector[i].getOwnPropertyNames(keyframeProperties); |
| 101 for (size_t j = 0; j < keyframeProperties.size(); ++j) { | 101 for (size_t j = 0; j < keyframeProperties.size(); ++j) { |
| 102 String property = keyframeProperties[j]; | 102 String property = keyframeProperties[j]; |
| 103 CSSPropertyID id = camelCaseCSSPropertyNameToID(property); | 103 CSSPropertyID id = camelCaseCSSPropertyNameToID(property); |
| 104 if (id == CSSPropertyInvalid) | 104 if (id == CSSPropertyInvalid) |
| 105 continue; | 105 continue; |
| 106 String value; | 106 String value; |
| 107 DictionaryHelper::get(keyframeDictionaryVector[i], property, value); | 107 DictionaryHelper::get(keyframeDictionaryVector[i], property, value); |
| 108 keyframe->setPropertyValue(id, value, styleSheetContents); | 108 keyframe->setPropertyValue(id, value, styleSheetContents); |
| 109 } | 109 } |
| 110 } | 110 } |
| 111 | 111 |
| 112 RefPtrWillBeRawPtr<StringKeyframeEffectModel> keyframeEffectModel = StringKe
yframeEffectModel::create(keyframes); | 112 RefPtrWillBeRawPtr<StringKeyframeEffectModel> keyframeEffectModel = StringKe
yframeEffectModel::create(keyframes); |
| 113 if (!keyframeEffectModel->isReplaceOnly()) { | 113 if (!keyframeEffectModel->isReplaceOnly()) { |
| 114 exceptionState.throwDOMException(NotSupportedError, "Partial keyframes a
re not supported."); | 114 exceptionState.throwDOMException(NotSupportedError, "Partial keyframes a
re not supported."); |
| 115 return nullptr; | 115 return nullptr; |
| 116 } | 116 } |
| 117 keyframeEffectModel->forceConversionsToAnimatableValues(element); | 117 keyframeEffectModel->forceConversionsToAnimatableValues(element); |
| 118 | 118 |
| 119 return keyframeEffectModel; | 119 return keyframeEffectModel; |
| 120 } | 120 } |
| 121 | 121 |
| 122 } // namespace blink | 122 } // namespace blink |
| OLD | NEW |