From 7e60ad4ae6487ad38495043649323ddd8c6a6acf Mon Sep 17 00:00:00 2001 From: Jonathan Watt Date: Wed, 4 Sep 2013 11:39:31 +0100 Subject: [PATCH] Bug 907503 - Fix invalidation for SMIL animation in SVG-as-an-image. r=roc --- layout/base/nsDisplayList.cpp | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/layout/base/nsDisplayList.cpp b/layout/base/nsDisplayList.cpp index b12509ec0d4d..520df5f3d7ff 100644 --- a/layout/base/nsDisplayList.cpp +++ b/layout/base/nsDisplayList.cpp @@ -1141,7 +1141,16 @@ void nsDisplayList::PaintForFrame(nsDisplayListBuilder* aBuilder, BuildContainerLayerFor(aBuilder, layerManager, aForFrame, nullptr, *this, containerParameters, nullptr); - if (widgetTransaction) { + nsIDocument* document = nullptr; + if (presShell) { + document = presShell->GetDocument(); + } + + if (widgetTransaction || + // SVG-as-an-image docs don't paint as part of the retained layer tree, + // but they still need the invalidation state bits cleared in order for + // invalidation for CSS/SMIL animation to work properly. + (document && document->IsBeingUsedAsImage())) { aForFrame->ClearInvalidationStateBits(); } @@ -1177,13 +1186,10 @@ void nsDisplayList::PaintForFrame(nsDisplayListBuilder* aBuilder, } bool mayHaveTouchListeners = false; - if (presShell) { - nsIDocument* document = presShell->GetDocument(); - if (document) { - nsCOMPtr innerWin(document->GetInnerWindow()); - if (innerWin) { - mayHaveTouchListeners = innerWin->HasTouchEventListeners(); - } + if (document) { + nsCOMPtr innerWin(document->GetInnerWindow()); + if (innerWin) { + mayHaveTouchListeners = innerWin->HasTouchEventListeners(); } }