Skip to content

Commit 5a68745

Browse files
Fix explanation of content scaling
1 parent 61644d0 commit 5a68745

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ There is no web API to easily render complex layouts of text and other content i
3030

3131
(*) Without `layoutsubtree`, geometry APIs such as `getBoundingClientRect()` on these elements return an empty rect. They do have computed styles, however, and are keyboard-focusable.
3232

33-
`drawElementImage(element ...)` takes the CTM (current transform matrix) of the canvas into consideration. The image drawn into the canvas is sized to `element`'s [`devicePixelContentBox`](https://web.dev/articles/device-pixel-content-box); content outside those bounds (including ink and layout overflow) are clipped. The `drawElementImage(element, x, y, dwidth, dheight)` variant resizes the image of `element`'s subtree to `dwidth` and `dheight`.
33+
`drawElementImage(element ...)` takes the CTM (current transform matrix) of the canvas into consideration. Any drawn element is implicitly treated as having the CSS property `contain:paint`; overflowing content (including both layout and ink overflow) will be clipped to the element's content box. The optional `dwidth` and `dheight` arguments specify a destination rect in canvas coordinates to which the element will be scaled. If omitted, the element will have the same size and proportion when drawn to the canvas as it would have were it rendered outside the canvas.
3434

3535
In addition, a `fireOnEveryPaint` option is added to `ResizeObserverOptions`, allowing script to be notified whenever any descendants of a `<canvas>` may render differently, so they can be redrawn. The callback to the resize observer will be called at resize observer timing, which is after DOM style and layout, but before paint.
3636

0 commit comments

Comments
 (0)