Bug 215896 - CSS invert() and opacity() filter implementations should use linear transfer functions for clarity and simplicity
Summary: CSS invert() and opacity() filter implementations should use linear transfer ...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: Other
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: frankhome61
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-08-27 11:32 PDT by frankhome61
Modified: 2020-08-27 18:24 PDT (History)
10 users (show)

See Also:


Attachments
Patch (4.02 KB, patch)
2020-08-27 11:45 PDT, frankhome61
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description frankhome61 2020-08-27 11:32:07 PDT
In WebKit's implementation of CSS filters invert() and opacity(), FEComponentTransfer is used and the transfer function is surprisingly to table, instead of linear. Looking at the CSS spec, https://drafts.fxtf.org/filter-effects/#invertEquivalent
invert() and opacity() is implemented using "table" with just 2 values, which is equivalent to using a linear function. I propose to change the implementation of invert() and opacity() to use linear transfer function as well for simplicity and clarity.
Comment 1 Radar WebKit Bug Importer 2020-08-27 11:32:37 PDT
<rdar://problem/67887069>
Comment 2 frankhome61 2020-08-27 11:45:35 PDT
Created attachment 407421 [details]
Patch
Comment 3 Darin Adler 2020-08-27 17:50:28 PDT
Comment on attachment 407421 [details]
Patch

Does this have any effect on performance?
Comment 4 frankhome61 2020-08-27 18:06:35 PDT
(In reply to Darin Adler from comment #3)
> Comment on attachment 407421 [details]
> Patch
> 
> Does this have any effect on performance?

No, not that I know of. By looking at the code, FEComponentTransfer eventually converts linear, discrete table transfer functions to a hash map that maps each R,G,B values to a new value by applying the transfer function. So I don't expect this patch to cause any performance hit at all
Comment 5 EWS 2020-08-27 18:24:21 PDT
Committed r266266: <https://trac.webkit.org/changeset/266266>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 407421 [details].