<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>306237</bug_id>
          
          <creation_ts>2026-01-25 17:30:47 -0800</creation_ts>
          <short_desc>Style queries are buggy inside a `display: contents` container</short_desc>
          <delta_ts>2026-05-19 01:26:04 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>CSS</component>
          <version>Safari 26</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=301871</see_also>
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Major</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Benoît Rouleau">benoit.rouleau</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>karlcow</cc>
    
    <cc>koivisto</cc>
    
    <cc>smh</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2174973</commentid>
    <comment_count>0</comment_count>
      <attachid>478133</attachid>
    <who name="Benoît Rouleau">benoit.rouleau</who>
    <bug_when>2026-01-25 17:30:47 -0800</bug_when>
    <thetext>Created attachment 478133
Reproduction of the bug

CSS container style queries behave super strangely when the container it is querying either has `display: contents` or is inside a `display: contents` wrapper. I am seeing all kinds of weirdness in a real project, but I managed to create a simple reproduction that hopefully allows you to find and fix the root cause for all of it. Check out the attached file. Thank you!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2175319</commentid>
    <comment_count>1</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2026-01-26 18:11:22 -0800</bug_when>
    <thetext>Thank you for the report! Is this the same as bug 301871?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2175407</commentid>
    <comment_count>2</comment_count>
    <who name="Benoît Rouleau">benoit.rouleau</who>
    <bug_when>2026-01-27 06:04:05 -0800</bug_when>
    <thetext>Ah, probably. Sorry for my bad searching skills!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2177045</commentid>
    <comment_count>3</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2026-02-01 17:31:11 -0800</bug_when>
    <thetext>&lt;rdar://problem/169407119&gt;</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>478133</attachid>
            <date>2026-01-25 17:30:47 -0800</date>
            <delta_ts>2026-01-25 17:30:47 -0800</delta_ts>
            <desc>Reproduction of the bug</desc>
            <filename>safari-bug-style-queries-display-contents.html</filename>
            <type>text/html</type>
            <size>713</size>
            <attacher name="Benoît Rouleau">benoit.rouleau</attacher>
            
              <data encoding="base64">PCFET0NUWVBFIGh0bWw+CjxodG1sIGxhbmc9ImVuIj4KPGhlYWQ+CiAgPG1ldGEgY2hhcnNldD0i
VVRGLTgiPgogIDxtZXRhIG5hbWU9InZpZXdwb3J0IiBjb250ZW50PSJ3aWR0aD1kZXZpY2Utd2lk
dGgsIGluaXRpYWwtc2NhbGU9MS4wIj4KICA8dGl0bGU+U2FmYXJpIGJ1ZyB3aXRoIGBkaXNwbGF5
OiBjb250ZW50c2AgYW5kIHN0eWxlIHF1ZXJpZXM8L3RpdGxlPgogIDxzdHlsZT4KICAgIC5jb250
ZW50cyB7CiAgICAgIGRpc3BsYXk6IGNvbnRlbnRzOwogICAgfQogIAogICAgLmNvbnRhaW5lciB7
CiAgICAgIGNvbnRhaW5lci1uYW1lOiBmb287CiAgICAgIC0tZm9vOiBiYXI7CiAgICB9CgogICAg
YnV0dG9uIHsKICAgICAgYm9yZGVyOiAxcHggc29saWQgYmxhY2s7CiAgICAgIGJhY2tncm91bmQt
Y29sb3I6IHdoaXRlOwoKICAgICAgQGNvbnRhaW5lciBmb28gc3R5bGUoLS1mb286IGJhcikgewog
ICAgICAgIGJhY2tncm91bmQtY29sb3I6IHJlZDsKICAgICAgfQogICAgfQogIDwvc3R5bGU+Cjwv
aGVhZD4KPGJvZHk+CiAgPGRpdiBjbGFzcz0iY29udGVudHMiPgogICAgPGRpdiBjbGFzcz0iY29u
dGFpbmVyIj4KICAgICAgPGJ1dHRvbiB0eXBlPSJidXR0b24iPkNsaWNrIG1lIGFuZCB0aGUgYmFj
a2dyb3VuZCB3aWxsIHN0b3AgYmVpbmcgcmVkIGZvciBubyByZWFzb248L2J1dHRvbj4KICAgIDwv
ZGl2PgogIDwvZGl2Pgo8L2JvZHk+CjwvaHRtbD4=
</data>

          </attachment>
      

    </bug>

</bugzilla>