Skip to content

Don't let display:none children force an inline formatting context - #656

Open
nicoburns wants to merge 1 commit into
mainfrom
devin/1786205018-display-none-classification
Open

Don't let display:none children force an inline formatting context#656
nicoburns wants to merge 1 commit into
mainfrom
devin/1786205018-display-none-classification

Conversation

@nicoburns

@nicoburns nicoburns commented Aug 8, 2026

Copy link
Copy Markdown
Member

Summary

Fixes a panic (Option::unwrap() on None at resolve.rs:375) hit by 6 WPT tests where the root element is display: none (e.g. css/CSS2/box-display/root-box-003.xht).

classify_flow_children counted display: none children as in-flow inline content (they cleared all_out_of_flow while leaving all_inline set). A container whose only non-whitespace children are display: none — such as the Document node when <html> is display: none — was therefore classified as all-inline and queued as an inline-layout construction task. The deferred-task loop then called element_data_mut().unwrap() on the Document node, which has no ElementData, and panicked.

Fix: skip display: none children in the classification (they generate no boxes, so they cast no vote). Such containers now take the all_out_of_flow path and their children are pushed as normal layout children, where Taffy already handles Display::None.

WPT: the 6 crashing tests now run (4 PASS, 2 FAIL for unrelated reasons); full css run shows no previously-passing test regressed and no new crashes.

Link to Devin session: https://dioxus.staging.devinenterprise.com/sessions/dde09f37a79d43a2ac7993911b21d308
Requested by: @nicoburns

WPT results

9 newly passing, 0 newly failing (net +9), 2 other status changes.

Full diff (11 changed tests)
+ Crash => Pass css/CSS2/box-display/root-box-003.xht
+ Fail => Pass css/CSS2/linebox/line-height-applies-to-016.xht
+ Fail => Pass css/CSS2/normal-flow/max-height-applies-to-016.xht
+ Fail => Pass css/CSS2/normal-flow/max-width-applies-to-016.xht
+ Fail => Pass css/CSS2/normal-flow/min-width-applies-to-016.xht
+ Fail => Pass css/css-animations/animation-name-in-shadow-part-inner-match.html
+ Crash => Pass css/css-backgrounds/background-color-body-propagation-005.html
! Crash => Fail css/css-backgrounds/background-color-root-propagation-001.html
+ Crash => Pass css/css-page/root-element-display-none-print.html
! Crash => Fail css/css-view-transitions/new-content-from-root-display-none.html
+ Crash => Pass css/selectors/not-default-ns-001.html

Generated by the WPT workflow.

display:none children generate no boxes, but classify_flow_children was
counting them as in-flow inline content. A container whose only children
are display:none (e.g. an <html> root with display:none) was classified
as all-inline and queued for inline layout construction -- panicking when
that container was the Document node, which has no element data.
@nicoburns nicoburns self-assigned this Aug 8, 2026
@staging-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

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