| 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 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 // otherwise, get the default value; cache it; return it | 336 // otherwise, get the default value; cache it; return it |
| 337 | 337 |
| 338 readonly attribute Boolean needsLayout; // means that a property with needsL
ayout:true has changed on this node or one of its descendants | 338 readonly attribute Boolean needsLayout; // means that a property with needsL
ayout:true has changed on this node or one of its descendants |
| 339 readonly attribute LayoutManager layoutManager; | 339 readonly attribute LayoutManager layoutManager; |
| 340 | 340 |
| 341 readonly attribute LayoutManager ownerLayoutManager; // defaults to the pare
ntNode.layoutManager | 341 readonly attribute LayoutManager ownerLayoutManager; // defaults to the pare
ntNode.layoutManager |
| 342 // if you are not the ownerLayoutManager, then ignore this StyleNode in la
yout() and paintChildren() | 342 // if you are not the ownerLayoutManager, then ignore this StyleNode in la
yout() and paintChildren() |
| 343 // using walkChildren() does this for you | 343 // using walkChildren() does this for you |
| 344 | 344 |
| 345 readonly attribute Boolean needsPaint; // means that either needsLayout is t
rue or a property with needsPaint:true has changed on this node or one of its de
scendants | 345 readonly attribute Boolean needsPaint; // means that either needsLayout is t
rue or a property with needsPaint:true has changed on this node or one of its de
scendants |
| 346 // needsPaint is set to false by the ownerLayoutManager's default paint()
method |
| 346 | 347 |
| 347 // only the ownerLayoutManager can change these | 348 // only the ownerLayoutManager can change these |
| 348 readonly attribute Float x; // relative to left edge of ownerLayoutManager | 349 readonly attribute Float x; // relative to left edge of ownerLayoutManager |
| 349 readonly attribute Float y; // relative to top edge of ownerLayoutManager | 350 readonly attribute Float y; // relative to top edge of ownerLayoutManager |
| 350 readonly attribute Float width; | 351 readonly attribute Float width; |
| 351 readonly attribute Float height; | 352 readonly attribute Float height; |
| 352 } | 353 } |
| 353 | 354 |
| 354 The flattened tree is represented as a hierarchy of Node objects. For | 355 The flattened tree is represented as a hierarchy of Node objects. For |
| 355 any element that only contains text node children, the "text" property | 356 any element that only contains text node children, the "text" property |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 428 | 429 |
| 429 virtual LayoutValueRange getIntrinsicHeight(Float? defaultHeight = null); | 430 virtual LayoutValueRange getIntrinsicHeight(Float? defaultHeight = null); |
| 430 // returns min-height, height, and max-height, normalised, defaulting to v
alues given in LayoutValueRange | 431 // returns min-height, height, and max-height, normalised, defaulting to v
alues given in LayoutValueRange |
| 431 // if argument is provided, it overrides height | 432 // if argument is provided, it overrides height |
| 432 | 433 |
| 433 virtual Dimensions layout(Number? width, Number? height); | 434 virtual Dimensions layout(Number? width, Number? height); |
| 434 // returns { } | 435 // returns { } |
| 435 // the return value should include the final value for whichever of the wi
dth and height arguments that is null | 436 // the return value should include the final value for whichever of the wi
dth and height arguments that is null |
| 436 // TODO(ianh): should we just grab the width and height from assumeDimensi
ons()? | 437 // TODO(ianh): should we just grab the width and height from assumeDimensi
ons()? |
| 437 | 438 |
| 438 void paint(RenderingSurface canvas); | 439 void markAsPainted(); // sets this.node.needsPaint to false |
| 440 virtual void paint(RenderingSurface canvas); |
| 439 // set a clip rect on the canvas for rect(0,0,this.width,this.height) | 441 // set a clip rect on the canvas for rect(0,0,this.width,this.height) |
| 440 // call the painter of each property, in order they were registered, which
on this element has a painter | 442 // call the painter of each property, in order they were registered, which
on this element has a painter |
| 441 // call this.paintChildren() | 443 // call this.paintChildren() |
| 442 // unset the clip | 444 // unset the clip |
| 445 // call markAsPainted() |
| 443 | 446 |
| 444 virtual void paintChildren(RenderingSurface canvas); | 447 virtual void paintChildren(RenderingSurface canvas); |
| 445 // just calls paint() for each child returned by walkChildren() whose need
sPaint is true, | 448 // just calls paint() for each child returned by walkChildren() whose need
sPaint is true, |
| 446 // after transforming the coordinate space by translate(child.x,child.y) | 449 // after transforming the coordinate space by translate(child.x,child.y) |
| 450 // you should skip children that will be clipped out of yourself because t
hey're outside your bounds |
| 447 | 451 |
| 448 virtual Node hitTest(Float x, Float y); | 452 virtual Node hitTest(Float x, Float y); |
| 449 // default implementation uses the node's children nodes' x, y, | 453 // default implementation uses the node's children nodes' x, y, |
| 450 // width, and height, skipping any that have width=0 or height=0, or | 454 // width, and height, skipping any that have width=0 or height=0, or |
| 451 // whose ownerLayoutManager is not |this| | 455 // whose ownerLayoutManager is not |this| |
| 452 // default implementation walks the tree backwards from its built-in order | 456 // default implementation walks the tree backwards from its built-in order |
| 453 // if no child is hit, then return this.node | 457 // if no child is hit, then return this.node |
| 454 // override this if you changed your children's z-order, or if you used ta
ke() to | 458 // override this if you changed your children's z-order, or if you used ta
ke() to |
| 455 // hoist some descendants up to be your responsibility, or if your childre
n aren't | 459 // hoist some descendants up to be your responsibility, or if your childre
n aren't |
| 456 // rectangular (e.g. you lay them out in a hex grid) | 460 // rectangular (e.g. you lay them out in a hex grid) |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 528 * ``error`` | 532 * ``error`` |
| 529 This adds to itself the declaration with value: | 533 This adds to itself the declaration with value: |
| 530 ``{ display: { value: sky.ErrorLayoutManager } }`` | 534 ``{ display: { value: sky.ErrorLayoutManager } }`` |
| 531 | 535 |
| 532 The ``div`` element doesn't have any default styles. | 536 The ``div`` element doesn't have any default styles. |
| 533 | 537 |
| 534 These declarations are all shared between all the elements (so e.g. if | 538 These declarations are all shared between all the elements (so e.g. if |
| 535 you reach in and change the declaration that was added to a ``title`` | 539 you reach in and change the declaration that was added to a ``title`` |
| 536 element, you're going to change the styles of all the other | 540 element, you're going to change the styles of all the other |
| 537 default-hidden elements). | 541 default-hidden elements). |
| OLD | NEW |