Skip to content

Carry needs_wrap into a display:contents child's layout children - #649

Open
latentharbor wants to merge 1 commit into
DioxusLabs:mainfrom
latentharbor:fix-display-contents-needs-wrap
Open

Carry needs_wrap into a display:contents child's layout children#649
latentharbor wants to merge 1 commit into
DioxusLabs:mainfrom
latentharbor:fix-display-contents-needs-wrap

Conversation

@latentharbor

Copy link
Copy Markdown

collect_complex_layout_children recurses into a display: contents child through collect_layout_children, which does not carry the enclosing container's needs_wrap policy. The text child is then pushed into a block container unwrapped, and taffy asks that Text node for its style, panicking with ```style is not available on this node kind.

Minimal reproduction, no script and no shadow DOM:

<div><span style="display:contents">x</span><div>y</div></div>

<slot> is display: contents in the UA stylesheet, so this tends to surface as a shadow-DOM failure although it has nothing to do with shadow trees.

One behavioural note, measured rather than assumed: against the Web Platform Tests this clears a large share of the panics of this class but not all of them, and it changes display-contents-suppression-dynamic-001 from PASS to FAIL. That test appears to have been passing because the subtree was suppressed by the bug rather than by the cascade, but I have not confirmed that reading and would welcome a second look.

Found while running WPT against blitz-dom in OpenKitesurf.

`collect_complex_layout_children` recurses into a `display: contents`
child through `collect_layout_children`, which does not carry the
enclosing container's `needs_wrap` policy. The text child is then pushed
into a block container unwrapped, and taffy asks that Text node for its
`style`, panicking with

    `style` is not available on this node kind

Minimal reproduction, no script and no shadow DOM:

    <div><span style="display:contents">x</span><div>y</div></div>

`<slot>` is `display: contents` in the UA stylesheet, so this tends to
surface as a shadow-DOM failure although it has nothing to do with shadow
trees.

One behavioural note, measured rather than assumed: against the Web
Platform Tests this clears a large share of the panics of this class but
not all of them, and it changes `display-contents-suppression-dynamic-001`
from PASS to FAIL. That test appears to have been passing because the
subtree was suppressed by the bug rather than by the cascade, but I have
not confirmed that reading and would welcome a second look.
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