<?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>200842</bug_id>
          
          <creation_ts>2019-08-16 16:38:17 -0700</creation_ts>
          <short_desc>Support for &quot;not&quot; in media queries</short_desc>
          <delta_ts>2023-02-10 17:53:36 -0800</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>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Dean Jackson">dino</reporter>
          <assigned_to name="Antti Koivisto">koivisto</assigned_to>
          <cc>ahmad.saleem792</cc>
    
    <cc>ap</cc>
    
    <cc>bfulgham</cc>
    
    <cc>ntim</cc>
    
    <cc>rniwa</cc>
    
    <cc>simon.fraser</cc>
    
    <cc>webkit-bug-importer</cc>
    
    <cc>zalan</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1562291</commentid>
    <comment_count>0</comment_count>
      <attachid>376565</attachid>
    <who name="Dean Jackson">dino</who>
    <bug_when>2019-08-16 16:38:17 -0700</bug_when>
    <thetext>Created attachment 376565
test case

We don&apos;t support the &quot;not&quot; operator in some parts of media queries. e.g.

@media not (max-device-width: 10px) { .box { background-color: blue; } }

That should evaluate to true on all devices which are wider than 10px.

Test case attached.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1562292</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2019-08-16 16:38:48 -0700</bug_when>
    <thetext>&lt;rdar://problem/54412886&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1562297</commentid>
    <comment_count>2</comment_count>
    <who name="Dean Jackson">dino</who>
    <bug_when>2019-08-16 16:41:45 -0700</bug_when>
    <thetext>I think we only support &quot;not keyword&quot; e.g. &quot;not screen&quot;, but do not support &quot;not&quot; before arbitrary expressions.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1562301</commentid>
    <comment_count>3</comment_count>
    <who name="Dean Jackson">dino</who>
    <bug_when>2019-08-16 16:46:00 -0700</bug_when>
    <thetext>Yes. Looks like MediaQueryParser::readMediaType looks for MediaQuery::Not via string. I don&apos;t see any calls to MediaQueryParser::readMediaNot.

We do support &quot;not&quot; in @supports CSSSupportsParser::consumeNegation</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1564859</commentid>
    <comment_count>4</comment_count>
    <who name="Dean Jackson">dino</who>
    <bug_when>2019-08-24 20:32:48 -0700</bug_when>
    <thetext>https://drafts.csswg.org/mediaqueries-4/#mq-not

The way I read this suggests that a &quot;not&quot; keyword requires a media type and media condition. So this might be correct behaviour.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1564860</commentid>
    <comment_count>5</comment_count>
    <who name="Dean Jackson">dino</who>
    <bug_when>2019-08-24 20:37:38 -0700</bug_when>
    <thetext>But, the syntax disagrees with this:

&lt;media-query&gt; = &lt;media-condition&gt;
             | [ not | only ]? &lt;media-type&gt; [ and &lt;media-condition-without-or&gt; ]?
&lt;media-type&gt; = &lt;ident&gt;

&lt;media-condition&gt; = &lt;media-not&gt; | &lt;media-in-parens&gt; [ &lt;media-and&gt;* | &lt;media-or&gt;* ]
&lt;media-condition-without-or&gt; = &lt;media-not&gt; | &lt;media-in-parens&gt; &lt;media-and&gt;*
&lt;media-not&gt; = not &lt;media-in-parens&gt;
&lt;media-and&gt; = and &lt;media-in-parens&gt;
&lt;media-or&gt; = or &lt;media-in-parens&gt;
&lt;media-in-parens&gt; = ( &lt;media-condition&gt; ) | &lt;media-feature&gt; | &lt;general-enclosed&gt;

&lt;media-feature&gt; = ( [ &lt;mf-plain&gt; | &lt;mf-boolean&gt; | &lt;mf-range&gt; ] )
&lt;mf-plain&gt; = &lt;mf-name&gt; : &lt;mf-value&gt;
&lt;mf-boolean&gt; = &lt;mf-name&gt;
&lt;mf-range&gt; = &lt;mf-name&gt; &lt;mf-comparison&gt; &lt;mf-value&gt;
           | &lt;mf-value&gt; &lt;mf-comparison&gt; &lt;mf-name&gt;
           | &lt;mf-value&gt; &lt;mf-lt&gt; &lt;mf-name&gt; &lt;mf-lt&gt; &lt;mf-value&gt;
           | &lt;mf-value&gt; &lt;mf-gt&gt; &lt;mf-name&gt; &lt;mf-gt&gt; &lt;mf-value&gt;
&lt;mf-name&gt; = &lt;ident&gt;
&lt;mf-value&gt; = &lt;number&gt; | &lt;dimension&gt; | &lt;ident&gt; | &lt;ratio&gt;
&lt;mf-lt&gt; = &apos;&lt;&apos; &apos;=&apos;?
&lt;mf-gt&gt; = &apos;&gt;&apos; &apos;=&apos;?
&lt;mf-eq&gt; = &apos;=&apos;
&lt;mf-comparison&gt; = &lt;mf-lt&gt; | &lt;mf-gt&gt; | &lt;mf-eq&gt;

&lt;general-enclosed&gt; = [ &lt;function-token&gt; &lt;any-value&gt; ) ] | ( &lt;ident&gt; &lt;any-value&gt; )
The &lt;media-type&gt; production does not include the keywords only, not, and, and or.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1892724</commentid>
    <comment_count>6</comment_count>
    <who name="Ahmad Saleem">ahmad.saleem792</who>
    <bug_when>2022-08-20 16:11:28 -0700</bug_when>
    <thetext>I am able to reproduce this bug in Safari 15.6.1 and Safari Technology Preview 151 using attached test case and it shows &quot;Black&quot; rectangle. While all other browsers (Chrome Canary 106 and Firefox Nightly 105) show &quot;Blue&quot; rectangle. Just wanted to share updated testing results. Thanks!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1932855</commentid>
    <comment_count>7</comment_count>
    <who name="Tim Nguyen (:ntim)">ntim</who>
    <bug_when>2023-02-10 17:53:36 -0800</bug_when>
    <thetext>Fixed by MQ4 support.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>376565</attachid>
            <date>2019-08-16 16:38:17 -0700</date>
            <delta_ts>2019-08-16 16:38:26 -0700</delta_ts>
            <desc>test case</desc>
            <filename>media-query-not.html</filename>
            <type>text/html</type>
            <size>426</size>
            <attacher name="Dean Jackson">dino</attacher>
            
              <data encoding="base64">PCFET0NUWVBFIGh0bWw+Cjx0aXRsZT5AbWVkaWEgbm90PC90aXRsZT4KPG1ldGEgbmFtZT0idmll
d3BvcnQiIGNvbnRlbnQ9IndpZHRoPWRldmljZS13aWR0aCI+Cgo8c3R5bGU+CmJvZHkgewogICAg
Zm9udC1mYW1pbHk6IHN5c3RlbS11aTsKfQoKLmJveCB7CiAgICB3aWR0aDogMjAwcHg7CiAgICBo
ZWlnaHQ6IDIwMHB4OwogICAgYmFja2dyb3VuZC1jb2xvcjogYmxhY2s7Cn0KCkBtZWRpYSBub3Qg
KG1heC1kZXZpY2Utd2lkdGg6IDEwcHgpIHsKICAgIC5ib3ggewogICAgICAgIGJhY2tncm91bmQt
Y29sb3I6IGJsdWU7CiAgICB9Cn0KPC9zdHlsZT4KCjxwcmU+QG1lZGlhIG5vdCAobWF4LWRldmlj
ZS13aWR0aDogMTBweCkgeyAuYm94IHsgYmFja2dyb3VuZC1jb2xvcjogYmx1ZTsgfSB9PC9wcmU+
Cgo8ZGl2IGNsYXNzPSJib3giPgo8L2Rpdj4K
</data>

          </attachment>
      

    </bug>

</bugzilla>