Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 18 additions & 11 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -3619,7 +3619,7 @@ a.setAttribute('href', 'http://example.com/'); // change the content attribute d
<ul class="brief">
<li><dfn data-noexport="" data-x-href="https://drafts.fxtf.org/geometry/#dommatrix"><code>DOMMatrix</code></dfn> interface
<li><dfn data-noexport="" data-x-href="https://drafts.fxtf.org/geometry/#dictdef-dommatrixinit"><code>DOMMatrixInit</code></dfn> interface
<li>The <dfn data-noexport="" data-x-href="https://drafts.fxtf.org/geometry/#validate-and-fixup">validate and fixup</dfn> algorithm for DOMMatrixInit
<li>The <dfn data-noexport="" data-x-href="https://drafts.fxtf.org/geometry/#create-a-dommatrix-from-the-dictionary">create a <code>DOMMatrix</code> from a dictionary</dfn> algorithm for <code>DOMMatrixInit</code>
</ul>

<!-- mention that the parser supports it? -->
Expand Down Expand Up @@ -60127,7 +60127,7 @@ interface <dfn>CanvasTransform</dfn> {

[NewObject] <span>DOMMatrix</span> <span data-x="dom-context-2d-getTransform">getTransform</span>();
void <span data-x="dom-context-2d-setTransform">setTransform</span>(unrestricted double a, unrestricted double b, unrestricted double c, unrestricted double d, unrestricted double e, unrestricted double f);
void <span data-x="dom-context-2d-setTransform">setTransform</span>(optional <span>DOMMatrixInit</span> matrix);
void <span data-x="dom-context-2d-setTransform">setTransform</span>(optional <span>DOMMatrixInit</span> transform);
void <span data-x="dom-context-2d-resetTransform">resetTransform</span>();
<!--
// v7 we've also received requests (though not many so far) for:
Expand Down Expand Up @@ -60302,7 +60302,7 @@ interface <dfn>CanvasGradient</dfn> {

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

optional

interface <dfn>CanvasPattern</dfn> {
// opaque object
void <span data-x="dom-canvaspattern-setTransform">setTransform</span>(<span>DOMMatrix</span> transform);
void <span data-x="dom-canvaspattern-setTransform">setTransform</span>(optional <span>DOMMatrixInit</span> transform);
};

interface <dfn>TextMetrics</dfn> {
Expand Down Expand Up @@ -60351,7 +60351,7 @@ interface <dfn>ImageData</dfn> {
<span data-x="dom-Path2D-merge">Constructor</span>(sequence&lt;<span>Path2D</span>&gt; paths, optional <span>CanvasFillRule</span> fillRule = "<span data-x="dom-context-2d-fillRule-nonzero">nonzero</span>"),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be changed to not be nullable and not specify an explicit default value, I believe.

Such arguments are always considered to have a default value of an empty dictionary, unless otherwise specified.

http://heycam.github.io/webidl/#idl-operations

<span data-x="dom-Path2D-withdata">Constructor</span>(DOMString d), Exposed=(Window,Worker)]
interface <dfn>Path2D</dfn> {
void <span data-x="dom-Path2D-addPath">addPath</span>(<span>Path2D</span> path, optional <span>DOMMatrix</span>? transformation = null);
void <span data-x="dom-Path2D-addPath">addPath</span>(<span>Path2D</span> path, optional <span>DOMMatrixInit</span> transform);
};
<span>Path2D</span> implements <span>CanvasPath</span>;</pre>

Expand Down Expand Up @@ -62444,8 +62444,12 @@ try {

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: result of creating a... with proper data-x would be nicer than result of running create a...

<li><p>Create a copy of all the subpaths in <var>b</var>. Let this copy be known as <var>c</var>.</p></li>

<li><p>Let <var>matrix</var> be the result of <span data-x="create a DOMMatrix from a
dictionary">creating a <code>DOMMatrix</code> from a dictionary</span>
<var>transform</var>.</p></li>

<li><p>Transform all the coordinates and lines in <var>c</var> by the transform matrix
<var>transform</var>, if it is not null.</p></li>
<var>matrix</var>.</p></li>

<li><p>Let (<var>x</var>, <var>y</var>) be the last point in the last subpath
of <var>c</var>.</p></li>
Expand Down Expand Up @@ -62541,7 +62545,7 @@ try {

</dd>

<dt><var>context</var> . <code data-x="dom-context-2d-setTransform">setTransform</code>(<var>matrix</var>)</dt>
<dt><var>context</var> . <code data-x="dom-context-2d-setTransform">setTransform</code>(<var>transform</var>)</dt>

<dd>

Expand Down Expand Up @@ -62628,9 +62632,10 @@ try {
data-x=""><span data-x="dom-context-2d-transform">transform</span>(<var>a</var>, <var>b</var>,
<var>c</var>, <var>d</var>, <var>e</var>, <var>f</var>)</code> method with the same arguments.</p>

<p>The <dfn><code data-x="">setTransform(<var>matrix</var>)</code></dfn> method must
<p>The <dfn><code data-x="">setTransform(<var>transform</var>)</code></dfn> method must
reset the <span>current transformation matrix</span> to the value represented by the result of
running the <span>validate and fixup</span> algorithm on <var>matrix</var>.</p>
<span data-x="create a DOMMatrix from a dictionary">creating a <code>DOMMatrix</code> from a
dictionary</span> <var>transform</var>.</p>

<p>The <dfn><code data-x="dom-context-2d-resetTransform">resetTransform()</code></dfn> method must
reset the <span>current transformation matrix</span> to the identity matrix.</p>
Expand Down Expand Up @@ -63071,9 +63076,11 @@ try {
<p>Patterns have a transformation matrix, which controls how the pattern is used when it is
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Running that algorithm makes it still just a dictionary. The geometry spec itself invokes https://drafts.fxtf.org/geometry/#dom-dommatrix-frommatrix e.g. from https://drafts.fxtf.org/geometry/#dom-dommatrix-multiplyself which seems better.

I should make that a proper entry point though (in the Geometry spec) rather than an API calling another API... Will fix that right now.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that I just reused a setup here we already had elsewhere, but I'm happy to change that one too as part of this PR.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the idea here is that we stop referencing validate and fixup and use this instead?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah.

painted. Initially, a pattern's transformation matrix must be the identity transform.</p>

<p>When the <dfn><code data-x="dom-canvaspattern-setTransform">setTransform()</code></dfn> method
is invoked on the pattern, the user agent must replace the pattern's transformation matrix with
the one described by the <code>DOMMatrix</code> object provided as an argument to the method.</p>
<p>The <dfn><code
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You've made transform optional in the IDL, but forgot to specify what happens here when no transform is specified. Should this reset the transfrom, leave it unchanged, throw an exception, something else? Why does the asrgument need to be optional?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a weird thing from dictionaries. They are optional, but end up being passed anyway, possibly as empty dictionary if there are no defaults. So even though the argument is optional, you will always have it passed and it'll contain a dictionary.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suspected it was something like that. Thanks for clarifying.

data-x="dom-canvaspattern-setTransform">setTransform(<var>transform</var>)</code></dfn> method,
when invoked, must reset the pattern's transformation matrix to the value represented by the
result of <span data-x="create a DOMMatrix from a dictionary">creating a <code>DOMMatrix</code>
from a dictionary</span> <var>transform</var>.</p>

<p>When a pattern is to be rendered within an area, the user agent must run the following steps to
determine what is rendered:</p>
Expand Down