<?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>287918</bug_id>
          
          <creation_ts>2025-02-18 17:22:04 -0800</creation_ts>
          <short_desc>random() with viewport units changes on every layout</short_desc>
          <delta_ts>2025-02-19 09:16: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>Other</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>WORKSFORME</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="Simon Fraser (smfr)">simon.fraser</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>koivisto</cc>
    
    <cc>ntim</cc>
    
    <cc>sam</cc>
    
    <cc>simon.fraser</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2095693</commentid>
    <comment_count>0</comment_count>
      <attachid>474283</attachid>
    <who name="Simon Fraser (smfr)">simon.fraser</who>
    <bug_when>2025-02-18 17:22:04 -0800</bug_when>
    <thetext>Created attachment 474283
Test case

Load the attached testcase, with `random()` enabled, and resize the window.

Note that the stars move around with every resize. This is surprising.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2095694</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2025-02-18 17:22:35 -0800</bug_when>
    <thetext>&lt;rdar://problem/145102437&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2095883</commentid>
    <comment_count>2</comment_count>
    <who name="Sam Weinig">sam</who>
    <bug_when>2025-02-19 08:48:32 -0800</bug_when>
    <thetext>I believe this is behaving correctly per the current spec as the random caching keys are calculated from the &quot;used values&quot;, so each time the window is resized, the used values for the viewport units change, and thus a new random value is selected.  See https://drafts.csswg.org/css-values-5/#random-caching

Whether this behavior is good / expected is another story. WebKit is the first to implement, so feedback to the editors on this makes sense to me.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2095887</commentid>
    <comment_count>3</comment_count>
    <who name="Tim Nguyen (:ntim)">ntim</who>
    <bug_when>2025-02-19 09:16:22 -0800</bug_when>
    <thetext>I filed https://github.com/w3c/csswg-drafts/issues/11747</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>474283</attachid>
            <date>2025-02-18 17:22:04 -0800</date>
            <delta_ts>2025-02-18 17:22:04 -0800</delta_ts>
            <desc>Test case</desc>
            <filename>random-starfield.html</filename>
            <type>text/html</type>
            <size>948</size>
            <attacher name="Simon Fraser (smfr)">simon.fraser</attacher>
            
              <data encoding="base64">PCFET0NUWVBFIGh0bWw+CjxodG1sPgo8aGVhZD4KICAgIDxtZXRhIG5hbWU9InZpZXdwb3J0IiBj
b250ZW50PSJ3aWR0aD1kZXZpY2Utd2lkdGgsIGluaXRpYWwtc2NhbGU9MSwgc2hyaW5rLXRvLWZp
dD1ubyI+CiAgICA8dGl0bGU+PC90aXRsZT4KICAgIDxzdHlsZT4KICAgICAgICA6cm9vdCB7CiAg
ICAgICAgICAgIGJhY2tncm91bmQtY29sb3I6ICMxMTE7CiAgICAgICAgfQogICAgICAgIC5zdGFy
IHsKICAgICAgICAgICAgcG9zaXRpb246IGFic29sdXRlOwogICAgICAgICAgICBsZWZ0OiByYW5k
b20ocGVyLWVsZW1lbnQsIDB2dywgMTAwdncpOwogICAgICAgICAgICB0b3A6IHJhbmRvbShwZXIt
ZWxlbWVudCwgMHZoLCAxMDB2aCk7CiAgICAgICAgICAgIHdpZHRoOiByYW5kb20ocGVyLWVsZW1l
bnQsIDFweCwgNXB4KTsKICAgICAgICAgICAgaGVpZ2h0OiByYW5kb20ocGVyLWVsZW1lbnQsIDFw
eCwgNXB4KTsKICAgICAgICAgICAgYm9yZGVyLXJhZGl1czogNTAlOwogICAgICAgICAgICBiYWNr
Z3JvdW5kLWNvbG9yOiB3aGl0ZTsKICAgICAgICB9CiAgICA8L3N0eWxlPgogICAgPHNjcmlwdD4K
ICAgICAgICB3aW5kb3cuYWRkRXZlbnRMaXN0ZW5lcignbG9hZCcsICgpID0+IHsKICAgICAgICAg
ICAgY29uc3QgbnVtU3RhcnMgPSAxMDA7CiAgICAgICAgICAgIAogICAgICAgICAgICBmb3IgKGxl
dCBpID0gMDsgaSA8IG51bVN0YXJzOyArK2kpIHsKICAgICAgICAgICAgICAgIGNvbnN0IHN0YXIg
PSBkb2N1bWVudC5jcmVhdGVFbGVtZW50KCdkaXYnKTsKICAgICAgICAgICAgICAgIHN0YXIuY2xh
c3NOYW1lID0gJ3N0YXInOwoKICAgICAgICAgICAgICAgIGRvY3VtZW50LmJvZHkuYXBwZW5kQ2hp
bGQoc3Rhcik7CiAgICAgICAgICAgIH0KICAgICAgICB9LCBmYWxzZSk7CiAgICA8L3NjcmlwdD4K
PC9oZWFkPgo8Ym9keT4KICAgIAo8L2JvZHk+CjwvaHRtbD4K
</data>

          </attachment>
      

    </bug>

</bugzilla>