| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "core/animation/AnimationInputHelpers.h" | 5 #include "core/animation/AnimationInputHelpers.h" |
| 6 | 6 |
| 7 #include "core/SVGNames.h" | 7 #include "core/SVGNames.h" |
| 8 #include "core/XLinkNames.h" | |
| 9 #include "core/css/CSSValueList.h" | 8 #include "core/css/CSSValueList.h" |
| 10 #include "core/css/parser/CSSParser.h" | 9 #include "core/css/parser/CSSParser.h" |
| 11 #include "core/css/resolver/CSSToStyleMap.h" | 10 #include "core/css/resolver/CSSToStyleMap.h" |
| 12 #include "core/svg/SVGElement.h" | 11 #include "core/svg/SVGElement.h" |
| 13 #include "core/svg/animation/SVGSMILElement.h" | 12 #include "core/svg/animation/SVGSMILElement.h" |
| 14 #include "wtf/text/StringBuilder.h" | 13 #include "wtf/text/StringBuilder.h" |
| 15 | 14 |
| 16 namespace blink { | 15 namespace blink { |
| 17 | 16 |
| 18 const char kSVGPrefix[] = "svg-"; | 17 const char kSVGPrefix[] = "svg-"; |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 &SVGNames::dyAttr, | 80 &SVGNames::dyAttr, |
| 82 &SVGNames::edgeModeAttr, | 81 &SVGNames::edgeModeAttr, |
| 83 &SVGNames::elevationAttr, | 82 &SVGNames::elevationAttr, |
| 84 &SVGNames::exponentAttr, | 83 &SVGNames::exponentAttr, |
| 85 &SVGNames::filterUnitsAttr, | 84 &SVGNames::filterUnitsAttr, |
| 86 &SVGNames::fxAttr, | 85 &SVGNames::fxAttr, |
| 87 &SVGNames::fyAttr, | 86 &SVGNames::fyAttr, |
| 88 &SVGNames::gradientTransformAttr, | 87 &SVGNames::gradientTransformAttr, |
| 89 &SVGNames::gradientUnitsAttr, | 88 &SVGNames::gradientUnitsAttr, |
| 90 &SVGNames::heightAttr, | 89 &SVGNames::heightAttr, |
| 90 &SVGNames::hrefAttr, |
| 91 &SVGNames::in2Attr, | 91 &SVGNames::in2Attr, |
| 92 &SVGNames::inAttr, | 92 &SVGNames::inAttr, |
| 93 &SVGNames::interceptAttr, | 93 &SVGNames::interceptAttr, |
| 94 &SVGNames::k1Attr, | 94 &SVGNames::k1Attr, |
| 95 &SVGNames::k2Attr, | 95 &SVGNames::k2Attr, |
| 96 &SVGNames::k3Attr, | 96 &SVGNames::k3Attr, |
| 97 &SVGNames::k4Attr, | 97 &SVGNames::k4Attr, |
| 98 &SVGNames::kernelMatrixAttr, | 98 &SVGNames::kernelMatrixAttr, |
| 99 &SVGNames::kernelUnitLengthAttr, | 99 &SVGNames::kernelUnitLengthAttr, |
| 100 &SVGNames::lengthAdjustAttr, | 100 &SVGNames::lengthAdjustAttr, |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 &SVGNames::widthAttr, | 154 &SVGNames::widthAttr, |
| 155 &SVGNames::x1Attr, | 155 &SVGNames::x1Attr, |
| 156 &SVGNames::x2Attr, | 156 &SVGNames::x2Attr, |
| 157 &SVGNames::xAttr, | 157 &SVGNames::xAttr, |
| 158 &SVGNames::xChannelSelectorAttr, | 158 &SVGNames::xChannelSelectorAttr, |
| 159 &SVGNames::y1Attr, | 159 &SVGNames::y1Attr, |
| 160 &SVGNames::y2Attr, | 160 &SVGNames::y2Attr, |
| 161 &SVGNames::yAttr, | 161 &SVGNames::yAttr, |
| 162 &SVGNames::yChannelSelectorAttr, | 162 &SVGNames::yChannelSelectorAttr, |
| 163 &SVGNames::zAttr, | 163 &SVGNames::zAttr, |
| 164 &XLinkNames::hrefAttr, | |
| 165 }; | 164 }; |
| 166 for (size_t i = 0; i < WTF_ARRAY_LENGTH(attributes); i++) | 165 for (size_t i = 0; i < WTF_ARRAY_LENGTH(attributes); i++) |
| 167 supportedAttributes.set(*attributes[i], attributes[i]); | 166 supportedAttributes.set(*attributes[i], attributes[i]); |
| 168 } | 167 } |
| 169 return supportedAttributes; | 168 return supportedAttributes; |
| 170 } | 169 } |
| 171 | 170 |
| 172 QualifiedName svgAttributeName(const String& property) | 171 QualifiedName svgAttributeName(const String& property) |
| 173 { | 172 { |
| 174 ASSERT(!isSVGPrefixed(property)); | 173 ASSERT(!isSVGPrefixed(property)); |
| 175 | |
| 176 if (property == "href") | |
| 177 return XLinkNames::hrefAttr; | |
| 178 | |
| 179 return QualifiedName(nullAtom, AtomicString(property), nullAtom); | 174 return QualifiedName(nullAtom, AtomicString(property), nullAtom); |
| 180 } | 175 } |
| 181 | 176 |
| 182 const QualifiedName* AnimationInputHelpers::keyframeAttributeToSVGAttribute(cons
t String& property, Element& element) | 177 const QualifiedName* AnimationInputHelpers::keyframeAttributeToSVGAttribute(cons
t String& property, Element& element) |
| 183 { | 178 { |
| 184 if (!RuntimeEnabledFeatures::webAnimationsSVGEnabled() || !element.isSVGElem
ent() || !isSVGPrefixed(property)) | 179 if (!RuntimeEnabledFeatures::webAnimationsSVGEnabled() || !element.isSVGElem
ent() || !isSVGPrefixed(property)) |
| 185 return nullptr; | 180 return nullptr; |
| 186 | 181 |
| 187 SVGElement& svgElement = toSVGElement(element); | 182 SVGElement& svgElement = toSVGElement(element); |
| 188 if (isSVGSMILElement(svgElement)) | 183 if (isSVGSMILElement(svgElement)) |
| (...skipping 19 matching lines...) Expand all Loading... |
| 208 ASSERT(!value || value->isCSSWideKeyword()); | 203 ASSERT(!value || value->isCSSWideKeyword()); |
| 209 return nullptr; | 204 return nullptr; |
| 210 } | 205 } |
| 211 CSSValueList* valueList = toCSSValueList(value.get()); | 206 CSSValueList* valueList = toCSSValueList(value.get()); |
| 212 if (valueList->length() > 1) | 207 if (valueList->length() > 1) |
| 213 return nullptr; | 208 return nullptr; |
| 214 return CSSToStyleMap::mapAnimationTimingFunction(*valueList->item(0), true); | 209 return CSSToStyleMap::mapAnimationTimingFunction(*valueList->item(0), true); |
| 215 } | 210 } |
| 216 | 211 |
| 217 } // namespace blink | 212 } // namespace blink |
| OLD | NEW |