798b991cd2b0ec62ad2c1134789fb37eb4b4604d
[WebKit-https.git] / Source / JavaScriptCore / inspector / protocol / Canvas.json
1 {
2     "domain": "Canvas",
3     "availability": ["web"],
4     "description": "Canvas domain allows tracking of canvases that have an associated graphics context. Tracks canvases in the DOM and CSS canvases created with -webkit-canvas.",
5     "types": [
6         {
7             "id": "CanvasId",
8             "type": "string",
9             "description": "Unique canvas identifier."
10         },
11         {
12             "id": "ProgramId",
13             "type": "string",
14             "description": "Unique shader program identifier."
15         },
16         {
17             "id": "ContextType",
18             "type": "string",
19             "enum": ["canvas-2d", "bitmaprenderer", "webgl", "webgl2", "webgpu"],
20             "description": "The type of rendering context backing the canvas element."
21         },
22         {
23             "id": "ShaderType",
24             "type": "string",
25             "enum": ["fragment", "vertex"],
26             "description": "Shader type. WebGL supports vertex and fragment shaders."
27         },
28         {
29             "id": "ContextAttributes",
30             "type": "object",
31             "description": "Drawing surface attributes.",
32             "properties": [
33                 { "name": "alpha", "type": "boolean", "optional": true, "description": "WebGL, WebGL2, ImageBitmapRenderingContext" },
34                 { "name": "depth", "type": "boolean", "optional": true, "description": "WebGL, WebGL2" },
35                 { "name": "stencil", "type": "boolean", "optional": true, "description": "WebGL, WebGL2" },
36                 { "name": "antialias", "type": "boolean", "optional": true, "description": "WebGL, WebGL2" },
37                 { "name": "premultipliedAlpha", "type": "boolean", "optional": true, "description": "WebGL, WebGL2" },
38                 { "name": "preserveDrawingBuffer", "type": "boolean", "optional": true, "description": "WebGL, WebGL2" },
39                 { "name": "failIfMajorPerformanceCaveat", "type": "boolean", "optional": true, "description": "WebGL, WebGL2" },
40                 { "name": "powerPreference", "type": "string", "optional": true, "description": "WebGL, WebGL2, WebGPU" }
41             ]
42         },
43         {
44             "id": "Canvas",
45             "type": "object",
46             "description": "Information about a canvas for which a rendering context has been created.",
47             "properties": [
48                 { "name": "canvasId", "$ref": "CanvasId", "description": "Canvas identifier." },
49                 { "name": "contextType", "$ref": "ContextType", "description": "The type of rendering context backing the canvas." },
50                 { "name": "nodeId", "$ref": "DOM.NodeId", "optional": true, "description": "The corresponding DOM node id." },
51                 { "name": "cssCanvasName", "type": "string", "optional": true, "description": "The CSS canvas identifier, for canvases created with <code>document.getCSSCanvasContext</code>." },
52                 { "name": "contextAttributes", "$ref": "ContextAttributes", "optional": true, "description": "Context attributes for rendering contexts." },
53                 { "name": "memoryCost", "type": "number", "optional": true, "description": "Memory usage of the canvas in bytes." },
54                 { "name": "backtrace", "type": "array", "items": { "$ref": "Console.CallFrame" }, "optional": true, "description": "Backtrace that was captured when this canvas context was created." }
55             ]
56         }
57     ],
58     "commands": [
59         {
60             "name": "enable",
61             "description": "Enables Canvas domain events."
62         },
63         {
64             "name": "disable",
65             "description": "Disables Canvas domain events."
66         },
67         {
68             "name": "requestNode",
69             "description": "Gets the NodeId for the canvas node with the given CanvasId.",
70             "parameters": [
71                 { "name": "canvasId", "$ref": "CanvasId", "description": "Canvas identifier." }
72             ],
73             "returns": [
74                 { "name": "nodeId", "$ref": "DOM.NodeId", "description": "Node identifier for given canvas." }
75             ]
76         },
77         {
78             "name": "requestContent",
79             "description": "Gets the data for the canvas node with the given CanvasId.",
80             "parameters": [
81                 { "name": "canvasId", "$ref": "CanvasId", "description": "Canvas identifier." }
82             ],
83             "returns": [
84                 { "name": "content", "type": "string", "description": "Base64-encoded data of the canvas' contents." }
85             ]
86         },
87         {
88             "name": "requestClientNodes",
89             "description": "Gets all <code>-webkit-canvas</code> nodes or active <code>HTMLCanvasElement</code> for a <code>WebGPUDevice</code>.",
90             "parameters": [
91                 { "name": "canvasId", "$ref": "CanvasId" }
92             ],
93             "returns": [
94                 { "name": "clientNodeIds", "type": "array", "items": { "$ref": "DOM.NodeId" } }
95             ]
96         },
97         {
98             "name": "resolveContext",
99             "description": "Resolves JavaScript canvas/device context object for given canvasId.",
100             "parameters": [
101                 { "name": "canvasId", "$ref": "CanvasId", "description": "Canvas identifier." },
102                 { "name": "objectGroup", "type": "string", "optional": true, "description": "Symbolic group name that can be used to release multiple objects." }
103             ],
104             "returns": [
105                 { "name": "object", "$ref": "Runtime.RemoteObject", "description": "JavaScript object wrapper for given canvas context." }
106             ]
107         },
108         {
109             "name": "setRecordingAutoCaptureFrameCount",
110             "description": "Tells the backend to record `count` frames whenever a new context is created.",
111             "parameters": [
112                 { "name": "count", "type": "integer", "description": "Number of frames to record (0 means don't record anything)." }
113             ]
114         },
115         {
116             "name": "startRecording",
117             "description": "Record the next frame, or up to the given number of bytes of data, for the given canvas.",
118             "parameters": [
119                 { "name": "canvasId", "$ref": "CanvasId" },
120                 { "name": "frameCount", "type": "integer", "optional": true, "description": "Number of frames to record (unlimited when not specified)." },
121                 { "name": "memoryLimit", "type": "integer", "optional": true, "description": "Memory limit of recorded data (100MB when not specified)." }
122             ]
123         },
124         {
125             "name": "stopRecording",
126             "description": "Stop recording the given canvas.",
127             "parameters": [
128                 { "name": "canvasId", "$ref": "CanvasId" }
129             ]
130         },
131         {
132             "name": "requestShaderSource",
133             "description": "Requests the source of the shader of the given type from the program with the given id.",
134             "parameters": [
135                 { "name": "programId", "$ref": "ProgramId" },
136                 { "name": "shaderType", "$ref": "ShaderType" }
137             ],
138             "returns": [
139                 { "name": "content", "type": "string" }
140             ]
141         },
142         {
143             "name": "updateShader",
144             "description": "Compiles and links the shader with identifier and type with the given source code.",
145             "parameters": [
146                 { "name": "programId", "$ref": "ProgramId" },
147                 { "name": "shaderType", "$ref": "ShaderType" },
148                 { "name": "source", "type": "string" }
149             ]
150         },
151         {
152             "name": "setShaderProgramDisabled",
153             "description": "Enable/disable the visibility of the given shader program.",
154             "parameters": [
155                 { "name": "programId", "$ref": "ProgramId" },
156                 { "name": "disabled", "type": "boolean" }
157             ]
158         },
159         {
160             "name": "setShaderProgramHighlighted",
161             "description": "Enable/disable highlighting of the given shader program.",
162             "parameters": [
163                 { "name": "programId", "$ref": "ProgramId" },
164                 { "name": "highlighted", "type": "boolean" }
165             ]
166         }
167     ],
168     "events": [
169         {
170             "name": "canvasAdded",
171             "parameters": [
172                 { "name": "canvas", "$ref": "Canvas", "description": "Canvas object." }
173             ]
174         },
175         {
176             "name": "canvasRemoved",
177             "parameters": [
178                 { "name": "canvasId", "$ref": "CanvasId", "description": "Removed canvas identifier." }
179             ]
180         },
181         {
182             "name": "canvasMemoryChanged",
183             "parameters": [
184                 { "name": "canvasId", "$ref": "CanvasId", "description": "Identifier of canvas that changed." },
185                 { "name": "memoryCost", "type": "number", "description": "New memory cost value for the canvas in bytes." }
186             ]
187         },
188         {
189             "name": "extensionEnabled",
190             "parameters": [
191                 { "name": "canvasId", "$ref": "CanvasId" },
192                 { "name": "extension", "type": "string", "description": "Name of the extension that was enabled." }
193             ]
194         },
195         {
196             "name": "clientNodesChanged",
197             "parameters": [
198                 { "name": "canvasId", "$ref": "CanvasId", "description": "Identifier of canvas that changed." }
199             ]
200         },
201         {
202             "name": "recordingStarted",
203             "parameters": [
204                 { "name": "canvasId", "$ref": "CanvasId" },
205                 { "name": "initiator", "$ref": "Recording.Initiator" }
206             ]
207         },
208         {
209             "name": "recordingProgress",
210             "parameters": [
211                 { "name": "canvasId", "$ref": "CanvasId" },
212                 { "name": "frames", "type": "array", "items": { "$ref": "Recording.Frame" }},
213                 { "name": "bufferUsed", "type": "integer", "description": "Total memory size in bytes of all data recorded since the recording began." }
214             ]
215         },
216         {
217             "name": "recordingFinished",
218             "parameters": [
219                 { "name": "canvasId", "$ref": "CanvasId" },
220                 { "name": "recording", "$ref": "Recording.Recording", "optional": true }
221             ]
222         },
223         {
224             "name": "programCreated",
225             "parameters": [
226                 { "name": "canvasId", "$ref": "CanvasId", "description": "Canvas identifier." },
227                 { "name": "programId", "$ref": "ProgramId", "description": "Program identifier." }
228             ]
229         },
230         {
231             "name": "programDeleted",
232             "parameters": [
233                 { "name": "programId", "$ref": "ProgramId", "description": "Program identifier." }
234             ]
235         }
236     ]
237 }