<?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>278244</bug_id>
          
          <creation_ts>2024-08-16 11:58:19 -0700</creation_ts>
          <short_desc>Re-implement calc() to more closely align with current spec</short_desc>
          <delta_ts>2024-09-25 09:25:01 -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 18</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=255280</see_also>
    
    <see_also>https://bugs.webkit.org/show_bug.cgi?id=279498</see_also>
    
    <see_also>https://bugs.webkit.org/show_bug.cgi?id=280034</see_also>
          <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>
          
          <blocked>278852</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Sam Weinig">sam</reporter>
          <assigned_to name="Sam Weinig">sam</assigned_to>
          <cc>brandon</cc>
    
    <cc>govett</cc>
    
    <cc>koivisto</cc>
    
    <cc>ntim</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2053349</commentid>
    <comment_count>0</comment_count>
    <who name="Sam Weinig">sam</who>
    <bug_when>2024-08-16 11:58:19 -0700</bug_when>
    <thetext>Re-implement calc() to more closely align with current spec.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2053388</commentid>
    <comment_count>1</comment_count>
    <who name="Sam Weinig">sam</who>
    <bug_when>2024-08-16 14:03:50 -0700</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/32321</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2054514</commentid>
    <comment_count>2</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2024-08-21 14:28:43 -0700</bug_when>
    <thetext>Committed 282580@main (e6902e0483c5): &lt;https://commits.webkit.org/282580@main&gt;

Reviewed commits have been landed. Closing PR #32321 and removing active labels.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2054515</commentid>
    <comment_count>3</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2024-08-21 14:29:15 -0700</bug_when>
    <thetext>&lt;rdar://problem/134446246&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2059342</commentid>
    <comment_count>4</comment_count>
    <who name="Tim Nguyen (:ntim)">ntim</who>
    <bug_when>2024-09-11 10:32:53 -0700</bug_when>
    <thetext>*** Bug 255280 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2059523</commentid>
    <comment_count>5</comment_count>
    <who name="Tim Nguyen (:ntim)">ntim</who>
    <bug_when>2024-09-11 18:25:11 -0700</bug_when>
    <thetext>*** Bug 255280 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2059556</commentid>
    <comment_count>6</comment_count>
    <who name="Brandon McConnell">brandon</who>
    <bug_when>2024-09-11 20:12:26 -0700</bug_when>
    <thetext>Yes, see the related tests can be seen here:
https://wpt.fyi/results/css/css-values?label=pr_head&amp;max-count=1&amp;pr=42517

I spec&apos;d them here:
https://github.com/web-platform-tests/wpt/pull/42517

-
Can someone please reopen this ticket until all the related tests pass? This is if the affirmation bug is truly considered a duplicate.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2059710</commentid>
    <comment_count>7</comment_count>
    <who name="Sam Weinig">sam</who>
    <bug_when>2024-09-12 10:14:41 -0700</bug_when>
    <thetext>The WPT website unfortunately doesn&apos;t run the latest WebKit, so it is not showing accurate results.

But, I can tell you what the output on ToT is for each of those tests:

calc-background-position-002.html: All passing

PASS testing background-position: calc(2px + 3px) calc(4px + 5px)
PASS testing background-position: calc(18px - 7px) calc(19px - 7px)
PASS testing background-position: calc(4 * 5px) calc(6px * 4)
PASS testing background-position: calc(100px / 4) calc(119px / 7)
PASS testing background-position: calc(6px + 21%) calc(7em + 22%)
PASS testing background-position: calc(-8px + 23%) calc(-9em + 24%)

calc-in-media-queries-with-mixed-units.html: All but one are passing.

(the failing test seems to be an error in the test, I raised the issue here -&gt; https://github.com/w3c/csswg-drafts/issues/10809 

PASS box should be orange if the calc between px-em in @media was correct
PASS box should be orange if the calc between vh+em in @media was correct
PASS box should be orange if the calc between vw-em in @media was correct
PASS box should be orange if the calc between vw+vh in @media was correct
PASS box should be orange if the calc between vh+px in @media was correct
PASS box should be orange if the calc between vw+px in @media was correct
PASS box should be orange if the calc between px/em*em in @media was correct
PASS box should be orange if the calc between vh*em in @media was correct
FAIL box should be orange if the calc between vh*vw/em*px/vh in @media was correct assert_equals: expected &quot;rgb(255, 165, 0)&quot; but got &quot;rgb(0, 0, 255)&quot;
PASS box should be orange if the calc between vw/px*vh in @media was correct
PASS box should be orange if the calc between vh*vw/em*px in @media was correct
PASS box should be orange if the calc between vw*vh*px*em/px/px/px in @media was correct


calc-linear-radial-conic-gradient-001.html: All passing

PASS testing background-image: linear-gradient(rgb(0, 128, 0) calc(0%), rgb(0, 0, 255))
PASS testing background-image: linear-gradient(calc(90deg), rgb(0, 128, 0), rgb(0, 0, 255))
PASS testing background-image: linear-gradient(calc(90deg), rgb(0, 128, 0) calc(0%), rgb(0, 0, 255))
PASS testing background-image: linear-gradient(calc(0.1turn + 0.15turn), rgb(0, 128, 0), rgb(0, 0, 255))
PASS testing background-image: linear-gradient(calc(150grad - 50grad), rgb(0, 128, 0), rgb(0, 0, 255))
PASS testing background-image: linear-gradient(calc(200grad - 90deg), rgb(0, 128, 0), rgb(0, 0, 255))
PASS testing background-image: radial-gradient(rgb(0, 128, 0) calc(10% + 20%), rgb(0, 0, 255) calc(30% + 40%))
PASS testing background-image: conic-gradient(rgb(0, 128, 0) calc(50% + 10%), rgb(0, 0, 255) calc(60% + 20%))

calc-z-index-fractions-001.html: All passing

PASS testing z-index: calc(2.5 / 2)
PASS testing z-index: calc(3 / 2)
PASS testing z-index: calc(3.5 / 2)
PASS testing z-index: calc(-2.5 / 2)
PASS testing z-index: calc(-3 / 2)
PASS testing z-index: calc(-3.5 / 2)

getComputedStyle-border-radius-001.html: All passing

PASS testing border-top-left-radius: calc(25% + 10px) calc(25% + 20px)
PASS testing border-top-right-radius: calc(25% + 16px)
PASS testing border-bottom-right-radius: 25%
PASS testing border-bottom-left-radius: 25px
PASS testing border-radius: calc(25% + 10px) calc(25% + 16px) 25% 25px / calc(25% + 20px) calc(25% + 16px) 25% 25px

getComputedStyle-border-radius-003.html: All passing

PASS testing border-radius: calc(1% + 1px) calc(2% + 2px) calc(3% + 3px) calc(4% + 4px) / calc(5% + 5px) calc(6% + 6px) calc(7% + 7px) calc(8% + 8px)

getComputedStyle-calc-mixed-units-001.html: All passing

PASS testing background-size: calc(67% - 54% + 4em) 50%
PASS testing background-position: calc(100% - 100% + 20em)
PASS testing height: calc(60% - 50% + 3em)

getComputedStyle-calc-mixed-units-002.html: All passing

PASS testing width: calc(10% + 2em)
PASS testing width: calc(5% + 4rem)
PASS testing width: calc(8lh + 7px)
PASS testing height: calc(10% + 6pt)
PASS testing width: calc(4em + 2.6458333cm)
PASS testing height: calc(5em + 26.458333mm)
PASS testing width: calc(2in + 101.6Q)
PASS testing height: calc(1pc + 3pt)

getComputedStyle-calc-mixed-units-003.html: All passing

PASS testing width: calc(5px * 10lh / 1px)
PASS testing width: calc(20% * 0.5em / 1px)
PASS testing width: calc(4px * 4em / 1px)
PASS testing width: calc(400px / 4lh * 1px)
PASS testing width: calc(20% / 0.5em * 1px)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2061361</commentid>
    <comment_count>8</comment_count>
    <who name="Tim Nguyen (:ntim)">ntim</who>
    <bug_when>2024-09-18 23:08:04 -0700</bug_when>
    <thetext>*** Bug 259013 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2061363</commentid>
    <comment_count>9</comment_count>
    <who name="Tim Nguyen (:ntim)">ntim</who>
    <bug_when>2024-09-18 23:09:01 -0700</bug_when>
    <thetext>*** Bug 259038 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2061854</commentid>
    <comment_count>10</comment_count>
    <who name="Tim Nguyen (:ntim)">ntim</who>
    <bug_when>2024-09-20 09:06:36 -0700</bug_when>
    <thetext>*** Bug 242629 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>