| 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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 | 186 |
| 187 auto iter = supportedAttributes.find(attributeName); | 187 auto iter = supportedAttributes.find(attributeName); |
| 188 if (iter == supportedAttributes.end() || !svgElement->propertyFromAttribute(
*iter->value)) | 188 if (iter == supportedAttributes.end() || !svgElement->propertyFromAttribute(
*iter->value)) |
| 189 return nullptr; | 189 return nullptr; |
| 190 | 190 |
| 191 return iter->value; | 191 return iter->value; |
| 192 } | 192 } |
| 193 | 193 |
| 194 } // namespace | 194 } // namespace |
| 195 | 195 |
| 196 PassRefPtrWillBeRawPtr<EffectModel> EffectInput::convert(Element* element, const
Vector<Dictionary>& keyframeDictionaryVector, ExceptionState& exceptionState) | 196 EffectModel* EffectInput::convert(Element* element, const Vector<Dictionary>& ke
yframeDictionaryVector, ExceptionState& exceptionState) |
| 197 { | 197 { |
| 198 if (!element) | 198 if (!element) |
| 199 return nullptr; | 199 return nullptr; |
| 200 | 200 |
| 201 // TODO(alancutter): Remove this once composited animations no longer depend
on AnimatableValues. | 201 // TODO(alancutter): Remove this once composited animations no longer depend
on AnimatableValues. |
| 202 if (element->inActiveDocument()) | 202 if (element->inActiveDocument()) |
| 203 element->document().updateLayoutTreeForNodeIfNeeded(element); | 203 element->document().updateLayoutTreeForNodeIfNeeded(element); |
| 204 | 204 |
| 205 StyleSheetContents* styleSheetContents = element->document().elementSheet().
contents(); | 205 StyleSheetContents* styleSheetContents = element->document().elementSheet().
contents(); |
| 206 StringKeyframeVector keyframes; | 206 StringKeyframeVector keyframes; |
| 207 double lastOffset = 0; | 207 double lastOffset = 0; |
| 208 | 208 |
| 209 for (const auto& keyframeDictionary : keyframeDictionaryVector) { | 209 for (const auto& keyframeDictionary : keyframeDictionaryVector) { |
| 210 RefPtrWillBeRawPtr<StringKeyframe> keyframe = StringKeyframe::create(); | 210 StringKeyframe* keyframe = StringKeyframe::create(); |
| 211 | 211 |
| 212 ScriptValue scriptValue; | 212 ScriptValue scriptValue; |
| 213 bool frameHasOffset = DictionaryHelper::get(keyframeDictionary, "offset"
, scriptValue) && !scriptValue.isNull(); | 213 bool frameHasOffset = DictionaryHelper::get(keyframeDictionary, "offset"
, scriptValue) && !scriptValue.isNull(); |
| 214 | 214 |
| 215 if (frameHasOffset) { | 215 if (frameHasOffset) { |
| 216 double offset; | 216 double offset; |
| 217 DictionaryHelper::get(keyframeDictionary, "offset", offset); | 217 DictionaryHelper::get(keyframeDictionary, "offset", offset); |
| 218 | 218 |
| 219 // Keyframes with offsets outside the range [0.0, 1.0] are an error. | 219 // Keyframes with offsets outside the range [0.0, 1.0] are an error. |
| 220 if (std::isnan(offset)) { | 220 if (std::isnan(offset)) { |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 continue; | 269 continue; |
| 270 | 270 |
| 271 SVGElement* svgElement = toSVGElement(element); | 271 SVGElement* svgElement = toSVGElement(element); |
| 272 const QualifiedName* qualifiedName = supportedSVGAttribute(property,
svgElement); | 272 const QualifiedName* qualifiedName = supportedSVGAttribute(property,
svgElement); |
| 273 | 273 |
| 274 if (qualifiedName) | 274 if (qualifiedName) |
| 275 keyframe->setPropertyValue(*qualifiedName, value, svgElement); | 275 keyframe->setPropertyValue(*qualifiedName, value, svgElement); |
| 276 } | 276 } |
| 277 } | 277 } |
| 278 | 278 |
| 279 RefPtrWillBeRawPtr<StringKeyframeEffectModel> keyframeEffectModel = StringKe
yframeEffectModel::create(keyframes); | 279 StringKeyframeEffectModel* keyframeEffectModel = StringKeyframeEffectModel::
create(keyframes); |
| 280 if (keyframeEffectModel->hasSyntheticKeyframes()) { | 280 if (keyframeEffectModel->hasSyntheticKeyframes()) { |
| 281 exceptionState.throwDOMException(NotSupportedError, "Partial keyframes a
re not supported."); | 281 exceptionState.throwDOMException(NotSupportedError, "Partial keyframes a
re not supported."); |
| 282 return nullptr; | 282 return nullptr; |
| 283 } | 283 } |
| 284 if (!keyframeEffectModel->isReplaceOnly()) { | 284 if (!keyframeEffectModel->isReplaceOnly()) { |
| 285 exceptionState.throwDOMException(NotSupportedError, "Additive animations
are not supported."); | 285 exceptionState.throwDOMException(NotSupportedError, "Additive animations
are not supported."); |
| 286 return nullptr; | 286 return nullptr; |
| 287 } | 287 } |
| 288 keyframeEffectModel->forceConversionsToAnimatableValues(*element, element->c
omputedStyle()); | 288 keyframeEffectModel->forceConversionsToAnimatableValues(*element, element->c
omputedStyle()); |
| 289 | 289 |
| 290 return keyframeEffectModel; | 290 return keyframeEffectModel; |
| 291 } | 291 } |
| 292 | 292 |
| 293 PassRefPtrWillBeRawPtr<EffectModel> EffectInput::convert(Element* element, const
EffectModelOrDictionarySequence& effectInput, ExceptionState& exceptionState) | 293 EffectModel* EffectInput::convert(Element* element, const EffectModelOrDictionar
ySequence& effectInput, ExceptionState& exceptionState) |
| 294 { | 294 { |
| 295 if (effectInput.isEffectModel()) | 295 if (effectInput.isEffectModel()) |
| 296 return effectInput.getAsEffectModel(); | 296 return effectInput.getAsEffectModel(); |
| 297 if (effectInput.isDictionarySequence()) | 297 if (effectInput.isDictionarySequence()) |
| 298 return convert(element, effectInput.getAsDictionarySequence(), exception
State); | 298 return convert(element, effectInput.getAsDictionarySequence(), exception
State); |
| 299 return nullptr; | 299 return nullptr; |
| 300 } | 300 } |
| 301 | 301 |
| 302 } // namespace blink | 302 } // namespace blink |
| OLD | NEW |