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

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

Issue 2874203003: Implement serialization/deserialization of geometry interfaces (Closed)
Patch Set: x Created 3 years, 6 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
« no previous file with comments | « third_party/WebKit/Source/core/geometry/DOMMatrixReadOnly.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/DOMMatrixReadOnly.h" 5 #include "core/geometry/DOMMatrixReadOnly.h"
6 6
7 #include "bindings/core/v8/V8ObjectBuilder.h" 7 #include "bindings/core/v8/V8ObjectBuilder.h"
8 #include "core/css/CSSIdentifierValue.h" 8 #include "core/css/CSSIdentifierValue.h"
9 #include "core/css/CSSToLengthConversionData.h" 9 #include "core/css/CSSToLengthConversionData.h"
10 #include "core/css/CSSValueList.h" 10 #include "core/css/CSSValueList.h"
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 "for a 3D matrix."); 122 "for a 3D matrix.");
123 return nullptr; 123 return nullptr;
124 } 124 }
125 return new DOMMatrixReadOnly(sequence, sequence.size()); 125 return new DOMMatrixReadOnly(sequence, sequence.size());
126 } 126 }
127 127
128 NOTREACHED(); 128 NOTREACHED();
129 return nullptr; 129 return nullptr;
130 } 130 }
131 131
132 DOMMatrixReadOnly* DOMMatrixReadOnly::CreateForSerialization(double sequence[],
133 int size) {
134 return new DOMMatrixReadOnly(sequence, size);
135 }
136
132 DOMMatrixReadOnly* DOMMatrixReadOnly::fromFloat32Array( 137 DOMMatrixReadOnly* DOMMatrixReadOnly::fromFloat32Array(
133 NotShared<DOMFloat32Array> float32_array, 138 NotShared<DOMFloat32Array> float32_array,
134 ExceptionState& exception_state) { 139 ExceptionState& exception_state) {
135 if (float32_array.View()->length() != 6 && 140 if (float32_array.View()->length() != 6 &&
136 float32_array.View()->length() != 16) { 141 float32_array.View()->length() != 16) {
137 exception_state.ThrowTypeError( 142 exception_state.ThrowTypeError(
138 "The sequence must contain 6 elements for a 2D matrix or 16 elements a " 143 "The sequence must contain 6 elements for a 2D matrix or 16 elements a "
139 "for 3D matrix."); 144 "for 3D matrix.");
140 return nullptr; 145 return nullptr;
141 } 146 }
(...skipping 15 matching lines...) Expand all
157 float64_array.View()->length()); 162 float64_array.View()->length());
158 } 163 }
159 164
160 DOMMatrixReadOnly* DOMMatrixReadOnly::fromMatrix( 165 DOMMatrixReadOnly* DOMMatrixReadOnly::fromMatrix(
161 DOMMatrixInit& other, 166 DOMMatrixInit& other,
162 ExceptionState& exception_state) { 167 ExceptionState& exception_state) {
163 if (!ValidateAndFixup(other, exception_state)) { 168 if (!ValidateAndFixup(other, exception_state)) {
164 DCHECK(exception_state.HadException()); 169 DCHECK(exception_state.HadException());
165 return nullptr; 170 return nullptr;
166 } 171 }
167
168 if (other.is2D()) { 172 if (other.is2D()) {
169 double args[] = {other.m11(), other.m12(), other.m21(), 173 double args[] = {other.m11(), other.m12(), other.m21(),
170 other.m22(), other.m41(), other.m42()}; 174 other.m22(), other.m41(), other.m42()};
171 return new DOMMatrixReadOnly(args, 6); 175 return new DOMMatrixReadOnly(args, 6);
172 } 176 }
173 177
174 double args[] = {other.m11(), other.m12(), other.m13(), other.m14(), 178 double args[] = {other.m11(), other.m12(), other.m13(), other.m14(),
175 other.m21(), other.m22(), other.m23(), other.m24(), 179 other.m21(), other.m22(), other.m23(), other.m24(),
176 other.m31(), other.m32(), other.m33(), other.m34(), 180 other.m31(), other.m32(), other.m33(), other.m34(),
177 other.m41(), other.m42(), other.m43(), other.m44()}; 181 other.m41(), other.m42(), other.m43(), other.m44()};
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 412
409 matrix_->MakeIdentity(); 413 matrix_->MakeIdentity();
410 operations.Apply(FloatSize(0, 0), *matrix_); 414 operations.Apply(FloatSize(0, 0), *matrix_);
411 415
412 is2d_ = !operations.Has3DOperation(); 416 is2d_ = !operations.Has3DOperation();
413 417
414 return; 418 return;
415 } 419 }
416 420
417 } // namespace blink 421 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/geometry/DOMMatrixReadOnly.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698