Index: third_party/WebKit/Source/core/dom/DOMMatrixReadOnly.cpp |
diff --git a/third_party/WebKit/Source/core/dom/DOMMatrixReadOnly.cpp b/third_party/WebKit/Source/core/dom/DOMMatrixReadOnly.cpp |
index 252d8e9d058b7cf1a4903d23745e798eada44724..82b6298d50fa4119469185be3b3be533b3784fd3 100644 |
--- a/third_party/WebKit/Source/core/dom/DOMMatrixReadOnly.cpp |
+++ b/third_party/WebKit/Source/core/dom/DOMMatrixReadOnly.cpp |
@@ -9,29 +9,29 @@ namespace blink { |
DOMMatrixReadOnly* DOMMatrixReadOnly::create(Vector<double> sequence, ExceptionState& exceptionState) |
{ |
if (sequence.size() != 6 && sequence.size() != 16) { |
- exceptionState.throwTypeError("An invalid number sequence is specified. The sequence must contain 6 elements for 2D matrix and 16 elements for 3D matrix."); |
+ exceptionState.throwTypeError("The sequence must contain 6 elements for a 2D matrix or 16 elements for a 3D matrix."); |
return nullptr; |
} |
- return new DOMMatrixReadOnly(sequence); |
-} |
- |
-DOMMatrixReadOnly::DOMMatrixReadOnly(Vector<double> sequence) |
-{ |
- if (sequence.size() == 6) { |
- m_matrix = TransformationMatrix::create( |
- sequence[0], sequence[1], sequence[2], sequence[3], |
- sequence[4], sequence[5]); |
- m_is2D = true; |
- } else if (sequence.size() == 16) { |
- m_matrix = TransformationMatrix::create( |
- sequence[0], sequence[1], sequence[2], sequence[3], |
- sequence[4], sequence[5], sequence[6], sequence[7], |
- sequence[8], sequence[9], sequence[10], sequence[11], |
- sequence[12], sequence[13], sequence[14], sequence[15]); |
- m_is2D = false; |
- } else { |
- NOTREACHED(); |
+ return new DOMMatrixReadOnly(sequence, sequence.size()); |
+} |
+ |
+DOMMatrixReadOnly* DOMMatrixReadOnly::fromFloat32Array(DOMFloat32Array* float32Array, ExceptionState& exceptionState) |
+{ |
+ if (float32Array->length() != 6 && float32Array->length() != 16) { |
+ exceptionState.throwTypeError("The sequence must contain 6 elements for a 2D matrix or 16 elements a for 3D matrix."); |
+ return nullptr; |
+ } |
+ return new DOMMatrixReadOnly(float32Array->data(), float32Array->length()); |
+} |
+ |
+ |
+DOMMatrixReadOnly* DOMMatrixReadOnly::fromFloat64Array(DOMFloat64Array* float64Array, ExceptionState& exceptionState) |
+{ |
+ if (float64Array->length() != 6 && float64Array->length() != 16) { |
+ exceptionState.throwTypeError("The sequence must contain 6 elements for a 2D matrix or 16 elements for a 3D matrix."); |
+ return nullptr; |
} |
+ return new DOMMatrixReadOnly(float64Array->data(), float64Array->length()); |
} |
DOMMatrixReadOnly::~DOMMatrixReadOnly() |