OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "core/dom/DOMMatrix.h" | 5 #include "core/dom/DOMMatrix.h" |
6 | 6 |
7 #include "core/css/CSSIdentifierValue.h" | 7 #include "core/css/CSSIdentifierValue.h" |
8 #include "core/css/CSSToLengthConversionData.h" | 8 #include "core/css/CSSToLengthConversionData.h" |
9 #include "core/css/CSSValueList.h" | 9 #include "core/css/CSSValueList.h" |
10 #include "core/css/parser/CSSParser.h" | 10 #include "core/css/parser/CSSParser.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 "for a 3D matrix."); | 59 "for a 3D matrix."); |
60 return nullptr; | 60 return nullptr; |
61 } | 61 } |
62 return new DOMMatrix(float64Array->data(), float64Array->length()); | 62 return new DOMMatrix(float64Array->data(), float64Array->length()); |
63 } | 63 } |
64 | 64 |
65 template <typename T> | 65 template <typename T> |
66 DOMMatrix::DOMMatrix(T sequence, int size) | 66 DOMMatrix::DOMMatrix(T sequence, int size) |
67 : DOMMatrixReadOnly(sequence, size) {} | 67 : DOMMatrixReadOnly(sequence, size) {} |
68 | 68 |
69 DOMMatrix::DOMMatrix(const TransformationMatrix& matrix, bool is2D) { | 69 DOMMatrix::DOMMatrix(const TransformationMatrix& matrix, bool is2D) |
70 m_matrix = TransformationMatrix::create(matrix); | 70 : DOMMatrixReadOnly(matrix, is2D) {} |
71 m_is2D = is2D; | |
72 } | |
73 | 71 |
74 DOMMatrix* DOMMatrix::fromMatrix(DOMMatrixInit& other, | 72 DOMMatrix* DOMMatrix::fromMatrix(DOMMatrixInit& other, |
75 ExceptionState& exceptionState) { | 73 ExceptionState& exceptionState) { |
76 validateAndFixup(other, exceptionState); | 74 validateAndFixup(other, exceptionState); |
77 if (exceptionState.hadException()) | 75 if (exceptionState.hadException()) |
78 return nullptr; | 76 return nullptr; |
79 | 77 |
80 if (other.is2D()) { | 78 if (other.is2D()) { |
81 return new DOMMatrix({other.m11(), other.m12(), other.m21(), other.m22(), | 79 return new DOMMatrix({other.m11(), other.m12(), other.m21(), other.m22(), |
82 other.m41(), other.m42()}, | 80 other.m41(), other.m42()}, |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 | 294 |
297 m_matrix->makeIdentity(); | 295 m_matrix->makeIdentity(); |
298 operations.apply(FloatSize(0, 0), *m_matrix); | 296 operations.apply(FloatSize(0, 0), *m_matrix); |
299 | 297 |
300 m_is2D = !operations.has3DOperation(); | 298 m_is2D = !operations.has3DOperation(); |
301 | 299 |
302 return this; | 300 return this; |
303 } | 301 } |
304 | 302 |
305 } // namespace blink | 303 } // namespace blink |
OLD | NEW |