Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(412)

Side by Side Diff: third_party/WebKit/Source/bindings/IDLExtendedAttributes.md

Issue 2043503002: Add [CEReactions] IDL attributes for Custom Elements V1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: yukishiino review Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/bindings/IDLExtendedAttributes.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 Extended attributes are generally not inherited: only extended attributes on the interface itself are consulted. However, there are a handful of extended attrib utes that are inherited (applying them to an ancestor interface applies them to the descendants). These are extended attributes that affect memory management, a nd currently consists of `[DependentLifetime]` and `[ActiveScriptWrappable]`; th e up-to-date list is [compute_dependencies.INHERITED_EXTENDED_ATTRIBUTES](https: //code.google.com/p/chromium/codesearch#chromium/src/third_party/WebKit/Source/b indings/scripts/compute_dependencies.py&q=INHERITED_EXTENDED_ATTRIBUTES). 133 Extended attributes are generally not inherited: only extended attributes on the interface itself are consulted. However, there are a handful of extended attrib utes that are inherited (applying them to an ancestor interface applies them to the descendants). These are extended attributes that affect memory management, a nd currently consists of `[DependentLifetime]` and `[ActiveScriptWrappable]`; th e up-to-date list is [compute_dependencies.INHERITED_EXTENDED_ATTRIBUTES](https: //code.google.com/p/chromium/codesearch#chromium/src/third_party/WebKit/Source/b indings/scripts/compute_dependencies.py&q=INHERITED_EXTENDED_ATTRIBUTES).
134 134
135 ## Standard Web IDL Extended Attributes 135 ## Standard Web IDL Extended Attributes
136 136
137 These are defined in the [ECMAScript-specific extended attributes](http://heycam .github.io/webidl/#es-extended-attributes) section of the [Web IDL spec](http:// heycam.github.io/webidl/), and alter the binding behavior. 137 These are defined in the [ECMAScript-specific extended attributes](http://heycam .github.io/webidl/#es-extended-attributes) section of the [Web IDL spec](http:// heycam.github.io/webidl/), and alter the binding behavior.
138 138
139 *** note 139 *** note
140 Unsupported: `[ArrayClass]`, `[ImplicitThis]`, `[LenientThis]`, `[NamedPropertie sObject]`, `[TreatNonCallableAsNull]` 140 Unsupported: `[ArrayClass]`, `[ImplicitThis]`, `[LenientThis]`, `[NamedPropertie sObject]`, `[TreatNonCallableAsNull]`
141 *** 141 ***
142 142
143 ### [CEReactions] _(m, a)_
144
145 Standard: [CEReactions](https://html.spec.whatwg.org/multipage/scripting.html#ce reactions)
146
147 Summary: `[CEReactoins]` indicates that
148 [custom element reactions](https://html.spec.whatwg.org/multipage/scripting.html #concept-custom-element-reaction)
149 are triggered for this method or attribute.
150
151 Usage: `[CEReactions]` takes no arguments.
152
143 ### [Clamp] _(a, p)_ 153 ### [Clamp] _(a, p)_
144 154
145 Standard: [Clamp](https://heycam.github.io/webidl/#Clamp) 155 Standard: [Clamp](https://heycam.github.io/webidl/#Clamp)
146 156
147 Summary: `[Clamp]` indicates that when an ECMAScript Number is converted to the IDL type, out of range values will be clamped to the range of valid values, rath er than using the operators that use a modulo operation (ToInt32, ToUint32, etc. ). 157 Summary: `[Clamp]` indicates that when an ECMAScript Number is converted to the IDL type, out of range values will be clamped to the range of valid values, rath er than using the operators that use a modulo operation (ToInt32, ToUint32, etc. ).
148 158
149 Usage: The `[Clamp]` extended attribute MUST NOT appear on a read only attribute , or an attribute, operation argument or dictionary member that is not of an int eger type. 159 Usage: The `[Clamp]` extended attribute MUST NOT appear on a read only attribute , or an attribute, operation argument or dictionary member that is not of an int eger type.
150 160
151 `[Clamp]` can be specified on writable attributes: 161 `[Clamp]` can be specified on writable attributes:
152 162
(...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after
847 void V8XXX::visitDOMWrapper(DOMDataStore* store, void* object, v8::Persistent<v8 ::Object> wrapper) 857 void V8XXX::visitDOMWrapper(DOMDataStore* store, void* object, v8::Persistent<v8 ::Object> wrapper)
848 { 858 {
849 ... 859 ...
850 } 860 }
851 ``` 861 ```
852 862
853 ### [CustomElementCallbacks] _(m, a)_ 863 ### [CustomElementCallbacks] _(m, a)_
854 864
855 Summary: Wraps the method/accessor with a Custom Elements "callback delivery sco pe" which will dispatch Custom Element callbacks (createdCallback, attributeChan gedCallback, etc.) before returning to script. 865 Summary: Wraps the method/accessor with a Custom Elements "callback delivery sco pe" which will dispatch Custom Element callbacks (createdCallback, attributeChan gedCallback, etc.) before returning to script.
856 866
867 *** note
868 This attribute is only for Custom Elements V0,
869 and is superceded by `[CEReactions]` for V1.
870 ***
871
857 If the method/accessor creates elements or modifies DOM nodes in any way, it sho uld be tagged with this extended attribute. Even if you're not a Node, this may apply to you! For example [DOMTokenList.toggle](https://code.google.com/p/chromi um/codesearch#chromium/src/third_party/WebKit/Source/core/dom/DOMTokenList.idl&l =34) can be reflected in the attribute of its associated element, so it needs to be tagged with CustomElementCallbacks. If the method/accessor only calls someth ing that may modify the DOM (for example, it runs user script as a callback) you don't need to tag your method with `[CustomElementCallbacks]`; that is the resp onsibility of the binding that actually modifies the DOM. In general over-applyi ng this extended attribute is safe, with one caveat: 872 If the method/accessor creates elements or modifies DOM nodes in any way, it sho uld be tagged with this extended attribute. Even if you're not a Node, this may apply to you! For example [DOMTokenList.toggle](https://code.google.com/p/chromi um/codesearch#chromium/src/third_party/WebKit/Source/core/dom/DOMTokenList.idl&l =34) can be reflected in the attribute of its associated element, so it needs to be tagged with CustomElementCallbacks. If the method/accessor only calls someth ing that may modify the DOM (for example, it runs user script as a callback) you don't need to tag your method with `[CustomElementCallbacks]`; that is the resp onsibility of the binding that actually modifies the DOM. In general over-applyi ng this extended attribute is safe, with one caveat:
858 873
859 * This extended attribute MUST NOT be used on members that operate on non-main t hreads, because the callback delivery scope accesses statics. 874 * This extended attribute MUST NOT be used on members that operate on non-main t hreads, because the callback delivery scope accesses statics.
860 * Basically: Don't apply this extended attribute to anything that can be called from a worker. 875 * Basically: Don't apply this extended attribute to anything that can be called from a worker.
861 * This criterion (accessible by workers) depends on implementation and cannot ea sily be checked from the IDL or C++ headers (it includes obvious cases like `[Ex posed=Worker]`, where there is a constructor on the (JS) global object, but also cases where the C++ creates or accesses methods internally), so please be caref ul. 876 * This criterion (accessible by workers) depends on implementation and cannot ea sily be checked from the IDL or C++ headers (it includes obvious cases like `[Ex posed=Worker]`, where there is a constructor on the (JS) global object, but also cases where the C++ creates or accesses methods internally), so please be caref ul.
862 877
863 Usage: `[CustomElementCallbacks]` takes no arguments. 878 Usage: `[CustomElementCallbacks]` takes no arguments.
864 879
865 ### [Default] _(p)_ 880 ### [Default] _(p)_
866 881
(...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after
1561 Copyright (C) 2009 Apple Inc. All rights reserved. 1576 Copyright (C) 2009 Apple Inc. All rights reserved.
1562 1577
1563 Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1578 Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1564 1579
1565 1. Redistributions of source code must retain the above copyright notice, this l ist of conditions and the following disclaimer. 1580 1. Redistributions of source code must retain the above copyright notice, this l ist of conditions and the following disclaimer.
1566 1581
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. 1582 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.
1568 1583
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. 1584 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.
1570 *** 1585 ***
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/bindings/IDLExtendedAttributes.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698