Skip to content

Add Position::Static (new default) and Position::Fixed - #1140

Open
nicoburns wants to merge 3 commits into
mainfrom
devin/1787345886-position-static-fixed
Open

Add Position::Static (new default) and Position::Fixed#1140
nicoburns wants to merge 3 commits into
mainfrom
devin/1787345886-position-static-fixed

Conversation

@nicoburns

Copy link
Copy Markdown
Member

Objective

First step towards browser-correct out-of-flow (absolute/fixed) hoisting: make the Position enum reflect the full CSS position model.

  • Position gains Static and Fixed variants, plus is_out_of_flow() / is_positioned() helpers
  • Breaking: Position::Static replaces Position::Relative as the default (matching CSS). Static is normal flow but ignores inset and (once hoisting lands) will not act as a containing block for absolute descendants
  • Fixed is treated as out-of-flow everywhere Absolute was; it currently behaves identically to Absolute (positioned relative to its parent). True containing-block hoisting (nearest positioned ancestor for absolute, root for fixed) lands in a follow-up PR
  • CSS parser (parse feature) accepts all four keywords: static | relative | absolute | fixed
  • CHANGELOG.md updated

Context

Part of the OOF-hoisting plan discussed with @nicoburns: candidate bubbling through LayoutOutput, a shared CB-side positioning pass, CB-relative Layout.location, and rounding-via-CB recursion follow in the next PR. This PR only introduces the style-level model so the layout changes can build on it.

Mechanical changes:

  • Algorithm checks generalized from position == Absolute to position.is_out_of_flow(), and relative-inset application gated on position == Relative (so Static ignores insets)
  • gentest's default serialized position changed from relative to static; test fixtures that relied on the old default for inset behavior now declare position: relative explicitly, and generated tests were regenerated
  • Benchmark helpers map Static → legacy Relative and Fixed → legacy Absolute for the taffy 0.3 / yoga comparisons (yoga's PositionType::Static is used directly)

cargo test --workspace, cargo fmt, cargo clippy all pass.

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

@staging-devin-ai-integration

Copy link
Copy Markdown

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR that start with 'DevinAI' or '@devin'.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

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