{ "domain": "Canvas", "availability": ["web"], "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.", "types": [ { "id": "CanvasId", "type": "string", "description": "Unique canvas identifier." }, { "id": "ProgramId", "type": "string", "description": "Unique shader program identifier." }, { "id": "ContextType", "type": "string", "enum": ["canvas-2d", "bitmaprenderer", "webgl", "webgl2", "webmetal"], "description": "The type of rendering context backing the canvas element." }, { "id": "ShaderType", "type": "string", "enum": ["fragment", "vertex"], "description": "Shader type. WebGL supports vertex and fragment shaders." }, { "id": "ContextAttributes", "type": "object", "description": "Drawing surface attributes.", "properties": [ { "name": "alpha", "type": "boolean", "optional": true }, { "name": "depth", "type": "boolean", "optional": true }, { "name": "stencil", "type": "boolean", "optional": true }, { "name": "antialias", "type": "boolean", "optional": true }, { "name": "premultipliedAlpha", "type": "boolean", "optional": true }, { "name": "preserveDrawingBuffer", "type": "boolean", "optional": true }, { "name": "failIfMajorPerformanceCaveat", "type": "boolean", "optional": true } ] }, { "id": "Canvas", "type": "object", "description": "Information about a canvas for which a rendering context has been created.", "properties": [ { "name": "canvasId", "$ref": "CanvasId", "description": "Canvas identifier." }, { "name": "contextType", "$ref": "ContextType", "description": "The type of rendering context backing the canvas." }, { "name": "nodeId", "$ref": "DOM.NodeId", "optional": true, "description": "The corresponding DOM node id." }, { "name": "cssCanvasName", "type": "string", "optional": true, "description": "The CSS canvas identifier, for canvases created with document.getCSSCanvasContext." }, { "name": "contextAttributes", "$ref": "ContextAttributes", "optional": true, "description": "Context attributes for rendering contexts." }, { "name": "memoryCost", "type": "number", "optional": true, "description": "Memory usage of the canvas in bytes." }, { "name": "backtrace", "type": "array", "items": { "$ref": "Console.CallFrame" }, "optional": true, "description": "Backtrace that was captured when this canvas context was created." } ] } ], "commands": [ { "name": "enable", "description": "Enables Canvas domain events." }, { "name": "disable", "description": "Disables Canvas domain events." }, { "name": "requestNode", "description": "Gets the NodeId for the canvas node with the given CanvasId.", "parameters": [ { "name": "canvasId", "$ref": "CanvasId", "description": "Canvas identifier." } ], "returns": [ { "name": "nodeId", "$ref": "DOM.NodeId", "description": "Node identifier for given canvas." } ] }, { "name": "requestContent", "description": "Gets the data for the canvas node with the given CanvasId.", "parameters": [ { "name": "canvasId", "$ref": "CanvasId", "description": "Canvas identifier." } ], "returns": [ { "name": "content", "type": "string", "description": "Base64-encoded data of the canvas' contents." } ] }, { "name": "requestCSSCanvasClientNodes", "description": "Gets all the nodes that are using this canvas via -webkit-canvas.", "parameters": [ { "name": "canvasId", "$ref": "CanvasId" } ], "returns": [ { "name": "clientNodeIds", "type": "array", "items": { "$ref": "DOM.NodeId" } } ] }, { "name": "resolveCanvasContext", "description": "Resolves JavaScript canvas context object for given canvasId.", "parameters": [ { "name": "canvasId", "$ref": "CanvasId", "description": "Canvas identifier." }, { "name": "objectGroup", "type": "string", "optional": true, "description": "Symbolic group name that can be used to release multiple objects." } ], "returns": [ { "name": "object", "$ref": "Runtime.RemoteObject", "description": "JavaScript object wrapper for given canvas context." } ] }, { "name": "setRecordingAutoCaptureFrameCount", "description": "Tells the backend to record `count` frames whenever a new context is created.", "parameters": [ { "name": "count", "type": "integer", "description": "Number of frames to record (0 means don't record anything)." } ] }, { "name": "startRecording", "description": "Record the next frame, or up to the given number of bytes of data, for the given canvas.", "parameters": [ { "name": "canvasId", "$ref": "CanvasId" }, { "name": "frameCount", "type": "integer", "optional": true, "description": "Number of frames to record (unlimited when not specified)." }, { "name": "memoryLimit", "type": "integer", "optional": true, "description": "Memory limit of recorded data (100MB when not specified)." } ] }, { "name": "stopRecording", "description": "Stop recording the given canvas.", "parameters": [ { "name": "canvasId", "$ref": "CanvasId" } ] }, { "name": "requestShaderSource", "description": "Requests the source of the shader of the given type from the program with the given id.", "parameters": [ { "name": "programId", "$ref": "ProgramId" }, { "name": "shaderType", "$ref": "ShaderType" } ], "returns": [ { "name": "content", "type": "string" } ] }, { "name": "updateShader", "description": "Compiles and links the shader with identifier and type with the given source code.", "parameters": [ { "name": "programId", "$ref": "ProgramId" }, { "name": "shaderType", "$ref": "ShaderType" }, { "name": "source", "type": "string" } ] }, { "name": "setShaderProgramDisabled", "description": "Enable/disable the visibility of the given shader program.", "parameters": [ { "name": "programId", "$ref": "ProgramId" }, { "name": "disabled", "type": "boolean" } ] }, { "name": "setShaderProgramHighlighted", "description": "Enable/disable highlighting of the given shader program.", "parameters": [ { "name": "programId", "$ref": "ProgramId" }, { "name": "highlighted", "type": "boolean" } ] } ], "events": [ { "name": "canvasAdded", "parameters": [ { "name": "canvas", "$ref": "Canvas", "description": "Canvas object." } ] }, { "name": "canvasRemoved", "parameters": [ { "name": "canvasId", "$ref": "CanvasId", "description": "Removed canvas identifier." } ] }, { "name": "canvasMemoryChanged", "parameters": [ { "name": "canvasId", "$ref": "CanvasId", "description": "Identifier of canvas that changed." }, { "name": "memoryCost", "type": "number", "description": "New memory cost value for the canvas in bytes." } ] }, { "name": "extensionEnabled", "parameters": [ { "name": "canvasId", "$ref": "CanvasId" }, { "name": "extension", "type": "string", "description": "Name of the extension that was enabled." } ] }, { "name": "cssCanvasClientNodesChanged", "parameters": [ { "name": "canvasId", "$ref": "CanvasId", "description": "Identifier of canvas that changed." } ] }, { "name": "recordingStarted", "parameters": [ { "name": "canvasId", "$ref": "CanvasId" }, { "name": "initiator", "$ref": "Recording.Initiator" } ] }, { "name": "recordingProgress", "parameters": [ { "name": "canvasId", "$ref": "CanvasId" }, { "name": "frames", "type": "array", "items": { "$ref": "Recording.Frame" }}, { "name": "bufferUsed", "type": "integer", "description": "Total memory size in bytes of all data recorded since the recording began." } ] }, { "name": "recordingFinished", "parameters": [ { "name": "canvasId", "$ref": "CanvasId" }, { "name": "recording", "$ref": "Recording.Recording", "optional": true } ] }, { "name": "programCreated", "parameters": [ { "name": "canvasId", "$ref": "CanvasId", "description": "Canvas identifier." }, { "name": "programId", "$ref": "ProgramId", "description": "Program identifier." } ] }, { "name": "programDeleted", "parameters": [ { "name": "programId", "$ref": "ProgramId", "description": "Program identifier." } ] } ] }