[webkit-dev] How to handle Array types in IDL files?

2009-08-26 Thread Drew Wilson
I'm trying to update MessageEvent to match the current HTML5 spec.
Currently, MessageEvent has two references to MessagePort:

readonly attribute *MessagePort messagePort*;

void initMessageEvent(in DOMString typeArg, in boolean canBubbleArg,
in boolean cancelableArg, in DOMString dataArg, in DOMString originArg, in
DOMString lastEventIdArg, in DOMWindow sourceArg, *in MessagePort
messagePort*);

MessageEvent now needs to support an array of MessagePorts. I had planned to
provide a custom getter for the messagePort attribute and change
initMessageEvent to be custom as well, resulting in this:

readonly attribute [CustomGetter] *Array ports*;

[Custom] void initMessageEvent(in DOMString typeArg, in boolean
canBubbleArg, in boolean cancelableArg, in DOMString dataArg, in DOMString
originArg, in DOMString lastEventIdArg, in DOMWindow sourceArg, *in Array
messagePorts*);

My custom JS handlers could map between JSArray and the native WebCore
collection used by the impl class. I'm not certain whether this is the right
approach for the objc bindings, however - in fact, the generated code for
DOMMessageEvent.mm contains #import Array.h and #import
DOMArrayInternal.h, neither of which exist.

What do people suggest here? I'm not certain how this should be exposed for
ObjC. Other classes (like Clipboard.idl) that use Array don't seem to have
objc bindings, but I don't think that's an option for MessageEvent.

-atw
___
webkit-dev mailing list
webkit-dev@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev


Re: [webkit-dev] How to handle Array types in IDL files?

2009-08-26 Thread Drew Wilson
To be more precise, the HTML5 IDL defines the following:

typedef sequenceMessagePort MessagePortArray;


The types above are all MessagePortArray in the spec, not Array. So it seems
like the intent is that they should indeed get mapped to a vanilla JS Array.

I could make these attributes JS-only - that shouldn't be a huge issue since
MessagePorts are currently only enabled for JS anyway (MessagePort is an
empty interface for ObjC). Is that acceptable? Sam?

-atw

On Wed, Aug 26, 2009 at 12:34 AM, Cameron McCormack c...@mcc.id.au wrote:

 Maciej Stachowiak:
  We probably need special support for Web IDL array types in the
  bindings generator. Sam can probably comment n more detail. As a
  stopgap, we could make the relevant IDL attributes be JS only. I
  would check out what Web IDL says about Array - I don't think it's
  supposed to be reflected as just a vanilla JS Array.

 Currently Web IDL says that when getting an attribute of type
 sequenceT, a new JS Array object is returned.  For array types,
 T[], a host object with particular [[Get]] and [[Put]] behaviour is
 meant to be used, which makes it similar to a native Array.

 Both of these things are pretty speculative, and could do with review.

 --
 Cameron McCormack ≝ http://mcc.id.au/

___
webkit-dev mailing list
webkit-dev@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev


Re: [webkit-dev] How to handle Array types in IDL files?

2009-08-26 Thread Sam Weinig
Making this JS only for now seems fine.  If we want to enable MessagePorts
for other binding languages we can define the mapping ourselves.  For
example, for a sequence, the clear mapping for ObjC would be to NSArray*.
-Sam

On Wed, Aug 26, 2009 at 5:03 PM, Drew Wilson atwil...@google.com wrote:

 To be more precise, the HTML5 IDL defines the following:

 typedef sequenceMessagePort MessagePortArray;


 The types above are all MessagePortArray in the spec, not Array. So it
 seems like the intent is that they should indeed get mapped to a vanilla JS
 Array.

 I could make these attributes JS-only - that shouldn't be a huge issue
 since MessagePorts are currently only enabled for JS anyway (MessagePort is
 an empty interface for ObjC). Is that acceptable? Sam?

 -atw

 On Wed, Aug 26, 2009 at 12:34 AM, Cameron McCormack c...@mcc.id.au wrote:

 Maciej Stachowiak:
  We probably need special support for Web IDL array types in the
  bindings generator. Sam can probably comment n more detail. As a
  stopgap, we could make the relevant IDL attributes be JS only. I
  would check out what Web IDL says about Array - I don't think it's
  supposed to be reflected as just a vanilla JS Array.

 Currently Web IDL says that when getting an attribute of type
 sequenceT, a new JS Array object is returned.  For array types,
 T[], a host object with particular [[Get]] and [[Put]] behaviour is
 meant to be used, which makes it similar to a native Array.

 Both of these things are pretty speculative, and could do with review.

 --
 Cameron McCormack ≝ http://mcc.id.au/



 ___
 webkit-dev mailing list
 webkit-dev@lists.webkit.org
 http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev


___
webkit-dev mailing list
webkit-dev@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev


Re: [webkit-dev] How to handle Array types in IDL files?

2009-08-26 Thread Maciej Stachowiak


On Aug 26, 2009, at 9:26 AM, Sam Weinig wrote:

Making this JS only for now seems fine.  If we want to enable  
MessagePorts for other binding languages we can define the mapping  
ourselves.  For example, for a sequence, the clear mapping for ObjC  
would be to NSArray*.


I think ultimately we should support the sequence syntax in the  
bindings generator.


 - Maciej



-Sam

On Wed, Aug 26, 2009 at 5:03 PM, Drew Wilson atwil...@google.com  
wrote:

To be more precise, the HTML5 IDL defines the following:

typedef sequenceMessagePort MessagePortArray;

The types above are all MessagePortArray in the spec, not Array. So  
it seems like the intent is that they should indeed get mapped to a  
vanilla JS Array.


I could make these attributes JS-only - that shouldn't be a huge  
issue since MessagePorts are currently only enabled for JS anyway  
(MessagePort is an empty interface for ObjC). Is that acceptable? Sam?


-atw

On Wed, Aug 26, 2009 at 12:34 AM, Cameron McCormack c...@mcc.id.au  
wrote:

Maciej Stachowiak:
 We probably need special support for Web IDL array types in the
 bindings generator. Sam can probably comment n more detail. As a
 stopgap, we could make the relevant IDL attributes be JS only. I
 would check out what Web IDL says about Array - I don't think it's
 supposed to be reflected as just a vanilla JS Array.

Currently Web IDL says that when getting an attribute of type
sequenceT, a new JS Array object is returned.  For array types,
T[], a host object with particular [[Get]] and [[Put]] behaviour is
meant to be used, which makes it similar to a native Array.

Both of these things are pretty speculative, and could do with review.

--
Cameron McCormack ≝ http://mcc.id.au/


___
webkit-dev mailing list
webkit-dev@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev




___
webkit-dev mailing list
webkit-dev@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev


Re: [webkit-dev] How to handle Array types in IDL files?

2009-08-26 Thread Sam Weinig
On Wed, Aug 26, 2009 at 8:27 PM, Maciej Stachowiak m...@apple.com wrote:


 On Aug 26, 2009, at 9:26 AM, Sam Weinig wrote:

 Making this JS only for now seems fine.  If we want to enable MessagePorts
 for other binding languages we can define the mapping ourselves.  For
 example, for a sequence, the clear mapping for ObjC would be to NSArray*.


 I think ultimately we should support the sequence syntax in the bindings
 generator.

 Definitely.  But like with most of these things, it is nice to see it
mocked up first with custom code.

-Sam
___
webkit-dev mailing list
webkit-dev@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev