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

Side by Side 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 unified diff | Download patch
OLDNEW
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/css/CSSValueList.h" 8 #include "core/css/CSSValueList.h"
9 #include "core/css/parser/CSSParser.h" 9 #include "core/css/parser/CSSParser.h"
10 #include "core/css/resolver/CSSToStyleMap.h" 10 #include "core/css/resolver/CSSToStyleMap.h"
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 String unprefixedProperty = removeSVGPrefix(property); 195 String unprefixedProperty = removeSVGPrefix(property);
196 QualifiedName attributeName = svgAttributeName(unprefixedProperty); 196 QualifiedName attributeName = svgAttributeName(unprefixedProperty);
197 const AttributeNameMap& supportedAttributes = getSupportedAttributes(); 197 const AttributeNameMap& supportedAttributes = getSupportedAttributes();
198 auto iter = supportedAttributes.find(attributeName); 198 auto iter = supportedAttributes.find(attributeName);
199 if (iter == supportedAttributes.end() || !svgElement.propertyFromAttribute(* iter->value)) 199 if (iter == supportedAttributes.end() || !svgElement.propertyFromAttribute(* iter->value))
200 return nullptr; 200 return nullptr;
201 201
202 return iter->value; 202 return iter->value;
203 } 203 }
204 204
205 PassRefPtr<TimingFunction> AnimationInputHelpers::parseTimingFunction(const Stri ng& string) 205 PassRefPtr<TimingFunction> AnimationInputHelpers::parseTimingFunction(const Stri ng& string, Document* document)
206 { 206 {
207 if (string.isEmpty()) 207 if (string.isEmpty())
208 return nullptr; 208 return nullptr;
209 209
210 CSSValue* value = CSSParser::parseSingleValue(CSSPropertyTransitionTimingFun ction, string); 210 CSSValue* value = CSSParser::parseSingleValue(CSSPropertyTransitionTimingFun ction, string);
211 if (!value || !value->isValueList()) { 211 if (!value || !value->isValueList()) {
212 ASSERT(!value || value->isCSSWideKeyword()); 212 ASSERT(!value || value->isCSSWideKeyword());
213 if (document) {
214 if (string.startsWith("function")) {
215 // Due to a bug in old versions of the web-animations-next
216 // polyfill, in some circumstances the string passed in here
217 // may be a Javascript function instead of the allowed values
218 // from the spec
219 // (http://w3c.github.io/web-animations/#dom-animationeffecttimi ngreadonly-easing)
220 // This bug was fixed in
221 // https://github.com/web-animations/web-animations-next/pull/42 3
222 // and we want to track how often it is still being hit. The
223 // linear case is special because 'linear' is the default value
224 // for easing.
225 if (string == "function (a){return a}")
226 UseCounter::count(*document, UseCounter::WebAnimationsEasing AsFunctionLinear);
227 else
228 UseCounter::count(*document, UseCounter::WebAnimationsEasing AsFunctionOther);
229 }
230 }
213 return nullptr; 231 return nullptr;
214 } 232 }
215 CSSValueList* valueList = toCSSValueList(value); 233 CSSValueList* valueList = toCSSValueList(value);
216 if (valueList->length() > 1) 234 if (valueList->length() > 1)
217 return nullptr; 235 return nullptr;
218 return CSSToStyleMap::mapAnimationTimingFunction(*valueList->item(0), true); 236 return CSSToStyleMap::mapAnimationTimingFunction(*valueList->item(0), true);
219 } 237 }
220 238
221 } // namespace blink 239 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698