void YogaLayoutableShadowNode::layoutChildren(LayoutContext layoutContext) { for (auto child : getLayoutableChildNodes()) { auto yogaLayoutableChild = std::dynamic_pointer_cast<const YogaLayoutableShadowNode>(child); if (!yogaLayoutableChild) { continue; } auto nonConstYogaLayoutableChild = std::const_pointer_cast<YogaLayoutableShadowNode>(yogaLayoutableChild); LayoutMetrics childLayoutMetrics = layoutMetricsFromYogaNode(nonConstYogaLayoutableChild->yogaNode_); nonConstYogaLayoutableChild->setLayoutMetrics(childLayoutMetrics); } }
void LayoutableShadowNode::layout(LayoutContext layoutContext) { layoutChildren(layoutContext); for (auto child : getLayoutableChildNodes()) { if (!child->getHasNewLayout()) { continue; } child->ensureUnsealed(); child->setHasNewLayout(false); const LayoutMetrics childLayoutMetrics = child->getLayoutMetrics(); if (childLayoutMetrics.displayType == DisplayType::None) { continue; } LayoutContext childLayoutContext = LayoutContext(layoutContext); childLayoutContext.absolutePosition += childLayoutMetrics.frame.origin; child->layout(layoutContext); } }