Skip to content

Add BlockContext::float_snapshot/restore_float_snapshot for speculative float placement - #1068

Draft
nicoburns wants to merge 1 commit into
devin/1786127796-float-zero-heightfrom
devin/1786127796-float-snapshot
Draft

Add BlockContext::float_snapshot/restore_float_snapshot for speculative float placement#1068
nicoburns wants to merge 1 commit into
devin/1786127796-float-zero-heightfrom
devin/1786127796-float-snapshot

Conversation

@nicoburns

@nicoburns nicoburns commented Aug 7, 2026

Copy link
Copy Markdown
Member

Objective

Part 5/5 of the float placement fixes split from #1063 (stacked on #1067).

Adds a small public API for callers integrating inline layout (e.g. Blitz):

impl BlockContext<'_> {
    pub fn float_snapshot(&self) -> FloatContext;
    pub fn restore_float_snapshot(&mut self, snapshot: FloatContext);
}

An inline layout engine may need to place a float mid-line before knowing whether the line's content fits beside it (e.g. white-space: nowrap or unbreakable content discovered later on the line). The snapshot lets it speculatively place floats and roll them back if the line must be re-laid without them. Used by DioxusLabs/blitz#628 (fixes WPT float-nowrap-3/9.html there).

Feedback wanted

This is a pragmatic clone/restore API; happy to reshape it (e.g. a transactional guard type) if preferred.

Context

Stack (bottom-up): rules 3&7 overflow (#1064) → margin collapse (#1065) → height-aware slots (#1066) → zero-height floats (#1067) → this PR. Together they supersede #1063 (closed). Latest WPT verification after rebasing onto v0.13-era main: blitz css/CSS2/floats+floats-clear = 247 PASS / 90 FAIL / 0 CRASH of 337 with the stack + DioxusLabs/blitz#628, vs 227 PASS / 110 FAIL on current blitz main (20 newly passing, 0 regressions).

Link to Devin session: https://app.devin.ai/sessions/2aa49a15ca484966b5b71922bfd2bb58
Requested by: @nicoburns

@nicoburns nicoburns self-assigned this Aug 7, 2026
@devin-ai-integration

Copy link
Copy Markdown
Contributor

🤖 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

@devin-ai-integration
devin-ai-integration Bot force-pushed the devin/1786127796-float-snapshot branch from d504f52 to 439fbba Compare August 7, 2026 20:26
@nicoburns
nicoburns force-pushed the devin/1786127796-float-snapshot branch from 439fbba to 2aa0b63 Compare August 7, 2026 20:27
@nicoburns
nicoburns force-pushed the devin/1786127796-float-snapshot branch from 2aa0b63 to 90e4db4 Compare August 7, 2026 20:30
@devin-ai-integration
devin-ai-integration Bot force-pushed the devin/1786127796-float-snapshot branch from 90e4db4 to 28a2a6c Compare August 13, 2026 21:11
@devin-ai-integration
devin-ai-integration Bot force-pushed the devin/1786127796-float-snapshot branch from 28a2a6c to 9010d12 Compare August 13, 2026 21:12
@devin-ai-integration
devin-ai-integration Bot force-pushed the devin/1786127796-float-snapshot branch from 9010d12 to 4ee2990 Compare August 18, 2026 21:16
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