| OLD | NEW |
| 1 Sky Style Language | 1 Sky Style Language |
| 2 ================== | 2 ================== |
| 3 | 3 |
| 4 Planed changes | 4 Planed changes |
| 5 -------------- | 5 -------------- |
| 6 | 6 |
| 7 Add //-to-end-of-line comments to be consistent with the script | 7 Add //-to-end-of-line comments to be consistent with the script |
| 8 language. | 8 language. |
| 9 | 9 |
| 10 | 10 |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 | | +-- AnimatableStringStyleValue* | 262 | | +-- AnimatableStringStyleValue* |
| 263 | | | 263 | | |
| 264 | +-- ObjectStyleValue | 264 | +-- ObjectStyleValue |
| 265 | | 265 | |
| 266 +-- PrimitiveValuesListStyleValue* | 266 +-- PrimitiveValuesListStyleValue* |
| 267 */ | 267 */ |
| 268 ``` | 268 ``` |
| 269 | 269 |
| 270 The types marked with * in the list above are not part of sky:core. | 270 The types marked with * in the list above are not part of sky:core. |
| 271 | 271 |
| 272 TODO(ianh): consider removing 'StyleValue' from these class names |
| 273 |
| 272 ```javascript | 274 ```javascript |
| 273 abstract class StyleNode { | 275 abstract class StyleNode { |
| 274 abstract void markDirty(); | 276 abstract void markDirty(); |
| 275 } | 277 } |
| 276 | 278 |
| 277 class StyleValueResolverSettings { | 279 class StyleValueResolverSettings { |
| 278 // this is used as an "out" parameter for 'resolve()' below | 280 // this is used as an "out" parameter for 'resolve()' below |
| 279 constructor(); | 281 constructor(); |
| 280 void reset(); // resets values to defaults so that object can be reused | 282 void reset(); // resets values to defaults so that object can be reused |
| 281 attribute Boolean layoutDependent; // default to false | 283 attribute Boolean layoutDependent; // default to false |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 abstract class LengthStyleValue : AbstractStyleValue { | 321 abstract class LengthStyleValue : AbstractStyleValue { |
| 320 abstract Float resolve(PropertyHandle property, RenderNode node, StyleValueRes
olverSettings? settings = null); | 322 abstract Float resolve(PropertyHandle property, RenderNode node, StyleValueRes
olverSettings? settings = null); |
| 321 } | 323 } |
| 322 | 324 |
| 323 class PixelLengthStyleValue : LengthStyleValue { | 325 class PixelLengthStyleValue : LengthStyleValue { |
| 324 constructor(StyleNode parentNode, Float number); | 326 constructor(StyleNode parentNode, Float number); |
| 325 readonly attribute Float value; | 327 readonly attribute Float value; |
| 326 Float resolve(PropertyHandle property, RenderNode node, StyleValueResolverSett
ings? settings = null); | 328 Float resolve(PropertyHandle property, RenderNode node, StyleValueResolverSett
ings? settings = null); |
| 327 } | 329 } |
| 328 | 330 |
| 329 typedef Color Float; // TODO(ianh): figure out what Color should be | 331 typedef RawColor Float; // TODO(ianh): figure out what Color should be |
| 330 class ColorStyleValue : LengthStyleValue { | 332 class ColorStyleValue : LengthStyleValue { |
| 331 constructor(StyleNode parentNode, Float red, Float green, Float blue, Float al
pha); | 333 constructor(StyleNode parentNode, Float red, Float green, Float blue, Float al
pha); |
| 332 // ... color API ... | 334 // ... color API ... |
| 333 Color resolve(PropertyHandle property, RenderNode node, StyleValueResolverSett
ings? settings = null); | 335 RawColor resolve(PropertyHandle property, RenderNode node, StyleValueResolverS
ettings? settings = null); |
| 334 } | 336 } |
| 335 | 337 |
| 336 class AbstractOpaqueStyleValue : AbstractStyleValue { | 338 class AbstractOpaqueStyleValue : AbstractStyleValue { |
| 337 abstract constructor(StyleNode parentNode, any value); | 339 abstract constructor(StyleNode parentNode, any value); |
| 338 readonly attribute any value; | 340 readonly attribute any value; |
| 339 any resolve(PropertyHandle property, RenderNode node, StyleValueResolverSettin
gs? settings = null); | 341 any resolve(PropertyHandle property, RenderNode node, StyleValueResolverSettin
gs? settings = null); |
| 340 // returns value | 342 // returns value |
| 341 } | 343 } |
| 342 | 344 |
| 343 class IdentifierStyleValue : AbstractOpaqueStyleValue { | 345 class IdentifierStyleValue : AbstractOpaqueStyleValue { |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 493 Cascade | 495 Cascade |
| 494 ------- | 496 ------- |
| 495 | 497 |
| 496 Simultaneously walk the tree rooted at the application Document, | 498 Simultaneously walk the tree rooted at the application Document, |
| 497 taking into account shadow trees and child distribution, and the tree | 499 taking into account shadow trees and child distribution, and the tree |
| 498 rooted at the document's RenderNode. | 500 rooted at the document's RenderNode. |
| 499 | 501 |
| 500 If you come across a node that doesn't have an assigned RenderNode, | 502 If you come across a node that doesn't have an assigned RenderNode, |
| 501 then create one, placing it in the appropriate place in the RenderTree | 503 then create one, placing it in the appropriate place in the RenderTree |
| 502 tree, after any nodes marked isGhost=true, with ownerLayoutManager | 504 tree, after any nodes marked isGhost=true, with ownerLayoutManager |
| 503 pointing to the parent RenderNode's layoutManager, and then, if | 505 pointing to the parent RenderNode's layoutManager, if it has one, and, |
| 504 autoreap is false on the ownerLayoutManager, mark it "isNew". | 506 if it has one and autoreap is false on that layout manager, mark the |
| 507 new node "isNew". (This means that when a node is marked isNew, the |
| 508 layout manager has already laid out at least one frame.) |
| 505 | 509 |
| 506 For each element, if the node's needsManager is true, call | 510 For each element, if the node's needsManager is true, call |
| 507 getLayoutManager() on the element, and if that's not null, and if the | 511 getLayoutManager() on the element, and if that's not null, and if the |
| 508 returned class isn't the same class as the current layoutManager, if | 512 returned class isn't the same class as the current layoutManager, if |
| 509 any, construct the given class and assign it to the RenderNode's | 513 any, construct the given class and assign it to the RenderNode's |
| 510 layoutManager, then set all the child RenderNodes' ownerLayoutManager | 514 layoutManager, then set all the child RenderNodes' ownerLayoutManager |
| 511 to that object; if it returns null, and that node already has a | 515 to that object; if it returns null, and that node already has a |
| 512 layoutManager, then set isGhost=true for that node and all its | 516 layoutManager, then set isGhost=true for that node and all its |
| 513 children (without changing the layoutManager). Otherwise, if it | 517 children (without changing the layoutManager). Otherwise, if it |
| 514 returned null and there's already no layoutManager, remove the node | 518 returned null and there's already no layoutManager, remove the node |
| (...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 924 ``` | 928 ``` |
| 925 | 929 |
| 926 The ``div`` element doesn't have any default styles. | 930 The ``div`` element doesn't have any default styles. |
| 927 | 931 |
| 928 These declarations are all shared between all the elements (so e.g. if | 932 These declarations are all shared between all the elements (so e.g. if |
| 929 you reach in and change the declaration that was added to a ``title`` | 933 you reach in and change the declaration that was added to a ``title`` |
| 930 element, you're going to change the styles of all the other | 934 element, you're going to change the styles of all the other |
| 931 default-hidden elements). (In other words, in the code snippets above, | 935 default-hidden elements). (In other words, in the code snippets above, |
| 932 the ``d`` variable is initialised in shared code, and only the | 936 the ``d`` variable is initialised in shared code, and only the |
| 933 addStyles() call is per-element.) | 937 addStyles() call is per-element.) |
| OLD | NEW |