Open Bug 820580 Opened 12 years ago Updated 2 years ago

Excessive painting w/ animated SVG background

Categories

(Core :: SVG, defect)

x86_64
Linux
defect

Tracking

()

People

(Reporter: bugs, Unassigned)

References

()

Details

Attachments

(2 files)

Compare:
http://m8y.org/tmp/testcase228.xhtml
to
http://m8y.org/tmp/leaves.svg
with nglayout.debug.paint_flashing set to true.

background image repaints entire page, continuously.

Also, and this is kind of annoying.  If I switch to another tab, the CPU usage on the SVG drops off quite a lot.
Not low enough IMO, but quite a lot.

If I switch to another tab, the CPU usage of the html page remains high.
Attached file testcase 1
Here's a testcase. Paint-flashing shows that we're continuously painting the full <div>.

If you just view the SVG directly, only the animated purple rect is repainted.
(In reply to nemo from comment #0)
> If I switch to another tab, the CPU usage of the html page remains high.

May be worth tracking this part ^^ in a separate bug.
(In reply to Daniel Holbert [:dholbert] from comment #2)
> Created attachment 691145 [details]
> testcase 1
> 
> Here's a testcase. Paint-flashing shows that we're continuously painting the
> full <div>.

This happens because we invalidate the full SVG image every time we change:
  https://mxr.mozilla.org/mozilla-central/source/image/src/VectorImage.cpp#725

This might be hard to change... We receive notification to invalidate by registering as a nsSVGRenderingObserver, and nsSVGRenderingObservers don't receive bounds information with their notifications -- they just get a "stuff changed, so you better redraw yourself" callback.
  https://mxr.mozilla.org/mozilla-central/source/layout/svg/nsSVGEffects.h#34

To fix this correctly, I think we'd need to either make nsSVGRenderingObserver significantly more intelligent, or else stop using nsSVGRenderingObserver and use another means of figuring out when/where to invalidate.
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: