| Index: sky/specs/dom.md
|
| diff --git a/sky/specs/dom.md b/sky/specs/dom.md
|
| index 6cfe67fb122b9cedaf0386968a94f1a557695199..6dc8230a90b3f8a4620ec57bf750f3b053d99bca 100644
|
| --- a/sky/specs/dom.md
|
| +++ b/sky/specs/dom.md
|
| @@ -30,6 +30,21 @@ abstract class Node : EventTarget { // implemented in C++
|
| virtual void parentChangeCallback(ParentNode? oldParent, ParentNode? newParent, ChildNode? previousSibling, ChildNode? nextSibling); // O(N) in descendants (calls attached/detached)
|
| virtual void attachedCallback(); // noop
|
| virtual void detachedCallback(); // noop
|
| +
|
| + readonly attribute ElementStyleDeclarationList? style; // O(1)
|
| + // for nodes that aren't reachable from the Application Document, returns null
|
| + // (so in particular orphaned subtrees and nodes in module documents don't have one)
|
| + // -- should be updated when the node's parent chain changes (same time as, e.g.,
|
| + // the id hashtable is updated)
|
| + // also always returns null for ContentElement elements and ShadowRoot nodes
|
| + readonly attribute RenderNode? renderNode; // O(1)
|
| + // this will be null until the first time it is rendered
|
| + // it becomes null again when it is taken out of the rendering (see style.md)
|
| + abstract virtual LayoutManagerConstructor getLayoutManager(); // O(1)
|
| + void resetLayoutManager(); // O(1)
|
| + // if renderNode is non-null:
|
| + // sets renderNode.layoutManager to null
|
| + // sets renderNode.needsManager to true
|
| }
|
|
|
| abstract class ParentNode : Node {
|
| @@ -69,18 +84,11 @@ abstract class Element : ParentNode {
|
| virtual void attributeChangeCallback(String name, String? oldValue, String? newValue); // noop
|
| // TODO(ianh): does a node ever need to know when it's been redistributed?
|
|
|
| - readonly attribute ElementStyleDeclarationList style; // O(1)
|
| - readonly attribute RenderNode? renderNode; // O(1)
|
| - // this will be null until the first time it is rendered
|
| virtual LayoutManagerConstructor getLayoutManager(); // O(1)
|
| // default implementation looks up the 'display' property and returns the value:
|
| // if (renderNode)
|
| // return renderNode.getProperty(phDisplay);
|
| // return null;
|
| - void resetLayoutManager(); // O(1)
|
| - // if renderNode is non-null:
|
| - // sets renderNode.layoutManager to null
|
| - // sets renderNode.needsManager to true
|
| }
|
|
|
| class Text : Node {
|
| @@ -90,6 +98,9 @@ class Text : Node {
|
| void replaceWith(String node); // O(1) // special case override of Node.replaceWith()
|
|
|
| virtual void valueChangeCallback(String? oldValue, String? newValue); // noop
|
| +
|
| + virtual LayoutManagerConstructor getLayoutManager(); // O(1)
|
| + // default implementation returns TextLayoutManager's constructor
|
| }
|
|
|
| class DocumentFragment : ParentNode {
|
| @@ -110,20 +121,14 @@ class ShadowRoot : TreeScope {
|
|
|
| class Document : TreeScope {
|
| constructor (ChildArguments... nodes); // O(N) in number of arguments plus all their descendants
|
| -}
|
|
|
| -class SelectorQuery {
|
| - constructor (String selector); // O(F()) where F() is the complexity of the selector
|
| -
|
| - Boolean matches(Element element); // O(F())
|
| - Element? find(Element root); // O(N*F())+O(M) where N is the number of descendants and M the average depth of the tree
|
| - Element? find(DocumentFragment root); // O(N*F())+O(M) where N is the number of descendants and M the average depth of the tree
|
| - Element? find(TreeScope root); // O(N*F()) where N is the number of descendants
|
| - Array<Element> findAll(Element root); // O(N*F())+O(N*M) where N is the number of descendants and M the average depth of the tree
|
| - Array<Element> findAll(DocumentFragment root); // O(N*F())+O(N*M) where N is the number of descendants and M the average depth of the tree
|
| - Array<Element> findAll(TreeScope root); // O(N*F()) where N is the number of descendants
|
| + virtual LayoutManagerConstructor getLayoutManager(); // O(1)
|
| + // default implementation returns sky.rootLayoutManager;
|
| }
|
|
|
| +attribute LayoutManagerConstructor rootLayoutManager; // O(1)
|
| + // initially configured to return BlockLayoutManager
|
| +
|
|
|
| // BUILT-IN ELEMENTS
|
|
|
| @@ -254,4 +259,16 @@ interface ElementConstructor {
|
| constructor attribute String tagName;
|
| constructor attribute Boolean shadow;
|
| }
|
| +
|
| +class SelectorQuery {
|
| + constructor (String selector); // O(F()) where F() is the complexity of the selector
|
| +
|
| + Boolean matches(Element element); // O(F())
|
| + Element? find(Element root); // O(N*F())+O(M) where N is the number of descendants and M the average depth of the tree
|
| + Element? find(DocumentFragment root); // O(N*F())+O(M) where N is the number of descendants and M the average depth of the tree
|
| + Element? find(TreeScope root); // O(N*F()) where N is the number of descendants
|
| + Array<Element> findAll(Element root); // O(N*F())+O(N*M) where N is the number of descendants and M the average depth of the tree
|
| + Array<Element> findAll(DocumentFragment root); // O(N*F())+O(N*M) where N is the number of descendants and M the average depth of the tree
|
| + Array<Element> findAll(TreeScope root); // O(N*F()) where N is the number of descendants
|
| +}
|
| ```
|
|
|