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

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

Issue 727993002: Specs: hit testing (and some cleanup) (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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 | « sky/examples/style/toolbar-layout.sky ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 void setChildY(child, y); // sets child.y 403 void setChildY(child, y); // sets child.y
404 void setChildSize(child, width, height); // sets child.width, child.height 404 void setChildSize(child, width, height); // sets child.width, child.height
405 void setChildWidth(child, width); // sets child.width 405 void setChildWidth(child, width); // sets child.width
406 void setChildHeight(child, height); // sets child.height 406 void setChildHeight(child, height); // sets child.height
407 // these set needsPaint on the node and on any node impacted by this (?) 407 // these set needsPaint on the node and on any node impacted by this (?)
408 // for setChildSize/Width/Height: if the new dimension is different than t he last assumed dimensions, and 408 // for setChildSize/Width/Height: if the new dimension is different than t he last assumed dimensions, and
409 // any StyleNodes with an ownerLayoutManager==this have cached values for getProperty() that are marked 409 // any StyleNodes with an ownerLayoutManager==this have cached values for getProperty() that are marked
410 // as provisional, clear them 410 // as provisional, clear them
411 411
412 Generator<StyleNode> walkChildren(); 412 Generator<StyleNode> walkChildren();
413 // returns a generator that iterates over the children, skipping any whose ownerLayoutManager is not this 413 // returns a generator that iterates over the children, skipping any whose ownerLayoutManager is not |this|
414 414
415 void paint(RenderingSurface canvas); 415 Generator<StyleNode> walkChildrenBackwards();
416 // set a clip rect on the canvas 416 // returns a generator that iterates over the children backwards, skipping any whose ownerLayoutManager is not |this|
417 // call the painter of each property, in order they were registered, which on this element has a painter
418 // call this.paintChildren()
419 // unset the clip
420
421 virtual void paintChildren(RenderingSurface canvas);
422 // just calls paint() for each child returned by walkChildren() whose need sPaint is true
423 417
424 void assumeDimensions(Float width, Float height); 418 void assumeDimensions(Float width, Float height);
425 // sets the assumed dimensions for calls to getProperty() on StyleNodes th at have this as an ownerLayoutManager 419 // sets the assumed dimensions for calls to getProperty() on StyleNodes th at have this as an ownerLayoutManager
426 // if the new dimension is different than the last assumed dimensions, and any StyleNodes with an 420 // if the new dimension is different than the last assumed dimensions, and any StyleNodes with an
427 // ownerLayoutManager==this have cached values for getProperty() that are marked as provisional, clear them 421 // ownerLayoutManager==this have cached values for getProperty() that are marked as provisional, clear them
428 // TODO(ianh): should we force this to match the input to layout(), when c alled from inside layout() and when 422 // TODO(ianh): should we force this to match the input to layout(), when c alled from inside layout() and when
429 // layout() has a forced width and/or height? 423 // layout() has a forced width and/or height?
430 424
431 virtual LayoutValueRange getIntrinsicWidth(Float? defaultWidth = null); 425 virtual LayoutValueRange getIntrinsicWidth(Float? defaultWidth = null);
432 // returns min-width, width, and max-width, normalised, defaulting to valu es given in LayoutValueRange 426 // returns min-width, width, and max-width, normalised, defaulting to valu es given in LayoutValueRange
433 // if argument is provided, it overrides width 427 // if argument is provided, it overrides width
434 428
435 virtual LayoutValueRange getIntrinsicHeight(Float? defaultHeight = null); 429 virtual LayoutValueRange getIntrinsicHeight(Float? defaultHeight = null);
436 // returns min-height, height, and max-height, normalised, defaulting to v alues given in LayoutValueRange 430 // returns min-height, height, and max-height, normalised, defaulting to v alues given in LayoutValueRange
437 // if argument is provided, it overrides height 431 // if argument is provided, it overrides height
438 432
439 virtual Dimensions layout(Number? width, Number? height); 433 virtual Dimensions layout(Number? width, Number? height);
440 // returns { } 434 // returns { }
441 // the return value should include the final value for whichever of the wi dth and height arguments that is null 435 // the return value should include the final value for whichever of the wi dth and height arguments that is null
442 // TODO(ianh): should we just grab the width and height from assumeDimensi ons()? 436 // TODO(ianh): should we just grab the width and height from assumeDimensi ons()?
443 437
438 void paint(RenderingSurface canvas);
439 // set a clip rect on the canvas
440 // call the painter of each property, in order they were registered, which on this element has a painter
441 // call this.paintChildren()
442 // unset the clip
443
444 virtual void paintChildren(RenderingSurface canvas);
445 // just calls paint() for each child returned by walkChildren() whose need sPaint is true
446
447 virtual Node hitTest(Float x, Float y);
448 // default implementation uses the node's children nodes' x, y,
449 // width, and height, skipping any that have width=0 or height=0, or
450 // whose ownerLayoutManager is not |this|
451 // default implementation walks the tree backwards from its built-in order
452 // if no child is hit, then return this.node
453 // override this if you changed your children's z-order, or if you used ta ke() to
454 // hoist some descendants up to be your responsibility, or if your childre n aren't
455 // rectangular (e.g. you lay them out in a hex grid)
456
444 } 457 }
445 458
446 dictionary LayoutValueRange { 459 dictionary LayoutValueRange {
447 // negative values here should be treated as zero 460 // negative values here should be treated as zero
448 Float minimum = 0; 461 Float minimum = 0;
449 Float value = 0; // ideal desired width; if it's not in the range minimum .. maximum then it overrides minimum and maximum 462 Float value = 0; // ideal desired width; if it's not in the range minimum .. maximum then it overrides minimum and maximum
450 (Float or Infinity) maximum = Infinity; 463 (Float or Infinity) maximum = Infinity;
451 } 464 }
452 465
453 dictionary Dimensions { 466 dictionary Dimensions {
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 * ``error`` 522 * ``error``
510 This adds to itself the declaration with value: 523 This adds to itself the declaration with value:
511 ``{ display: { value: sky.ErrorLayoutManager } }`` 524 ``{ display: { value: sky.ErrorLayoutManager } }``
512 525
513 The ``div`` element doesn't have any default styles. 526 The ``div`` element doesn't have any default styles.
514 527
515 These declarations are all shared between all the elements (so e.g. if 528 These declarations are all shared between all the elements (so e.g. if
516 you reach in and change the declaration that was added to a ``title`` 529 you reach in and change the declaration that was added to a ``title``
517 element, you're going to change the styles of all the other 530 element, you're going to change the styles of all the other
518 default-hidden elements). 531 default-hidden elements).
OLDNEW
« no previous file with comments | « sky/examples/style/toolbar-layout.sky ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698