[webkit-dev] "ReflectOnly" IDL equivalent

Chris Dumez cdumez at apple.com
Fri Jun 9 22:08:49 PDT 2017


> On Jun 9, 2017, at 11:47 AM, Sam Weinig <weinig at apple.com> wrote:
> 
> 
> 
>> On Jun 2, 2017, at 11:32 AM, Ryosuke Niwa <rniwa at webkit.org> wrote:
>> 
>> On Fri, Jun 2, 2017 at 9:18 AM, Chris Dumez <cdumez at apple.com> 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<EnumType>"
>> 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-dir>
- https://html.spec.whatwg.org/#dom-link-as <https://html.spec.whatwg.org/#dom-link-as>
- https://html.spec.whatwg.org/#dom-link-referrerpolicy <https://html.spec.whatwg.org/#dom-link-referrerpolicy>
- https://html.spec.whatwg.org/#dom-link-updateviacache <https://html.spec.whatwg.org/#dom-link-updateviacache>
- https://html.spec.whatwg.org/#dom-a-referrerpolicy <https://html.spec.whatwg.org/#dom-a-referrerpolicy>
- https://html.spec.whatwg.org/#dom-img-referrerpolicy <https://html.spec.whatwg.org/#dom-img-referrerpolicy>
- https://html.spec.whatwg.org/#dom-iframe-referrerpolicy <https://html.spec.whatwg.org/#dom-iframe-referrerpolicy>
- https://html.spec.whatwg.org/#dom-track-kind <https://html.spec.whatwg.org/#dom-track-kind>
- https://html.spec.whatwg.org/#dom-media-preload <https://html.spec.whatwg.org/#dom-media-preload>
- https://html.spec.whatwg.org/#dom-area-referrerpolicy <https://html.spec.whatwg.org/#dom-area-referrerpolicy>
- https://html.spec.whatwg.org/#dom-th-scope <https://html.spec.whatwg.org/#dom-th-scope>
- https://html.spec.whatwg.org/#dom-form-autocomplete <https://html.spec.whatwg.org/#dom-form-autocomplete>
- https://html.spec.whatwg.org/#dom-input-type <https://html.spec.whatwg.org/#dom-input-type>
- https://html.spec.whatwg.org/#dom-input-inputmode <https://html.spec.whatwg.org/#dom-input-inputmode>
- https://html.spec.whatwg.org/#dom-button-type <https://html.spec.whatwg.org/#dom-button-type>
- https://html.spec.whatwg.org/#dom-textarea-inputmode <https://html.spec.whatwg.org/#dom-textarea-inputmode>
- https://html.spec.whatwg.org/#dom-fs-method <https://html.spec.whatwg.org/#dom-fs-method>
- https://html.spec.whatwg.org/#dom-fs-enctype <https://html.spec.whatwg.org/#dom-fs-enctype>
- https://html.spec.whatwg.org/#dom-fs-formenctype <https://html.spec.whatwg.org/#dom-fs-formenctype>
- https://html.spec.whatwg.org/#dom-fs-formmethod <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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20170609/bf90fe6f/attachment.html>


More information about the webkit-dev mailing list