| 2443 | } |
| 2444 | |
| 2445 | void calculateLayout( |
| 2446 | yoga::Node* const node, |
| 2447 | const float ownerWidth, |
| 2448 | const float ownerHeight, |
| 2449 | const Direction ownerDirection) { |
| 2450 | Event::publish<Event::LayoutPassStart>(node); |
| 2451 | LayoutData markerData = {}; |
| 2452 | |
| 2453 | // Increment the generation count. This will force the recursive routine to |
| 2454 | // visit all dirty nodes at least once. Subsequent visits will be skipped if |
| 2455 | // the input parameters don't change. |
| 2456 | gCurrentGenerationCount.fetch_add(1, std::memory_order_relaxed); |
| 2457 | node->processDimensions(); |
| 2458 | const Direction direction = node->resolveDirection(ownerDirection); |
| 2459 | float width = YGUndefined; |
| 2460 | SizingMode widthSizingMode = SizingMode::MaxContent; |
| 2461 | const auto& style = node->style(); |
| 2462 | if (node->hasDefiniteLength(Dimension::Width, ownerWidth)) { |
| 2463 | width = |
| 2464 | (node->getResolvedDimension( |
| 2465 | direction, |
| 2466 | dimension(FlexDirection::Row), |
| 2467 | ownerWidth, |
| 2468 | ownerWidth) |
| 2469 | .unwrap() + |
| 2470 | node->style().computeMarginForAxis(FlexDirection::Row, ownerWidth)); |
| 2471 | widthSizingMode = SizingMode::StretchFit; |
| 2472 | } else if (style |
| 2473 | .resolvedMaxDimension( |
| 2474 | direction, Dimension::Width, ownerWidth, ownerWidth) |
| 2475 | .isDefined()) { |
| 2476 | width = style |
| 2477 | .resolvedMaxDimension( |
| 2478 | direction, Dimension::Width, ownerWidth, ownerWidth) |
| 2479 | .unwrap(); |
| 2480 | widthSizingMode = SizingMode::FitContent; |
| 2481 | } else { |
| 2482 | width = ownerWidth; |
| 2483 | widthSizingMode = yoga::isUndefined(width) ? SizingMode::MaxContent |
| 2484 | : SizingMode::StretchFit; |
| 2485 | } |
| 2486 | |
| 2487 | float height = YGUndefined; |
| 2488 | SizingMode heightSizingMode = SizingMode::MaxContent; |
| 2489 | if (node->hasDefiniteLength(Dimension::Height, ownerHeight)) { |
| 2490 | height = |
| 2491 | (node->getResolvedDimension( |
| 2492 | direction, |
| 2493 | dimension(FlexDirection::Column), |
| 2494 | ownerHeight, |
| 2495 | ownerWidth) |
| 2496 | .unwrap() + |
| 2497 | node->style().computeMarginForAxis(FlexDirection::Column, ownerWidth)); |
| 2498 | heightSizingMode = SizingMode::StretchFit; |
| 2499 | } else if (style |
| 2500 | .resolvedMaxDimension( |
| 2501 | direction, Dimension::Height, ownerHeight, ownerWidth) |
| 2502 | .isDefined()) { |
no test coverage detected