WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
NEW
184601
CSS filter property with feColorMatrix on moving elements does not work
https://bugs.webkit.org/show_bug.cgi?id=184601
Summary
CSS filter property with feColorMatrix on moving elements does not work
Alex Fallenstedt
Reported
2018-04-13 11:51:19 PDT
Created
attachment 337912
[details]
Safari - Video on top and image on bottom both using filter(#blue-tint) Hello, I am attempting to apply a filter color using an svg. I have discovered that this technique works well in Firefox, Chrome, but not Safari. You can see the example here:
https://codepen.io/Fallenstedt/pen/OvYGjV
I created an svg with an 'feColorMatrix' property to create a transparent blue overlay that I can use in the filter property of the video element. I have noticed that this technique works well if it's applied on a still image, like an <img> or a <video> placeholder, but does not get applied to the video.
Attachments
Safari - Video on top and image on bottom both using filter(#blue-tint)
(305.50 KB, image/png)
2018-04-13 11:51 PDT
,
Alex Fallenstedt
no flags
Details
Expected behavior - Video element and img both apply filter with svg
(2.19 MB, image/gif)
2018-04-13 11:52 PDT
,
Alex Fallenstedt
no flags
Details
Actual behavior - In Safari, video element ignores filter(#blue-tint)
(2.33 MB, image/gif)
2018-04-13 11:54 PDT
,
Alex Fallenstedt
no flags
Details
example comparing blue-wash SVG filter over video
(398.64 KB, image/jpeg)
2022-02-15 10:46 PST
,
Stephen Bannasch
no flags
Details
View All
Add attachment
proposed patch, testcase, etc.
Alex Fallenstedt
Comment 1
2018-04-13 11:52:43 PDT
Created
attachment 337913
[details]
Expected behavior - Video element and img both apply filter with svg
Alex Fallenstedt
Comment 2
2018-04-13 11:54:22 PDT
Created
attachment 337914
[details]
Actual behavior - In Safari, video element ignores filter(#blue-tint) Video element on top, image element on bottom
Radar WebKit Bug Importer
Comment 3
2018-04-16 09:24:11 PDT
<
rdar://problem/39458549
>
Alex Fallenstedt
Comment 4
2018-04-16 09:57:32 PDT
Further investigation proves that you can apply filters properly to still images. But if you attempt to apply a filter to a moving image, it breaks only in Safari.
Simon Fraser (smfr)
Comment 5
2018-04-16 10:00:32 PDT
The issue here is that WebKit doesn't support references to SVG filters when doing "accelerated" filters. This is a shame, since there's no way to do a color matrix via a CSS filter.
Alex Fallenstedt
Comment 6
2018-04-16 10:16:01 PDT
@smfr Am I not using a color matrix with an accelerated filter here? This example uses a still image that is turning blue and works perfectly on Safari.
https://codepen.io/Fallenstedt/pen/pLMZwG
A video does not produce a similar behavior on safari
https://codepen.io/Fallenstedt/pen/OvYGjV
Simon Fraser (smfr)
Comment 7
2018-04-16 10:18:25 PDT
There are two filter codepaths; one for static content, and another if we call into the compositing ("accelerated") code path. The url(#foobar) stuff doesn't work in the second case.
Alex Fallenstedt
Comment 8
2018-04-16 10:22:11 PDT
@smfr Ah, that makes sense. Thank you for the clarification.
Alec Larson
Comment 9
2020-07-24 10:35:08 PDT
Here's another reproduction:
https://codesandbox.io/embed/8zx4ppk01l
Stephen Bannasch
Comment 10
2022-02-15 10:20:27 PST
Also came across this bug trying to apply and svg feColorMatrix filter to an element containing a video. Works everywhere else.
Stephen Bannasch
Comment 11
2022-02-15 10:28:31 PST
Here's the very ugly hack I'm using to make something work on Safari: .fixed-video-container { visibility: visible; opacity: 1; filter: url(#blue-wash); @media not all and (min-resolution: 0.001dpcm) { @supports (-webkit-appearance: none) { filter: sepia(100%) hue-rotate(145deg) saturate(400%) brightness(100%) contrast(25%); } } }
Stephen Bannasch
Comment 12
2022-02-15 10:46:02 PST
Created
attachment 452051
[details]
example comparing blue-wash SVG filter over video To get some equivalent on Safari. html: <svg> <filter id="blue-wash"> <feColorMatrix type="matrix" values="0.36 0 0 0 0 0 0.75 0 0 0 0 0 0.82 0 0 0 0 0 0.2 0" /> </filter> </svg> css: .fixed-video-container { visibility: visible; opacity: 1; filter: url(#blue-wash); @media not all and (min-resolution: 0.001dpcm) { @supports (-webkit-appearance: none) { filter: sepia(100%) hue-rotate(145deg) saturate(400%) brightness(100%) contrast(25%); } } }
Simon Fraser (smfr)
Comment 13
2022-02-15 10:47:52 PST
You'll generally get better performance when animating the CSS filter properties, so it's better to use those than referencing SVG filters.
Stephen Bannasch
Comment 14
2022-02-15 10:51:16 PST
(In reply to Simon Fraser (smfr) from
comment #13
)
> You'll generally get better performance when animating the CSS filter > properties, so it's better to use those than referencing SVG filters.
It's hard to get the color of the blue-washed filtering my client wants for the video using just the CSS properties. I can get close but the SVG filter can easily get to the look they want. The image attachment shows the difference.
Yehonatan Daniv
Comment 15
2022-05-01 05:06:00 PDT
@smfr it seems that Webkit is unable to render *any* <*-source> effect on Video, be it mask, clip-path, filter, etc. This has been broken for a long time now, and some already work in other browsers, i.e: filter and clip-path work in Gecko and Blink. Gecko also renders mask. Is there a chance we can get this path fixed?
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug