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

Unified Diff: third_party/WebKit/Source/core/css/cssom/CSSTranslation.cpp

Issue 2937383002: [CSS Typed OM] Add missing error handling in the CSSTranslation constructor (Closed)
Patch Set: rebase Created 3 years, 6 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
« no previous file with comments | « third_party/WebKit/Source/core/css/cssom/CSSTranslation.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/css/cssom/CSSTranslation.cpp
diff --git a/third_party/WebKit/Source/core/css/cssom/CSSTranslation.cpp b/third_party/WebKit/Source/core/css/cssom/CSSTranslation.cpp
index 1d64903e34a52be52fbbb1daedf40a1ada27fbea..1f40792af34d24fa7cb60865d67c2fb58222ecda 100644
--- a/third_party/WebKit/Source/core/css/cssom/CSSTranslation.cpp
+++ b/third_party/WebKit/Source/core/css/cssom/CSSTranslation.cpp
@@ -14,7 +14,19 @@ CSSTranslation* CSSTranslation::Create(CSSNumericValue* x,
CSSNumericValue* y,
CSSNumericValue* z,
ExceptionState& exception_state) {
- if (z->ContainsPercent()) {
+ if ((x->GetType() != CSSStyleValue::StyleValueType::kLengthType &&
+ x->GetType() != CSSStyleValue::StyleValueType::kPercentType) ||
+ (y->GetType() != CSSStyleValue::StyleValueType::kLengthType &&
+ y->GetType() != CSSStyleValue::StyleValueType::kPercentType)) {
+ exception_state.ThrowTypeError(
+ "Must pass length or percentage to X and Y of CSSTranslation");
+ return nullptr;
+ }
+ if (z && z->GetType() != CSSStyleValue::StyleValueType::kLengthType) {
+ exception_state.ThrowTypeError("Must pass length to Z of CSSTranslation");
+ return nullptr;
+ }
+ if (z && z->ContainsPercent()) {
exception_state.ThrowTypeError(
"CSSTranslation does not support z CSSNumericValue with percent units");
return nullptr;
« no previous file with comments | « third_party/WebKit/Source/core/css/cssom/CSSTranslation.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698