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

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

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
« 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
new file mode 100644
index 0000000000000000000000000000000000000000..166be8966244a7c5040a7af0ea901e8f3acd400e
--- /dev/null
+++ b/third_party/WebKit/Source/core/css/cssom/TranslationTransformComponent.cpp
@@ -0,0 +1,32 @@
+// 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.
+
+#include "core/css/cssom/TranslationTransformComponent.h"
+
+#include "bindings/core/v8/ExceptionState.h"
+#include "core/css/CSSPrimitiveValue.h"
+#include "core/css/CSSValuePool.h"
+
+namespace blink {
+
+TranslationTransformComponent* TranslationTransformComponent::create(LengthValue* x, LengthValue* y, LengthValue* z, ExceptionState& exceptionState)
+{
+ if (z->containsPercent()) {
+ exceptionState.throwTypeError("TranslationTransformComponent does not support z LengthValue with percent units");
+ return nullptr;
+ }
+ return new TranslationTransformComponent(x, y, z);
+}
+
+PassRefPtrWillBeRawPtr<CSSFunctionValue> TranslationTransformComponent::toCSSValue() const
+{
+ RefPtrWillBeRawPtr<CSSFunctionValue> result = CSSFunctionValue::create(is2D() ? CSSValueTranslate : CSSValueTranslate3d);
+ result->append(m_x->toCSSValue());
+ result->append(m_y->toCSSValue());
+ if (!is2D())
+ result->append(m_z->toCSSValue());
+ return result.release();
+}
+
+} // namespace blink
« 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