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

Unified Diff: third_party/WebKit/Source/core/geometry/DOMMatrixReadOnly.cpp

Issue 2859293002: Use union instead of overload fo DOMMatrix/DOMMatrixReadOnly (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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/geometry/DOMMatrixReadOnly.cpp
diff --git a/third_party/WebKit/Source/core/geometry/DOMMatrixReadOnly.cpp b/third_party/WebKit/Source/core/geometry/DOMMatrixReadOnly.cpp
index fd09781ae4727015e83006bf86f86971163d5b6c..876729c9d273ea17eb17a8eaa8c750d523d9b25e 100644
--- a/third_party/WebKit/Source/core/geometry/DOMMatrixReadOnly.cpp
+++ b/third_party/WebKit/Source/core/geometry/DOMMatrixReadOnly.cpp
@@ -96,22 +96,28 @@ DOMMatrixReadOnly* DOMMatrixReadOnly::Create(ExceptionState& exception_state) {
return new DOMMatrixReadOnly(TransformationMatrix());
}
-DOMMatrixReadOnly* DOMMatrixReadOnly::Create(const String& transform_list,
- ExceptionState& exception_state) {
- DOMMatrixReadOnly* matrix = new DOMMatrixReadOnly(TransformationMatrix());
- matrix->SetMatrixValueFromString(transform_list, exception_state);
- return matrix;
-}
+DOMMatrixReadOnly* DOMMatrixReadOnly::Create(
+ StringOrUnrestrictedDoubleSequence& init,
+ ExceptionState& exception_state) {
+ if (init.isString()) {
+ DOMMatrixReadOnly* matrix = new DOMMatrixReadOnly(TransformationMatrix());
+ matrix->SetMatrixValueFromString(init.getAsString(), exception_state);
+ return matrix;
+ }
-DOMMatrixReadOnly* DOMMatrixReadOnly::Create(Vector<double> sequence,
- ExceptionState& exception_state) {
- if (sequence.size() != 6 && sequence.size() != 16) {
- exception_state.ThrowTypeError(
- "The sequence must contain 6 elements for a 2D matrix or 16 elements "
- "for a 3D matrix.");
- return nullptr;
+ if (init.isUnrestrictedDoubleSequence()) {
+ const Vector<double>& sequence = init.getAsUnrestrictedDoubleSequence();
+ if (sequence.size() != 6 && sequence.size() != 16) {
+ exception_state.ThrowTypeError(
+ "The sequence must contain 6 elements for a 2D matrix or 16 elements "
+ "for a 3D matrix.");
+ return nullptr;
+ }
+ return new DOMMatrixReadOnly(sequence, sequence.size());
}
- return new DOMMatrixReadOnly(sequence, sequence.size());
+
+ NOTREACHED();
+ return nullptr;
}
DOMMatrixReadOnly* DOMMatrixReadOnly::fromFloat32Array(

Powered by Google App Engine
This is Rietveld 408576698