Mozilla's getting a new look. What do you think? https://mzl.la/brandsurvey

CanvasRenderingContext2D.asyncDrawXULElement()

Non-standard
This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future.

The non-standard and internal only CanvasRenderingContext2D.asyncDrawXULElement() method of the Canvas 2D API renders a region of a XUL element into the canvas.

This API cannot be used by Web content. It is chrome only.

Syntax

void ctx.asyncDrawXULElement(element, x, y, w, h, bgColor, flags = 0);

Parameters

window
The XULElement to render.
x
The X coordinate of the element.
y
The Y coordnate of the element.
w
The width of the element.
h
The height of the element.
bgColor
A DOMString that specifies the color the canvas is filled with before the element is rendered into it. This color may be transparent/translucent. It is given as a CSS color string (for example, rgb() or rgba()).
flags Optional
Used to better control the asyncDrawXULElement call. Flags can be ORed together.
Constant Value Description
DRAWWINDOW_DRAW_CARET 0x01 Show the caret if appropriate when drawing.
DRAWWINDOW_DO_NOT_FLUSH 0x02 Do not flush pending layout notifications that could otherwise be batched up.
DRAWWINDOW_DRAW_VIEW 0x04 Draw scrollbars and scroll the viewport if they are present.
DRAWWINDOW_USE_WIDGET_LAYERS 0x08 Use the widget layer manager if available. This means hardware acceleration may be used, but it might actually be slower or lower quality than normal. It will, however, more accurately reflect the pixels rendered to the screen.
DRAWWINDOW_ASYNC_DECODE_IMAGES 0x10 Do not synchronously decode images - draw what we have.

Specifications

Not part of any current specification or draft. This is a non-standard and internal only API.

Browser compatibility

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support Not supported (Yes) Not supported Not supported Not supported
Feature Android Chrome for Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support Not supported Not supported (Yes) Not supported Not supported Not supported

See also

Document Tags and Contributors

 Contributors to this page: fscholz
 Last updated by: fscholz,