Support last-baseline alignment (align-items: last baseline) in flexbox and grid - #1111
Open
nicoburns wants to merge 3 commits into
Open
Conversation
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
staging-devin-ai-integration
Bot
force-pushed
the
devin/1786752736-last-baseline-alignment
branch
from
August 15, 2026 00:29
0ad7c95 to
9b629bb
Compare
This was referenced Aug 15, 2026
staging-devin-ai-integration
Bot
force-pushed
the
devin/1786752736-last-baseline-alignment
branch
from
August 18, 2026 18:51
7c5a77f to
6a8e18b
Compare
staging-devin-ai-integration
Bot
force-pushed
the
devin/1786752736-last-baseline-alignment
branch
from
August 19, 2026 00:29
6a8e18b to
2aaa511
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.
Objective
Implement last-baseline alignment (CSS
align-items: last baseline/align-self: last baseline) in flexbox and grid layout, on top of the last-baseline output support in #1110 (this PR is based on that branch and should merge after it).Context
Final PR of the last-baseline series (#1107 → #1108/#1109 → #1110 → this).
Style API (
src/style/alignment.rs):AlignItemsKeyword::LastBaselinevariant andAlignItems::LAST_BASELINEconstant (serde name"LastBaseline").last baseline(andfirst baselineas an alias ofbaseline);safe/unsafemodifiers remain invalid with baseline keywords.Flexbox (
src/compute/flexbox.rs):align-self: last baselineform a second baseline group, separate from first-baseline items, using the same participation rules (noautocross-axis margins, per flexbox §8.3).calculate_children_base_linesnow measures each group independently (skipping groups with ≤1 member), storingFlexItem::last_baselinewith the same scroll-container border-box clamping as first baselines; missing baselines are synthesized from the border box.child.last_baseline + max_last_baseline_descent.wrap-reverseflipping as for first baselines:align_last_baseline_columnfixtures, including RTL).last baselinelikeendfor static position purposes.Grid (
src/compute/grid/):GridItemgains alast_baseline_shimwhich acts as an extra bottom margin (the mirror image of the existing top-marginbaseline_shim), applied both during intrinsic track sizing (margins_axis_sums_with_baseline_shims) and final alignment (align_and_position_itemnow takes aLine<f32>of top/bottom shims).LastBaselinefalls back toEndalignment within the grid area, which combined with the bottom shim aligns the items' last baselines.Tests: 9 new gentest fixtures (36 generated tests) covering flex row/column/wrap-reverse/mixed-groups/auto-margin-exclusion and grid basic/nested/mixed-groups cases, plus parser and serde round-trip tests.
cargo fmt,clippy, and the full test suite pass.Feedback wanted
GridItem::last_baselinetransiently stores the item's last-baseline descent rather than the baseline itself (documented on the field); it is overwritten with the real baseline from the item's final layout before the container's last baseline is computed. A separate field could be used instead if this overloading is deemed too subtle.last baseline(left edges aligned, group anchored to the line's cross-end) was reverse-engineered from Chrome; other interpretations of the spec's fallback-alignment rules exist.Link to Devin session: https://dioxus.staging.devinenterprise.com/sessions/c0a80d9344d54e918b37cacfb71a2128
Requested by: @nicoburns