-
Notifications
You must be signed in to change notification settings - Fork 3k
Add HTML-in-Canvas APIs #11588
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Add HTML-in-Canvas APIs #11588
Changes from 1 commit
e181de1
8634ebe
afc4a4d
f151c83
74d67ae
f7d320a
3cad6d4
4367aac
84ec8e6
f351c3d
aed994e
8c3ce46
ff066c9
5e3c3d0
f8f119a
202adae
be22310
9866034
4e559a9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -66274,6 +66274,7 @@ interface <dfn interface>CanvasRenderingContext2D</dfn> { | |
<span>CanvasRenderingContext2D</span> includes <span>CanvasDrawPath</span>; | ||
<span>CanvasRenderingContext2D</span> includes <span>CanvasUserInterface</span>; | ||
<span>CanvasRenderingContext2D</span> includes <span>CanvasText</span>; | ||
<span>CanvasRenderingContext2D</span> includes <span>CanvasDrawElement</span>; | ||
<span>CanvasRenderingContext2D</span> includes <span>CanvasDrawImage</span>; | ||
<span>CanvasRenderingContext2D</span> includes <span>CanvasImageData</span>; | ||
<span>CanvasRenderingContext2D</span> includes <span>CanvasPathDrawingStyles</span>; | ||
|
@@ -66393,6 +66394,12 @@ interface mixin <dfn interface>CanvasText</dfn> { | |
<span>TextMetrics</span> <span data-x="dom-context-2d-measureText">measureText</span>(DOMString text); | ||
}; | ||
|
||
interface mixin <dfn interface>CanvasDrawElement</dfn> { | ||
// drawing elements | ||
undefined <span data-x="dom-context-2d-drawElement">drawElement</span>(<span>Element</span> element, unrestricted double x, unrestricted double y); | ||
undefined <span data-x="dom-context-2d-drawElement">drawElement</span>(<span>Element</span> element, unrestricted double x, unrestricted double y, unrestricted double w, unrestricted double y); | ||
}; | ||
|
||
interface mixin <dfn interface>CanvasDrawImage</dfn> { | ||
// drawing images | ||
undefined <span data-x="dom-context-2d-drawImage">drawImage</span>(<span>CanvasImageSource</span> image, unrestricted double dx, unrestricted double dy); | ||
|
@@ -70681,6 +70688,55 @@ try { | |
|
||
</div> | ||
|
||
|
||
<h6>Drawing elements</h6> | ||
|
||
<dl class="domintro"> | ||
<dt><code data-x=""><var>context</var>.<span subdfn data-x="dom-context-2d-drawElement">drawElement</span>(<var>image</var>, <var>x</var>, <var>y</var>)</code></dt> | ||
<dt><code data-x=""><var>context</var>.<span data-x="dom-context-2d-drawElement">drawElement</span>(<var>image</var>, <var>x</var>, <var>y</var>, <var>w</var>, <var>h</var>)</code></dt> | ||
|
||
<dd> | ||
<p>Draws the given element onto the canvas. Throws a <code>TypeError</code> if the element isn't | ||
a descendant of the canvas.</p> | ||
</dd> | ||
</dl> | ||
|
||
<div w-nodev> | ||
|
||
<p>Objects that implement the <code>CanvasDrawElement</code> interface have the <dfn method | ||
for="CanvasDrawElement"><code data-x="dom-context-2d-drawElement">drawElement()</code></dfn> | ||
method to draw elements.</p> | ||
|
||
<p>When the <code data-x="dom-context-2d-drawElement">drawElement()</code> method is invoked, the user | ||
agent must run these steps:</p> | ||
|
||
<ol> | ||
<li><p>π Let <var>element</var> be the first argument.</p> | ||
foolip marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
<li><p>If any of the arguments are infinite or NaN, then return.</p></li> | ||
|
||
<li><p>Let <var>usability</var> be the result of π.</p></li> | ||
|
||
<li><p>If <var>usability</var> is <i>bad</i>, then return (without drawing anything).</p></li> | ||
foolip marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
<li><p>π Update the rendering without painting.</p></li> | ||
foolip marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
<!-- If w/h arguments are given, should that be an input to layout here? | ||
And if not, is the layout totally unconstrained, infinite width?? --> | ||
foolip marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
<li><p>π Let <var>layoutBox</var> be <var>element</var>'s CSS layout box.</p></li> | ||
|
||
<li><p>If not specified, the <var>w</var> and <var>h</var> arguments must default to the width | ||
and height of <var>layoutBox</var>.</p></li> | ||
|
||
<li><p>If either <var>w</var> or <var>h</var> are zero, then return.</p></li> | ||
|
||
<li><p>π Paint <var>element</var> to the specified rectangular area without using any | ||
|
||
<span>CORS-cross-origin</span> data.</p></li> | ||
</ol> | ||
|
||
</div> | ||
|
||
|
||
<h6>Drawing images</h6> | ||
|
||
<p>Objects that implement the <code>CanvasDrawImage</code> interface have the <dfn method | ||
|
Uh oh!
There was an error while loading. Please reload this page.