Bug 196389

Summary: [css-values-3] Computed value of calc() expression in linear-gradient function incorrect
Product: WebKit Reporter: Gérard Talbot (no longer involved) <browserbugs2>
Component: CSSAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: ahmad.saleem792, bfulgham, emilio, karlcow, webkit-bug-importer
Priority: P2 Keywords: BrowserCompat, InRadar, WPTImpact
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
URL: http://www.gtalbot.org/BrowserBugsSection/CSS3Values/trac-webkit-linear-gradient-calc.html
Bug Depends on: 52378    
Bug Blocks:    

Description Gérard Talbot (no longer involved) 2019-03-28 20:39:58 PDT
Test
****

http://www.gtalbot.org/BrowserBugsSection/CSS3Values/trac-webkit-linear-gradient-calc.html



Expected result: 
linear-gradient(90deg, rgb(255, 255, 0), rgb(0, 0, 255) 50%)



Actual result in Epiphany 3.31.90-8061c1929 (WebKitGTK 2.24.0):
linear-gradient(calc(90deg), rgb(255, 255, 0), rgb(0, 0, 255) calc(50%))

- - - - - 

Firefox 68.0a1 buildID=20190327175114 achieves expected result.

- - - - - 

The original test is

https://trac.webkit.org/browser/webkit/trunk/LayoutTests/css3/calc/webkit-gradient-calc.html

and is using 
-webkit-gradient(linear,...) 
which is not standard.
linear-gradient() is standard.

- - - - - 

Correspondent Blink Issue:
https://bugs.chromium.org/p/chromium/issues/detail?id=947377

- - - - - 

I searched for duplicate and did not find any; I do not know if bug 52378 is still active.
Comment 1 Radar WebKit Bug Importer 2022-06-30 16:43:54 PDT
<rdar://problem/96254863>
Comment 2 Ahmad Saleem 2023-03-31 22:38:50 PDT
Chrome Canary 114 and Safari 16.4 & STP166 are failing this test.

Test Link - http://www.gtalbot.org/BrowserBugsSection/CSS3Values/trac-webkit-linear-gradient-calc.html

Firefox Nightly 113 is only browser passing this.
Comment 3 Gérard Talbot (no longer involved) 2023-07-19 12:02:14 PDT
Additional (more complete) test on computed value of 'background-image: [ linear | radial | conic ]-gradient()' with calc() function:
http://wpt.live/css/css-values/calc-linear-radial-conic-gradient-001.html

Test result:
https://wpt.fyi/results/css/css-values/calc-linear-radial-conic-gradient-001.html?label=experimental&label=master&aligned
Comment 4 Karl Dubost 2023-08-23 22:40:44 PDT
This has impact on a number of tests.
Example: http://wpt.live/css/css-backgrounds/parsing/background-image-computed.sub.html

Each time a calc is not being resolved to the hard values and kept as calc.

expected: "radial-gradient(0px at -30px -70px, rgb(255, 0, 0), rgb(0, 0, 255))" 
actual:   "radial-gradient(calc(-0.5em + 10px) at calc(-1em + 10px) calc(-2em + 10px), rgb(255, 0, 0), rgb(0, 0, 255))"