<html>
    <head>
      <base href="https://bugs.webkit.org/" />
    </head>
    <body>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - slot doesn't work as a flex container"
   href="https://bugs.webkit.org/show_bug.cgi?id=160740#c4">Comment # 4</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - slot doesn't work as a flex container"
   href="https://bugs.webkit.org/show_bug.cgi?id=160740">bug 160740</a>
              from <span class="vcard"><a class="email" href="mailto:rniwa&#64;webkit.org" title="Ryosuke Niwa &lt;rniwa&#64;webkit.org&gt;"> <span class="fn">Ryosuke Niwa</span></a>
</span></b>
        <pre>The problem here is that StyleResolver::adjustRenderStyle mutates display value based on the parent render style even if the current render object was display: contents.

You can see this in line 898 of StyleResolver.cpp where it says:

if (parentStyle.isDisplayFlexibleOrGridBox()) {
    style.setFloating(NoFloat);
    style.setDisplay(equivalentBlockDisplay(style.display(), style.isFloating(), !document().inQuirksMode()));
}

Even if we added style.display() != CONTENTS as an additional condition, we'd later create an anonymous render block in RenderBlock::addChildIgnoringContinuation:

if (newChild-&gt;isInline()) {
    // No suitable existing anonymous box - create a new one.
    RenderBlock* newBox = createAnonymousBlock();
    RenderBox::addChild(newBox, beforeChild);
    newBox-&gt;addChild(newChild);
    return;
}

So we really need to move this logic to when a RenderObject is created instead of at the time of style resolution.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>