css_layout.sg is the T22 sprint — CSS box model layout engine. Reads style properties (width, height, margin, padding, display) from style_buf @0x5B0000, computes CSS box model layout (content → padding → border → margin) for DOM nodes, stores layout boxes (x, y, w, h) at layout_buf @0x5C0000 (32 B/box). Cumulative position tracking for block flow. CSS-LAYOUT-PASS 8/8. 6216 B arm-el0.
Box model layout engine
css_layout.sg
Content→padding→border→margin box computation — reads per-node style properties from
style_buf: width, height, margin (top/right/bottom/left), padding (top/right/bottom/left), display (block/inline/none). Computes layout box: content rect → add padding → add border → add margin. Stores (x, y, w, h) at layout_buf (32 B per box). Block flow: cumulative Y position tracking — each block box starts below the previous box's margin-bottom. Test: 3 boxes with varying margin/padding combinations, verifies correct cumulative positioning. Pairs with css_paint.sg (sigil-video) which consumes layout_box results for rendering. CSS-LAYOUT-PASS 8/8.