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

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: make Create() function in DOMMatrix 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 8fa84ef432d644124b31e16b87e0d27662ff7456..4c9c44a90a8533cb60f83261292649f642a5e0bc 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,17 @@ bool CSSTransformValue::is2D() const {
return true;
}
+DOMMatrix* CSSTransformValue::toMatrix() const {
+ DOMMatrix* matrix = DOMMatrix::Create();
+ 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