Skip to content

feat(htmlcss): inline-block siblings via Taffy flex-wrap emulation#691

Merged
softmarshmallow merged 1 commit intohtmlcssfrom
claude/dazzling-dirac-3b738f
Apr 24, 2026
Merged

feat(htmlcss): inline-block siblings via Taffy flex-wrap emulation#691
softmarshmallow merged 1 commit intohtmlcssfrom
claude/dazzling-dirac-3b738f

Conversation

@softmarshmallow
Copy link
Copy Markdown
Member

Summary

Sub-PR for #690 — lands the first of the four tier-0 WPT primitives (display: inline-block).

Taffy has no inline formatting context, so a block container holding display: inline-block siblings previously either stacked them vertically (when preserved as elements) or dropped their width/height (when flattened into an InlineGroup). Both broke the WPT ref pattern where ≥2 explicit-size inline-blocks should sit side-by-side.

Impact on WPT refs

Unlocks refs that rely on inline-block for horizontal layout: ~37% of css-flexbox refs, ~30% of css-position refs (per ~/Desktop/grida-wpt/ref-primitives-inventory.md).

Gate

  • L0.exact: 65/65 at 100.00% (was 64/64). gate.floor=1.0, threshold=0, aa=true unchanged.
  • New fixture: fixtures/test-html/L0/layout-display-inline-block.html (paint-style, four equal-size blocks laid out via font-size:0 parent to kill inter-element whitespace).

Tier-0 primitives — remaining work

The loop also audited priorities 2–4; here's what they need before they can be pursued:

Priority Status Gating issue
2. Inline <svg> deferred Separate subject — needs DOM→SVG serialization + usvg::Tree wiring + Skia paint.
3. float blocked upstream Taffy 0.9.2 has no float property. Needs a custom layout pass outside Taffy.
4. writing-mode: vertical-* blocked upstream stylo's layout.writing-mode.enabled pref is missing from stylo_static_prefs/src/lib.rs and defaults to false; declarations are rejected at parse time and never reach ComputedStyle::clone_writing_mode(). Needs a cross-repo patch to gridaco/stylo.

Test plan

  • cargo build -p grida_wpt --release
  • cargo clippy --no-deps -- -D warnings
  • cargo test -p cg
  • L0.exact full run: 65 fixtures at 100.00%, min=100.00%, max=100.00%
  • No new fixture regressions (all previously-listed L0.exact entries still at 100%)

🤖 Generated with Claude Code

Taffy has no inline formatting context, so a block container holding
`display: inline-block` siblings previously either stacked them
vertically (when preserved as elements) or dropped their width/height
(when flattened into an InlineGroup). Both broke the WPT ref pattern
where two or more explicit-size inline-blocks should sit side-by-side.

- collect.rs: preserve inline-block as an element when it has an
  explicit width or height instead of flattening into the inline path.
- layout.rs: at Taffy-style time, detect containers whose element
  children are all inline-block (>=2, no text or other block children)
  and switch the container to Flex + flex-wrap:wrap + align-items:start.

Lands layout-display-inline-block.html in L0.exact (65 fixtures, all
100.00%). Unlocks WPT refs that rely on inline-block for horizontal
layout (37% of css-flexbox, 30% of css-position refs).
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 24, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
blog Ready Ready Preview, Comment Apr 24, 2026 3:16am
docs Ready Ready Preview, Comment Apr 24, 2026 3:16am
grida Ready Ready Preview, Comment Apr 24, 2026 3:16am
viewer Ready Ready Preview, Comment Apr 24, 2026 3:16am
3 Skipped Deployments
Project Deployment Actions Updated (UTC)
backgrounds Ignored Ignored Preview Apr 24, 2026 3:16am
code Ignored Ignored Apr 24, 2026 3:16am
legacy Ignored Ignored Apr 24, 2026 3:16am

Request Review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 24, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: dd978deb-ed9d-49d5-b9b7-198d275a17ab

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/dazzling-dirac-3b738f

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 18bbc0176b

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +439 to +444
let inline_block_with_size = child.display == types::Display::InlineBlock
&& (child.width != types::CssLength::Auto
|| child.height != types::CssLength::Auto);
let is_inline = (child.display == types::Display::Inline
|| child.display == types::Display::InlineBlock)
&& !inline_block_with_size;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Preserve inline flow for sized inline-block mixed with text

Marking every sized display:inline-block as non-inline here forces it out of InlineGroup, but the later emulation only runs when the parent has no text/inline groups and at least two inline-block elements. In mixed content (for example text + inline-block + text) or a single inline-block, the parent stays block and this node is laid out as a block child, inserting unintended line breaks around content that should remain in one inline formatting context.

Useful? React with 👍 / 👎.

Comment on lines +135 to +136
style.display = taffy::Display::Flex;
style.flex_wrap = taffy::FlexWrap::Wrap;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Force row direction when emulating inline-block container

After switching a block container to flex for inline-block emulation, the code keeps whatever flex-direction was parsed from CSS; that property is inert on block elements but can still compute to column, and once the display is changed it becomes active and stacks children vertically. To reliably emulate inline-block siblings, this branch should also set flex_direction to row (and avoid inheriting flex-only controls that were previously ignored).

Useful? React with 👍 / 👎.

@softmarshmallow softmarshmallow merged commit a3f18fd into htmlcss Apr 24, 2026
16 checks passed
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