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); |