diff --git a/packages/engine/ui/document.h b/packages/engine/ui/document.h index e92f69a..d238473 100644 --- a/packages/engine/ui/document.h +++ b/packages/engine/ui/document.h @@ -97,5 +97,12 @@ void endStyleMountBatch(); // presents to the panel would show unstyled content; the render path uses this to // suppress that flush until styles land. Defined in style.cpp. bool styleMountBatchActive(); +// Queues the class styles of a newly mounted root. The mounted root is what +// `:root` matches and where a stylesheet's custom properties live, but nothing +// in building it (createView + an id attribute) queues its own recompute, so +// `:root { --x: ... }` never landed and every var(--x) below resolved to +// nothing. Deferred and coalesced under an open batch, where it becomes the +// one top-most root; immediate otherwise. Defined in style.cpp. +void noteMountedRootStyle(int root); } // namespace gea::embedded::ui diff --git a/packages/engine/ui/layout.cpp b/packages/engine/ui/layout.cpp index c03a8fc..12be080 100644 --- a/packages/engine/ui/layout.cpp +++ b/packages/engine/ui/layout.cpp @@ -1129,8 +1129,15 @@ class FlexLayoutPass { } pen += gap + marginL + cn.layout.width + marginR; - if (soleRun && cn.type == NodeType::Text && !hasExplicitWidth(cn)) { - // text-align needs a box as wide as the line box to align inside. + // text-align needs a box as wide as the line box to align inside — but + // ONLY the alignments that actually consume the extra width. `start` + // (alignedOffset's 0 case) draws at the box's left edge either way, so + // widening is invisible, while the widened box becomes the run's + // layout.width and feeds the parent's shrink-to-fit: a `