[webkit-help] Help understanding how WebCore/bindings/js files get generated

Julien Chaffraix julien.chaffraix at gmail.com
Sun Aug 21 13:06:45 PDT 2011


> You will probably need to modify HTMLAttributenames.in
> Since its a completely new attribute/event, you will have to make parser
> understand that there is something like 'yourevent' existing. You will need
> to modify corresponding element source's
> attribute parsing logic. If most of the elements need to support this you
> can as well do it in HTMLElement::parseMappedAttribute().

This is probably more complicated that it should. What you describe
will make that setAttribute (...) / getAttribute(...) work correctly
(which is neat but not necessary to get a new binding to work).

Hack the idl file and add a new attribute is more than enough as a first step.

What you describe also explains only how to add the event listener to
an existing IDL / class, it does not cover adding the new event
itself.

> I suggest you dont modify anything under DerivedSources as most of source
> documents are automatically generated by refering .idl files.

Suggest is an understatement, you *should not* hack the autogenerated
files as anything doing an IDL recreation will remove your changes.
This is the best way to nicely shoot yourself in the foot (and the
reason why there is a header telling you not to touch them).

>>   I am trying to understand how the files in WebCore/bindings/js files get
>> populated.

See http://trac.webkit.org/wiki/SourceDirectory

It is not populated in any way. It is what is what is not
autogenerated by our IDL scripts.

>> I have a vague understanding that there are .idl files that control the
>> generation of these files. But, if there is some sort of documentation
>> describing how these are structured, how to approach writing a new file (for
>> example, if I want to introduce a new DOM event), it will be really helpful.

The closest would be http://trac.webkit.org/wiki/IdlAttributes but it
is more describing the syntax that anything else. Look at the other
IDLs for help you.

Hope it helps,
Julien


More information about the webkit-help mailing list