Bug 775697 - Cancel layer transactions that haven't ended after nsDisplaySVGEffects::PaintAsLayer returns. r=roc.
authorJonathan Watt <jwatt@jwatt.org>
Fri, 20 Jul 2012 00:53:55 -0400
changeset 105353 a52f4d713da94ef52ae572db91aa22b1c2f66cbc
parent 105352 d1a7f291841654db558a5c83a95758ccc8d17c27
child 105354 56b8e5d8c42f54631f3348085ea3f4e6a65e6ad2
push idunknown
push userunknown
push dateunknown
reviewersroc
bugs775697
milestone17.0a1
Bug 775697 - Cancel layer transactions that haven't ended after nsDisplaySVGEffects::PaintAsLayer returns. r=roc.
gfx/layers/basic/BasicLayerManager.cpp
gfx/layers/basic/BasicLayers.h
layout/base/FrameLayerBuilder.cpp
--- a/gfx/layers/basic/BasicLayerManager.cpp
+++ b/gfx/layers/basic/BasicLayerManager.cpp
@@ -379,16 +379,26 @@ ApplyDoubleBuffering(Layer* aLayer, cons
 void
 BasicLayerManager::EndTransaction(DrawThebesLayerCallback aCallback,
                                   void* aCallbackData,
                                   EndTransactionFlags aFlags)
 {
   EndTransactionInternal(aCallback, aCallbackData, aFlags);
 }
 
+void
+BasicLayerManager::AbortTransaction()
+{
+  NS_ASSERTION(InConstruction(), "Should be in construction phase");
+#ifdef DEBUG
+  mPhase = PHASE_NONE;
+#endif
+  mUsingDefaultTarget = false;
+}
+
 bool
 BasicLayerManager::EndTransactionInternal(DrawThebesLayerCallback aCallback,
                                           void* aCallbackData,
                                           EndTransactionFlags aFlags)
 {
   SAMPLE_LABEL("BasicLayerManager", "EndTranscationInternal");
 #ifdef MOZ_LAYERS_HAVE_LOG
   MOZ_LAYERS_LOG(("  ----- (beginning paint)"));
--- a/gfx/layers/basic/BasicLayers.h
+++ b/gfx/layers/basic/BasicLayers.h
@@ -89,16 +89,17 @@ public:
   virtual bool IsWidgetLayerManager() { return mWidget != nsnull; }
 
   virtual void BeginTransaction();
   virtual void BeginTransactionWithTarget(gfxContext* aTarget);
   virtual bool EndEmptyTransaction();
   virtual void EndTransaction(DrawThebesLayerCallback aCallback,
                               void* aCallbackData,
                               EndTransactionFlags aFlags = END_DEFAULT);
+  void AbortTransaction();
 
   virtual void SetRoot(Layer* aLayer);
 
   virtual already_AddRefed<ThebesLayer> CreateThebesLayer();
   virtual already_AddRefed<ContainerLayer> CreateContainerLayer();
   virtual already_AddRefed<ImageLayer> CreateImageLayer();
   virtual already_AddRefed<CanvasLayer> CreateCanvasLayer();
   virtual already_AddRefed<ColorLayer> CreateColorLayer();
--- a/layout/base/FrameLayerBuilder.cpp
+++ b/layout/base/FrameLayerBuilder.cpp
@@ -1631,16 +1631,19 @@ PaintInactiveLayer(nsDisplayListBuilder*
     return;
   }
   RestrictVisibleRegionForLayer(layer, itemVisibleRect);
   
   tempManager->SetRoot(layer);
   aLayerBuilder->WillEndTransaction(tempManager);
   if (aItem->GetType() == nsDisplayItem::TYPE_SVG_EFFECTS) {
     static_cast<nsDisplaySVGEffects*>(aItem)->PaintAsLayer(aBuilder, aCtx, tempManager);
+    if (tempManager->InTransaction()) {
+      tempManager->AbortTransaction();
+    }
   } else {
     tempManager->EndTransaction(FrameLayerBuilder::DrawThebesLayer, aBuilder);
   }
   aLayerBuilder->DidEndTransaction(tempManager);
  
 #ifdef MOZ_DUMP_PAINTING
   if (gfxUtils::sDumpPainting) {
     DumpPaintedImage(aItem, surf);