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

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

Issue 2943303002: [CSS Typed OM] Refactor is2D handling in CSSTransformComponents to match new spec (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 539f6fd67ea89397714fee0ad0f4d5b7176f4efa..7948a0d3c782639172897ca405924f8b57fd416a 100644
--- a/third_party/WebKit/Source/core/css/cssom/CSSTranslation.cpp
+++ b/third_party/WebKit/Source/core/css/cssom/CSSTranslation.cpp
@@ -11,6 +11,22 @@
namespace blink {
+CSSTranslation* CSSTranslation::Create(CSSNumericValue* x,
+ CSSNumericValue* y,
+ ExceptionState& exception_state) {
+ 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;
+ }
+ return new CSSTranslation(
+ x, y, CSSUnitValue::Create(0, CSSPrimitiveValue::UnitType::kPixels),
+ true /* is2D */);
+}
+
CSSTranslation* CSSTranslation::Create(CSSNumericValue* x,
CSSNumericValue* y,
CSSNumericValue* z,
@@ -32,7 +48,7 @@ CSSTranslation* CSSTranslation::Create(CSSNumericValue* x,
"CSSTranslation does not support z CSSNumericValue with percent units");
return nullptr;
}
- return new CSSTranslation(x, y, z);
+ return new CSSTranslation(x, y, z, false /* is2D */);
}
void CSSTranslation::setX(CSSNumericValue* x, ExceptionState& exception_state) {
@@ -70,10 +86,10 @@ void CSSTranslation::setZ(CSSNumericValue* z, ExceptionState& exception_state) {
CSSFunctionValue* CSSTranslation::ToCSSValue() const {
CSSFunctionValue* result = CSSFunctionValue::Create(
- Is2D() ? CSSValueTranslate : CSSValueTranslate3d);
+ is2D() ? CSSValueTranslate : CSSValueTranslate3d);
result->Append(*x_->ToCSSValue());
result->Append(*y_->ToCSSValue());
- if (!Is2D())
+ if (!is2D())
result->Append(*z_->ToCSSValue());
return result;
}
« 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