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

Side by Side Diff: third_party/WebKit/Source/core/html/canvas/CanvasContextCreationAttributes.idl

Issue 2708403003: Implement canvas color space IDL format for 2D canvas (Closed)
Patch Set: Fixing layout test failures Created 3 years, 10 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // The spec for HTMLCanvasElement.getContext() defines the context 5 // The spec for HTMLCanvasElement.getContext() defines the context
6 // creation attributes as type "any". In order to eliminate custom 6 // creation attributes as type "any". In order to eliminate custom
7 // bindings for getContext(), we define a dictionary that contains the 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 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 9 // possible to use a union type for this purpose because two dictionary
10 // types are not distinguishable. 10 // types are not distinguishable.
11 // 11 //
12 // Fortunately, there aren't any context creation attributes which are 12 // Fortunately, there aren't any context creation attributes which are
13 // defined with different default values in different context 13 // defined with different default values in different context
14 // specifications. (The "alpha" value, in particular, has a default 14 // specifications. (The "alpha" value, in particular, has a default
15 // value of true for both the Canvas2D and WebGL specifications.) 15 // value of true for both the Canvas2D and WebGL specifications.)
16 // 16 //
17 // The PermissiveDictionaryConversion extended attribute ignores 17 // The PermissiveDictionaryConversion extended attribute ignores
18 // non-object types (like 'true' and 'false') passed to getContext() for 18 // non-object types (like 'true' and 'false') passed to getContext() for
19 // the attributes instead of raising TypeError, following the behavior 19 // the attributes instead of raising TypeError, following the behavior
20 // of the previous custom binding. 20 // of the previous custom binding.
21 // 21 //
22 // N.B.: Web IDL doesn't support multiple inheritance of dictionaries. 22 // N.B.: Web IDL doesn't support multiple inheritance of dictionaries.
23 23
24 enum CanvasColorSpace {
25 "legacy-srgb", // default
Justin Novosad 2017/02/23 18:48:13 The revised proposal removes legacy srgb. Basical
zakerinasab 2017/02/23 20:22:33 Done.
26 "srgb",
27 "rec2020",
28 "p3",
29 };
24 30
25 enum CanvasColorSpace { "legacy-srgb", "srgb", "linear-rgb", "rec-2020", "p3"}; 31 enum CanvasPixelFormat {
32 "8-8-8-8", // default
33 "10-10-10-2",
34 "12-12-12-12",
35 "float16",
36 };
26 37
27 [PermissiveDictionaryConversion] 38 [PermissiveDictionaryConversion]
28 dictionary CanvasContextCreationAttributes { 39 dictionary CanvasContextCreationAttributes {
29 // Canvas 2D attributes 40 // Canvas 2D attributes
30 boolean alpha = true; // Also used for WebGL. 41 boolean alpha = true; // Also used for WebGL.
42 // TODO(crbug.com/637288): Do we keep "legacy-srgb" as the default?
43 // Must decide before shipping.
31 [RuntimeEnabled=ExperimentalCanvasFeatures] CanvasColorSpace colorSpace = "l egacy-srgb"; 44 [RuntimeEnabled=ExperimentalCanvasFeatures] CanvasColorSpace colorSpace = "l egacy-srgb";
45 [RuntimeEnabled=ExperimentalCanvasFeatures] CanvasPixelFormat pixelFormat = "8-8-8-8";
46 [RuntimeEnabled=ExperimentalCanvasFeatures] boolean linearPixelMath = false;
32 47
33 // WebGL attributes 48 // WebGL attributes
34 boolean depth = true; 49 boolean depth = true;
35 boolean stencil = false; 50 boolean stencil = false;
36 boolean antialias = true; 51 boolean antialias = true;
37 boolean premultipliedAlpha = true; 52 boolean premultipliedAlpha = true;
38 boolean preserveDrawingBuffer = false; 53 boolean preserveDrawingBuffer = false;
39 boolean failIfMajorPerformanceCaveat = false; 54 boolean failIfMajorPerformanceCaveat = false;
40 }; 55 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698