Block/float: fix BFC-beside-floats edge cases (full-height overlap, negative margins, flow-root) - #1060
Draft
nicoburns wants to merge 1 commit into
Draft
Block/float: fix BFC-beside-floats edge cases (full-height overlap, negative margins, flow-root)#1060nicoburns wants to merge 1 commit into
nicoburns wants to merge 1 commit into
Conversation
Contributor
🤖 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:
|
…ns, flow-root - Union float insets over the BFC root's entire height and iterate candidate positions at float-segment boundaries (CSS2 9.5) - Preserve negative containing-block insets in the fit-check - Include bottom padding/border in a BFC root's float-derived height - Add Style::item_is_flow_root / CoreStyle::is_flow_root so display: flow-root boxes establish a new BFC
devin-ai-integration
Bot
force-pushed
the
devin/1786129773-bfc-beside-floats
branch
from
August 13, 2026 21:35
6e811a8 to
91c5644
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
Fix the remaining Blitz WPT failures in the "BFC (new formatting context) beside floats" group. Per CSS2 §9.5, a box that establishes an independent formatting context must not overlap floats: it narrows beside them or moves below, and its margins interact with float edges specifically.
Three issues are fixed (rebased onto main after #1061/#1062/#1064/#1065, which fixed overlapping cases; the margin-absorption semantics from those PRs are preserved):
Full-height overlap — the fit-check only considered the float segment at the box's top edge, so a tall BFC root could overlap a wider float band lower down.
find_bfc_slotnow takes the box's top edgeyand itsheight(instead ofmin_y/clear/after) and unions the float insets (and per-side float presence) over all vertically-intersected segments; the caller measures the box at each candidate position (viaRunMode::ComputeSize) and advances past float-segment boundaries (next_bfc_candidate_y) until the full border box fits:Negative top margins — a BFC root pulled up by a negative top margin may sit (partially) above a float when it fits beside it, and moves below when it doesn't (previously it was always clamped down to the float segment's top).
BFC root height with floats — a BFC root's float-derived height now includes its bottom padding/border below the floats' bottom margin edge.
Context
Verified against blitz main (which is on taffy 0.13 / rev
d4a2b3bf) + this patch on the fullcss/CSS2/floats+css/CSS2/floats-clearWPT subsuites:Newly passing tests:
(The remaining test in the group, floats-wrap-bfc-006.xht, is blocked on table-caption support in blitz.)
Five new gentest fixtures cover the fixed behaviours (generated expectations verified against Chrome), including a
display: flow-rootcase now that main supportsDisplay::FlowRoot.cargo test,cargo fmtandcargo clippy --workspaceare clean.Note: running the WPT suites against latest taffy main required locally adding the new
known_dimensions_are_definitefield (from #1003) to blitz's twoLayoutInputinitializers inblitz-dom/src/layout/inline.rs— blitz will need that one-liner when it next bumps taffy.Link to Devin session: https://app.devin.ai/sessions/bd32f9420a3346a0be428cc02c532d0d
Requested by: @nicoburns