Skip to content

Auto margins share an inset-modified containing block no smaller than zero - #2485

Merged
ccheever merged 2 commits into
expo:mainfrom
Weesofficial:taffy-abspos-auto-margins
Dec 1, 2026
Merged

ccheever merged 2 commits into
expo:mainfrom
Weesofficial:taffy-abspos-auto-margins

Conversation

@Weesofficial

Copy link
Copy Markdown
Contributor

solve_axis in the vendored Taffy (vendor/taffy/src/compute/common/absolute.rs, Exact patch 18) computed free = area - start - end - size - margins for an absolutely positioned box's auto margins, even when the insets alone leave less than nothing. CSS Position 3 §4.1 reduces the inset that gives way so the inset-modified containing block is zero, never negative, and Chrome follows it.

50px box in a 100px block (Chrome 156 as oracle) Chrome Before
top:0; bottom:130px; margin-top:auto y = -50 y = -80
both margins auto, same insets -25 -40
insets crossing inside the block (top:60px; bottom:60px), margin-top:auto +10 -10
inline axis, margin-left:auto on an RTL box -30 -80
insets that leave room (control) matches matches

Fix (Exact patch 86, with its EXACT-PATCHES.md entry): free_space = (area - start - end).max(0.0) - size - margins. The offset still comes from the inset that holds, so only auto margins change.

Test: kernel/tests/it/browser_cases.rs::auto_margins_share_an_inset_modified_containing_block_no_smaller_than_zero (seven Chrome cases), failing without the fix. cargo test -p exact-kernel --lib and --test it pass, fmt, clippy on taffy and scripts/caps.mjs pass. Found with a differential layout fuzz against Chrome.

… zero

solve_axis (Exact patch 18) computed the free space for an absolutely positioned box's auto margins as area - start - end - size - margins even when the insets alone left less than nothing. CSS Position 3 (4.1) reduces the inset that gives way so the inset-modified containing block is zero, never negative, and Chrome follows it: a 50px box with top:0; bottom:130px; margin-top:auto in a 100px block sits at y=-50, not -80. The free space now starts from max(area - start - end, 0) (Exact patch 86); the offset still comes from the inset that holds.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-12-01T11:10:48.240208Z
We couldn’t complete this review. Comment @codex review to try again.
7a2ee91 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

# Conflicts:
#	kernel/tests/it/browser_cases.rs
#	vendor/taffy/EXACT-PATCHES.md
@ccheever
ccheever merged commit 02cf692 into expo:main Dec 1, 2026
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.

2 participants