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

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

Issue 2907973002: [css-typed-om] add toMatrix() method in CSSTransformValue.idl (Closed)
Patch Set: add toMatrix() Created 3 years, 7 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/CSSTransformValue.cpp
diff --git a/third_party/WebKit/Source/core/css/cssom/CSSTransformValue.cpp b/third_party/WebKit/Source/core/css/cssom/CSSTransformValue.cpp
index 989d2e8ae240f11ff8373588729f2396b16a0e1d..dfecf4e390e7f04417793fc9a90599e90a016ef2 100644
--- a/third_party/WebKit/Source/core/css/cssom/CSSTransformValue.cpp
+++ b/third_party/WebKit/Source/core/css/cssom/CSSTransformValue.cpp
@@ -5,7 +5,9 @@
#include "core/css/cssom/CSSTransformValue.h"
#include "core/css/CSSValueList.h"
+#include "core/css/cssom/CSSMatrixComponent.h"
#include "core/css/cssom/CSSTransformComponent.h"
+#include "core/geometry/DOMMatrix.h"
namespace blink {
@@ -34,6 +36,18 @@ bool CSSTransformValue::is2D() const {
return true;
}
+DOMMatrix* CSSTransformValue::toMatrix() const {
+ DOMMatrixInit init;
+ DOMMatrix* matrix = DOMMatrix::fromMatrix(init, ASSERT_NO_EXCEPTION);
zino 2017/06/02 02:31:21 IMHO, we don't need to copy the matrix from DOMMat
Hwanseung Lee 2017/06/02 13:25:51 Done.
+ for (size_t i = 0; i < transform_components_.size(); i++) {
+ CSSMatrixComponent* matrixComponent = transform_components_[i]->asMatrix();
+ if (matrixComponent) {
+ matrix->multiplySelf(matrixComponent->matrix());
+ }
+ }
+ return matrix;
+}
+
const CSSValue* CSSTransformValue::ToCSSValue() const {
CSSValueList* transform_css_value = CSSValueList::CreateSpaceSeparated();
for (size_t i = 0; i < transform_components_.size(); i++) {

Powered by Google App Engine
This is Rietveld 408576698