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

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

Issue 836193002: Specs: Move default layout manager stuff from default styles to getLayoutManager() (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 11 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 | sky/specs/modules.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 Sky DOM APIs 1 Sky DOM APIs
2 ============ 2 ============
3 3
4 ```javascript 4 ```javascript
5 5
6 // DOM 6 // DOM
7 7
8 typedef ChildNode (Element or Text); 8 typedef ChildNode (Element or Text);
9 typedef ChildArgument (Element or Text or String); 9 typedef ChildArgument (Element or Text or String);
10 10
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 116
117 class ShadowRoot : TreeScope { 117 class ShadowRoot : TreeScope {
118 constructor (Element host); // O(1) // note that there is no way in the API to use a newly created ShadowRoot 118 constructor (Element host); // O(1) // note that there is no way in the API to use a newly created ShadowRoot
119 readonly attribute Element host; // O(1) 119 readonly attribute Element host; // O(1)
120 } 120 }
121 121
122 class Document : TreeScope { 122 class Document : TreeScope {
123 constructor (ChildArguments... nodes); // O(N) in number of arguments plus all their descendants 123 constructor (ChildArguments... nodes); // O(N) in number of arguments plus all their descendants
124 124
125 virtual LayoutManagerConstructor getLayoutManager(); // O(1) 125 virtual LayoutManagerConstructor getLayoutManager(); // O(1)
126 // default implementation returns sky.rootLayoutManager; 126 // returns sky.rootLayoutManager;
127 } 127 }
128 128
129 attribute LayoutManagerConstructor rootLayoutManager; // O(1) 129 attribute LayoutManagerConstructor rootLayoutManager; // O(1)
130 // initially configured to return BlockLayoutManager 130 // initially configured to return BlockLayoutManager
131 131
132 132
133 // BUILT-IN ELEMENTS 133 // BUILT-IN ELEMENTS
134 134
135 class ImportElement : Element { 135 class ImportElement : Element {
136 constructor (Dictionary<String> attributes, ChildArguments... nodes); // O(M+N ), M = number of attributes, N = number of nodes plus all their descendants 136 constructor (Dictionary<String> attributes, ChildArguments... nodes); // O(M+N ), M = number of attributes, N = number of nodes plus all their descendants
137 constructor (ChildArguments... nodes); // shorthand 137 constructor (ChildArguments... nodes); // shorthand
138 constructor (Dictionary<String> attributes); // shorthand 138 constructor (Dictionary<String> attributes); // shorthand
139 constructor (); // shorthand 139 constructor (); // shorthand
140 constructor attribute String tagName; // O(1) // "import" 140 constructor attribute String tagName; // O(1) // "import"
141 constructor attribute Boolean shadow; // O(1) // false 141 constructor attribute Boolean shadow; // O(1) // false
142
143 virtual LayoutManagerConstructor getLayoutManager(); // O(1)
144 // returns null
142 } 145 }
143 class TemplateElement : Element { 146 class TemplateElement : Element {
144 constructor (Dictionary<String> attributes, ChildArguments... nodes); // O(M+N ), M = number of attributes, N = number of nodes plus all their descendants 147 constructor (Dictionary<String> attributes, ChildArguments... nodes); // O(M+N ), M = number of attributes, N = number of nodes plus all their descendants
145 constructor (ChildArguments... nodes); // shorthand 148 constructor (ChildArguments... nodes); // shorthand
146 constructor (Dictionary<String> attributes); // shorthand 149 constructor (Dictionary<String> attributes); // shorthand
147 constructor (); // shorthand 150 constructor (); // shorthand
148 constructor attribute String tagName; // O(1) // "template" 151 constructor attribute String tagName; // O(1) // "template"
149 constructor attribute Boolean shadow; // O(1) // false 152 constructor attribute Boolean shadow; // O(1) // false
150 153
151 readonly attribute DocumentFragment content; // O(1) 154 readonly attribute DocumentFragment content; // O(1)
155 virtual LayoutManagerConstructor getLayoutManager(); // O(1)
156 // returns null
152 } 157 }
153 class ScriptElement : Element { 158 class ScriptElement : Element {
154 constructor (Dictionary<String> attributes, ChildArguments... nodes); // O(M+N ), M = number of attributes, N = number of nodes plus all their descendants 159 constructor (Dictionary<String> attributes, ChildArguments... nodes); // O(M+N ), M = number of attributes, N = number of nodes plus all their descendants
155 constructor (ChildArguments... nodes); // shorthand 160 constructor (ChildArguments... nodes); // shorthand
156 constructor (Dictionary<String> attributes); // shorthand 161 constructor (Dictionary<String> attributes); // shorthand
157 constructor (); // shorthand 162 constructor (); // shorthand
158 constructor attribute String tagName; // O(1) // "script" 163 constructor attribute String tagName; // O(1) // "script"
159 constructor attribute Boolean shadow; // O(1) // false 164 constructor attribute Boolean shadow; // O(1) // false
165
166 virtual LayoutManagerConstructor getLayoutManager(); // O(1)
167 // returns null
160 } 168 }
161 class StyleElement : Element { 169 class StyleElement : Element {
162 constructor (Dictionary<String> attributes, ChildArguments... nodes); // O(M+N ), M = number of attributes, N = number of nodes plus all their descendants 170 constructor (Dictionary<String> attributes, ChildArguments... nodes); // O(M+N ), M = number of attributes, N = number of nodes plus all their descendants
163 constructor (ChildArguments... nodes); // shorthand 171 constructor (ChildArguments... nodes); // shorthand
164 constructor (Dictionary<String> attributes); // shorthand 172 constructor (Dictionary<String> attributes); // shorthand
165 constructor (); // shorthand 173 constructor (); // shorthand
166 constructor attribute String tagName; // O(1) // "style" 174 constructor attribute String tagName; // O(1) // "style"
167 constructor attribute Boolean shadow; // O(1) // false 175 constructor attribute Boolean shadow; // O(1) // false
168 176
169 Array<Rule> getRules(); // O(N) in rules 177 Array<Rule> getRules(); // O(N) in rules
178 virtual LayoutManagerConstructor getLayoutManager(); // O(1)
179 // returns null
170 } 180 }
171 class ContentElement : Element { 181 class ContentElement : Element {
172 constructor (Dictionary<String> attributes, ChildArguments... nodes); // O(M+N ), M = number of attributes, N = number of nodes plus all their descendants 182 constructor (Dictionary<String> attributes, ChildArguments... nodes); // O(M+N ), M = number of attributes, N = number of nodes plus all their descendants
173 constructor (ChildArguments... nodes); // shorthand 183 constructor (ChildArguments... nodes); // shorthand
174 constructor (Dictionary<String> attributes); // shorthand 184 constructor (Dictionary<String> attributes); // shorthand
175 constructor (); // shorthand 185 constructor (); // shorthand
176 constructor attribute String tagName; // O(1) // "content" 186 constructor attribute String tagName; // O(1) // "content"
177 constructor attribute Boolean shadow; // O(1) // false 187 constructor attribute Boolean shadow; // O(1) // false
178 188
179 Array<Node> getDistributedNodes(); // O(N) in distributed nodes 189 Array<Node> getDistributedNodes(); // O(N) in distributed nodes
190 virtual LayoutManagerConstructor getLayoutManager(); // O(1)
191 // returns null
180 } 192 }
181 class ImgElement : Element { 193 class ImgElement : Element {
182 constructor (Dictionary<String> attributes, ChildArguments... nodes); // O(M+N ), M = number of attributes, N = number of nodes plus all their descendants 194 constructor (Dictionary<String> attributes, ChildArguments... nodes); // O(M+N ), M = number of attributes, N = number of nodes plus all their descendants
183 constructor (ChildArguments... nodes); // shorthand 195 constructor (ChildArguments... nodes); // shorthand
184 constructor (Dictionary<String> attributes); // shorthand 196 constructor (Dictionary<String> attributes); // shorthand
185 constructor (); // shorthand 197 constructor (); // shorthand
186 constructor attribute String tagName; // O(1) // "img" 198 constructor attribute String tagName; // O(1) // "img"
187 constructor attribute Boolean shadow; // O(1) // false 199 constructor attribute Boolean shadow; // O(1) // false
200
201 virtual LayoutManagerConstructor getLayoutManager(); // O(1)
202 // returns ImgElementLayoutManager
188 } 203 }
189 class DivElement : Element { 204 class DivElement : Element {
190 constructor (Dictionary<String> attributes, ChildArguments... nodes); // O(M+N ), M = number of attributes, N = number of nodes plus all their descendants 205 constructor (Dictionary<String> attributes, ChildArguments... nodes); // O(M+N ), M = number of attributes, N = number of nodes plus all their descendants
191 constructor (ChildArguments... nodes); // shorthand 206 constructor (ChildArguments... nodes); // shorthand
192 constructor (Dictionary<String> attributes); // shorthand 207 constructor (Dictionary<String> attributes); // shorthand
193 constructor (); // shorthand 208 constructor (); // shorthand
194 constructor attribute String tagName; // O(1) // "div" 209 constructor attribute String tagName; // O(1) // "div"
195 constructor attribute Boolean shadow; // O(1) // false 210 constructor attribute Boolean shadow; // O(1) // false
196 } 211 }
197 class SpanElement : Element { 212 class SpanElement : Element {
198 constructor (Dictionary<String> attributes, ChildArguments... nodes); // O(M+N ), M = number of attributes, N = number of nodes plus all their descendants 213 constructor (Dictionary<String> attributes, ChildArguments... nodes); // O(M+N ), M = number of attributes, N = number of nodes plus all their descendants
199 constructor (ChildArguments... nodes); // shorthand 214 constructor (ChildArguments... nodes); // shorthand
200 constructor (Dictionary<String> attributes); // shorthand 215 constructor (Dictionary<String> attributes); // shorthand
201 constructor (); // shorthand 216 constructor (); // shorthand
202 constructor attribute String tagName; // O(1) // "span" 217 constructor attribute String tagName; // O(1) // "span"
203 constructor attribute Boolean shadow; // O(1) // false 218 constructor attribute Boolean shadow; // O(1) // false
204 } 219 }
205 class IframeElement : Element { 220 class IframeElement : Element {
206 constructor (Dictionary<String> attributes, ChildArguments... nodes); // O(M+N ), M = number of attributes, N = number of nodes plus all their descendants 221 constructor (Dictionary<String> attributes, ChildArguments... nodes); // O(M+N ), M = number of attributes, N = number of nodes plus all their descendants
207 constructor (ChildArguments... nodes); // shorthand 222 constructor (ChildArguments... nodes); // shorthand
208 constructor (Dictionary<String> attributes); // shorthand 223 constructor (Dictionary<String> attributes); // shorthand
209 constructor (); // shorthand 224 constructor (); // shorthand
210 constructor attribute String tagName; // O(1) // "iframe" 225 constructor attribute String tagName; // O(1) // "iframe"
211 constructor attribute Boolean shadow; // O(1) // false 226 constructor attribute Boolean shadow; // O(1) // false
227
228 virtual LayoutManagerConstructor getLayoutManager(); // O(1)
229 // returns IframeElementLayoutManager
212 } 230 }
213 class TElement : Element { 231 class TElement : Element {
214 constructor (Dictionary<String> attributes, ChildArguments... nodes); // O(M+N ), M = number of attributes, N = number of nodes plus all their descendants 232 constructor (Dictionary<String> attributes, ChildArguments... nodes); // O(M+N ), M = number of attributes, N = number of nodes plus all their descendants
215 constructor (ChildArguments... nodes); // shorthand 233 constructor (ChildArguments... nodes); // shorthand
216 constructor (Dictionary<String> attributes); // shorthand 234 constructor (Dictionary<String> attributes); // shorthand
217 constructor (); // shorthand 235 constructor (); // shorthand
218 constructor attribute String tagName; // O(1) // "t" 236 constructor attribute String tagName; // O(1) // "t"
219 constructor attribute Boolean shadow; // O(1) // false 237 constructor attribute Boolean shadow; // O(1) // false
220 } 238 }
221 class AElement : Element { 239 class AElement : Element {
222 constructor (Dictionary<String> attributes, ChildArguments... nodes); // O(M+N ), M = number of attributes, N = number of nodes plus all their descendants 240 constructor (Dictionary<String> attributes, ChildArguments... nodes); // O(M+N ), M = number of attributes, N = number of nodes plus all their descendants
223 constructor (ChildArguments... nodes); // shorthand 241 constructor (ChildArguments... nodes); // shorthand
224 constructor (Dictionary<String> attributes); // shorthand 242 constructor (Dictionary<String> attributes); // shorthand
225 constructor (); // shorthand 243 constructor (); // shorthand
226 constructor attribute String tagName; // O(1) // "a" 244 constructor attribute String tagName; // O(1) // "a"
227 constructor attribute Boolean shadow; // O(1) // false 245 constructor attribute Boolean shadow; // O(1) // false
228 } 246 }
229 class TitleElement : Element { 247 class TitleElement : Element {
230 constructor (Dictionary<String> attributes, ChildArguments... nodes); // O(M+N ), M = number of attributes, N = number of nodes plus all their descendants 248 constructor (Dictionary<String> attributes, ChildArguments... nodes); // O(M+N ), M = number of attributes, N = number of nodes plus all their descendants
231 constructor (ChildArguments... nodes); // shorthand 249 constructor (ChildArguments... nodes); // shorthand
232 constructor (Dictionary<String> attributes); // shorthand 250 constructor (Dictionary<String> attributes); // shorthand
233 constructor (); // shorthand 251 constructor (); // shorthand
234 constructor attribute String tagName; // O(1) // "title" 252 constructor attribute String tagName; // O(1) // "title"
235 constructor attribute Boolean shadow; // O(1) // false 253 constructor attribute Boolean shadow; // O(1) // false
254
255 virtual LayoutManagerConstructor getLayoutManager(); // O(1)
256 // returns null
236 } 257 }
237 class ErrorElement : Element { 258 class ErrorElement : Element {
238 constructor (Dictionary<String> attributes, ChildArguments... nodes); // O(M+N ), M = number of attributes, N = number of nodes plus all their descendants 259 constructor (Dictionary<String> attributes, ChildArguments... nodes); // O(M+N ), M = number of attributes, N = number of nodes plus all their descendants
239 constructor (ChildArguments... nodes); // shorthand 260 constructor (ChildArguments... nodes); // shorthand
240 constructor (Dictionary<String> attributes); // shorthand 261 constructor (Dictionary<String> attributes); // shorthand
241 constructor (); // shorthand 262 constructor (); // shorthand
242 constructor attribute String tagName; // O(1) // "error" 263 constructor attribute String tagName; // O(1) // "error"
243 constructor attribute Boolean shadow; // O(1) // false 264 constructor attribute Boolean shadow; // O(1) // false
265
266 virtual LayoutManagerConstructor getLayoutManager(); // O(1)
267 // returns ErrorElementLayoutManager
244 } 268 }
245 269
246 callback InternalElementConstructor void (Module module); 270 callback InternalElementConstructor void (Module module);
247 dictionary ElementRegistration { 271 dictionary ElementRegistration {
248 String tagName; 272 String tagName;
249 Boolean shadow = false; 273 Boolean shadow = false;
250 InternalElementConstructor? constructor = null; 274 InternalElementConstructor? constructor = null;
251 } 275 }
252 276
253 interface ElementConstructor { 277 interface ElementConstructor {
(...skipping 11 matching lines...) Expand all
265 289
266 Boolean matches(Element element); // O(F()) 290 Boolean matches(Element element); // O(F())
267 Element? find(Element root); // O(N*F())+O(M) where N is the number of descend ants and M the average depth of the tree 291 Element? find(Element root); // O(N*F())+O(M) where N is the number of descend ants and M the average depth of the tree
268 Element? find(DocumentFragment root); // O(N*F())+O(M) where N is the number o f descendants and M the average depth of the tree 292 Element? find(DocumentFragment root); // O(N*F())+O(M) where N is the number o f descendants and M the average depth of the tree
269 Element? find(TreeScope root); // O(N*F()) where N is the number of descendant s 293 Element? find(TreeScope root); // O(N*F()) where N is the number of descendant s
270 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 294 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
271 Array<Element> findAll(DocumentFragment root); // O(N*F())+O(N*M) where N is t he number of descendants and M the average depth of the tree 295 Array<Element> findAll(DocumentFragment root); // O(N*F())+O(N*M) where N is t he number of descendants and M the average depth of the tree
272 Array<Element> findAll(TreeScope root); // O(N*F()) where N is the number of d escendants 296 Array<Element> findAll(TreeScope root); // O(N*F()) where N is the number of d escendants
273 } 297 }
274 ``` 298 ```
OLDNEW
« no previous file with comments | « no previous file | sky/specs/modules.md » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698