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

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

Issue 1867803002: Add use counters for function values of easing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and update UseCounters again Created 4 years, 8 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 532cd58c4c39e71b101bb16206f6383603285b0a..21ad87c2d92a3d1c6933c3ad4e8f804440c820c2 100644
--- a/third_party/WebKit/Source/core/animation/AnimationInputHelpers.cpp
+++ b/third_party/WebKit/Source/core/animation/AnimationInputHelpers.cpp
@@ -202,7 +202,7 @@ const QualifiedName* AnimationInputHelpers::keyframeAttributeToSVGAttribute(cons
return iter->value;
}
-PassRefPtr<TimingFunction> AnimationInputHelpers::parseTimingFunction(const String& string)
+PassRefPtr<TimingFunction> AnimationInputHelpers::parseTimingFunction(const String& string, Document* document)
{
if (string.isEmpty())
return nullptr;
@@ -210,6 +210,24 @@ PassRefPtr<TimingFunction> AnimationInputHelpers::parseTimingFunction(const Stri
CSSValue* value = CSSParser::parseSingleValue(CSSPropertyTransitionTimingFunction, string);
if (!value || !value->isValueList()) {
ASSERT(!value || value->isCSSWideKeyword());
+ 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.
+ if (string == "function (a){return a}")
+ UseCounter::count(*document, UseCounter::WebAnimationsEasingAsFunctionLinear);
+ else
+ UseCounter::count(*document, UseCounter::WebAnimationsEasingAsFunctionOther);
+ }
+ }
return nullptr;
}
CSSValueList* valueList = toCSSValueList(value);

Powered by Google App Engine
This is Rietveld 408576698