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

Unified Diff: sky/examples/style/toolbar-layout.sky

Issue 745863002: Specs: update the layout and paint schemes to match discussions better (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sky/examples/style/hex-layout.sky ('k') | sky/specs/style.md » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/examples/style/toolbar-layout.sky
diff --git a/sky/examples/style/toolbar-layout.sky b/sky/examples/style/toolbar-layout.sky
index 4d29219f6027c5f16236b7cefa208c0befcd1c92..a10191e4c2525019f8adc2d74ed708b81f4584a5 100644
--- a/sky/examples/style/toolbar-layout.sky
+++ b/sky/examples/style/toolbar-layout.sky
@@ -52,7 +52,7 @@ SKY MODULE
springCount += 1;
pendingSpacing = spacing; // not +=, because we only have one extra spacing per batch of springs
} else {
- if (child.needsLayout) {
+ if (child.needsLayout || child.descendantNeedsLayout) {
childHeight = child.layoutManager.getIntrinsicHeight();
if (childHeight.value < height)
childHeight = childHeight.value;
@@ -185,25 +185,25 @@ SKY MODULE
}
function paintChildren(canvas) {
let width = this.node.width;
+ let children = this.walkChildren();
let loop = children.next();
while ((!loop.done) && (loop.value != this.firstSkippedChild))
this.paintChild(loop.value, canvas);
if (this.showingOverflow)
this.paintChild(this.overflowChild, canvas);
}
- function paintChild(child, canvas) {
- if (child.needsPaint) {
- canvas.save();
- try {
- canvas.beginPath();
- canvas.translate(child.x, child.y);
- canvas.rect(0, 0, child.width, child.height);
- canvas.clip();
- child.paint(canvas);
- } finally {
- canvas.restore();
- }
- }
+ function inChild(child, x, y) {
+ return (x >= child.x) && (y >= child.y) && (x < child.x+child.width) && (y < child.y+child.height);
+ }
+ function hitTest(x, y) {
+ let children = this.walkChildrenBackwards();
+ let loop = children.next();
+ while ((!loop.done) && (loop.value != this.firstSkippedChild))
+ if (this.inChild(loop.value, x, y))
+ return loop.value;
+ if (this.showingOverflow)
+ if (this.inChild(this.overflowChild, x, y))
+ return this.overflowChild;
}
}
sky.registerLayoutManager('toolbar', module.exports.ToolbarLayoutManager);
« no previous file with comments | « sky/examples/style/hex-layout.sky ('k') | sky/specs/style.md » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698