Bug 610491: Preemptively stop SVG animations in SVG-as-an-image in OnStartRequest. r=roc a=roc

This commit is contained in:
Daniel Holbert 2010-11-16 10:35:59 -08:00
parent 4a5f0f7ac1
commit 0f8a89b3b5
3 changed files with 3 additions and 6 deletions

View File

@ -1,5 +1,6 @@
<svg xmlns="http://www.w3.org/2000/svg" version="1.1"
width="100" height="100">
<rect width="100%" height="100%" fill="red"/>
<rect x="-600" width="100%" height="100%" fill="lime">
<animate attributeName="x" by="600" dur="0.001" fill="freeze"/>
</rect>

Before

Width:  |  Height:  |  Size: 227 B

After

Width:  |  Height:  |  Size: 275 B

View File

@ -251,6 +251,8 @@ SVGDocumentWrapper::OnStartRequest(nsIRequest* aRequest, nsISupports* ctxt)
if (NS_SUCCEEDED(rv) &&
NS_SUCCEEDED(mListener->OnStartRequest(aRequest, nsnull))) {
mViewer->GetDocument()->SetIsBeingUsedAsImage();
StopAnimation(); // otherwise animations start automatically in helper doc
rv = mViewer->Init(nsnull, nsIntRect(0, 0, 0, 0));
if (NS_SUCCEEDED(rv)) {
rv = mViewer->Open(nsnull, nsnull);

View File

@ -696,12 +696,6 @@ VectorImage::OnStopRequest(nsIRequest* aRequest, nsISupports* aCtxt,
mIsFullyLoaded = PR_TRUE;
mHaveAnimations = mSVGDocumentWrapper->IsAnimated();
if (mHaveAnimations && mAnimationMode == kDontAnimMode) {
// We're not supposed to be animating -- stop any animation before our
// SVG document's timeline gets a chance to progress.
mSVGDocumentWrapper->StopAnimation();
}
#ifdef MOZ_ENABLE_LIBXUL
// Start listening to our image for rendering updates
mRenderingObserver = new SVGRootRenderingObserver(mSVGDocumentWrapper, this);