Changes between Version 99 and Version 100 of WebKitIDL
- Timestamp:
- May 8, 2013, 1:29:13 AM (12 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
TabularUnified WebKitIDL
v99 v100 12 12 - [#Default Default(p)][[br]] 13 13 - [#Clamp Clamp(a,p)][[br]] 14 - [#Custom Custom(m,a), JSCustom(m,a), V8Custom(m,a), CustomGetter(a), JSCustomGetter(a), V8CustomGetter(a), CustomSetter(a), JSCustomSetter(a), V8CustomSetter(a)][[br]]14 - [#Custom Custom(m,a), CustomGetter(a), CustomSetter(a)][[br]] 15 15 - [#CallWith CallWith(i,m,a)][[br]] 16 16 - [#StrictTypeChecking StrictTypeChecking(m,a,p)][[br]] … … 27 27 - [#ConstructorTemplate ConstructorTemplate(i), InitializedByEventConstructor(a)][[br]] 28 28 - [#NamedConstructor NamedConstructor(i)][[br]] 29 - [#CustomConstructor CustomConstructor(i), JSCustomConstructor(i), V8CustomConstructor(i),ConstructorParameters(i)][[br]]29 - [#CustomConstructor CustomConstructor(i), ConstructorParameters(i)][[br]] 30 30 - [#Conditional Conditional(i,m,a)][[br]] 31 31 - [#V8EnabledAtRuntime V8EnabledAtRuntime(i,m,a)][[br]] … … 238 238 * IDL attributes for custom bindings are prefixed by "Custom". 239 239 240 For example, `[JSNoStaticTables]`, `[CustomGetter]`, `[V8CustomGetter]`,etc.240 For example, `[JSNoStaticTables]`, `[CustomGetter]`, etc. 241 241 242 242 = IDL attributes = #IDLAttributes … … 353 353 Hence calling `context.setColor(-1, 255, 257)` is equivalent to calling `setColorClamped(0, 255, 255)`. 354 354 355 == `[Custom]`(m,a), `[ JSCustom]`(m,a), `[V8Custom]`(m,a), `[CustomGetter]`(a), `[JSCustomGetter]`(a), `[V8CustomGetter]`(a), `[CustomSetter]`(a), `[JSCustomSetter]`(a), `[V8CustomSetter]`(a) == #Custom355 == `[Custom]`(m,a), `[CustomGetter]`(a), `[CustomSetter]`(a) == #Custom 356 356 357 357 Summary: They allow you to write bindings code manually as you like. 358 358 359 Usage: `[Custom]` , `[JSCustom]` and `[V8Custom]` can be specified on methods or attributes. `[CustomGetter]`, `[JSCustomGetter]`, `[V8CustomGetter]`, `[CustomSetter]`, `[JSCustomSetter]`, `[V8CustomSetter]` can be specified on attributes:359 Usage: `[Custom]` can be specified on methods or attributes. `[CustomGetter]`, `[CustomSetter]` can be specified on attributes: 360 360 {{{ 361 361 [Custom] void func(); … … 369 369 Before explaining the details, let us clarify the relationship of these IDL attributes. 370 370 371 * `[JSCustom]` on a method indicates that you can write JavaScriptCore custom bindings for the method. 372 * `[V8Custom]` on a method indicates that you can write V8 custom bindings for the method. 373 * `[Custom]` on a method is equivalent to `[JSCustom, V8Custom]`. 374 * `[JSCustomGetter]` or `[JSCustomSetter]` on an attribute indicates that you can write JavaScriptCore custom bindings for the attribute getter or setter. 375 * `[V8CustomGetter]` or `[V8CustomSetter]` on an attribute indicates that you can write V8 custom bindings for the attribute getter or setter. 376 * `[JSCustom]` on an attribute is equivalent to `[JSCustomGetter, JSCustomSetter]`. 377 * `[V8Custom]` on an attribute is equivalent to `[V8CustomGetter, V8CustomSetter]`. 378 * `[Custom]` on an attribute is equivalent to `[JSCustom, V8Custom]`, i.e. `[JSCustomGetter, JSCustomSetter, V8CustomGetter, V8CustomSetter]`. 371 * `[Custom]` on a method indicates that you can write JavaScriptCore custom bindings for the method. 372 * `[CustomGetter]` or `[CustomSetter]` on an attribute indicates that you can write JavaScriptCore custom bindings for the attribute getter or setter. 379 373 380 374 For example, if you want to write custom bindings only for an attribute getter of JavaScriptCore and V8 and an attribute setter of JavaScriptCore, you can specify `[CustomGetter, JSCustomSetter]`. 381 375 382 How to write custom bindings is different between JavaScriptCore and V8 or between a method andan attribute getter/setter, as follows:383 384 * Method in JavaScriptCore: Consider the following example:376 You can write custom bindings with JavaScriptCore for a method or an attribute getter/setter, as follows: 377 378 * Method: Consider the following example: 385 379 386 380 {{{ 387 381 interface XXX { 388 [ JSCustom] void func(int a, int b);382 [Custom] void func(int a, int b); 389 383 }; 390 384 }}} … … 398 392 Refer to WebCore/bindings/js/JSXXXCustom.cpp for more details. 399 393 400 * Attribute getter in JavaScriptCore: Consider the following example:394 * Attribute getter: Consider the following example: 401 395 402 396 {{{ 403 397 interface XXX { 404 attribute [ JSCustomGetter] DOMString str;398 attribute [CustomGetter] DOMString str; 405 399 }; 406 400 }}} … … 414 408 Refer to WebCore/bindings/js/JSXXXCustom.cpp for more details. 415 409 416 * Attribute setter in JavaScriptCore: Consider the following example:410 * Attribute setter: Consider the following example: 417 411 418 412 {{{ 419 413 interface XXX { 420 attribute [ JSCustomSetter] DOMString str;414 attribute [CustomSetter] DOMString str; 421 415 }; 422 416 }}} … … 428 422 } 429 423 }}} 430 Refer to WebCore/bindings/js/JSXXXCustom.cpp for more details.431 432 * Method in V8: Consider the following example:433 434 {{{435 interface XXX {436 [V8Custom] void func(int a, int b);437 };438 }}}439 You can write custom bindings in WebCore/bindings/v8/custom/V8XXXCustom.cpp:440 {{{441 v8::Handle<v8::Value> V8XXX::funcCallback(const v8::Arguments& args)442 {443 ...;444 }445 }}}446 Refer to WebCore/bindings/v8/custom/V8XXXCustom.cpp for more details.447 448 * Attribute getter in V8: Consider the following example:449 450 {{{451 interface XXX {452 attribute [V8CustomGetter] DOMString str;453 };454 }}}455 You can write custom bindings in WebCore/bindings/v8/custom/V8XXXCustom.cpp:456 {{{457 v8::Handle<v8::Value> V8XXX::strAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)458 {459 ...;460 }461 }}}462 Refer to WebCore/bindings/v8/custom/V8XXXCustom.cpp for more details.463 464 * Attribute setter in V8: Consider the following example:465 466 {{{467 interface XXX {468 attribute [V8CustomSetter] DOMString str;469 };470 }}}471 You can write custom bindings in WebCore/bindings/v8/custom/V8XXXCustom.cpp:472 {{{473 void V8XXX::strAccessorSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)474 {475 ...;476 }477 }}}478 Refer to WebCore/bindings/v8/custom/V8XXXCustom.cpp for more details.479 424 480 425 Note: ObjC, GObject and CPP bindings do not support custom bindings. … … 890 835 Whether you should allow an interface to have a named constructor or not depends on the spec of each interface. 891 836 892 == `[CustomConstructor]`(i), `[ JSCustomConstructor]`(i), `[V8CustomConstructor]`(i), `[ConstructorParameters]`(i) == #CustomConstructor837 == `[CustomConstructor]`(i), `[ConstructorParameters]`(i) == #CustomConstructor 893 838 894 839 Summary: They allow you to write custom bindings for constructors. 895 840 896 841 Usage: They can be specified on interfaces. 897 Regarding `[ConstructorParameters]`, the possible usage is `[ConstructorParameters=X]`, where `X` is the maximum number ofarguments of the constructor:842 Regarding `[ConstructorParameters]`, the possible usage is `[ConstructorParameters=X]`, where `X` is the number of mandatory arguments of the constructor: 898 843 {{{ 899 844 interface [ … … 910 855 Before explaining the details, let us clarify the relationship of these IDL attributes. 911 856 912 * `[JSCustomConstructor]` on an interface indicates that you can write JavaScriptCore custom bindings for the constructor. 913 * `[V8CustomConstructor]` on an interface indicates that you can write V8 custom bindings for the constructor. 914 * `[CustomConstructor]` is equivalent to `[JSCustomConstructor, V8CustomConstructor]`. 915 916 For example, if you specify `[Constructor, JSCustomConstructor]`, 917 then the constructor is generated only for V8 and you need to write JavaScriptCore custom bindings for the constructor. 918 919 How to write custom bindings is different between JavaScriptCore and V8. 920 921 * JavaScriptCore: Consider the following example: 857 * `[CustomConstructor]` on an interface indicates that you can write JavaScriptCore custom bindings for the constructor. 858 859 You can write custom bindings for JavaScriptCore as follows. 860 861 * Consider the following example: 922 862 923 863 {{{ … … 937 877 Refer to WebCore/bindings/js/JSXXXCustom.cpp for more details. 938 878 939 * V8: Consider the following example:940 941 {{{942 interface [943 CustomConstructor,944 ConstructorParameters=2945 ] XXX {946 };947 }}}948 Then you can write custom bindings in WebCore/bindings/v8/custom/V8XXXConstructorCustom.cpp:949 {{{950 v8::Handle<v8::Value> V8XXX::constructorCallback(const v8::Arguments& args)951 {952 ...;953 }954 }}}955 Refer to WebCore/bindings/v8/custom/V8XXXConstructorCustom.cpp for more details.956 957 879 `X` of `[ConstructorParameters=X]` is the number of mandatory arguments. 958 880 For example, if a constructor signature is `[Constructor(int a, int b, [Default=Undefined] optional int c, [Default=DefaultIsUndefined] optional int d)]`, then `X` is 2. 959 881 960 You do not need to specify `[ConstructorParameters]` if the interface does not have any of `[JSCustomConstructor]`, `[V8CustomConstructor]` or `[CustomConstructor]`.882 You do not need to specify `[ConstructorParameters]` if the interface does not have `[CustomConstructor]` extended attribute. 961 883 962 884 == `[Conditional]`(i,m,a) == #Conditional