Fix: lay out the arranged subviews of an NSStackView with constraints - #892
Open
DTW-Thalion wants to merge 6 commits into
Open
Fix: lay out the arranged subviews of an NSStackView with constraints#892DTW-Thalion wants to merge 6 commits into
DTW-Thalion wants to merge 6 commits into
Conversation
DTW-Thalion
force-pushed
the
feature/stackview-constraint-layout
branch
from
August 5, 2026 20:58
e711a97 to
2872850
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This needs #643, which carries the constraint solver; a commit there fixes the engine bookkeeping this exercises. Without #643 the arranged views are not laid out at all and the new test set skips.
-_layoutViewsWithOrientation: took the spacing as the stride, so three views at spacing 10 landed at 0, 10 and 20 on top of each other. It read neither the distribution nor the alignment, and it grew the stack view's own frame on every pass.
-updateConstraints now builds the layout: the first view against the leading edge plus the inset, each later one against the trailing edge of the view before it plus the gap, and every view against the alignment attribute on the cross axis. Fill gives the spare room to the first view, FillEqually shares it out but keeps any view wider than the equal share, FillProportionally scales the extents by one factor, EqualSpacing equalises the gaps, and EqualCentering equalises the distance between centres. Each of them leaves the extents alone where the views do not fit and runs past the trailing edge.
The frames in Tests/gui/NSStackView/arrangedLayout.m were measured on macOS 26. No assertion in that file passes before the change and all 17 pass after; Tests/gui/NSStackView is 46 passed 0 failed under a display.
Closes #628