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

Side by Side Diff: third_party/WebKit/Source/core/animation/AnimationInputHelpers.cpp

Issue 2038363002: Make CSSPropertyParser::parseSingleValue return a const CSSValue* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@_remove_const_cast_in_interpolation_type
Patch Set: Rebase 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 unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/animation/CSSInterpolationType.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "bindings/core/v8/ExceptionState.h" 7 #include "bindings/core/v8/ExceptionState.h"
8 #include "core/SVGNames.h" 8 #include "core/SVGNames.h"
9 #include "core/css/CSSValueList.h" 9 #include "core/css/CSSValueList.h"
10 #include "core/css/parser/CSSParser.h" 10 #include "core/css/parser/CSSParser.h"
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 return iter->value; 203 return iter->value;
204 } 204 }
205 205
206 PassRefPtr<TimingFunction> AnimationInputHelpers::parseTimingFunction(const Stri ng& string, Document* document, ExceptionState& exceptionState) 206 PassRefPtr<TimingFunction> AnimationInputHelpers::parseTimingFunction(const Stri ng& string, Document* document, ExceptionState& exceptionState)
207 { 207 {
208 if (string.isEmpty()) { 208 if (string.isEmpty()) {
209 exceptionState.throwTypeError("Easing may not be the empty string"); 209 exceptionState.throwTypeError("Easing may not be the empty string");
210 return nullptr; 210 return nullptr;
211 } 211 }
212 212
213 CSSValue* value = CSSParser::parseSingleValue(CSSPropertyTransitionTimingFun ction, string); 213 const CSSValue* value = CSSParser::parseSingleValue(CSSPropertyTransitionTim ingFunction, string);
214 if (!value || !value->isValueList()) { 214 if (!value || !value->isValueList()) {
215 ASSERT(!value || value->isCSSWideKeyword()); 215 ASSERT(!value || value->isCSSWideKeyword());
216 bool throwTypeError = true; 216 bool throwTypeError = true;
217 if (document) { 217 if (document) {
218 if (string.startsWith("function")) { 218 if (string.startsWith("function")) {
219 // Due to a bug in old versions of the web-animations-next 219 // Due to a bug in old versions of the web-animations-next
220 // polyfill, in some circumstances the string passed in here 220 // polyfill, in some circumstances the string passed in here
221 // may be a Javascript function instead of the allowed values 221 // may be a Javascript function instead of the allowed values
222 // from the spec 222 // from the spec
223 // (http://w3c.github.io/web-animations/#dom-animationeffecttimi ngreadonly-easing) 223 // (http://w3c.github.io/web-animations/#dom-animationeffecttimi ngreadonly-easing)
(...skipping 16 matching lines...) Expand all
240 // throwTypeError bool and this if-statement should be removed after the 240 // throwTypeError bool and this if-statement should be removed after the
241 // M53 branch point in July 2016, so that this case will also throw 241 // M53 branch point in July 2016, so that this case will also throw
242 // TypeErrors from M54 onward. 242 // TypeErrors from M54 onward.
243 if (!throwTypeError) { 243 if (!throwTypeError) {
244 return Timing::defaults().timingFunction; 244 return Timing::defaults().timingFunction;
245 } 245 }
246 246
247 exceptionState.throwTypeError("'" + string + "' is not a valid value for easing"); 247 exceptionState.throwTypeError("'" + string + "' is not a valid value for easing");
248 return nullptr; 248 return nullptr;
249 } 249 }
250 CSSValueList* valueList = toCSSValueList(value); 250 const CSSValueList* valueList = toCSSValueList(value);
251 if (valueList->length() > 1) { 251 if (valueList->length() > 1) {
252 exceptionState.throwTypeError("Easing may not be set to a list of values "); 252 exceptionState.throwTypeError("Easing may not be set to a list of values ");
253 return nullptr; 253 return nullptr;
254 } 254 }
255 return CSSToStyleMap::mapAnimationTimingFunction(valueList->item(0), true); 255 return CSSToStyleMap::mapAnimationTimingFunction(valueList->item(0), true);
256 } 256 }
257 257
258 } // namespace blink 258 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/animation/CSSInterpolationType.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698