Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(667)

Unified Diff: third_party/WebKit/Source/core/animation/AnimationInputHelpers.cpp

Issue 2047293002: Code cleanup: Replace Element with Document in element.animate() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@_killForceConversionsToAnimatableValues
Patch Set: Fix unit test crash. Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/animation/AnimationInputHelpers.cpp
diff --git a/third_party/WebKit/Source/core/animation/AnimationInputHelpers.cpp b/third_party/WebKit/Source/core/animation/AnimationInputHelpers.cpp
index 9076960682d9b4fd727f8bb2fb2aa9ed0e80924a..e0ae9802e58e59271744f5cdab015803c5f60dd0 100644
--- a/third_party/WebKit/Source/core/animation/AnimationInputHelpers.cpp
+++ b/third_party/WebKit/Source/core/animation/AnimationInputHelpers.cpp
@@ -53,9 +53,9 @@ CSSPropertyID AnimationInputHelpers::keyframeAttributeToCSSProperty(const String
return cssPropertyID(builder.toString());
}
-CSSPropertyID AnimationInputHelpers::keyframeAttributeToPresentationAttribute(const String& property, const Element& element)
+CSSPropertyID AnimationInputHelpers::keyframeAttributeToPresentationAttribute(const String& property)
{
- if (!RuntimeEnabledFeatures::webAnimationsSVGEnabled() || !element.isSVGElement() || !isSVGPrefixed(property))
+ if (!RuntimeEnabledFeatures::webAnimationsSVGEnabled() || !isSVGPrefixed(property))
return CSSPropertyInvalid;
String unprefixedProperty = removeSVGPrefix(property);
@@ -184,26 +184,22 @@ QualifiedName svgAttributeName(const String& property)
return QualifiedName(nullAtom, AtomicString(property), nullAtom);
}
-const QualifiedName* AnimationInputHelpers::keyframeAttributeToSVGAttribute(const String& property, Element& element)
+const QualifiedName* AnimationInputHelpers::keyframeAttributeToSVGAttribute(const String& property)
{
- if (!RuntimeEnabledFeatures::webAnimationsSVGEnabled() || !element.isSVGElement() || !isSVGPrefixed(property))
- return nullptr;
-
- SVGElement& svgElement = toSVGElement(element);
- if (isSVGSMILElement(svgElement))
+ if (!RuntimeEnabledFeatures::webAnimationsSVGEnabled() || !isSVGPrefixed(property))
return nullptr;
String unprefixedProperty = removeSVGPrefix(property);
QualifiedName attributeName = svgAttributeName(unprefixedProperty);
const AttributeNameMap& supportedAttributes = getSupportedAttributes();
auto iter = supportedAttributes.find(attributeName);
- if (iter == supportedAttributes.end() || !svgElement.propertyFromAttribute(*iter->value))
+ if (iter == supportedAttributes.end())
return nullptr;
return iter->value;
}
-PassRefPtr<TimingFunction> AnimationInputHelpers::parseTimingFunction(const String& string, Document* document, ExceptionState& exceptionState)
+PassRefPtr<TimingFunction> AnimationInputHelpers::parseTimingFunction(const String& string, Document& document, ExceptionState& exceptionState)
{
if (string.isEmpty()) {
exceptionState.throwTypeError("Easing may not be the empty string");
@@ -214,24 +210,22 @@ PassRefPtr<TimingFunction> AnimationInputHelpers::parseTimingFunction(const Stri
if (!value || !value->isValueList()) {
ASSERT(!value || value->isCSSWideKeyword());
bool throwTypeError = true;
- if (document) {
- if (string.startsWith("function")) {
- // Due to a bug in old versions of the web-animations-next
- // polyfill, in some circumstances the string passed in here
- // may be a Javascript function instead of the allowed values
- // from the spec
- // (http://w3c.github.io/web-animations/#dom-animationeffecttimingreadonly-easing)
- // This bug was fixed in
- // https://github.com/web-animations/web-animations-next/pull/423
- // and we want to track how often it is still being hit. The
- // linear case is special because 'linear' is the default value
- // for easing. See http://crbug.com/601672
- if (string == "function (a){return a}") {
- Deprecation::countDeprecation(*document, UseCounter::WebAnimationsEasingAsFunctionLinear);
- throwTypeError = false;
- } else {
- UseCounter::count(*document, UseCounter::WebAnimationsEasingAsFunctionOther);
- }
+ if (string.startsWith("function")) {
+ // Due to a bug in old versions of the web-animations-next
+ // polyfill, in some circumstances the string passed in here
+ // may be a Javascript function instead of the allowed values
+ // from the spec
+ // (http://w3c.github.io/web-animations/#dom-animationeffecttimingreadonly-easing)
+ // This bug was fixed in
+ // https://github.com/web-animations/web-animations-next/pull/423
+ // and we want to track how often it is still being hit. The
+ // linear case is special because 'linear' is the default value
+ // for easing. See http://crbug.com/601672
+ if (string == "function (a){return a}") {
+ Deprecation::countDeprecation(document, UseCounter::WebAnimationsEasingAsFunctionLinear);
+ throwTypeError = false;
+ } else {
+ UseCounter::count(document, UseCounter::WebAnimationsEasingAsFunctionOther);
}
}

Powered by Google App Engine
This is Rietveld 408576698