<?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>242629</bug_id>
          
          <creation_ts>2022-07-11 19:54:00 -0700</creation_ts>
          <short_desc>atan2 calc() function behaves incorrectly with different units</short_desc>
          <delta_ts>2024-11-10 20:40:22 -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>Safari 15</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>DUPLICATE</resolution>
          <dup_id>278244</dup_id>
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>GoodFirstBug, InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Devon Govett">govett</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>50167214</cc>
    
    <cc>ahmad.saleem792</cc>
    
    <cc>ap</cc>
    
    <cc>bfulgham</cc>
    
    <cc>karlcow</cc>
    
    <cc>koivisto</cc>
    
    <cc>nmouchtaris</cc>
    
    <cc>ntim</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>1882323</commentid>
    <comment_count>0</comment_count>
    <who name="Devon Govett">govett</who>
    <bug_when>2022-07-11 19:54:00 -0700</bug_when>
    <thetext>The atan2 function in CSS accepts dimensions, percentages, or numbers as inputs as long as the two arguments have the same type. However, the matching type doesn&apos;t mean the values are of the same units. As discussed in https://github.com/w3c/csswg-drafts/issues/7482, WebKit&apos;s current implementation behaves incorrectly when the units differ.

For example, currently the following behave identically:

```
rotate: atan2(90px, 90px);
rotate: atan2(90px, 90vw);
```

However, `90vw` should be resolved at computed value time and used rather than ignoring the unit completely. The same is true for examples like the following, where a computation includes incompatible units:

```
rotate: atan2(90px, 10px + 10vw);
```

Currently, WebKit ignores the 10vw completely here, and behaves the same as atan2(90px, 10px). The computation should be resolved and the result should be based on whatever 10px + 10vw computes to.

The current tests in web platform tests don&apos;t include any examples of differing units, but probably should.

Here&apos;s a codepen where you can see how WebKit currently renders some examples. https://codepen.io/devongovett/pen/GRxqNYj</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1884999</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2022-07-18 19:54:55 -0700</bug_when>
    <thetext>&lt;rdar://problem/97235085&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1894363</commentid>
    <comment_count>2</comment_count>
    <who name="Ahmad Saleem">ahmad.saleem792</who>
    <bug_when>2022-08-28 18:51:03 -0700</bug_when>
    <thetext>All three browsers differ in the attached test case (CodePen) from Comment 0.

*** Safari Technology Preview 152 on macOS 12.5.1 ***

Two Tilted red square first then in the last square

*** Chrome Canary 107 ***

Three red square

*** Firefox Nightly 106 ***

Titled red square and then simple square and then again tiled red square.

______

Just wanted to share updated results. Thanks!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1970284</commentid>
    <comment_count>3</comment_count>
    <who name="Ahmad Saleem">ahmad.saleem792</who>
    <bug_when>2023-08-09 05:43:11 -0700</bug_when>
    <thetext>Chrome Canary 117 and WebKit ToT (266719@main) seems to match each other while Firefox Nightly 118 is different from other.

Do we need to do anything here? CCing @Tim - since he fixed similar bugs recently.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1983583</commentid>
    <comment_count>4</comment_count>
    <who name="Tim Nguyen (:ntim)">ntim</who>
    <bug_when>2023-10-08 10:45:22 -0700</bug_when>
    <thetext>(In reply to Ahmad Saleem from comment #3)
&gt; Chrome Canary 117 and WebKit ToT (266719@main) seems to match each other
&gt; while Firefox Nightly 118 is different from other.
&gt; 
&gt; Do we need to do anything here? CCing @Tim - since he fixed similar bugs
&gt; recently.

WebKit &amp; Chrome still have an incorrect result here, since the first 2 squares are identical (first one uses 90px, second uses 90vw).

They should defer computation to computed-value time.

Arguably Firefox is slightly more correct here by rejecting the computation altogether (instead of computing to something incorrect), but that&apos;s not what the spec wants.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2061853</commentid>
    <comment_count>5</comment_count>
    <who name="Tim Nguyen (:ntim)">ntim</who>
    <bug_when>2024-09-20 09:06:36 -0700</bug_when>
    <thetext>

*** This bug has been marked as a duplicate of bug 278244 ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2074197</commentid>
    <comment_count>6</comment_count>
    <who name="yisibl">50167214</who>
    <bug_when>2024-11-10 20:32:05 -0800</bug_when>
    <thetext>Looks like Chrome 132 is wrong in the second test case? It seems to resolve to `atan2(5px, 5px)`.

```css
#b {
    rotate: atan2(5px, 5vw);
}
```</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2074199</commentid>
    <comment_count>7</comment_count>
    <who name="Karl Dubost">karlcow</who>
    <bug_when>2024-11-10 20:40:22 -0800</bug_when>
    <thetext>Also relevant https://github.com/w3c/csswg-drafts/issues/8169</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>