Skip to content

Commit 20d3b05

Browse files
zcorpansvgeesus
authored andcommitted
Introduce DOMQuad.fromQuad(). Fixes https://www.w3.org/Bugs/Public/show_bug.cgi?id=27492
1 parent 68c036a commit 20d3b05

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

geometry/Overview.bs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,13 +281,21 @@ Objects implementing the <a interface>DOMQuad</a> interface represents a <dfn>qu
281281
Exposed=(Window,Worker)]
282282
interface DOMQuad {
283283
[NewObject] static DOMQuad fromRect(optional DOMRectInit other);
284+
[NewObject] static DOMQuad fromQuad(optional DOMQuadInit other);
284285

285286
[SameObject] readonly attribute DOMPoint p1;
286287
[SameObject] readonly attribute DOMPoint p2;
287288
[SameObject] readonly attribute DOMPoint p3;
288289
[SameObject] readonly attribute DOMPoint p4;
289290
[SameObject] readonly attribute DOMRectReadOnly bounds;
290291
};
292+
293+
dictionary DOMQuadInit {
294+
DOMPointInit p1;
295+
DOMPointInit p2;
296+
DOMPointInit p3;
297+
DOMPointInit p4;
298+
};
291299
</pre>
292300

293301
The <dfn dfn-type=constructor dfn-for=DOMQuad><code>DOMQuad(<var>p1</var>, <var>p2</var>, <var>p3</var>, <var>p4</var>)</code></dfn> constructor, when invoked, must run the following steps:
@@ -313,6 +321,18 @@ The <dfn dfn-for=DOMQuad><code>fromRect(<var>other</var>)</code></dfn> static me
313321
<li><p>Return a new <a interface>DOMQuad</a> with <a attribute for=DOMQuad>p1</a> set to <var>point 1</var>, <a attribute for=DOMQuad>p2</a> set to <var>point 2</var>, <a attribute for=DOMQuad>p3</a> set to <var>point 3</var> and <a attribute for=DOMQuad>p4</a> set to <var>point 4</var>, and let the <a>associated bounding rectangle</a> be <var>bounds</var>.
314322
</ol>
315323

324+
The <dfn dfn-for=DOMQuad><code>fromQuad(<var>other</var>)></code></dfn> static method on {{DOMQuad}} must run the following steps:
325+
326+
1. Let <var>point 1</var> be the result of invoking {{DOMPoint/fromPoint()}} static method on {{DOMPoint}} with the {{DOMQuadInit/p1}} dictionary member of <var>other</var> as argument, if it exists.
327+
1. Let <var>point 2</var> be the result of invoking {{DOMPoint/fromPoint()}} static method on {{DOMPoint}} with the {{DOMQuadInit/p2}} dictionary member of <var>other</var> as argument, if it exists.
328+
1. Let <var>point 3</var> be the result of invoking {{DOMPoint/fromPoint()}} static method on {{DOMPoint}} with the {{DOMQuadInit/p3}} dictionary member of <var>other</var> as argument, if it exists.
329+
1. Let <var>point 4</var> be the result of invoking {{DOMPoint/fromPoint()}} static method on {{DOMPoint}} with the {{DOMQuadInit/p4}} dictionary member of <var>other</var> as argument, if it exists.
330+
1. Return a new {{DOMQuad}} with
331+
{{DOMQuad/p1}} set to <var>point 1</var>,
332+
{{DOMQuad/p2}} set to <var>point 2</var>,
333+
{{DOMQuad/p3}} set to <var>point 3</var> and
334+
{{DOMQuad/p4}} set to <var>point 4</var>.
335+
316336
<div dfn-type=attribute dfn-for=DOMQuad>
317337
The <dfn>p1</dfn> attribute must return a <a interface>DOMPoint</a> that represents <a attribute>p1</a> of the quadrilateral it was invoked on. The author can modify the returned <a interface>DOMPoint</a> object, which directly affects the quadrilateral.
318338

0 commit comments

Comments
 (0)