Bug 251197

Summary: resolution is an optional parameter on image-set()
Product: WebKit Reporter: Karl Dubost <karlcow>
Component: CSSAssignee: Nobody <webkit-unassigned>
Status: RESOLVED DUPLICATE    
Severity: Normal CC: ntim, rreno, simon.fraser, webkit-bug-importer
Priority: P2 Keywords: BrowserCompat, InRadar, WPTImpact
Version: Safari Technology Preview   
Hardware: Unspecified   
OS: Unspecified   
URL: https://wpt.fyi/results/css/css-images/image-set/image-set-no-res-rendering-2.html?label=master&label=experimental&product=chrome&product=firefox&product=safari&aligned&view=interop&q=label%3Ainterop-2023-webcompat

Description Karl Dubost 2023-01-25 23:45:26 PST
Interop2023

Test is failing 

https://wpt.fyi/results/css/css-images/image-set/image-set-no-res-rendering-2.html?label=master&label=experimental&product=chrome&product=firefox&product=safari&aligned&view=interop&q=label%3Ainterop-2023-webcompat

#test {
  background-image: image-set(url("/images/green.png"), url("/images/green.png"));
  width: 100px;
  height: 100px;
}

is a valid syntax.

Safari accepts only 

#test {
  background-image: image-set(url("/images/green.png") 1x, url("/images/green.png") 1x);
  width: 100px;
  height: 100px;
}

The spec says: 
https://w3c.github.io/csswg-drafts/css-images-4/#image-set-notation


A <resolution> (optional). This is used to help the UA decide which <image-set-option> to choose. If the image reference is for a raster image, it also specifies the image’s natural resolution, overriding any other source of data that might supply a natural resolution.

If not specified, it behaves as 1x for the purpose of selecting which <image-set-option> to use. It also defaults the image’s natural resolution to 1x, but if some other source of data supplies a natural resolution, that resolution must be honored instead.
Comment 1 Radar WebKit Bug Importer 2023-01-25 23:45:48 PST
<rdar://problem/104683761>
Comment 2 Tim Nguyen (:ntim) 2023-01-26 00:37:06 PST
This should be trivial to fix: https://searchfox.org/wubkat/rev/1c8b29ff201022e3a20578244e85d25d1b7706c4/Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp#4432-4436

Not sure how the <= 0 case should be handled, but the !resolution case needs to fallback to 1 instead of doing an early return.
Comment 3 Ryan Reno 2023-02-23 15:21:15 PST
I'm going to dup this to https://bugs.webkit.org/show_bug.cgi?id=225185 since the fix for both of these bugs is best landed together.

*** This bug has been marked as a duplicate of bug 225185 ***