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

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

Issue 1851003002: Throw TypeError if easing string is invalid. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase 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 68071a95fcb07f152b93530d5c72f216bfa428ed..460620613e2e613cf121e14c52926f90c5adf175 100644
--- a/third_party/WebKit/Source/core/animation/AnimationInputHelpers.cpp
+++ b/third_party/WebKit/Source/core/animation/AnimationInputHelpers.cpp
@@ -4,6 +4,7 @@
#include "core/animation/AnimationInputHelpers.h"
+#include "bindings/core/v8/ExceptionState.h"
#include "core/SVGNames.h"
#include "core/css/CSSValueList.h"
#include "core/css/parser/CSSParser.h"
@@ -201,19 +202,24 @@ const QualifiedName* AnimationInputHelpers::keyframeAttributeToSVGAttribute(cons
return iter->value;
}
-PassRefPtr<TimingFunction> AnimationInputHelpers::parseTimingFunction(const String& string)
+PassRefPtr<TimingFunction> AnimationInputHelpers::parseTimingFunction(const String& string, ExceptionState& exceptionState)
{
- if (string.isEmpty())
+ if (string.isEmpty()) {
+ exceptionState.throwTypeError("Easing may not be the empty string");
return nullptr;
+ }
CSSValue* value = CSSParser::parseSingleValue(CSSPropertyTransitionTimingFunction, string);
if (!value || !value->isValueList()) {
ASSERT(!value || value->isCSSWideKeyword());
+ exceptionState.throwTypeError("'" + string + "' is not a valid value for easing");
return nullptr;
}
CSSValueList* valueList = toCSSValueList(value);
- if (valueList->length() > 1)
+ if (valueList->length() > 1) {
+ exceptionState.throwTypeError("Easing may not be set to a list of values");
return nullptr;
+ }
return CSSToStyleMap::mapAnimationTimingFunction(*valueList->item(0), true);
}

Powered by Google App Engine
This is Rietveld 408576698