static void YGNodeEmptyContainerSetMeasuredDimensions()

in yoga/Yoga.cpp [1742:1773]


static void YGNodeEmptyContainerSetMeasuredDimensions(
    const YGNodeRef node,
    const float availableWidth,
    const float availableHeight,
    const YGMeasureMode widthMeasureMode,
    const YGMeasureMode heightMeasureMode,
    const float ownerWidth,
    const float ownerHeight) {
  const auto& padding = node->getLayout().padding;
  const auto& border = node->getLayout().border;

  float width = availableWidth;
  if (widthMeasureMode == YGMeasureModeUndefined ||
      widthMeasureMode == YGMeasureModeAtMost) {
    width = padding[YGEdgeLeft] + padding[YGEdgeRight] + border[YGEdgeLeft] +
        border[YGEdgeRight];
  }
  node->setLayoutMeasuredDimension(
      YGNodeBoundAxis(node, YGFlexDirectionRow, width, ownerWidth, ownerWidth),
      YGDimensionWidth);

  float height = availableHeight;
  if (heightMeasureMode == YGMeasureModeUndefined ||
      heightMeasureMode == YGMeasureModeAtMost) {
    height = padding[YGEdgeTop] + padding[YGEdgeBottom] + border[YGEdgeTop] +
        border[YGEdgeBottom];
  }
  node->setLayoutMeasuredDimension(
      YGNodeBoundAxis(
          node, YGFlexDirectionColumn, height, ownerHeight, ownerWidth),
      YGDimensionHeight);
}