Closed Bug 1852175 Opened 2 years ago Closed 10 months ago

svg color-interpolation-filters linearRGB not supported

Categories

(Core :: Graphics, defect)

Firefox 117
defect

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: rob.j.louie, Unassigned)

References

Details

Attachments

(5 files)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36

Steps to reproduce:

View any svg with filters, especially light filters. For a specific example visit the w3 test page for filters-light-01-f: https://www.w3.org/Graphics/SVG/Test/20061213/htmlObjectHarness/full-filters-light-01-f.html

Note, this seems directly related to: https://bugzilla.mozilla.org/show_bug.cgi?id=298281

Both are about color spaces, but this is a different feature which uses it.

Actual results:

The rendered images do not match the spec, as linearRGB is not supported in Firefox even though it is the default. You'll notice the resulting images are much darker. Other browsers and operating systems render this correctly.

Expected results:

The rendered SVG should match the spec image.

The Bugbug bot thinks this bug should belong to the 'Core::Graphics: WebRender' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → Graphics: WebRender
Product: Firefox → Core
Attached image testcase

Seems supported to me. If there is anything wrong, it's not lack of color-interpolation-filters support.

Note that when you specify a colour in a lighting filter you're implicitly using an sRGB colour.

Here I show how my sample svg renders in different viewers. There's the Windows preview in the upper left, the svg rendered in WebStorm lower left, Chrome in center, Firefox on the right.

Here you can see what happens if I add color-interpolation-filters="sRGB" to the svg. Now all displays look very similar.

This is why I thought the bug was with this feature. Furthermore, adding color-interpolation-filters="linearRGB" does not change the display in firefox at all, but it does in all other browsers/viewers. (this is the default so don't need to add it, but even specifically adding it seems to have no effect).

Attached image test-case.svg

My test case

Added attachments to help clarify the issue.

The first shot shows the w3 reference rendered on chrome vs firefox. On the right in firefox you can see everything is rendered much darker compared to the reference.

After that I show a sample svg rendered in windows, webstorm, chrome, and firefox. You can see firefox shows it very dark.

Then you can see what happens if I specify color-interpolation-filters="sRGB". Now windows, chrome, and firefox are very similar.

In addition, adding color-interpolation-filters="linearRGB" seems to have no effect in firefox.

So I do see your test case shows a difference, but then I don't know how to explain the much darker rendering in firefox, both in the w3 reference images, and in my test case.

See comment 4 and note that w3c testcase is obsolete so I think both the testcase and Chrome are in error.

It just seems that windows, chrome, osx, safari, gimp, and IE11 (everything I could get to open an svg) are all in error and only firefox is correct then.

If that is the case, and I'm definitely willing to believe that, can you explain comment 4 or point me to info somewhere? I tried reading the docs on the w3c site and don't see anything about lighting being only in sRGB.

It does state that filter functions operate in sRGB, but that's the only reference to something only supporting sRGB, and filter function don't include lighting: https://drafts.fxtf.org/filter-effects/#filter-functions

In fact what I found seems to state that color-interpolation-filters does apply to lighting, as it says it applies to all filters, and diffuse lighting is one of them: https://drafts.fxtf.org/filter-effects/#propdef-color-interpolation-filters

What I mean is that when you specify a colour e.g. rgb(255, 255, 255) or by an equivalent string such as white then that colour is in sRGB. It's kind of obvious when you see it in the first form. Filter funcations by default operate in linearRGB (mostly) but when you're specifying a colour e.g. the colour for feFloodFill then that flood-color is an sRGB colour and you'd have to convert (the same for lighting colours).

I'm not sure Firefox is correct, but then again I'm not sure it's wrong either.

Toggling color-interpolation-filters between linearRGB and sRGB in "test-case.svg" doesn't seem to have any effect (while it works fine in the simpler "testcase" that uses the feComponentTransfer filter).

It feels to me like we ignore linearRGB in this specific case (for the feDiffuseLighting filter and maybe others?).

It seems that feDiffuseLighting is not supported by webrender and uses the blob fallback (while feComponentTransfer is).
It might be that the fallback doesn't account for color space changes.

Severity: -- → S3
Component: Graphics: WebRender → Graphics
Status: UNCONFIRMED → RESOLVED
Closed: 10 months ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: