| 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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 | 182 |
| 183 auto iter = supportedAttributes.find(attributeName); | 183 auto iter = supportedAttributes.find(attributeName); |
| 184 if (iter == supportedAttributes.end() || !svgElement->propertyFromAttribute(
*iter->value)) | 184 if (iter == supportedAttributes.end() || !svgElement->propertyFromAttribute(
*iter->value)) |
| 185 return nullptr; | 185 return nullptr; |
| 186 | 186 |
| 187 return iter->value; | 187 return iter->value; |
| 188 } | 188 } |
| 189 | 189 |
| 190 } // namespace | 190 } // namespace |
| 191 | 191 |
| 192 PassRefPtrWillBeRawPtr<AnimationEffect> EffectInput::convert(Element* element, c
onst Vector<Dictionary>& keyframeDictionaryVector, ExceptionState& exceptionStat
e) | 192 AnimationEffect* EffectInput::convert(Element* element, const Vector<Dictionary>
& keyframeDictionaryVector, ExceptionState& exceptionState) |
| 193 { | 193 { |
| 194 // FIXME: Remove the dependency on element. | 194 // FIXME: Remove the dependency on element. |
| 195 if (!element) | 195 if (!element) |
| 196 return nullptr; | 196 return nullptr; |
| 197 | 197 |
| 198 StyleSheetContents* styleSheetContents = element->document().elementSheet().
contents(); | 198 StyleSheetContents* styleSheetContents = element->document().elementSheet().
contents(); |
| 199 StringKeyframeVector keyframes; | 199 StringKeyframeVector keyframes; |
| 200 double lastOffset = 0; | 200 double lastOffset = 0; |
| 201 | 201 |
| 202 for (const auto& keyframeDictionary : keyframeDictionaryVector) { | 202 for (const auto& keyframeDictionary : keyframeDictionaryVector) { |
| 203 RefPtrWillBeRawPtr<StringKeyframe> keyframe = StringKeyframe::create(); | 203 StringKeyframe* keyframe = StringKeyframe::create(); |
| 204 | 204 |
| 205 ScriptValue scriptValue; | 205 ScriptValue scriptValue; |
| 206 bool frameHasOffset = DictionaryHelper::get(keyframeDictionary, "offset"
, scriptValue) && !scriptValue.isNull(); | 206 bool frameHasOffset = DictionaryHelper::get(keyframeDictionary, "offset"
, scriptValue) && !scriptValue.isNull(); |
| 207 | 207 |
| 208 if (frameHasOffset) { | 208 if (frameHasOffset) { |
| 209 double offset; | 209 double offset; |
| 210 DictionaryHelper::get(keyframeDictionary, "offset", offset); | 210 DictionaryHelper::get(keyframeDictionary, "offset", offset); |
| 211 | 211 |
| 212 // Keyframes with offsets outside the range [0.0, 1.0] are an error. | 212 // Keyframes with offsets outside the range [0.0, 1.0] are an error. |
| 213 if (std::isnan(offset)) { | 213 if (std::isnan(offset)) { |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 continue; | 262 continue; |
| 263 | 263 |
| 264 SVGElement* svgElement = toSVGElement(element); | 264 SVGElement* svgElement = toSVGElement(element); |
| 265 const QualifiedName* qualifiedName = supportedSVGAttribute(property,
svgElement); | 265 const QualifiedName* qualifiedName = supportedSVGAttribute(property,
svgElement); |
| 266 | 266 |
| 267 if (qualifiedName) | 267 if (qualifiedName) |
| 268 keyframe->setPropertyValue(*qualifiedName, value, svgElement); | 268 keyframe->setPropertyValue(*qualifiedName, value, svgElement); |
| 269 } | 269 } |
| 270 } | 270 } |
| 271 | 271 |
| 272 RefPtrWillBeRawPtr<StringKeyframeEffectModel> keyframeEffectModel = StringKe
yframeEffectModel::create(keyframes); | 272 StringKeyframeEffectModel* keyframeEffectModel = StringKeyframeEffectModel::
create(keyframes); |
| 273 if (keyframeEffectModel->hasSyntheticKeyframes()) { | 273 if (keyframeEffectModel->hasSyntheticKeyframes()) { |
| 274 exceptionState.throwDOMException(NotSupportedError, "Partial keyframes a
re not supported."); | 274 exceptionState.throwDOMException(NotSupportedError, "Partial keyframes a
re not supported."); |
| 275 return nullptr; | 275 return nullptr; |
| 276 } | 276 } |
| 277 if (!keyframeEffectModel->isReplaceOnly()) { | 277 if (!keyframeEffectModel->isReplaceOnly()) { |
| 278 exceptionState.throwDOMException(NotSupportedError, "Additive animations
are not supported."); | 278 exceptionState.throwDOMException(NotSupportedError, "Additive animations
are not supported."); |
| 279 return nullptr; | 279 return nullptr; |
| 280 } | 280 } |
| 281 keyframeEffectModel->forceConversionsToAnimatableValues(*element, element->c
omputedStyle()); | 281 keyframeEffectModel->forceConversionsToAnimatableValues(*element, element->c
omputedStyle()); |
| 282 | 282 |
| 283 return keyframeEffectModel; | 283 return keyframeEffectModel; |
| 284 } | 284 } |
| 285 | 285 |
| 286 PassRefPtrWillBeRawPtr<AnimationEffect> EffectInput::convert(Element* element, c
onst AnimationEffectOrDictionarySequence& effectInput, ExceptionState& exception
State) | 286 AnimationEffect* EffectInput::convert(Element* element, const AnimationEffectOrD
ictionarySequence& effectInput, ExceptionState& exceptionState) |
| 287 { | 287 { |
| 288 if (effectInput.isAnimationEffect()) | 288 if (effectInput.isAnimationEffect()) |
| 289 return effectInput.getAsAnimationEffect(); | 289 return effectInput.getAsAnimationEffect(); |
| 290 if (effectInput.isDictionarySequence()) | 290 if (effectInput.isDictionarySequence()) |
| 291 return convert(element, effectInput.getAsDictionarySequence(), exception
State); | 291 return convert(element, effectInput.getAsDictionarySequence(), exception
State); |
| 292 return nullptr; | 292 return nullptr; |
| 293 } | 293 } |
| 294 | 294 |
| 295 } // namespace blink | 295 } // namespace blink |
| OLD | NEW |