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

Side by Side Diff: third_party/WebKit/Source/core/geometry/DOMMatrix.cpp

Issue 2874203003: Implement serialization/deserialization of geometry interfaces (Closed)
Patch Set: x 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 unified diff | Download patch
OLDNEW
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/geometry/DOMMatrix.h" 5 #include "core/geometry/DOMMatrix.h"
6 6
7 namespace blink { 7 namespace blink {
8 8
9 DOMMatrix* DOMMatrix::Create(ExceptionState& exception_state) { 9 DOMMatrix* DOMMatrix::Create(ExceptionState& exception_state) {
10 return new DOMMatrix(TransformationMatrix()); 10 return new DOMMatrix(TransformationMatrix());
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 76
77 DOMMatrix::DOMMatrix(const TransformationMatrix& matrix, bool is2d) 77 DOMMatrix::DOMMatrix(const TransformationMatrix& matrix, bool is2d)
78 : DOMMatrixReadOnly(matrix, is2d) {} 78 : DOMMatrixReadOnly(matrix, is2d) {}
79 79
80 DOMMatrix* DOMMatrix::fromMatrix(DOMMatrixInit& other, 80 DOMMatrix* DOMMatrix::fromMatrix(DOMMatrixInit& other,
81 ExceptionState& exception_state) { 81 ExceptionState& exception_state) {
82 if (!ValidateAndFixup(other, exception_state)) { 82 if (!ValidateAndFixup(other, exception_state)) {
83 DCHECK(exception_state.HadException()); 83 DCHECK(exception_state.HadException());
84 return nullptr; 84 return nullptr;
85 } 85 }
86 return fromMatrixForSerialization(other);
87 }
88
89 DOMMatrix* DOMMatrix::fromMatrixForSerialization(DOMMatrixInit& other) {
86 if (other.is2D()) { 90 if (other.is2D()) {
87 return new DOMMatrix({other.m11(), other.m12(), other.m21(), other.m22(), 91 return new DOMMatrix(
88 other.m41(), other.m42()}, 92 {other.a(), other.b(), other.c(), other.d(), other.e(), other.f()},
89 other.is2D()); 93 other.is2D());
90 } 94 }
91 95
92 return new DOMMatrix({other.m11(), other.m12(), other.m13(), other.m14(), 96 return new DOMMatrix({other.m11(), other.m12(), other.m13(), other.m14(),
93 other.m21(), other.m22(), other.m23(), other.m24(), 97 other.m21(), other.m22(), other.m23(), other.m24(),
94 other.m31(), other.m32(), other.m33(), other.m34(), 98 other.m31(), other.m32(), other.m33(), other.m34(),
95 other.m41(), other.m42(), other.m43(), other.m44()}, 99 other.m41(), other.m42(), other.m43(), other.m44()},
96 other.is2D()); 100 other.is2D());
97 } 101 }
98 102
99 void DOMMatrix::SetIs2D(bool value) { 103 void DOMMatrix::SetIs2D(bool value) {
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 return this; 271 return this;
268 } 272 }
269 273
270 DOMMatrix* DOMMatrix::setMatrixValue(const String& input_string, 274 DOMMatrix* DOMMatrix::setMatrixValue(const String& input_string,
271 ExceptionState& exception_state) { 275 ExceptionState& exception_state) {
272 SetMatrixValueFromString(input_string, exception_state); 276 SetMatrixValueFromString(input_string, exception_state);
273 return this; 277 return this;
274 } 278 }
275 279
276 } // namespace blink 280 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698