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

Unified Diff: third_party/WebKit/Source/core/dom/custom/README.md

Issue 2003033004: Split custom element script use and move it into bindings (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address feedback. Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/dom/custom/README.md
diff --git a/third_party/WebKit/Source/core/dom/custom/README.md b/third_party/WebKit/Source/core/dom/custom/README.md
index b86a2e18838b70ccbba3020215b94be986b96c46..5d7f387bec4546340b26a952aa05109303968097 100644
--- a/third_party/WebKit/Source/core/dom/custom/README.md
+++ b/third_party/WebKit/Source/core/dom/custom/README.md
@@ -8,27 +8,46 @@ Contact Dominic Cooney
([dominicc@chromium.org](mailto:dominicc@chromium.org)) with
questions.
+### Code Location
+
+The custom elements implementation is split between core/dom and
+bindings/core/v8.
+
## Design
### Some Important Classes
###### CustomElementDefinition
-The definition of one ‘class’ of element; it consists of a
-tag name, and a prototype.
+The definition of one ‘class’ of element. This type is
+abstract to permit different kinds of definitions, although at the
+moment there is only one: ScriptCustomElementDefinition.
+
+ScriptCustomElementDefinition is linked to its constructor by an ID
+number. The ID number is stored in a map, keyed by constructor, in a
+hidden value of the CustomElementsRegistry wrapper. The ID is an index
+into a list of definitions stored in V8PerContextData.
+
+###### CustomElementDescriptor
+
+A tuple of local name, and custom element name. For autonomous custom
+elements, these strings are the same; for customized built-in elements
+these strings will be different. In that case, the local name is the
+element's tag name and the custom element name is related to the value
+of the “is” attribute.
###### CustomElementsRegistry
-Implements the `window.customElements` property. This maintains a list
-of definitions, and a mapping from constructors to an index in this
-list. The same map also has indexes as keys and prototypes as values.
+Implements the `window.customElements` property. This maintains the
+set of registered names. The wrapper of this object is used by
+ScriptCustomElementDefinition to cache state in V8.
###### V8HTMLElement Constructor
The `HTMLElement` interface constructor. When a custom element is
created from JavaScript all we have to go on is the constructor (in
-`new.target`); this uses CustomElementRegistry’s map to find
-which definition and prototype to use.
+`new.target`); this uses ScriptCustomElementDefinition's state to find
+the definition to use.
### Memory Management
@@ -38,7 +57,8 @@ the parser. On the other hand, we must not leak when a window can no
longer run script.
We use a V8HiddenValue on the CustomElementsRegistry wrapper which
-points to a map that keeps constructors and prototypes alive.
+points to a map that keeps constructors and prototypes alive. See
+ScriptCustomElementDefinition.
## Style Guide

Powered by Google App Engine
This is Rietveld 408576698