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

Unified Diff: third_party/WebKit/Source/modules/canvas/HTMLCanvasElementModule.cpp

Issue 1836283002: Implement HTMLCanvasElement's transferControlToOffscreen (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update interface layout tests result Created 4 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
Index: third_party/WebKit/Source/modules/canvas/HTMLCanvasElementModule.cpp
diff --git a/third_party/WebKit/Source/modules/canvas/HTMLCanvasElementModule.cpp b/third_party/WebKit/Source/modules/canvas/HTMLCanvasElementModule.cpp
index 09f992f2cf01f9b7b3e18e551a876c3e9d171f26..7988132932fe846834bb47e377a9b4324e3b9a8f 100644
--- a/third_party/WebKit/Source/modules/canvas/HTMLCanvasElementModule.cpp
+++ b/third_party/WebKit/Source/modules/canvas/HTMLCanvasElementModule.cpp
@@ -17,4 +17,15 @@ void HTMLCanvasElementModule::getContext(HTMLCanvasElement& canvas, const String
}
}
+OffscreenCanvas* HTMLCanvasElementModule::transferControlToOffscreen(HTMLCanvasElement& canvas, ExceptionState& exceptionState)
+{
+ if (canvas.renderingContext()) {
+ exceptionState.throwDOMException(InvalidStateError, "Cannot transfer control from a canvas that has a rendering context.");
+ return nullptr;
+ }
+ OffscreenCanvas* offscreenCanvas = OffscreenCanvas::create(canvas.width(), canvas.height());
+ offscreenCanvas->setAssociatedCanvas(&canvas);
+ return offscreenCanvas;
+}
+
}

Powered by Google App Engine
This is Rietveld 408576698