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

Unified Diff: Source/core/html/canvas/CanvasContextCreationAttributes.idl

Issue 795833004: Use dictionaries for context creation attributes. Eliminate custom bindings. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years 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: Source/core/html/canvas/CanvasContextCreationAttributes.idl
diff --git a/Source/core/html/canvas/CanvasContextCreationAttributes.idl b/Source/core/html/canvas/CanvasContextCreationAttributes.idl
new file mode 100644
index 0000000000000000000000000000000000000000..b24c4e645b30491fc818b7957a5efd5828c2a529
--- /dev/null
+++ b/Source/core/html/canvas/CanvasContextCreationAttributes.idl
@@ -0,0 +1,33 @@
+// Copyright 2014 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.
+
+// The spec for HTMLCanvasElement.getContext() defines the context
+// creation attributes as type "any". In order to eliminate custom
+// bindings for getContext(), we define a dictionary that contains the
+// union of all of the context types' attributes. Note that it is not
+// possible to use a union type for this purpose because two dictionary
+// types are not distinguishable.
+//
+// Fortunately, there aren't any context creation attributes which are
+// defined with different default values in different context
+// specifications. (The "alpha" value, in particular, has a default
+// value of true for both the Canvas2D and WebGL specifications.)
+//
+// N.B.: Web IDL doesn't support multiple inheritance of dictionaries.
+
+dictionary CanvasContextCreationAttributes {
+ // Canvas 2D attributes
+ boolean alpha = true; // Also used for WebGL.
+ // Note: the bindings generator ignores the RuntimeEnabled
+ // extended attribute for dictionary members.
+ [RuntimeEnabled=ExperimentalCanvasFeatures] DOMString storage;
+
+ // WebGL attributes
+ boolean depth = true;
+ boolean stencil = false;
+ boolean antialias = true;
+ boolean premultipliedAlpha = true;
+ boolean preserveDrawingBuffer = false;
+ boolean failIfMajorPerformanceCaveat = false;
+};

Powered by Google App Engine
This is Rietveld 408576698