Re: [webkit-dev] "ReflectOnly" IDL equivalent

2017-06-10 Thread Sam Weinig


> On Jun 10, 2017, at 3:41 PM, Maciej Stachowiak  wrote:
> 
> 
> 
> On Jun 9, 2017, at 10:08 PM, Chris Dumez  > wrote:
> 
>> 
>>> On Jun 9, 2017, at 11:47 AM, Sam Weinig >> > wrote:
>>> 
>>> 
>>> 
 On Jun 2, 2017, at 11:32 AM, Ryosuke Niwa > wrote:
 
 On Fri, Jun 2, 2017 at 9:18 AM, Chris Dumez > wrote:
> Hi,
> 
> No, I do not believe WebKit supports ReflectOnly and this is not standard
> IDL either.
> 
> The way to do it in WebKit would be to use a regular DOMString attribute, 
> as
> in the specification and implement this logic in the c++ getter for this
> attribute. See HTMLElement::dir() for an example.
> 
> We could also consider adding support for something like ReflectOnly in 
> our
> bindings generator considering that this seems to be used quite a bit in 
> the
> HTML specification and it would decrease code complexity a little.
> I’d actually be in favor of that.
 
 I'd suggest other names like "ReflectEnum" or even "Reflect"
 where EnumType is the name of enum that defines the list of values.
 
 "ReflectOnly" doesn't tell us on what "only" applies. If I didn't know
 the context, it sounds like something that does less work than regular
 "Reflect”.
>>> 
>>> 
>>> I don’t see a good reason to complicate the bindings until this becomes 
>>> more common place.  For now, I would just implement HTMLLinkElement::as() 
>>> to behave as you want and leave the IDL unannotated, and we can revisit it 
>>> at a later time.
>> 
>> As I said, this is already used in quite a few places in the HTML spec:
>> - https://html.spec.whatwg.org/#dom-dir 
>> 
>> - https://html.spec.whatwg.org/#dom-link-as 
>> 
>> - https://html.spec.whatwg.org/#dom-link-referrerpolicy 
>> 
>> - https://html.spec.whatwg.org/#dom-link-updateviacache 
>> 
>> - https://html.spec.whatwg.org/#dom-a-referrerpolicy 
>> 
>> - https://html.spec.whatwg.org/#dom-img-referrerpolicy 
>> 
>> - https://html.spec.whatwg.org/#dom-iframe-referrerpolicy 
>> 
>> - https://html.spec.whatwg.org/#dom-track-kind 
>> 
>> - https://html.spec.whatwg.org/#dom-media-preload 
>> 
>> - https://html.spec.whatwg.org/#dom-area-referrerpolicy 
>> 
>> - https://html.spec.whatwg.org/#dom-th-scope 
>> 
>> - https://html.spec.whatwg.org/#dom-form-autocomplete 
>> 
>> - https://html.spec.whatwg.org/#dom-input-type 
>> 
>> - https://html.spec.whatwg.org/#dom-input-inputmode 
>> 
>> - https://html.spec.whatwg.org/#dom-button-type 
>> 
>> - https://html.spec.whatwg.org/#dom-textarea-inputmode 
>> 
>> - https://html.spec.whatwg.org/#dom-fs-method 
>> 
>> - https://html.spec.whatwg.org/#dom-fs-enctype 
>> 
>> - https://html.spec.whatwg.org/#dom-fs-formenctype 
>> 
>> - https://html.spec.whatwg.org/#dom-fs-formmethod 
>> 
>> 
>> Having a per-standard implementation in the bindings would likely be better 
>> than many potentially non-compliant ones.
> 

That is quite an imposing list, I rescind my objection.

> The HTML spec's name for this concept, "limited to only known values" is 
> really clear and better than "only" or "enum". I wonder if we could make a 
> name based on this, such as
> 
> ReflectLimitedToKnownValues
> ReflectOnlyKnownValues
> ReflectKnownValues
> ReflectLimited
> 
> (The last of this might be too vague.)

I’d prefer ReflectLimitedToKnownValues.

- Sam

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


Re: [webkit-dev] "ReflectOnly" IDL equivalent

2017-06-10 Thread Maciej Stachowiak


> On Jun 9, 2017, at 10:08 PM, Chris Dumez  wrote:
> 
> 
>>> On Jun 9, 2017, at 11:47 AM, Sam Weinig  wrote:
>>> 
>>> 
>>> 
>>> On Jun 2, 2017, at 11:32 AM, Ryosuke Niwa  wrote:
>>> 
 On Fri, Jun 2, 2017 at 9:18 AM, Chris Dumez  wrote:
 Hi,
 
 No, I do not believe WebKit supports ReflectOnly and this is not standard
 IDL either.
 
 The way to do it in WebKit would be to use a regular DOMString attribute, 
 as
 in the specification and implement this logic in the c++ getter for this
 attribute. See HTMLElement::dir() for an example.
 
 We could also consider adding support for something like ReflectOnly in our
 bindings generator considering that this seems to be used quite a bit in 
 the
 HTML specification and it would decrease code complexity a little.
 I’d actually be in favor of that.
>>> 
>>> I'd suggest other names like "ReflectEnum" or even "Reflect"
>>> where EnumType is the name of enum that defines the list of values.
>>> 
>>> "ReflectOnly" doesn't tell us on what "only" applies. If I didn't know
>>> the context, it sounds like something that does less work than regular
>>> "Reflect”.
>> 
>> 
>> I don’t see a good reason to complicate the bindings until this becomes more 
>> common place.  For now, I would just implement HTMLLinkElement::as() to 
>> behave as you want and leave the IDL unannotated, and we can revisit it at a 
>> later time.
> 
> As I said, this is already used in quite a few places in the HTML spec:
> - https://html.spec.whatwg.org/#dom-dir
> - https://html.spec.whatwg.org/#dom-link-as
> - https://html.spec.whatwg.org/#dom-link-referrerpolicy
> - https://html.spec.whatwg.org/#dom-link-updateviacache
> - https://html.spec.whatwg.org/#dom-a-referrerpolicy
> - https://html.spec.whatwg.org/#dom-img-referrerpolicy
> - https://html.spec.whatwg.org/#dom-iframe-referrerpolicy
> - https://html.spec.whatwg.org/#dom-track-kind
> - https://html.spec.whatwg.org/#dom-media-preload
> - https://html.spec.whatwg.org/#dom-area-referrerpolicy
> - https://html.spec.whatwg.org/#dom-th-scope
> - https://html.spec.whatwg.org/#dom-form-autocomplete
> - https://html.spec.whatwg.org/#dom-input-type
> - https://html.spec.whatwg.org/#dom-input-inputmode
> - https://html.spec.whatwg.org/#dom-button-type
> - https://html.spec.whatwg.org/#dom-textarea-inputmode
> - https://html.spec.whatwg.org/#dom-fs-method
> - https://html.spec.whatwg.org/#dom-fs-enctype
> - https://html.spec.whatwg.org/#dom-fs-formenctype
> - https://html.spec.whatwg.org/#dom-fs-formmethod
> 
> Having a per-standard implementation in the bindings would likely be better 
> than many potentially non-compliant ones.

The HTML spec's name for this concept, "limited to only known values" is really 
clear and better than "only" or "enum". I wonder if we could make a name based 
on this, such as

ReflectLimitedToKnownValues
ReflectOnlyKnownValues
ReflectKnownValues
ReflectLimited

(The last of this might be too vague.)

> 
> --
>  Chris Dumez
> 
> ___
> webkit-dev mailing list
> webkit-dev@lists.webkit.org
> https://lists.webkit.org/mailman/listinfo/webkit-dev
___
webkit-dev mailing list
webkit-dev@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-dev


Re: [webkit-dev] "ReflectOnly" IDL equivalent

2017-06-09 Thread Chris Dumez

> On Jun 9, 2017, at 11:47 AM, Sam Weinig  wrote:
> 
> 
> 
>> On Jun 2, 2017, at 11:32 AM, Ryosuke Niwa  wrote:
>> 
>> On Fri, Jun 2, 2017 at 9:18 AM, Chris Dumez  wrote:
>>> Hi,
>>> 
>>> No, I do not believe WebKit supports ReflectOnly and this is not standard
>>> IDL either.
>>> 
>>> The way to do it in WebKit would be to use a regular DOMString attribute, as
>>> in the specification and implement this logic in the c++ getter for this
>>> attribute. See HTMLElement::dir() for an example.
>>> 
>>> We could also consider adding support for something like ReflectOnly in our
>>> bindings generator considering that this seems to be used quite a bit in the
>>> HTML specification and it would decrease code complexity a little.
>>> I’d actually be in favor of that.
>> 
>> I'd suggest other names like "ReflectEnum" or even "Reflect"
>> where EnumType is the name of enum that defines the list of values.
>> 
>> "ReflectOnly" doesn't tell us on what "only" applies. If I didn't know
>> the context, it sounds like something that does less work than regular
>> "Reflect”.
> 
> 
> I don’t see a good reason to complicate the bindings until this becomes more 
> common place.  For now, I would just implement HTMLLinkElement::as() to 
> behave as you want and leave the IDL unannotated, and we can revisit it at a 
> later time.

As I said, this is already used in quite a few places in the HTML spec:
- https://html.spec.whatwg.org/#dom-dir 
- https://html.spec.whatwg.org/#dom-link-as 

- https://html.spec.whatwg.org/#dom-link-referrerpolicy 

- https://html.spec.whatwg.org/#dom-link-updateviacache 

- https://html.spec.whatwg.org/#dom-a-referrerpolicy 

- https://html.spec.whatwg.org/#dom-img-referrerpolicy 

- https://html.spec.whatwg.org/#dom-iframe-referrerpolicy 

- https://html.spec.whatwg.org/#dom-track-kind 

- https://html.spec.whatwg.org/#dom-media-preload 

- https://html.spec.whatwg.org/#dom-area-referrerpolicy 

- https://html.spec.whatwg.org/#dom-th-scope 

- https://html.spec.whatwg.org/#dom-form-autocomplete 

- https://html.spec.whatwg.org/#dom-input-type 

- https://html.spec.whatwg.org/#dom-input-inputmode 

- https://html.spec.whatwg.org/#dom-button-type 

- https://html.spec.whatwg.org/#dom-textarea-inputmode 

- https://html.spec.whatwg.org/#dom-fs-method 

- https://html.spec.whatwg.org/#dom-fs-enctype 

- https://html.spec.whatwg.org/#dom-fs-formenctype 

- https://html.spec.whatwg.org/#dom-fs-formmethod 


Having a per-standard implementation in the bindings would likely be better 
than many potentially non-compliant ones.

--
 Chris Dumez

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


Re: [webkit-dev] "ReflectOnly" IDL equivalent

2017-06-09 Thread Yoav Weiss
Apologies for not updating this thread sooner.
I already went ahead and implemented
 `as()` to reflect what's
needed, and was planning to refactor that and add a "ReflectEnum" binding
at a later patch.
If that's not needed, I can just leave it as is.

On Fri, Jun 9, 2017 at 8:47 PM Sam Weinig  wrote:

>
>
> > On Jun 2, 2017, at 11:32 AM, Ryosuke Niwa  wrote:
> >
> > On Fri, Jun 2, 2017 at 9:18 AM, Chris Dumez  wrote:
> >> Hi,
> >>
> >> No, I do not believe WebKit supports ReflectOnly and this is not
> standard
> >> IDL either.
> >>
> >> The way to do it in WebKit would be to use a regular DOMString
> attribute, as
> >> in the specification and implement this logic in the c++ getter for this
> >> attribute. See HTMLElement::dir() for an example.
> >>
> >> We could also consider adding support for something like ReflectOnly in
> our
> >> bindings generator considering that this seems to be used quite a bit
> in the
> >> HTML specification and it would decrease code complexity a little.
> >> I’d actually be in favor of that.
> >
> > I'd suggest other names like "ReflectEnum" or even "Reflect"
> > where EnumType is the name of enum that defines the list of values.
> >
> > "ReflectOnly" doesn't tell us on what "only" applies. If I didn't know
> > the context, it sounds like something that does less work than regular
> > "Reflect”.
>
>
> I don’t see a good reason to complicate the bindings until this becomes
> more common place.  For now, I would just implement HTMLLinkElement::as()
> to behave as you want and leave the IDL unannotated, and we can revisit it
> at a later time.
>
> - Sam
___
webkit-dev mailing list
webkit-dev@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-dev


Re: [webkit-dev] "ReflectOnly" IDL equivalent

2017-06-09 Thread Sam Weinig


> On Jun 2, 2017, at 11:32 AM, Ryosuke Niwa  wrote:
> 
> On Fri, Jun 2, 2017 at 9:18 AM, Chris Dumez  wrote:
>> Hi,
>> 
>> No, I do not believe WebKit supports ReflectOnly and this is not standard
>> IDL either.
>> 
>> The way to do it in WebKit would be to use a regular DOMString attribute, as
>> in the specification and implement this logic in the c++ getter for this
>> attribute. See HTMLElement::dir() for an example.
>> 
>> We could also consider adding support for something like ReflectOnly in our
>> bindings generator considering that this seems to be used quite a bit in the
>> HTML specification and it would decrease code complexity a little.
>> I’d actually be in favor of that.
> 
> I'd suggest other names like "ReflectEnum" or even "Reflect"
> where EnumType is the name of enum that defines the list of values.
> 
> "ReflectOnly" doesn't tell us on what "only" applies. If I didn't know
> the context, it sounds like something that does less work than regular
> "Reflect”.


I don’t see a good reason to complicate the bindings until this becomes more 
common place.  For now, I would just implement HTMLLinkElement::as() to behave 
as you want and leave the IDL unannotated, and we can revisit it at a later 
time.

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


Re: [webkit-dev] "ReflectOnly" IDL equivalent

2017-06-02 Thread Ryosuke Niwa
On Fri, Jun 2, 2017 at 9:18 AM, Chris Dumez  wrote:
> Hi,
>
> No, I do not believe WebKit supports ReflectOnly and this is not standard
> IDL either.
>
> The way to do it in WebKit would be to use a regular DOMString attribute, as
> in the specification and implement this logic in the c++ getter for this
> attribute. See HTMLElement::dir() for an example.
>
> We could also consider adding support for something like ReflectOnly in our
> bindings generator considering that this seems to be used quite a bit in the
> HTML specification and it would decrease code complexity a little.
> I’d actually be in favor of that.

I'd suggest other names like "ReflectEnum" or even "Reflect"
where EnumType is the name of enum that defines the list of values.

"ReflectOnly" doesn't tell us on what "only" applies. If I didn't know
the context, it sounds like something that does less work than regular
"Reflect".

- R. Niwa
___
webkit-dev mailing list
webkit-dev@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-dev


Re: [webkit-dev] "ReflectOnly" IDL equivalent

2017-06-02 Thread Chris Dumez
Hi,

No, I do not believe WebKit supports ReflectOnly and this is not standard IDL 
either.

The way to do it in WebKit would be to use a regular DOMString attribute, as in 
the specification and implement this logic in the c++ getter for this 
attribute. See HTMLElement::dir() for an example.

We could also consider adding support for something like ReflectOnly in our 
bindings generator considering that this seems to be used quite a bit in the 
HTML specification and it would decrease code complexity a little.
I’d actually be in favor of that.

--
 Chris Dumez




> On Jun 1, 2017, at 10:57 PM, Yoav Weiss  wrote:
> 
> I'm working on the link preload feature and as part of that want to align it 
> to the spec from an IDL perspective.
> The `as` attribute is defined  as 
> an "enumerated attribute", which reflects only a finite set of known values. 
> That is important for feature detection purposes, so that developers can know 
> which `as` values are supported by the implementation.
> 
> In Blink this is done using `ReflectOnly 
> `
>  (pending CL ), and I'm 
> wondering what is the WebKit equivalent to implement attributes that are 
> limited to known values 
> .
> 
> Thanks! :)
> Yoav
> ___
> webkit-dev mailing list
> webkit-dev@lists.webkit.org
> https://lists.webkit.org/mailman/listinfo/webkit-dev

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


[webkit-dev] "ReflectOnly" IDL equivalent

2017-06-01 Thread Yoav Weiss
I'm working on the link preload feature and as part of that want to align
it to the spec from an IDL perspective.
The `as` attribute is defined 
as an "enumerated attribute", which reflects only a finite set of known
values. That is important for feature detection purposes, so that
developers can know which `as` values are supported by the implementation.

In Blink this is done using `ReflectOnly
`
(pending CL ), and I'm
wondering what is the WebKit equivalent to implement attributes that
are limited
to known values 
.

Thanks! :)
Yoav
___
webkit-dev mailing list
webkit-dev@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-dev