Bug 216111 - background-image filter() function does not do retina scaling
Summary: background-image filter() function does not do retina scaling
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: Other
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Kiet Ho
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-09-02 18:07 PDT by frankhome61
Modified: 2023-06-15 14:39 PDT (History)
7 users (show)

See Also:


Attachments
Left is applying filter on an img node, right is applying filter on a background-image (137.52 KB, image/png)
2020-09-02 18:07 PDT, frankhome61
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description frankhome61 2020-09-02 18:07:09 PDT
Created attachment 407843 [details]
Left is applying filter on an img node, right is applying filter on a background-image

There is a test case, fast/filter-image/background-filter-image.html that is testing the result of rendering background-image with filters. However there is a problem where current WebKit doesn't render the background image on Retina screens properly. In this test, background-filter-image.html uses 
    background-image: filter(url(../replaced/resources/compass.jpg), sepia(1)); 
to apply a sepia filter on the background image of a div; 

we are comparing against the reference test, fast/filter-image/background-filter-image-expected.html, which is just applying a sepia filter on a img node. 
    img {
        width: 100px;
        height: 100px;
        filter: sepia(1);
    }
    <img src="../replaced/resources/compass.jpg">

I have included a screenshot of the comparison: on the left we can see a sharp image, which is from fast/filter-image/background-filter-image-expected.html; on the right is a lower quality image from fast/filter-image/background-filter-image.html. 
Seems that we didn't upscale the image on retina screens when rendering background-image
Comment 1 Radar WebKit Bug Importer 2020-09-02 18:07:51 PDT
<rdar://problem/68244885>
Comment 2 Said Abou-Hallawa 2023-06-06 13:04:56 PDT
The fast/filter-image/background-filter-image.html is currently passing at least on macOS. This is true because WKR and DRT work on 1x mode. To fix this bug we need to move this test to fast/hidpi and include this line at the beginning:

    <script src="resources/ensure-hidpi.js"></script>
Comment 3 Kiet Ho 2023-06-15 14:39:50 PDT
Pull request: https://github.com/WebKit/WebKit/pull/15021