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

Unified Diff: third_party/WebKit/Source/bindings/core/v8/custom/V8DOMMatrixReadOnlyCustom.cpp

Issue 2747383003: WIP: Brand-check on DOMMatrixReadOnly multiply.
Patch Set: Created 3 years, 9 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
« no previous file with comments | « third_party/WebKit/Source/bindings/bindings.gni ('k') | third_party/WebKit/Source/core/dom/DOMMatrix.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/bindings/core/v8/custom/V8DOMMatrixReadOnlyCustom.cpp
diff --git a/third_party/WebKit/Source/bindings/core/v8/custom/V8DOMMatrixReadOnlyCustom.cpp b/third_party/WebKit/Source/bindings/core/v8/custom/V8DOMMatrixReadOnlyCustom.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..44a0ccd4015c09ccadf838239c9981aeb933d2f9
--- /dev/null
+++ b/third_party/WebKit/Source/bindings/core/v8/custom/V8DOMMatrixReadOnlyCustom.cpp
@@ -0,0 +1,47 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "bindings/core/v8/V8DOMMatrixReadOnly.h"
+
+#include "bindings/core/v8/V8DOMMatrixInit.h"
+#include "core/dom/DOMMatrix.h"
+#include "core/dom/DOMMatrixInit.h"
+
+namespace blink {
+
+void V8DOMMatrixReadOnly::multiplyMethodCustom(
+ const v8::FunctionCallbackInfo<v8::Value>& info) {
+ ExceptionState exceptionState(info.GetIsolate(),
+ ExceptionState::ExecutionContext,
+ "DOMMatrixReadOnly", "multiply");
+
+ DOMMatrixReadOnly* impl = V8DOMMatrixReadOnly::toImpl(info.Holder());
+
+ if (!isUndefinedOrNull(info[0]) && !info[0]->IsObject()) {
+ exceptionState.throwTypeError("parameter 1 ('other') is not an object.");
+
+ return;
+ }
+
+ if (DOMMatrixReadOnly* otherMatrix = V8DOMMatrixReadOnly::toImplWithTypeCheck(
+ info.GetIsolate(), info[0])) {
+ v8SetReturnValue(info,
+ DOMMatrix::create(impl->matrix() * otherMatrix->matrix()));
+ return;
+ }
+
+ DOMMatrixInit other;
+ V8DOMMatrixInit::toImpl(info.GetIsolate(), info[0], other, exceptionState);
+ if (exceptionState.hadException()) {
+ return;
+ }
+
+ DOMMatrix* result = impl->multiply(other, exceptionState);
+ if (exceptionState.hadException()) {
+ return;
+ }
+ v8SetReturnValue(info, result);
+}
+
+} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/bindings/bindings.gni ('k') | third_party/WebKit/Source/core/dom/DOMMatrix.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698