Bug 215896

Summary: CSS invert() and opacity() filter implementations should use linear transfer functions for clarity and simplicity
Product: WebKit Reporter: frankhome61
Component: CSSAssignee: frankhome61
Status: RESOLVED FIXED    
Severity: Normal CC: changseok, darin, dino, esprehn+autocc, ews-watchlist, glenn, kondapallykalyan, mmaxfield, pdr, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: Other   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch none

frankhome61
Reported 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.
Attachments
Patch (4.02 KB, patch)
2020-08-27 11:45 PDT, frankhome61
no flags
Radar WebKit Bug Importer
Comment 1 2020-08-27 11:32:37 PDT
frankhome61
Comment 2 2020-08-27 11:45:35 PDT
Darin Adler
Comment 3 2020-08-27 17:50:28 PDT
Comment on attachment 407421 [details] Patch Does this have any effect on performance?
frankhome61
Comment 4 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
EWS
Comment 5 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].
Note You need to log in before you can comment on or make changes to this bug.