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

Unified Diff: LayoutTests/fast/canvas/webgl/draw-webgl-to-canvas-2d-after-to-data-url-without-context.html

Issue 750273003: canvas: calling toDataURL without context doesn't create a buffer of canvas 2d. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: fix typo Created 6 years, 1 month 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: LayoutTests/fast/canvas/webgl/draw-webgl-to-canvas-2d-after-to-data-url-without-context.html
diff --git a/LayoutTests/fast/canvas/webgl/draw-webgl-to-canvas-2d-after-to-data-url-without-context.html b/LayoutTests/fast/canvas/webgl/draw-webgl-to-canvas-2d-after-to-data-url-without-context.html
new file mode 100644
index 0000000000000000000000000000000000000000..359649a401a5471c5632533263d575958d561085
--- /dev/null
+++ b/LayoutTests/fast/canvas/webgl/draw-webgl-to-canvas-2d-after-to-data-url-without-context.html
@@ -0,0 +1,39 @@
+<!DOCTYPE html>
+<html>
+<body>
+<span id="description" style="color: white">
+Everything is same to draw-webgl-to-canvas-2d.html except for calling
+redundant toDataURL().
+Canvas spec allows to call toDataURL() without a context. Some bad things
+can happen if we call toDataURL() without a context and then create a context
+and then call toDataURL() again.
+</span>
+<canvas id="preserve-canvas3d" width="100" height="100"></canvas>
+<canvas id="preserve-canvas2d" width="100" height="100"></canvas>
+<canvas id="nonpreserve-canvas3d" width="100" height="100"></canvas>
+<canvas id="nonpreserve-canvas2d" width="100" height="100"></canvas>
+<script src="../../../resources/js-test.js"></script>
+<script src="resources/draw-webgl-to-canvas-2d.js"></script>
+<script>
+function createContexts() {
+ var preserve_canvas2d = document.getElementById("preserve-canvas2d");
+ preserve_canvas2d.toDataURL();
+ preserve_ctx2D = preserve_canvas2d.getContext("2d");
+ preserve_canvas2d.toDataURL();
+ preserve_canvas3D = document.getElementById('preserve-canvas3d');
+ preserve_canvas3D.toDataURL();
+ preserve_gl = preserve_canvas3D.getContext('webgl', {'preserveDrawingBuffer': true});
+ preserve_canvas3D.toDataURL();
+
+ var nonpreserve_canvas2d = document.getElementById("nonpreserve-canvas2d");
+ nonpreserve_canvas2d.toDataURL();
+ nonpreserve_ctx2D = nonpreserve_canvas2d.getContext("2d");
+ nonpreserve_canvas2d.toDataURL();
+ nonpreserve_canvas3D = document.getElementById('nonpreserve-canvas3d');
+ nonpreserve_canvas3D.toDataURL();
+ nonpreserve_gl = nonpreserve_canvas3D.getContext('webgl', {'preserveDrawingBuffer': false});
+ nonpreserve_canvas3D.toDataURL();
+}
+</script>
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698