Resolve grid areas for out-of-flow boxes at positioning time - #1143
Closed
nicoburns wants to merge 4 commits into
Closed
Resolve grid areas for out-of-flow boxes at positioning time#1143nicoburns wants to merge 4 commits into
nicoburns wants to merge 4 commits into
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/1787402661-oof-grid-area
branch
from
August 23, 2026 19:04
82273be to
b8b030d
Compare
staging-devin-ai-integration
Bot
force-pushed
the
devin/1787348650-oof-hoisting
branch
from
August 23, 2026 19:04
2d03982 to
6e7ed2b
Compare
staging-devin-ai-integration
Bot
force-pushed
the
devin/1787402661-oof-grid-area
branch
from
August 23, 2026 19:15
b8b030d to
5442d16
Compare
staging-devin-ai-integration
Bot
force-pushed
the
devin/1787348650-oof-hoisting
branch
from
August 24, 2026 19:14
6ca0a55 to
42da269
Compare
staging-devin-ai-integration
Bot
force-pushed
the
devin/1787402661-oof-grid-area
branch
from
August 24, 2026 19:14
5442d16 to
4cd7813
Compare
staging-devin-ai-integration
Bot
force-pushed
the
devin/1787348650-oof-hoisting
branch
from
August 25, 2026 16:26
42da269 to
9e237c0
Compare
staging-devin-ai-integration
Bot
force-pushed
the
devin/1787402661-oof-grid-area
branch
from
August 25, 2026 16:26
4cd7813 to
88d1309
Compare
staging-devin-ai-integration
Bot
force-pushed
the
devin/1787402661-oof-grid-area
branch
from
August 25, 2026 17:09
7201b3e to
f780070
Compare
staging-devin-ai-integration
Bot
force-pushed
the
devin/1787348650-oof-hoisting
branch
from
August 25, 2026 17:09
9e237c0 to
683ef33
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
Third PR in the out-of-flow hoisting series (stacked on #1141, which is stacked on #1140).
Per CSS, an absolutely positioned box whose containing block is generated by a grid container is positioned relative to the grid area determined by its grid-placement properties (falling back to the padding box for
autoplacement). With hoisting (#1141) the containing block may not be the box's parent, so grid areas must be resolved at final positioning time from the containing block's track geometry — this is also how Blink does it (OutOfFlowLayoutPart→ComputeOutOfFlowItemContainingRectkeyed off the containing block, using the grid's persistedGridLayoutData).Chrome confirms this applies to non-direct descendants too: the new
grid_absolute_hoisted_descendant_grid_areagentest fixture (an abspos box withgrid-row/grid-columnset whose parent is a static in-flow grid item, so its CB is the grid) resolves against the grid area in Chrome, and now in taffy.Context
perform_oof_layoutnow takes the current node's id and, per claimed candidate, reads the node's detailed layout info; if it isDetailedLayoutInfo::Grid, the candidate's inset-resolution area becomesDetailedGridInfo::resolve_absolute_grid_area(child.grid_row(), child.grid_column(), ...)instead of the passed padding-box area:New
OofItemStyle: CoreStylestyle trait with defaulted,grid-feature-gatedgrid_row/grid_columnmethods — grid placement is an item property read from the candidate at positioning time, so it lives on a dedicated OOF-item style trait rather thanCoreStyle.GridItemStylekeeps its own copies for in-flow grid items.New
LayoutContainingBlock: LayoutPartialTreetree trait housing the containing-block-side OOF positioning requirements:type OofItemStyle<'a>+ requiredget_oof_item_style(NodeId)— the candidate's style.get_detailed_layout_info(NodeId) -> &DetailedLayoutInfo<Self::CustomIdent>(default returnsDetailedLayoutInfo::None, degrading to padding-box positioning for custom trees that don't implement it).All container algorithms (
compute_block_layout,compute_flexbox_layout,compute_grid_layout,compute_root_layout) require this trait, since any container may be the containing block of hoisted boxes. (A follow-up could moveperform_oof_layoutdispatch out of the algorithms into the shared traversal layer, at which point this trait becomes a dispatcher-only bound.)DetailedLayoutInfoand the detailed grid info types are un-gated from thedetailed_layout_infocargo feature (the feature is retained but no longer gates anything), so the data is available to the positioning pass in all builds.DetailedLayoutInfobecomes generic over the custom identifier string type (DetailedLayoutInfo<S = DefaultCheapStr>), with a hidden never-constructed variant consumingSwhengridis disabled. Grid layout now always callsset_detailed_grid_info, and does so before its out-of-flow positioning pass so the pass can read the grid's own geometry.Direct abspos children of a grid container that is itself their containing block are still laid out in-algorithm (unchanged); the positioning-time path handles hoisted (non-direct) descendants and root-claimed candidates.
New gentest fixtures:
grid_absolute_hoisted_descendant_grid_areaandgrid_absolute_hoisted_descendant_auto_placement(8 generated tests, LTR/RTL × border-box/content-box). Full suite: 6013 gentests + hand-written tests pass; clippy clean;--no-default-features,--no-default-features --features grid, and--all-featuresall compile.Feedback wanted
detailed_layout_infocargo feature should be removed outright now that it gates nothing.Phantomvariant onDetailedLayoutInfo(needed to consume theSgeneric whengridis disabled) — open to alternatives.Link to Devin session: https://dioxus.staging.devinenterprise.com/sessions/65c5463061c8403bade7888271d5eeb4
Open in Devin Desktop: https://dioxus.staging.devinenterprise.com/desktop/session/65c5463061c8403bade7888271d5eeb4?variant=devin-insiders
Requested by: @nicoburns