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

Side by Side 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: Rebased. 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // The spec for HTMLCanvasElement.getContext() defines the context
6 // creation attributes as type "any". In order to eliminate custom
7 // bindings for getContext(), we define a dictionary that contains the
8 // union of all of the context types' attributes. Note that it is not
9 // possible to use a union type for this purpose because two dictionary
10 // types are not distinguishable.
11 //
12 // Fortunately, there aren't any context creation attributes which are
13 // defined with different default values in different context
14 // specifications. (The "alpha" value, in particular, has a default
15 // value of true for both the Canvas2D and WebGL specifications.)
16 //
17 // The PermissiveDictionaryConversion extended attribute ignores
18 // non-object types (like 'true' and 'false') passed to getContext() for
19 // the attributes instead of raising TypeError, following the behavior
20 // of the previous custom binding.
21 //
22 // N.B.: Web IDL doesn't support multiple inheritance of dictionaries.
23
24 [PermissiveDictionaryConversion]
25 dictionary CanvasContextCreationAttributes {
26 // Canvas 2D attributes
27 boolean alpha = true; // Also used for WebGL.
28
29 // WebGL attributes
30 boolean depth = true;
31 boolean stencil = false;
32 boolean antialias = true;
33 boolean premultipliedAlpha = true;
34 boolean preserveDrawingBuffer = false;
35 boolean failIfMajorPerformanceCaveat = false;
36 };
OLDNEW
« no previous file with comments | « Source/core/html/canvas/CanvasContextAttributes.cpp ('k') | Source/core/html/canvas/CanvasRenderingContext2D.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698