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

Side by Side Diff: sky/examples/style/toolbar-layout.sky

Issue 744843003: Specs: Simplify the paint model. Now you are not responsible for (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/hex-layout.sky ('k') | sky/specs/style.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 MODULE 1 SKY MODULE
2 <import src="sky:core" as="sky"/> 2 <import src="sky:core" as="sky"/>
3 <script> 3 <script>
4 // display: toolbar; 4 // display: toolbar;
5 // toolbar-spacing: <length> 5 // toolbar-spacing: <length>
6 // display: spring; // remaining space is split equally amongst the springs 6 // display: spring; // remaining space is split equally amongst the springs
7 // children are vertically centered, layout out left-to-right with toolbar-spac ing space between them 7 // children are vertically centered, layout out left-to-right with toolbar-spac ing space between them
8 // last child is hidden by default unless there's not enough room for the other s, then it's shown last, right-aligned 8 // last child is hidden by default unless there's not enough room for the other s, then it's shown last, right-aligned
9 module.exports.SpringLayoutManager = class SpringLayoutManager extends sky.Layo utManager { } 9 module.exports.SpringLayoutManager = class SpringLayoutManager extends sky.Layo utManager { }
10 sky.registerLayoutManager('spring', module.exports.SpringLayoutManager); 10 sky.registerLayoutManager('spring', module.exports.SpringLayoutManager);
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 result.value = result.maximum; 181 result.value = result.maximum;
182 if (result.value < result.minimum) 182 if (result.value < result.minimum)
183 result.value = result.minimum; 183 result.value = result.minimum;
184 return result; 184 return result;
185 } 185 }
186 function paintChildren(canvas) { 186 function paintChildren(canvas) {
187 let width = this.node.width; 187 let width = this.node.width;
188 let children = this.walkChildren(); 188 let children = this.walkChildren();
189 let loop = children.next(); 189 let loop = children.next();
190 while ((!loop.done) && (loop.value != this.firstSkippedChild)) 190 while ((!loop.done) && (loop.value != this.firstSkippedChild))
191 this.paintChild(loop.value, canvas); 191 canvas.paintChild(loop.value);
192 if (this.showingOverflow) 192 if (this.showingOverflow)
193 this.paintChild(this.overflowChild, canvas); 193 canvas.paintChild(this.overflowChild);
194 } 194 }
195 function inChild(child, x, y) { 195 function inChild(child, x, y) {
196 return (x >= child.x) && (y >= child.y) && (x < child.x+child.width) && (y < child.y+child.height); 196 return (x >= child.x) && (y >= child.y) && (x < child.x+child.width) && (y < child.y+child.height);
197 } 197 }
198 function hitTest(x, y) { 198 function hitTest(x, y) {
199 let children = this.walkChildrenBackwards(); 199 let children = this.walkChildrenBackwards();
200 let loop = children.next(); 200 let loop = children.next();
201 while ((!loop.done) && (loop.value != this.firstSkippedChild)) 201 while ((!loop.done) && (loop.value != this.firstSkippedChild))
202 if (this.inChild(loop.value, x, y)) 202 if (this.inChild(loop.value, x, y))
203 return loop.value; 203 return loop.value;
204 if (this.showingOverflow) 204 if (this.showingOverflow)
205 if (this.inChild(this.overflowChild, x, y)) 205 if (this.inChild(this.overflowChild, x, y))
206 return this.overflowChild; 206 return this.overflowChild;
207 } 207 }
208 } 208 }
209 sky.registerLayoutManager('toolbar', module.exports.ToolbarLayoutManager); 209 sky.registerLayoutManager('toolbar', module.exports.ToolbarLayoutManager);
210 </script> 210 </script>
OLDNEW
« 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