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

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

Issue 850593003: Examples: move markAsLaidOut() to just before the return, so the asserts work (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 11 months 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/block-layout.sky ('k') | sky/examples/style/toolbar-layout.sky » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/examples/style/hex-layout.sky
diff --git a/sky/examples/style/hex-layout.sky b/sky/examples/style/hex-layout.sky
index 15982a0af084a62302f3b09d5bdd95bcb4f8b8cb..5225ddafc2e1f14077be57b379dfd8382cf09e42 100644
--- a/sky/examples/style/hex-layout.sky
+++ b/sky/examples/style/hex-layout.sky
@@ -3,7 +3,6 @@
<script>
class BeehiveLayoutManager extends sky.LayoutManager {
function layout(width, height) {
- this.markAsLaidOut();
if (width == null)
width = this.getIntrinsicWidth().value;
let autoHeight = false;
@@ -20,10 +19,13 @@
let y = 0;
while (!loop.done) {
let child = loop.value;
- if (child.needsLayout || child.descendantNeedsLayout) {
+ if (child.needsLayout) {
child.layoutManager.layout(cellDim, cellDim);
// we ignore the size the child reported from layout(), and force it to the cell dimensions
this.setChildSize(child, cellDim, cellDim);
+ } else if (child.descendantNeedsLayout) {
+ child.layoutManager.layoutDescendants();
+ this.setChildSize(child, cellDim, cellDim);
}
this.setChildPosition(child, x * cellDim + (y % 2) * cellDim/2, y * 3/4 * cellDim);
x += 1;
@@ -35,6 +37,7 @@
}
if (height == 0)
height = (1 + y * 3/4) * cellDim;
+ this.markAsLaidOut();
return {
width: width,
height: height,
« no previous file with comments | « sky/examples/style/block-layout.sky ('k') | sky/examples/style/toolbar-layout.sky » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698