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

Unified Diff: third_party/WebKit/Source/core/dom/DOMMatrix.cpp

Issue 2374773002: [GeometryInterface] Add DOMMatrix(numberSequence) constructor. (Closed)
Patch Set: Created 4 years, 3 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/dom/DOMMatrix.cpp
diff --git a/third_party/WebKit/Source/core/dom/DOMMatrix.cpp b/third_party/WebKit/Source/core/dom/DOMMatrix.cpp
index eb1c68e50141bf610385bcbb9685fdaf660e8cb8..73b06db27656b1b7df481c31cff78eef31af37ca 100644
--- a/third_party/WebKit/Source/core/dom/DOMMatrix.cpp
+++ b/third_party/WebKit/Source/core/dom/DOMMatrix.cpp
@@ -6,22 +6,31 @@
namespace blink {
-DOMMatrix* DOMMatrix::create()
+DOMMatrix* DOMMatrix::create(ExceptionState& exceptionState)
{
return new DOMMatrix(TransformationMatrix());
}
-DOMMatrix* DOMMatrix::create(DOMMatrixReadOnly* other)
+DOMMatrix* DOMMatrix::create(DOMMatrixReadOnly* other, ExceptionState& exceptionState)
{
return new DOMMatrix(other->matrix(), other->is2D());
}
-DOMMatrix* DOMMatrix::create(const SkMatrix44& matrix)
+DOMMatrix* DOMMatrix::create(const SkMatrix44& matrix, ExceptionState& exceptionState)
{
TransformationMatrix transformationMatrix(matrix);
return new DOMMatrix(transformationMatrix, transformationMatrix.isAffine());
}
+DOMMatrix* DOMMatrix::create(Vector<double> sequence, ExceptionState& exceptionState)
+{
+ if (sequence.size() != 6 && sequence.size() != 16) {
+ exceptionState.throwTypeError("The sequence must contain 6 elements for a 2D matrix or 16 elements for a 3D matrix.");
+ return nullptr;
+ }
+ return new DOMMatrix(sequence, sequence.size());
+}
+
DOMMatrix* DOMMatrix::fromFloat32Array(DOMFloat32Array* float32Array, ExceptionState& exceptionState)
{
if (float32Array->length() != 6 && float32Array->length() != 16) {

Powered by Google App Engine
This is Rietveld 408576698