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

Side by Side Diff: sky/specs/apis.md

Issue 810173002: Specs: Revamp how styling works to make it possible (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 6 years 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 | sky/specs/style.md » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 APIs 1 APIs
2 ==== 2 ====
3 3
4 The Sky core API 4 The Sky core API
5 ---------------- 5 ----------------
6 6
7 ```javascript 7 ```javascript
8 module 'sky:core' { 8 module 'sky:core' {
9 9
10 // EVENTS 10 // EVENTS
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 118
119 // Returns a new Array and new Attr instances every time. 119 // Returns a new Array and new Attr instances every time.
120 Array<Attr> getAttributes(); // O(N) in number of attributes 120 Array<Attr> getAttributes(); // O(N) in number of attributes
121 121
122 readonly attribute ShadowRoot? shadowRoot; // O(1) // returns the shadow roo t 122 readonly attribute ShadowRoot? shadowRoot; // O(1) // returns the shadow roo t
123 Array<ContentElement> getDestinationInsertionPoints(); // O(N) in number of insertion points the node is in 123 Array<ContentElement> getDestinationInsertionPoints(); // O(N) in number of insertion points the node is in
124 124
125 virtual void endTagParsedCallback(); // noop 125 virtual void endTagParsedCallback(); // noop
126 virtual void attributeChangeCallback(String name, String? oldValue, String? newValue); // noop 126 virtual void attributeChangeCallback(String name, String? oldValue, String? newValue); // noop
127 // TODO(ianh): does a node ever need to know when it's been redistributed? 127 // TODO(ianh): does a node ever need to know when it's been redistributed?
128
129 readonly attribute StyleDeclarationList style; // O(1)
130 virtual LayoutManagerConstructor getLayoutManager(RenderNode renderNode); // O(1)
131 // default implementation looks up the 'display' property and returns the value:
132 // if (renderNode)
133 // return renderNode.getProperty(phDisplay);
134 // return null;
135 readonly attribute RenderNode? renderNode; // O(1)
136 // this will be null until the first time it is rendered
137 void resetLayoutManager(); // O(1)
138 // if renderNode is non-null:
139 // sets renderNode.layoutManager to null
140 // sets renderNode.needsManager to true
128 } 141 }
129 142
130 class Text : Node { 143 class Text : Node {
131 constructor (String value = ''); // O(1) 144 constructor (String value = ''); // O(1)
132 attribute String value; // O(1) 145 attribute String value; // O(1)
133 146
134 void replaceWith(String node); // O(1) // special case override of Node.repl aceWith() 147 void replaceWith(String node); // O(1) // special case override of Node.repl aceWith()
135 148
136 virtual void valueChangeCallback(String? oldValue, String? newValue); // noo p 149 virtual void valueChangeCallback(String? oldValue, String? newValue); // noo p
137 } 150 }
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 constructor attribute String tagName; // O(1) // "script" 210 constructor attribute String tagName; // O(1) // "script"
198 constructor attribute Boolean shadow; // O(1) // false 211 constructor attribute Boolean shadow; // O(1) // false
199 } 212 }
200 class StyleElement : Element { 213 class StyleElement : Element {
201 constructor (Dictionary<String> attributes, ChildArguments... nodes); // O(M +N), M = number of attributes, N = number of nodes plus all their descendants 214 constructor (Dictionary<String> attributes, ChildArguments... nodes); // O(M +N), M = number of attributes, N = number of nodes plus all their descendants
202 constructor (ChildArguments... nodes); // shorthand 215 constructor (ChildArguments... nodes); // shorthand
203 constructor (Dictionary<String> attributes); // shorthand 216 constructor (Dictionary<String> attributes); // shorthand
204 constructor (); // shorthand 217 constructor (); // shorthand
205 constructor attribute String tagName; // O(1) // "style" 218 constructor attribute String tagName; // O(1) // "style"
206 constructor attribute Boolean shadow; // O(1) // false 219 constructor attribute Boolean shadow; // O(1) // false
220
221 Array<Rule> getRules(); // O(N) in rules
207 } 222 }
208 class ContentElement : Element { 223 class ContentElement : Element {
209 constructor (Dictionary<String> attributes, ChildArguments... nodes); // O(M +N), M = number of attributes, N = number of nodes plus all their descendants 224 constructor (Dictionary<String> attributes, ChildArguments... nodes); // O(M +N), M = number of attributes, N = number of nodes plus all their descendants
210 constructor (ChildArguments... nodes); // shorthand 225 constructor (ChildArguments... nodes); // shorthand
211 constructor (Dictionary<String> attributes); // shorthand 226 constructor (Dictionary<String> attributes); // shorthand
212 constructor (); // shorthand 227 constructor (); // shorthand
213 constructor attribute String tagName; // O(1) // "content" 228 constructor attribute String tagName; // O(1) // "content"
214 constructor attribute Boolean shadow; // O(1) // false 229 constructor attribute Boolean shadow; // O(1) // false
215 230
216 Array<Node> getDistributedNodes(); // O(N) in distributed nodes 231 Array<Node> getDistributedNodes(); // O(N) in distributed nodes
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 typedef NewType OldType; // useful when OldType is a commonly-used union 396 typedef NewType OldType; // useful when OldType is a commonly-used union
382 397
383 callback CallbackName ReturnType (ArgumentType argumentName); 398 callback CallbackName ReturnType (ArgumentType argumentName);
384 399
385 class ClassName { 400 class ClassName {
386 // a class corresponds to a JavaScript prototype 401 // a class corresponds to a JavaScript prototype
387 // corresponds to a WebIDL 'interface' 402 // corresponds to a WebIDL 'interface'
388 } 403 }
389 404
390 abstract class Superclass { 405 abstract class Superclass {
391 // an abstract class can't have a constructor 406 // an abstract class can't have a non-abstract constructor
392 // in every other respect it is the same as a regular class 407 // an abstract class may have abstract constructors and methods
408 // an abstract class may have everything else a class can have
409
410 abstract constructor ();
411 // this indicates that non-abstract subclasses must have a constructor wit h the given arguments
412
413 abstract ReturnType methodCallback();
414 // this method does nothing, but is included to describe the interface tha t subclasses will implement
415 // a non-abstract class must have an explicit implementation of all inheri ted abstract methods
416
393 } 417 }
394 418
395 class Subclass : Superclass { 419 class Subclass : Superclass {
396 // properties 420 // properties
397 readonly attribute ReturnType attributeName; // getter 421 readonly attribute ReturnType attributeName; // getter
398 attribute ReturnType attributeName; // getter and setter 422 attribute ReturnType attributeName; // getter and setter
399 423
400 // methods and constructors 424 // methods and constructors
401 constructor (); 425 constructor ();
402 ReturnType method(); 426 ReturnType method();
403 // When the platform calls this method, it always invokes the "real" metho d, even if it's been 427 // When the platform calls this method, it always invokes the "real" metho d, even if it's been
404 // deleted from the prototypes (as if it took a reference to the method at startup, and stored 428 // deleted from the prototypes (as if it took a reference to the method at startup, and stored
405 // state using Symbols) 429 // state using Symbols)
406 // Calling a method with fewer arguments than defined will throw. 430 // Calling a method with fewer arguments than defined will throw.
407 // Calling a method with more arguments ignores the extra arguments. 431 // Calling a method with more arguments ignores the extra arguments.
408 virtual ReturnType methodCallback(); 432 virtual ReturnType methodCallback();
409 // when the platform calls this, it actually calls it the way JS would, so author overrides do 433 // when the platform calls this, it actually calls it the way JS would, so author overrides do
410 // affect what gets called. Make sure if you override it that you call the superclass implementation! 434 // affect what gets called. Make sure if you override it that you call the superclass implementation!
411 // The default implementations of 'virtual' methods all end by calling the identically named method 435 // The default implementations of 'virtual' methods all end by calling the identically named method
412 // on the superclass, if there is such a method. 436 // on the superclass, if there is such a method.
413 437
438 // non-abstract classes cannot have abstract constructors or methods, and in particular, must
439 // have explicit non-abstract versions of any inherited abstract constructor s or methods
440
414 // properties on the constructor 441 // properties on the constructor
415 constructor readonly attribute ReturnType staticName; 442 constructor readonly attribute ReturnType staticName;
416 443
417 // private APIs - see below 444 // private APIs - see below
418 private void method(); 445 private void method();
419 446
420 // arguments and overloading are done as follows 447 // arguments and overloading are done as follows
421 // note that the argument names are only for documentation purposes 448 // note that the argument names are only for documentation purposes
422 ReturnType method(ArgumentType argumentName1, ArgumentType argumentName2); 449 ReturnType method(ArgumentType argumentName1, ArgumentType argumentName2);
423 // the last argument's type can have "..." appended to it to indicate a vara rgs-like situation 450 // the last argument's type can have "..." appended to it to indicate a vara rgs-like situation
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 499
473 The following types are available: 500 The following types are available:
474 501
475 * ``Integer`` - WebIDL ``long long`` 502 * ``Integer`` - WebIDL ``long long``
476 * ``Float`` - WebIDL ``double`` 503 * ``Float`` - WebIDL ``double``
477 * ``Infinity`` - singleton type with value ``Infinity`` 504 * ``Infinity`` - singleton type with value ``Infinity``
478 * ``String`` - WebIDL ``USVString`` 505 * ``String`` - WebIDL ``USVString``
479 * ``Boolean`` - WebIDL ``boolean`` 506 * ``Boolean`` - WebIDL ``boolean``
480 # ``Object`` - WebIDL ``object`` (``ClassName`` can be used as a literal for thi s type) 507 # ``Object`` - WebIDL ``object`` (``ClassName`` can be used as a literal for thi s type)
481 * ``ClassName`` - an instance of the class ClassName 508 * ``ClassName`` - an instance of the class ClassName
509 * ``Class<ClassName>`` - a class ClassName or one of its subclasses (not an inst ance)
482 * ``DictionaryName`` - an instance of the dictionary DictionaryName 510 * ``DictionaryName`` - an instance of the dictionary DictionaryName
483 * ``Promise<Type>`` - WebIDL ``Promise<T>`` 511 * ``Promise<Type>`` - WebIDL ``Promise<T>``
484 * ``Generator<Type>`` - An ECMAScript generator function that returns data of th e given type 512 * ``Generator<Type>`` - An ECMAScript generator function that returns data of th e given type
485 * ``Array<Type>`` - WebIDL ``sequence<T>`` 513 * ``Array<Type>`` - WebIDL ``sequence<T>``
486 * ``Dictionary<Type>`` - unordered set of name-value String-Type pairs with no d uplicate names 514 * ``Dictionary<Type>`` - unordered set of name-value String-Type pairs with no d uplicate names
487 * ``Type?`` - union of Type and the singleton type with value ``null`` (WebIDL n ullable) 515 * ``Type?`` - union of Type and the singleton type with value ``null`` (WebIDL n ullable)
488 * ``(Type1 or Type2)`` - union of Type1 and Type2 (WebIDL union) 516 * ``(Type1 or Type2)`` - union of Type1 and Type2 (WebIDL union)
489 * ``any`` - union of all types (WebIDL ``any``) 517 * ``any`` - union of all types (WebIDL ``any``)
490 518
491 Methods that return nothing (undefined, in JS) use the keyword "void" 519 Methods that return nothing (undefined, in JS) use the keyword "void"
(...skipping 24 matching lines...) Expand all
516 the core mojo fabric JS API sky:mojo:fabric:core 544 the core mojo fabric JS API sky:mojo:fabric:core
517 the asyncWait/cancelWait mojo fabric JS API (interface to IPC thread) sky:moj o:fabric:ipc 545 the asyncWait/cancelWait mojo fabric JS API (interface to IPC thread) sky:moj o:fabric:ipc
518 the mojom for the shell, proxying through C++ so that the shell pipe isn't exp osed sky:mojo:shell 546 the mojom for the shell, proxying through C++ so that the shell pipe isn't exp osed sky:mojo:shell
519 the sky API sky:core 547 the sky API sky:core
520 the sky debug symbols for private APIs sky:debug 548 the sky debug symbols for private APIs sky:debug
521 ``` 549 ```
522 550
523 TODO(ianh): determine if we want to separate the "this" from the 551 TODO(ianh): determine if we want to separate the "this" from the
524 Document, especially for Modules, so that exposing a module's element 552 Document, especially for Modules, so that exposing a module's element
525 doesn't expose the module's exports attribute. 553 doesn't expose the module's exports attribute.
OLDNEW
« no previous file with comments | « no previous file | sky/specs/style.md » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698