Bug 287918

Summary: random() with viewport units changes on every layout
Product: WebKit Reporter: Simon Fraser (smfr) <simon.fraser>
Component: CSSAssignee: Nobody <webkit-unassigned>
Status: RESOLVED WORKSFORME    
Severity: Normal CC: koivisto, ntim, sam, simon.fraser, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: Other   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Test case none

Simon Fraser (smfr)
Reported 2025-02-18 17:22:04 PST
Created attachment 474283 [details] 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.
Attachments
Test case (948 bytes, text/html)
2025-02-18 17:22 PST, Simon Fraser (smfr)
no flags
Radar WebKit Bug Importer
Comment 1 2025-02-18 17:22:35 PST
Sam Weinig
Comment 2 2025-02-19 08:48:32 PST
I believe this is behaving correctly per the current spec as the random caching keys are calculated from the "used values", 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.
Tim Nguyen (:ntim)
Comment 3 2025-02-19 09:16:22 PST
Note You need to log in before you can comment on or make changes to this bug.