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

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

Issue 1603813002: CSS Typed OM: Add TranslationTransformComponent (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@cssValueAndCssString
Patch Set: Remove unnecessary class declaraion 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
Index: third_party/WebKit/Source/core/css/cssom/TranslationTransformComponent.h
diff --git a/third_party/WebKit/Source/core/css/cssom/TranslationTransformComponent.h b/third_party/WebKit/Source/core/css/cssom/TranslationTransformComponent.h
new file mode 100644
index 0000000000000000000000000000000000000000..3531def2f322b2e875e7fede707d93248f5890f7
--- /dev/null
+++ b/third_party/WebKit/Source/core/css/cssom/TranslationTransformComponent.h
@@ -0,0 +1,61 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef TranslationTransformComponent_h
+#define TranslationTransformComponent_h
+
+#include "core/css/cssom/LengthValue.h"
+#include "core/css/cssom/TransformComponent.h"
+
+namespace blink {
+
+class ExceptionState;
+
+class CORE_EXPORT TranslationTransformComponent final : public TransformComponent {
+ WTF_MAKE_NONCOPYABLE(TranslationTransformComponent);
+ DEFINE_WRAPPERTYPEINFO();
+public:
+ static TranslationTransformComponent* create(LengthValue* x, LengthValue* y, ExceptionState&)
+ {
+ return new TranslationTransformComponent(x, y, nullptr);
+ }
+ static TranslationTransformComponent* create(LengthValue* x, LengthValue* y, LengthValue* z, ExceptionState&);
+
+ LengthValue* x() const { return m_x; }
+ LengthValue* y() const { return m_y; }
+ LengthValue* z() const { return m_z; }
+
+ TransformComponentType type() const override { return is2D() ? TranslationType : Translation3DType; }
+
+ // TODO: Implement asMatrix for TranslationTransformComponent.
+ MatrixTransformComponent* asMatrix() const override { return nullptr; }
+
+ PassRefPtrWillBeRawPtr<CSSFunctionValue> toCSSValue() const override;
+
+ DEFINE_INLINE_VIRTUAL_TRACE()
+ {
+ visitor->trace(m_x);
+ visitor->trace(m_y);
+ visitor->trace(m_z);
+ TransformComponent::trace(visitor);
+ }
+
+private:
+ TranslationTransformComponent(LengthValue* x, LengthValue* y, LengthValue* z)
+ : TransformComponent()
+ , m_x(x)
+ , m_y(y)
+ , m_z(z)
+ { }
+
+ bool is2D() const { return !m_z; }
+
+ Member<LengthValue> m_x;
+ Member<LengthValue> m_y;
+ Member<LengthValue> m_z;
+};
+
+} // namespace blink
+
+#endif

Powered by Google App Engine
This is Rietveld 408576698