[Webkit-unassigned] [Bug 78315] REGRESSION(99539): Infinite repaint loop with SVGImage and deferred repaint timers

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Mar 6 06:29:30 PST 2012


https://bugs.webkit.org/show_bug.cgi?id=78315





--- Comment #16 from Nikolas Zimmermann <zimmermann at kde.org>  2012-03-06 06:29:30 PST ---
(In reply to comment #15)
> SVGImage::drawSVGToImageBuffer    frame->view()->resize(this->size());
> 
> From other fixes to similar problems in this area in the past, I assume the correct solution is to ensure that the layout (and the resize) happen before we're painting at all.
drawSVGToImageBuffer layouts the SVG document, and paints it while the host document is painting. This is potentially okay, when done right. Currently drawSVGToImageBuffer overrides the imageObserver to zero, so that any frame view resize calls etc. that follow, don't cause calls to SVGImageChromeClient::invalidateContentsAndRootView(), as that calls back to the host document, which is currently painting.

But I've realized this doensn't prevent the SVG documents FrameView to schedule relayouts/repaints, and that's the problem - we don't want that at all.

Currently drawSVGToImageBuffer works like this:
- Override image observer, so that no one notices what we're doing with the SVG document (in theory)
- Resize to desired target size and zoom factor (this information comes from the SVGImageCache) - utilizing SVGImage::draw(), which calls frameView->layout().
- Draw SVG root object to ImageBuffer (SVGImage::draw, calling frameView->paint()).
- Reset zoom factor and size to initial size
- Restore image observer.

Basically we need to be able to snapshot the document at a specific size & zoom level, but then restore the original document as-is. We can't leave the cached document mutated in any way. Consider two SVG documents which both embed foo.svg - if document 'A' wants to draw the SVG Image into a 300x300 target <div> element as background-image, it would resize the SVG document to 300x300, paint that. Now what if document 'B' already embedded the embedded SVG before with another size? It would now get redrawn as well using another size.....

When animations are running its even harder to get this right, if resources are shared.

To summarize: I think the drawSVGToImageBuffer approach is right in general, but still has some bugs. 
You coudl try to call frame->view()->beginDefferedRepaints() after the setImageObserver(0) call, end endDeferredRepaints() after the restoring of it, and see if that affects anything.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list