| 432 | } |
| 433 | |
| 434 | const applyOverflowStyles = (node: LayoutNode, style: Styles): void => { |
| 435 | // Yoga's Overflow controls whether children expand the container. |
| 436 | // 'hidden' and 'scroll' both prevent expansion; 'scroll' additionally |
| 437 | // signals that the renderer should apply scrollTop translation. |
| 438 | // overflowX/Y are render-time concerns; for layout we use the union. |
| 439 | const y = style.overflowY ?? style.overflow |
| 440 | const x = style.overflowX ?? style.overflow |
| 441 | if (y === 'scroll' || x === 'scroll') { |
| 442 | node.setOverflow(LayoutOverflow.Scroll) |
| 443 | } else if (y === 'hidden' || x === 'hidden') { |
| 444 | node.setOverflow(LayoutOverflow.Hidden) |
| 445 | } else if ( |
| 446 | 'overflow' in style || |
| 447 | 'overflowX' in style || |
| 448 | 'overflowY' in style |
| 449 | ) { |
| 450 | node.setOverflow(LayoutOverflow.Visible) |
| 451 | } |
| 452 | } |
| 453 | |
| 454 | const applyMarginStyles = (node: LayoutNode, style: Styles): void => { |
| 455 | if ('margin' in style) { |