int rootBoxHeight = getRootBoxHeight(root);
int x = rootBoxX;
for (int i = 0; i < children.size(); i++) {
LayoutPart current = children.get(i);
Box box = current.getBox();
BoxConstraints boxConstraints = current.getBoxConstraints();
int elementWidth;
if (boxConstraints.getWidth() != null && boxConstraints.getWidth().hasHeightSuffix()) {
int elementHeight = processHeightConstraint(rootBoxHeight, box, boxConstraints, 0);
box.setHeight(elementHeight);
elementWidth = calcElementWidth(children, rootBoxWidth, boxConstraints, elementHeight);
box.setWidth(elementWidth);
} else if (hasHeightConstraint(boxConstraints) && boxConstraints.getHeight().hasWidthSuffix()) {
elementWidth = calcElementWidth(children, rootBoxWidth, boxConstraints, 0);
box.setWidth(elementWidth);
int elementHeight = processHeightConstraint(rootBoxHeight, box, boxConstraints, elementWidth);
box.setHeight(elementHeight);
} else {
elementWidth = calcElementWidth(children, rootBoxWidth, boxConstraints, 0);
box.setWidth(elementWidth);
int elementHeight = processHeightConstraint(rootBoxHeight, box, boxConstraints, 0);
box.setHeight(elementHeight);
}
box.setY(processVerticalAlignment(rootBoxY, rootBoxHeight, box, boxConstraints));
box.setX(x);
x += elementWidth;
}
}