When filter blur applied to background-attachment:fixed, the browser flickers on scroll
Categories
(Core :: Web Painting, defect, P2)
Tracking
()
People
(Reporter: roland, Unassigned)
References
(Depends on 1 open bug)
Details
(Keywords: testcase)
Updated•8 years ago
|
Comment 2•8 years ago
|
||
Comment 6•8 years ago
|
||
Updated•8 years ago
|
Comment 7•8 years ago
|
||
Comment 9•8 years ago
|
||
| Reporter | ||
Comment 10•6 years ago
|
||
See my previous comment.
Comment 11•6 years ago
|
||
Apologies for overlooking the previous comment.
(In reply to Soós Roland from comment #9)
:Botond The page works fine for me and I do not see any TypeErrors you
mentioned.Just checked with Firefox 57.0.4
https://smartslider3.com/bugs/firefox/blurfixed/
I do still get a TypeError. This is what is printed in the Console:
TypeError: n2(...).offset(...) is undefined [Learn More] blurfixed:227:33
element https://smartslider3.com/bugs/firefox/blurfixed/:227:33
onclick https://smartslider3.com/bugs/firefox/blurfixed/:1:1
Here is a JSfiddle with the bug: https://jsfiddle.net/ff9d2u3v/2/ For this
case only the first image relevant as that is the one with
background-attachment: fixed.Another example which does not flicker instead renders with 1 sec delay
after you scroll: https://jsfiddle.net/xsbn7jbm/
These are other examples where bug 1300864 has helped, but has not solved the problem completely, as described in bug 1404218 comment 12. I'm going to mark this bug as dependent on bug 1404218 which tracks further improvements in this area.
Comment 12•6 years ago
|
||
By the way, both fiddles behave perfectly in Firefox Nightly with WebRender enabled, so if that's an option for you, it's an easy fix.
| Reporter | ||
Comment 13•6 years ago
|
||
You are right. It seems this issue haven been fixed.
Comment 14•6 years ago
|
||
Based on some profiling done this week, the reason the examples from comment 9 still exhibit the bug despite the intervention made in bug 1300864, is that blurs are really slow to compute on the CPU, and so the page cannot be painted within the frame budget. The intervention in bug 1300864 only fixed the problem for pages that can be painted within the frame budget.
So, the options here are:
- Switch to GPU rendering (WebRender). This is being actively worked on, and is shipping on Windows with qualified graphics cards in Firefox 67.
- Trade off the jumpiness caused by the slow painting time, to scrolling jank, by disabling asynchronous scrolling (option 3 from bug 1404218 comment 12). You can see what this looks like by setting the pref
layers.async-pan-zoom.enabledtofalseinabout:config. I'm open to input on whether that would be better or worse than the current behaviour. - Try to optimize the code to compute blurs on the CPU. Markus says this may be possible, but the value proposition is dubious given our pivot to GPU-based rendering.
| Reporter | ||
Comment 15•6 years ago
|
||
Instead of applying blur over and over for every page scroll, why don't you just simply blur it once at initial render (and for every other action which affect the the image ex.: background-size:cover + size change) and reuse that blurred resource like you would with a simple image at page scroll?
Comment 16•6 years ago
|
||
In more typical cases, there is scrolled content which moves relative to the fixed background when you scroll, and the blur applies to their combination, and so needs to be recomputed on every frame.
We could probably detect the special case where there is no scrolled content, and avoid re-blurring on every frame in that case, but would that apply in your real-world use cases?
| Reporter | ||
Comment 17•6 years ago
|
||
When the scrolled content and the background image are on a different layer with same blur, they looks identical when they are on the same layer.
Left is the single layer.
Right has a div in the background with the blurred image. And before that there is another div with the blurred text.
https://jsfiddle.net/1wsLmxbq/
Comment 18•6 years ago
|
||
No, the two are not equivalent. blur(over(A, B)) is, in general, different from over(blur(A), blur(B)). Here's an example: https://jsfiddle.net/pxLastb4/
The other factor that makes it impossible to cache the blurred rendering in the general case is the rectangle clip: The rectangle in which the fixed background is displayed moves during scrolling. The blur is applied outside of that rectangle clip. So, as the rectangle moves, the pixels around the shifted edges of the rectangle would need to be recomputed.
As the page author, if you want to express the fact that the blur should stay constant during scrolling, please use position:fixed and put your blur effect inside the fixed element. If you need a "moving window" effect, and you want that windowing clip to be applied outside of the blur, then you can use the properties "clip" or "clip-path" on a scrolled element to apply a scrolled clip to the position:fixed element. There's some example code for this in this stackoverflow answer.
Updated•3 years ago
|
Description
•