Examples: move markAsLaidOut() to just before the return, so the asserts work
Specs: introduce layoutDescendants() to avoid work when a layout manager is unaffected by its childrens' intrinsic dimensions Examples: update for layoutDescendants() change Specs: add "lifetime" to resolver settings so that a transition can avoid having to dirty every consumer of the property every frame when it only needs to update the objects that are changing that frame Specs: expose the parents on AbstractStyleDeclarationList subclasses Specs: fix documentation around autoreap Specs: fix definition of setProperty() Specs: clean up the dimension-related logic of layout managers Review URL: https://codereview.chromium.org/850593003
This commit is contained in:
parent
6646821d57
commit
7598f1fd3c
@ -7,7 +7,6 @@ SKY MODULE
|
||||
<script>
|
||||
module.exports.BlockLayoutManager = class BlockLayoutManager extends sky.LayoutManager {
|
||||
function layout(width, height) {
|
||||
this.markAsLaidOut();
|
||||
if (width == null)
|
||||
width = this.getIntrinsicWidth().value;
|
||||
let autoHeight = false;
|
||||
@ -31,11 +30,15 @@ SKY MODULE
|
||||
}
|
||||
if (autoHeight)
|
||||
height = y;
|
||||
this.markAsLaidOut();
|
||||
return {
|
||||
width: width,
|
||||
height: height,
|
||||
}
|
||||
}
|
||||
function layoutDescendants() {
|
||||
this.layout(node.width, node.height);
|
||||
}
|
||||
function getIntrinsicWidth() {
|
||||
let width = this.node.getProperty('width');
|
||||
if (typeof width != 'number') {
|
||||
|
@ -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,
|
||||
|
@ -23,7 +23,6 @@ SKY MODULE
|
||||
this.overflowChild = null;
|
||||
}
|
||||
function layout(width, height) {
|
||||
this.markAsLaidOut();
|
||||
let children = null;
|
||||
let loop = null;
|
||||
if (height == null)
|
||||
@ -58,7 +57,7 @@ SKY MODULE
|
||||
childHeight = childHeight.value;
|
||||
else
|
||||
childHeight = height;
|
||||
dims = child.layoutManager.layout(width, height);
|
||||
dims = child.layoutManager.layout(null, height);
|
||||
this.setChildSize(child, dims.width, dims.height);
|
||||
} else {
|
||||
dims = {
|
||||
@ -125,11 +124,15 @@ SKY MODULE
|
||||
else
|
||||
this.firstSkippedChild = this.overflowChild;
|
||||
|
||||
this.markAsLaidOut();
|
||||
return {
|
||||
width: width,
|
||||
height: height,
|
||||
}
|
||||
}
|
||||
function layoutDescendants() {
|
||||
this.layout(node.width, node.height);
|
||||
}
|
||||
function getIntrinsicWidth() {
|
||||
let width = this.node.getProperty('width');
|
||||
if (typeof width != 'number') {
|
||||
|
Loading…
x
Reference in New Issue
Block a user