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

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

Issue 2514043002: [CSS Typed OM] Add CSSValue->CSSSkew conversions (Closed)
Patch Set: Merge branch 'update-transform-tests' into cssskew-fromcssvalue-2 Created 4 years 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/CSSSkew.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/CSSSkew.cpp
diff --git a/third_party/WebKit/Source/core/css/cssom/CSSSkew.cpp b/third_party/WebKit/Source/core/css/cssom/CSSSkew.cpp
index 41ccab13ef1d8685f8e0f88b8c55dc4c7c7a0945..681ae1db85a151b7eae60fdaa80c7ed4d42536b7 100644
--- a/third_party/WebKit/Source/core/css/cssom/CSSSkew.cpp
+++ b/third_party/WebKit/Source/core/css/cssom/CSSSkew.cpp
@@ -6,9 +6,46 @@
#include "core/css/CSSFunctionValue.h"
#include "core/css/CSSPrimitiveValue.h"
+#include "core/css/cssom/CSSAngleValue.h"
namespace blink {
+CSSSkew* CSSSkew::fromCSSValue(const CSSFunctionValue& value) {
+ const CSSPrimitiveValue& xValue = toCSSPrimitiveValue(value.item(0));
+ if (xValue.isCalculated()) {
+ // TODO(meade): Decide what we want to do with calc angles.
+ return nullptr;
+ }
+ DCHECK(xValue.isAngle());
+ switch (value.functionType()) {
+ case CSSValueSkew:
+ if (value.length() == 2U) {
+ const CSSPrimitiveValue& yValue = toCSSPrimitiveValue(value.item(1));
+ if (yValue.isCalculated()) {
+ // TODO(meade): Decide what we want to do with calc angles.
+ return nullptr;
+ }
+ DCHECK(yValue.isAngle());
+ return CSSSkew::create(CSSAngleValue::fromCSSValue(xValue),
+ CSSAngleValue::fromCSSValue(yValue));
+ }
+ // Else fall through; skew(ax) == skewX(ax).
+ case CSSValueSkewX:
+ DCHECK_EQ(value.length(), 1U);
+ return CSSSkew::create(
+ CSSAngleValue::fromCSSValue(xValue),
+ CSSAngleValue::create(0, CSSPrimitiveValue::UnitType::Degrees));
+ case CSSValueSkewY:
+ DCHECK_EQ(value.length(), 1U);
+ return CSSSkew::create(
+ CSSAngleValue::create(0, CSSPrimitiveValue::UnitType::Degrees),
+ CSSAngleValue::fromCSSValue(xValue));
+ default:
+ NOTREACHED();
+ return nullptr;
+ }
+}
+
CSSFunctionValue* CSSSkew::toCSSValue() const {
CSSFunctionValue* result = CSSFunctionValue::create(CSSValueSkew);
result->append(*CSSPrimitiveValue::create(m_ax->value(), m_ax->unit()));
« no previous file with comments | « third_party/WebKit/Source/core/css/cssom/CSSSkew.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698