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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 PassRefPtrWillBeRawPtr<AnimationEffect> EffectInput::convert(Element* element, c
onst Vector<Dictionary>& keyframeDictionaryVector, ExceptionState& exceptionSta
te, bool unsafe) | 51 PassRefPtrWillBeRawPtr<AnimationEffect> EffectInput::convert(Element* element, c
onst Vector<Dictionary>& keyframeDictionaryVector, ExceptionState& exceptionSta
te, bool unsafe) |
52 { | 52 { |
53 // FIXME: This test will not be neccessary once resolution of keyframe value
s occurs at | 53 // FIXME: This test will not be neccessary once resolution of keyframe value
s occurs at |
54 // animation application time. | 54 // animation application time. |
55 if (!unsafe && !checkDocumentAndRenderer(element)) | 55 if (!unsafe && !checkDocumentAndRenderer(element)) |
56 return nullptr; | 56 return nullptr; |
57 | 57 |
58 StyleSheetContents* styleSheetContents = element->document().elementSheet().
contents(); | 58 StyleSheetContents* styleSheetContents = element->document().elementSheet().
contents(); |
59 | 59 |
60 // FIXME: Move this code into KeyframeEffectModel, it will be used by the ID
L constructor for that class. | 60 // FIXME: Move this code into KeyframeEffectModel, it will be used by the ID
L constructor for that class. |
61 AnimatableValueKeyframeVector keyframes; | 61 KeyframeEffectModel::KeyframeVector keyframes; |
62 WillBeHeapVector<RefPtrWillBeMember<MutableStylePropertySet> > propertySetVe
ctor; | 62 WillBeHeapVector<RefPtrWillBeMember<MutableStylePropertySet> > propertySetVe
ctor; |
63 | 63 |
64 for (size_t i = 0; i < keyframeDictionaryVector.size(); ++i) { | 64 for (size_t i = 0; i < keyframeDictionaryVector.size(); ++i) { |
65 RefPtrWillBeRawPtr<MutableStylePropertySet> propertySet = MutableStylePr
opertySet::create(); | 65 RefPtrWillBeRawPtr<MutableStylePropertySet> propertySet = MutableStylePr
opertySet::create(); |
66 propertySetVector.append(propertySet); | 66 propertySetVector.append(propertySet); |
67 | 67 |
68 RefPtrWillBeRawPtr<AnimatableValueKeyframe> keyframe = AnimatableValueKe
yframe::create(); | 68 RefPtrWillBeRawPtr<Keyframe> keyframe = Keyframe::create(); |
69 keyframes.append(keyframe); | 69 keyframes.append(keyframe); |
70 | 70 |
71 double offset; | 71 double offset; |
72 if (keyframeDictionaryVector[i].get("offset", offset)) | 72 if (keyframeDictionaryVector[i].get("offset", offset)) |
73 keyframe->setOffset(offset); | 73 keyframe->setOffset(offset); |
74 | 74 |
75 String compositeString; | 75 String compositeString; |
76 keyframeDictionaryVector[i].get("composite", compositeString); | 76 keyframeDictionaryVector[i].get("composite", compositeString); |
77 if (compositeString == "add") | 77 if (compositeString == "add") |
78 keyframe->setComposite(AnimationEffect::CompositeAdd); | 78 keyframe->setComposite(AnimationEffect::CompositeAdd); |
(...skipping 20 matching lines...) Expand all Loading... |
99 if (id == CSSPropertyInvalid || !CSSAnimations::isAnimatableProperty
(id)) | 99 if (id == CSSPropertyInvalid || !CSSAnimations::isAnimatableProperty
(id)) |
100 continue; | 100 continue; |
101 | 101 |
102 String value; | 102 String value; |
103 keyframeDictionaryVector[i].get(property, value); | 103 keyframeDictionaryVector[i].get(property, value); |
104 propertySet->setProperty(id, value, false, styleSheetContents); | 104 propertySet->setProperty(id, value, false, styleSheetContents); |
105 } | 105 } |
106 } | 106 } |
107 | 107 |
108 // FIXME: Replace this with code that just parses, when that code is availab
le. | 108 // FIXME: Replace this with code that just parses, when that code is availab
le. |
109 RefPtrWillBeRawPtr<AnimatableValueKeyframeEffectModel> keyframeEffectModel =
StyleResolver::createKeyframeEffectModel(*element, propertySetVector, keyframes
); | 109 RefPtrWillBeRawPtr<KeyframeEffectModel> keyframeEffectModel = StyleResolver:
:createKeyframeEffectModel(*element, propertySetVector, keyframes); |
110 if (!keyframeEffectModel->isReplaceOnly()) { | 110 if (!keyframeEffectModel->isReplaceOnly()) { |
111 exceptionState.throwDOMException(NotSupportedError, "Partial keyframes a
re not supported."); | 111 exceptionState.throwDOMException(NotSupportedError, "Partial keyframes a
re not supported."); |
112 return nullptr; | 112 return nullptr; |
113 } | 113 } |
114 | 114 |
115 return keyframeEffectModel; | 115 return keyframeEffectModel; |
116 } | 116 } |
117 | 117 |
118 } // namespace WebCore | 118 } // namespace WebCore |
OLD | NEW |