[geometry] Dictionary argument for DOMQuad constructor

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:35:50 UTC