RESOLVED LATER 69045
Implement Canvas drawElement()
https://bugs.webkit.org/show_bug.cgi?id=69045
Summary Implement Canvas drawElement()
Matthew Delaney
Reported 2011-09-28 17:56:33 PDT
This is the tracking bug for implementing an experimental enhancement to <canvas> to render (potentially) any HTMLElement to the canvas. Currently, drawImage() exposes the ability to draw HTML{Image,Video,Canvas}Elements to canvas. This enhancement would extend this functionality to allow the author to draw any HTMLElement as it would otherwise be rendered, with certain restrictions (see below), to the canvas. This initial approach will define a new method on the canvas context called drawElement() that will behave very similar to drawImage() but instead accept a reference to any HTMLElement. Possible restrictions: - We may want to ignore elements if their rendering is uncertain, such as unrooted elements whose style is not clear or elements with non-rectangular layout. - We may want to modify the rendering of certain elements under certain circumstances - similar to how we render some elements differently during printing due to limitations of graphics back-ends and such. - We may want to consider all possible side-effects of exposing a feature like this to developers, such as possible watering-down of semantics, loss of accessibility, etc. (Note: Theoretically these issues already exist in canvas, however this feature could exacerbate them.) - We most certainly will want to impose restrictions on this function's use and its side-effects upon the canvas/context due to certain security concerns (see below). Security concerns: - I think it's wisest to keep all security discussions inside a separate bug in that component since I foresee the discussion roping in other areas' security issues. I'll create that bug now. - To say the least, all cross domain restrictions and tainting that applies currently to drawing images and videos to canvas will likely apply in a similar fashion here depending upon the element being drawn, BUT again, it's probably best to keep all the discussion in one place in the attached security bug.
Attachments
Dirk Schulze
Comment 1 2014-04-03 03:59:31 PDT
I think we need this feature to be documented. Even though it is very similar to the idea of the element() function or the <feImage> element for SVG Filters. Especially the security model needs to be crafted, especially because you don't want to taint the Canvas if not necessary.
Note You need to log in before you can comment on or make changes to this bug.