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

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

Issue 1689573002: CSS Typed OM: asMatrix for TransformComponent with LengthValue types (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@asMatrixMethod
Patch Set: Add in Translation and use exceptionState.hadException Created 4 years, 10 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/TranslationTransformComponent.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/TranslationTransformComponent.cpp
diff --git a/third_party/WebKit/Source/core/css/cssom/TranslationTransformComponent.cpp b/third_party/WebKit/Source/core/css/cssom/TranslationTransformComponent.cpp
index 166be8966244a7c5040a7af0ea901e8f3acd400e..aa6a4b23c93a4eb1606f45d2ac2ce68103510ad5 100644
--- a/third_party/WebKit/Source/core/css/cssom/TranslationTransformComponent.cpp
+++ b/third_party/WebKit/Source/core/css/cssom/TranslationTransformComponent.cpp
@@ -7,6 +7,7 @@
#include "bindings/core/v8/ExceptionState.h"
#include "core/css/CSSPrimitiveValue.h"
#include "core/css/CSSValuePool.h"
+#include "core/css/cssom/MatrixTransformComponent.h"
namespace blink {
@@ -19,6 +20,20 @@ TranslationTransformComponent* TranslationTransformComponent::create(LengthValue
return new TranslationTransformComponent(x, y, z);
}
+MatrixTransformComponent* TranslationTransformComponent::asMatrix(ExceptionState& exceptionState) const
+{
+ double x = m_x->computeLengthPx(exceptionState);
+ double y = m_y->computeLengthPx(exceptionState);
+ double z = is2D() ? 0 : m_z->computeLengthPx(exceptionState);
+ if (exceptionState.hadException())
+ return nullptr;
+
+ if (is2D())
+ return MatrixTransformComponent::translate(x, y);
+ return MatrixTransformComponent::translate3d(x, y, z);
+}
+
+
PassRefPtrWillBeRawPtr<CSSFunctionValue> TranslationTransformComponent::toCSSValue() const
{
RefPtrWillBeRawPtr<CSSFunctionValue> result = CSSFunctionValue::create(is2D() ? CSSValueTranslate : CSSValueTranslate3d);
« no previous file with comments | « third_party/WebKit/Source/core/css/cssom/TranslationTransformComponent.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698