Skip to content

feat(gpui): let an element lay out content while layout runs - #5

Closed
mateo-m wants to merge 4 commits into
remorses:gpuixfrom
mateo-m:gpui-isolated-layout
Closed

mateo-m wants to merge 4 commits into
remorses:gpuixfrom
mateo-m:gpui-isolated-layout

Conversation

@mateo-m

@mateo-m mateo-m commented Sep 4, 2026 •

Copy link
Copy Markdown

What this adds

  • IsolatedLayout: a second taffy tree that an element can enter while the window's tree computes.
  • With it, a measure closure inside Window::request_measured_layout can lay out and measure a child.

GPUIX needs this for a panel whose height animates to the height of its content. Taffy hands the parent's width to the measure closure. The content must be measured at that width so text wraps the way it will on screen.

What I ran and saw

  • cargo check -p gpui -p gpui_apple passes on this branch.
  • cargo test -p gpui passes (269 tests plus 1 doc test).
  • The GPUIX native suite exercises this through the animated auto-height path in the test renderer.

What I did not verify

  • No revert-and-fail cycle for this commit alone. The GPUIX auto-height tests fail without it, but I did not re-run that cycle for this PR.

Moved from the fork

The same stack, rebased onto zed-industries main, is open upstream as zed-industries#63771. This PR is the path for the GPUIX submodule, which follows the gpuix branch of this repo.

This PR was mateo-m/zed#4. The branch merged gpuix at 8802c83 before the move, with no conflicts. cargo check -p gpui -p gpui_wgpu passes on the merged head.

Bottom of a stack. The corner shapes PR and the effect layers PR build on this branch.

Taffy computes one tree at a time. The measure closure of
`Window::request_measured_layout` runs inside that computation, so an
element cannot lay a child out there, and `Window::layout_engine` is
`None` for the duration anyway. An element that wants to size itself
from content it has to measure has no way to do it.

`IsolatedLayout` holds a second tree for that content. `enter` puts it in
front of the window's tree for the duration of a closure and gives the
window its own tree back afterwards.

GPUIX needs this for a panel whose height animates to the height of its
content. The width is what the parent gives it, which taffy hands to the
measure closure, and the content has to be measured at that width for
text to wrap the way it will on screen.

Sent upstream as the same change on gpui/isolated-layout.
@mateo-m

mateo-m commented Sep 4, 2026 •

Copy link
Copy Markdown
Author

Reopened. This PR stays the path for the GPUIX submodule: AGENTS.md in remorses/gpuix asks for GPUI changes as commits on this branch before the submodule points at them. The same stack, rebased onto zed-industries main, is open as zed-industries#63771.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant