OLD | NEW |
1 # Blink IDL Extended Attributes | 1 # Blink IDL Extended Attributes |
2 | 2 |
3 [TOC] | 3 [TOC] |
4 | 4 |
5 ## Introduction | 5 ## Introduction |
6 | 6 |
7 The main interest in extended attributes are their _semantics_: Blink implements
many more extended attributes than the Web IDL standard, to specify various beh
avior. | 7 The main interest in extended attributes are their _semantics_: Blink implements
many more extended attributes than the Web IDL standard, to specify various beh
avior. |
8 | 8 |
9 The authoritative list of allowed extended attributes and values is [bindings/ID
LExtendedAttributes.txt](https://code.google.com/p/chromium/codesearch#chromium/
src/third_party/WebKit/Source/bindings/IDLExtendedAttributes.txt). This is compl
ete but not necessarily precise (there may be unused extended attributes or valu
es), since validation is run on build, but coverage isn't checked. | 9 The authoritative list of allowed extended attributes and values is [bindings/ID
LExtendedAttributes.txt](https://code.google.com/p/chromium/codesearch#chromium/
src/third_party/WebKit/Source/bindings/IDLExtendedAttributes.txt). This is compl
ete but not necessarily precise (there may be unused extended attributes or valu
es), since validation is run on build, but coverage isn't checked. |
10 | 10 |
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 ```js | 405 ```js |
406 window.screenX; // Evaluates to 0 | 406 window.screenX; // Evaluates to 0 |
407 window.screenX = "foo"; | 407 window.screenX = "foo"; |
408 window.screenX; // Evaluates to "foo" | 408 window.screenX; // Evaluates to "foo" |
409 delete window.screenX; | 409 delete window.screenX; |
410 window.screenX; // Evaluates to 0. 0 remains. | 410 window.screenX; // Evaluates to 0. 0 remains. |
411 ``` | 411 ``` |
412 | 412 |
413 Whether `[Replaceable]` should be specified or not depends on the spec of each a
ttribute. | 413 Whether `[Replaceable]` should be specified or not depends on the spec of each a
ttribute. |
414 | 414 |
415 ### [SameObject] _(m)_ | 415 ### [SameObject] _(a)_ |
416 | 416 |
417 Standard: [SameObject](http://heycam.github.io/webidl/#SameObject) | 417 Standard: [SameObject](http://heycam.github.io/webidl/#SameObject) |
418 | 418 |
419 Summary: Signals that a `readonly` attribute that returns an object type always
returns the same object. | 419 Summary: Signals that a `readonly` attribute that returns an object type always
returns the same object. |
420 | 420 |
421 The resulting object is cached in the binding layer and re-used in later calls i
n order to guarantee that the attribute always returns the same object. | 421 This attribute has no effect on code generation and should simply be used in Bli
nk IDL files if the specification uses it. If you want the binding layer to cach
e the resulting object, use `[SaveSameObject]`. |
422 | 422 |
423 ### [TreatNullAs] _(a,p)_, [TreatUndefinedAs] _(a,p)_ | 423 ### [TreatNullAs] _(a,p)_, [TreatUndefinedAs] _(a,p)_ |
424 | 424 |
425 Standard: [TreatNullAs](http://heycam.github.io/webidl/#TreatNullAs) | 425 Standard: [TreatNullAs](http://heycam.github.io/webidl/#TreatNullAs) |
426 | 426 |
427 `[TreatUndefinedAs]` has been been removed from the spec. | 427 `[TreatUndefinedAs]` has been been removed from the spec. |
428 | 428 |
429 Summary: They control the behavior when a JavaScript null or undefined is passed
to a DOMString attribute or parameter. | 429 Summary: They control the behavior when a JavaScript null or undefined is passed
to a DOMString attribute or parameter. |
430 | 430 |
431 Implementation: **Non-standard:** Web IDL specifies the EmptyString identifier f
or both these extended attributes, and `Null` and `Missing` for `TreatUndefinedA
s`. Blink uses the `NullString` identifier instead of `EmptyString` which yields
a Blink null string, corresponding to JavaScript `null`, for which both `String
::IsEmpty()` and `String::IsNull()` return true, instead of the empty string `""
`, which is empty but not `null`. This is for performance reasons; see [Strings
in Blink](https://docs.google.com/a/google.com/document/d/1kOCUlJdh2WJMJGDf-WoEQ
hmnjKLaOYRbiHz5TiGJl14/edit) for reference. It also does not implement `TreatUnd
efinedAs=Null` or `TreatUndefinedAs=Missing`. | 431 Implementation: **Non-standard:** Web IDL specifies the EmptyString identifier f
or both these extended attributes, and `Null` and `Missing` for `TreatUndefinedA
s`. Blink uses the `NullString` identifier instead of `EmptyString` which yields
a Blink null string, corresponding to JavaScript `null`, for which both `String
::IsEmpty()` and `String::IsNull()` return true, instead of the empty string `""
`, which is empty but not `null`. This is for performance reasons; see [Strings
in Blink](https://docs.google.com/a/google.com/document/d/1kOCUlJdh2WJMJGDf-WoEQ
hmnjKLaOYRbiHz5TiGJl14/edit) for reference. It also does not implement `TreatUnd
efinedAs=Null` or `TreatUndefinedAs=Missing`. |
(...skipping 808 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1240 do: | 1240 do: |
1241 | 1241 |
1242 ```webidl | 1242 ```webidl |
1243 // Overload can be replaced with optional if `[RuntimeEnabled]` is removed | 1243 // Overload can be replaced with optional if `[RuntimeEnabled]` is removed |
1244 foo(long x); | 1244 foo(long x); |
1245 [RuntimeEnabled=FeatureName] foo(long x, long y); | 1245 [RuntimeEnabled=FeatureName] foo(long x, long y); |
1246 ``` | 1246 ``` |
1247 | 1247 |
1248 For more information, see [RuntimeEnabledFeatures](https://code.google.com/p/chr
omium/codesearch#chromium/src/third_party/WebKit/Source/platform/RuntimeEnabledF
eatures.in). | 1248 For more information, see [RuntimeEnabledFeatures](https://code.google.com/p/chr
omium/codesearch#chromium/src/third_party/WebKit/Source/platform/RuntimeEnabledF
eatures.in). |
1249 | 1249 |
| 1250 ### [SaveSameObject] _(a)_ |
| 1251 |
| 1252 Summary: Caches the resulting object and always returns the same object. |
| 1253 |
| 1254 When specified, caches the resulting object and returns it in later calls so tha
t the attribute always returns the same object. Must be accompanied with `[SameO
bject]`. |
| 1255 |
1250 ### [SetWrapperReferenceFrom=xxx] _(i)_ | 1256 ### [SetWrapperReferenceFrom=xxx] _(i)_ |
1251 | 1257 |
1252 ### [SetWrapperReferenceTo=xxx] _(i)_ | 1258 ### [SetWrapperReferenceTo=xxx] _(i)_ |
1253 | 1259 |
1254 Summary: This generates code that allows you to set up implicit references betwe
en wrappers which can be used to keep wrappers alive during GC. | 1260 Summary: This generates code that allows you to set up implicit references betwe
en wrappers which can be used to keep wrappers alive during GC. |
1255 | 1261 |
1256 Usage: `[SetWrapperReferenceFrom]` and `[SetWrapperReferenceTo]` can be specifie
d on an interface. Use `[Custom=VisitDOMWrapper]` instead if want to write a cus
tom function. | 1262 Usage: `[SetWrapperReferenceFrom]` and `[SetWrapperReferenceTo]` can be specifie
d on an interface. Use `[Custom=VisitDOMWrapper]` instead if want to write a cus
tom function. |
1257 | 1263 |
1258 ```webidl | 1264 ```webidl |
1259 [ | 1265 [ |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1555 Copyright (C) 2009 Apple Inc. All rights reserved. | 1561 Copyright (C) 2009 Apple Inc. All rights reserved. |
1556 | 1562 |
1557 Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met: | 1563 Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met: |
1558 | 1564 |
1559 1. Redistributions of source code must retain the above copyright notice, this l
ist of conditions and the following disclaimer. | 1565 1. Redistributions of source code must retain the above copyright notice, this l
ist of conditions and the following disclaimer. |
1560 | 1566 |
1561 2. Redistributions in binary form must reproduce the above copyright notice, thi
s list of conditions and the following disclaimer in the documentation and/or ot
her materials provided with the distribution. | 1567 2. Redistributions in binary form must reproduce the above copyright notice, thi
s list of conditions and the following disclaimer in the documentation and/or ot
her materials provided with the distribution. |
1562 | 1568 |
1563 THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS “AS IS” AND ANY EXP
RESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIE
S OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, I
NCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMI
TED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFI
TS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHE
THER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSI
BILITY OF SUCH DAMAGE. | 1569 THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS “AS IS” AND ANY EXP
RESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIE
S OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, I
NCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMI
TED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFI
TS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHE
THER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSI
BILITY OF SUCH DAMAGE. |
1564 *** | 1570 *** |
OLD | NEW |