Chromium Code Reviews| 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 26 matching lines...) Expand all Loading... | |
| 37 #include "core/SVGNames.h" | 37 #include "core/SVGNames.h" |
| 38 #include "core/XLinkNames.h" | 38 #include "core/XLinkNames.h" |
| 39 #include "core/animation/AnimationInputHelpers.h" | 39 #include "core/animation/AnimationInputHelpers.h" |
| 40 #include "core/animation/KeyframeEffectModel.h" | 40 #include "core/animation/KeyframeEffectModel.h" |
| 41 #include "core/animation/StringKeyframe.h" | 41 #include "core/animation/StringKeyframe.h" |
| 42 #include "core/css/resolver/StyleResolver.h" | 42 #include "core/css/resolver/StyleResolver.h" |
| 43 #include "core/dom/Document.h" | 43 #include "core/dom/Document.h" |
| 44 #include "core/dom/Element.h" | 44 #include "core/dom/Element.h" |
| 45 #include "core/dom/NodeComputedStyle.h" | 45 #include "core/dom/NodeComputedStyle.h" |
| 46 #include "core/svg/animation/SVGSMILElement.h" | 46 #include "core/svg/animation/SVGSMILElement.h" |
| 47 #include "wtf/ASCIICType.h" | |
| 47 #include "wtf/HashSet.h" | 48 #include "wtf/HashSet.h" |
| 48 #include "wtf/NonCopyingSort.h" | 49 #include "wtf/NonCopyingSort.h" |
| 49 | 50 |
| 50 namespace blink { | 51 namespace blink { |
| 51 | 52 |
| 52 namespace { | 53 namespace { |
| 53 | 54 |
| 55 bool svgPrefixed(const String& property) | |
| 56 { | |
| 57 return property.length() >= 4 && property.startsWith("svg") && isASCIIUpper( property[3]); | |
| 58 } | |
| 59 | |
| 54 QualifiedName svgAttributeName(String property) | 60 QualifiedName svgAttributeName(String property) |
| 55 { | 61 { |
| 56 if (property.length() >= 4 && property.startsWith("svg")) { | 62 // Replace 'svgTransform' with 'transform', etc. |
| 57 // Replace 'svgTransform' with 'transform', etc. | 63 ASSERT(svgPrefixed(property)); |
| 58 property.remove(0, 3); | 64 UChar first = toASCIILower(property[3]); |
| 59 property = property.lower(); | 65 property.remove(0, 4); |
| 60 } | 66 property.insert(&first, 1, 0); |
|
shans
2015/06/07 06:42:06
This differs from the previous behaviour, but I as
Eric Willigers
2015/06/09 04:02:12
Yes, I was sloppy before, it is now correct.
alancutter (OOO until 2018)
2015/06/09 06:25:05
So we no longer support animating things like svgc
| |
| 61 | 67 |
| 62 if (property == "href") | 68 if (property == "href") |
| 63 return XLinkNames::hrefAttr; | 69 return XLinkNames::hrefAttr; |
| 64 | 70 |
| 65 return QualifiedName(nullAtom, AtomicString(property), SVGNames::amplitudeAt tr.namespaceURI()); | 71 return QualifiedName(nullAtom, AtomicString(property), SVGNames::amplitudeAt tr.namespaceURI()); |
| 66 } | 72 } |
| 67 | 73 |
| 68 const QualifiedName* supportedSVGAttribute(const String& property, SVGElement* s vgElement) | 74 const QualifiedName* supportedSVGAttribute(const String& property, SVGElement* s vgElement) |
| 69 { | 75 { |
| 70 typedef HashMap<QualifiedName, const QualifiedName*> AttributeNameMap; | 76 typedef HashMap<QualifiedName, const QualifiedName*> AttributeNameMap; |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 253 keyframe->setPropertyValue(id, value, element, styleSheetContent s); | 259 keyframe->setPropertyValue(id, value, element, styleSheetContent s); |
| 254 continue; | 260 continue; |
| 255 } | 261 } |
| 256 | 262 |
| 257 if (property == "offset" | 263 if (property == "offset" |
| 258 || property == "composite" | 264 || property == "composite" |
| 259 || property == "easing") { | 265 || property == "easing") { |
| 260 continue; | 266 continue; |
| 261 } | 267 } |
| 262 | 268 |
| 263 if (!RuntimeEnabledFeatures::webAnimationsSVGEnabled() || !element-> isSVGElement()) | 269 if (!RuntimeEnabledFeatures::webAnimationsSVGEnabled() || !element-> isSVGElement() || !svgPrefixed(property)) |
| 264 continue; | 270 continue; |
| 265 | 271 |
| 266 SVGElement* svgElement = toSVGElement(element); | 272 SVGElement* svgElement = toSVGElement(element); |
| 267 const QualifiedName* qualifiedName = supportedSVGAttribute(property, svgElement); | 273 const QualifiedName* qualifiedName = supportedSVGAttribute(property, svgElement); |
| 268 | 274 |
| 269 if (qualifiedName) | 275 if (qualifiedName) |
| 270 keyframe->setPropertyValue(*qualifiedName, value, svgElement); | 276 keyframe->setPropertyValue(*qualifiedName, value, svgElement); |
| 271 } | 277 } |
| 272 } | 278 } |
| 273 | 279 |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 288 PassRefPtrWillBeRawPtr<EffectModel> EffectInput::convert(Element* element, const EffectModelOrDictionarySequence& effectInput, ExceptionState& exceptionState) | 294 PassRefPtrWillBeRawPtr<EffectModel> EffectInput::convert(Element* element, const EffectModelOrDictionarySequence& effectInput, ExceptionState& exceptionState) |
| 289 { | 295 { |
| 290 if (effectInput.isEffectModel()) | 296 if (effectInput.isEffectModel()) |
| 291 return effectInput.getAsEffectModel(); | 297 return effectInput.getAsEffectModel(); |
| 292 if (effectInput.isDictionarySequence()) | 298 if (effectInput.isDictionarySequence()) |
| 293 return convert(element, effectInput.getAsDictionarySequence(), exception State); | 299 return convert(element, effectInput.getAsDictionarySequence(), exception State); |
| 294 return nullptr; | 300 return nullptr; |
| 295 } | 301 } |
| 296 | 302 |
| 297 } // namespace blink | 303 } // namespace blink |
| OLD | NEW |