W3C home > Mailing lists > Public > www-style@w3.org > March 2015

Re: [geometry] Dictionary argument for DOMQuad constructor

From: Simon Pieters <simonp@opera.com>
Date: Tue, 24 Mar 2015 21:51:02 +0100
To: "public-fx@w3.org" <public-fx@w3.org>
Message-ID: <op.xv0r7cumidj3kv@simons-mbp>
Sorry, I sent this to www-style instead of public-fx. Moving to  

On Tue, 24 Mar 2015 21:35:19 +0100, Simon Pieters <simonp@opera.com> wrote:

> The constructor for DOMQuad is currently:
> http://dev.w3.org/fxtf/geometry/#DOMQuad
> [Constructor(optional DOMPointInit p1, optional DOMPointInit p2,
>               optional DOMPointInit p3, optional DOMPointInit p4),
>   Constructor(optional DOMRectInit rect),
>   Exposed=(Window,Worker)]
> interface DOMQuad {
>      [SameObject] readonly attribute DOMPoint p1;
>      [SameObject] readonly attribute DOMPoint p2;
>      [SameObject] readonly attribute DOMPoint p3;
>      [SameObject] readonly attribute DOMPoint p4;
>      [SameObject] readonly attribute DOMRectReadOnly bounds;
> };
> I think there are a few issues here.
> * All arguments are optional. This is invalid WebIDL since it's not  
> possible to distinguish which constructor to use. For other constructors  
> I've let the dictionary be optional and have the other constructor have  
> two required arguments. We can do that here as well.
> * If one does `new DOMQuad(other_domquad)`, it will convert the object  
> to a DOMRectInit and result in the same thing as `new DOMQuad({})` which  
> is probably not what was intended. Supporting two kinds of dictionaries  
> is not straightforward, though, since I think WebIDL doesn't distinguish  
> between different dictionaries. My proposal to fix this is to have a  
> dictionary type that can have rect members or quad members; see  
> https://www.w3.org/Bugs/Public/show_bug.cgi?id=27492#c1
> Any opinions?

Simon Pieters
Opera Software
Received on Tuesday, 24 March 2015 20:51:33 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:52 UTC