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

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

Issue 2707243006: [SharedArrayBuffer] Prevent SharedArrayBuffer being used in Web APIs (Closed)
Patch Set: remove unused checks Created 3 years, 8 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/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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 if (sequence.size() != 6 && sequence.size() != 16) { 108 if (sequence.size() != 6 && sequence.size() != 16) {
109 exceptionState.throwTypeError( 109 exceptionState.throwTypeError(
110 "The sequence must contain 6 elements for a 2D matrix or 16 elements " 110 "The sequence must contain 6 elements for a 2D matrix or 16 elements "
111 "for a 3D matrix."); 111 "for a 3D matrix.");
112 return nullptr; 112 return nullptr;
113 } 113 }
114 return new DOMMatrixReadOnly(sequence, sequence.size()); 114 return new DOMMatrixReadOnly(sequence, sequence.size());
115 } 115 }
116 116
117 DOMMatrixReadOnly* DOMMatrixReadOnly::fromFloat32Array( 117 DOMMatrixReadOnly* DOMMatrixReadOnly::fromFloat32Array(
118 DOMFloat32Array* float32Array, 118 const NotShared<DOMFloat32Array>& float32Array,
119 ExceptionState& exceptionState) { 119 ExceptionState& exceptionState) {
120 if (float32Array->length() != 6 && float32Array->length() != 16) { 120 if (float32Array.view()->length() != 6 &&
121 float32Array.view()->length() != 16) {
121 exceptionState.throwTypeError( 122 exceptionState.throwTypeError(
122 "The sequence must contain 6 elements for a 2D matrix or 16 elements a " 123 "The sequence must contain 6 elements for a 2D matrix or 16 elements a "
123 "for 3D matrix."); 124 "for 3D matrix.");
124 return nullptr; 125 return nullptr;
125 } 126 }
126 return new DOMMatrixReadOnly(float32Array->data(), float32Array->length()); 127 return new DOMMatrixReadOnly(float32Array.view()->data(),
128 float32Array.view()->length());
127 } 129 }
128 130
129 DOMMatrixReadOnly* DOMMatrixReadOnly::fromFloat64Array( 131 DOMMatrixReadOnly* DOMMatrixReadOnly::fromFloat64Array(
130 DOMFloat64Array* float64Array, 132 const NotShared<DOMFloat64Array>& float64Array,
131 ExceptionState& exceptionState) { 133 ExceptionState& exceptionState) {
132 if (float64Array->length() != 6 && float64Array->length() != 16) { 134 if (float64Array.view()->length() != 6 &&
135 float64Array.view()->length() != 16) {
133 exceptionState.throwTypeError( 136 exceptionState.throwTypeError(
134 "The sequence must contain 6 elements for a 2D matrix or 16 elements " 137 "The sequence must contain 6 elements for a 2D matrix or 16 elements "
135 "for a 3D matrix."); 138 "for a 3D matrix.");
136 return nullptr; 139 return nullptr;
137 } 140 }
138 return new DOMMatrixReadOnly(float64Array->data(), float64Array->length()); 141 return new DOMMatrixReadOnly(float64Array.view()->data(),
142 float64Array.view()->length());
139 } 143 }
140 144
141 DOMMatrixReadOnly* DOMMatrixReadOnly::fromMatrix( 145 DOMMatrixReadOnly* DOMMatrixReadOnly::fromMatrix(
142 DOMMatrixInit& other, 146 DOMMatrixInit& other,
143 ExceptionState& exceptionState) { 147 ExceptionState& exceptionState) {
144 if (!validateAndFixup(other, exceptionState)) { 148 if (!validateAndFixup(other, exceptionState)) {
145 DCHECK(exceptionState.hadException()); 149 DCHECK(exceptionState.hadException());
146 return nullptr; 150 return nullptr;
147 } 151 }
148 152
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 393
390 m_matrix->makeIdentity(); 394 m_matrix->makeIdentity();
391 operations.apply(FloatSize(0, 0), *m_matrix); 395 operations.apply(FloatSize(0, 0), *m_matrix);
392 396
393 m_is2D = !operations.has3DOperation(); 397 m_is2D = !operations.has3DOperation();
394 398
395 return; 399 return;
396 } 400 }
397 401
398 } // namespace blink 402 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698