Bug 803826 - Only reset the layer builder pointer in ~ClippedDisplayItem. r=mattwoodrow
authorChris Lord <chrislord.net@gmail.com>
Tue, 23 Oct 2012 12:05:14 +0100
changeset 111273 51c21a53a849e566c255a903394daacde162d0ed
parent 111272 6b9d82bf9a94e8d16cc1151c23d19aeef65cbaf8
child 111274 edd0d1d9cd0b3089eed5cdadf127c011ddd8fe32
push id93
push usernmatsakis@mozilla.com
push dateWed, 31 Oct 2012 21:26:57 +0000
reviewersmattwoodrow
bugs803826
milestone19.0a1
Bug 803826 - Only reset the layer builder pointer in ~ClippedDisplayItem. r=mattwoodrow PaintInactiveLayer was resetting the layer manager's layer builder pointer, but this was unnecessary as this was also being done on destruction of the ClippedDisplayItem.
layout/base/FrameLayerBuilder.cpp
layout/base/FrameLayerBuilder.h
--- a/layout/base/FrameLayerBuilder.cpp
+++ b/layout/base/FrameLayerBuilder.cpp
@@ -1938,18 +1938,17 @@ PaintInactiveLayer(nsDisplayListBuilder*
     }
   } else {
     basic->EndTransaction(FrameLayerBuilder::DrawThebesLayer, aBuilder);
   }
   FrameLayerBuilder *builder = static_cast<FrameLayerBuilder*>(basic->GetUserData(&gLayerManagerLayerBuilder));
   if (builder) {
     builder->DidEndTransaction();
   }
- 
-  basic->SetUserData(&gLayerManagerLayerBuilder, NULL);
+
 #ifdef MOZ_DUMP_PAINTING
   if (gfxUtils::sDumpPainting) {
     DumpPaintedImage(aItem, surf);
 
     surf->SetDeviceOffset(gfxPoint(0, 0));
     aContext->SetSource(surf, itemVisibleRect.TopLeft());
     aContext->Rectangle(itemVisibleRect);
     aContext->Fill();
@@ -2335,17 +2334,17 @@ FrameLayerBuilder::AddThebesDisplayItem(
   if (aLayerState != LAYER_NONE) {
     DisplayItemData *data = GetDisplayItemDataForManager(aItem, aLayer->Manager());
     if (data) {
       tempManager = data->mInactiveManager;
     }
     if (!tempManager) {
       tempManager = new BasicLayerManager();
     }
-        
+
     // We need to grab these before calling AddLayerDisplayItem because it will overwrite them.
     nsRegion clip;
     FrameLayerBuilder::Clip* oldClip = nullptr;
     GetOldLayerFor(aItem, nullptr, &oldClip);
     hasClip = ComputeCombinedClip(aClip, oldClip, 
                                   aTopLeft - thebesData->mLastActiveScrolledRootOrigin,
                                   clip);
 
@@ -2418,17 +2417,17 @@ FrameLayerBuilder::AddThebesDisplayItem(
         invalid.ScaleRoundOut(thebesData->mXScale, thebesData->mYScale);
         InvalidatePostTransformRegion(aLayer, invalid,
                                       GetTranslationForThebesLayer(aLayer));
       }
     }
     ClippedDisplayItem* cdi =
       entry->mItems.AppendElement(ClippedDisplayItem(aItem, aClip,
                                                      mContainerLayerGeneration));
-    cdi->mInactiveLayer = tempManager;
+    cdi->mInactiveLayerManager = tempManager;
   }
 }
 
 FrameLayerBuilder::DisplayItemData*
 FrameLayerBuilder::StoreDataForFrame(nsDisplayItem* aItem, Layer* aLayer, LayerState aState)
 {
   DisplayItemData* oldData = GetDisplayItemDataForManager(aItem, mRetainingManager);
   if (oldData) {
@@ -2479,21 +2478,21 @@ FrameLayerBuilder::StoreDataForFrame(nsI
 
   data->AddFrame(aFrame);
 
   lmd->mDisplayItems.PutEntry(data);
 }
 
 FrameLayerBuilder::ClippedDisplayItem::~ClippedDisplayItem()
 {
-  if (mInactiveLayer) {
+  if (mInactiveLayerManager) {
     // We always start a transaction during layer construction for all inactive
     // layers, but we don't necessarily call EndTransaction during painting.
     // If the transaaction is still open, end it to avoid assertions.
-    BasicLayerManager* basic = static_cast<BasicLayerManager*>(mInactiveLayer.get());
+    BasicLayerManager* basic = static_cast<BasicLayerManager*>(mInactiveLayerManager.get());
     if (basic->InTransaction()) {
       basic->EndTransaction(nullptr, nullptr);
     }
     basic->SetUserData(&gLayerManagerLayerBuilder, nullptr);
   }
 }
 
 void
@@ -3233,18 +3232,18 @@ FrameLayerBuilder::DrawThebesLayer(Thebe
         currentClip = cdi->mClip;
         aContext->Save();
         NS_ASSERTION(commonClipCount < 100,
           "Maybe you really do have more than a hundred clipping rounded rects, or maybe something has gone wrong.");
         currentClip.ApplyTo(aContext, presContext, commonClipCount);
       }
     }
 
-    if (cdi->mInactiveLayer) {
-      PaintInactiveLayer(builder, cdi->mInactiveLayer, cdi->mItem, aContext, rc);
+    if (cdi->mInactiveLayerManager) {
+      PaintInactiveLayer(builder, cdi->mInactiveLayerManager, cdi->mItem, aContext, rc);
     } else {
       nsIFrame* frame = cdi->mItem->GetUnderlyingFrame();
       if (frame) {
         frame->AddStateBits(NS_FRAME_PAINTED_THEBES);
       }
 #ifdef MOZ_DUMP_PAINTING
 
       if (gfxUtils::sDumpPainting) {
--- a/layout/base/FrameLayerBuilder.h
+++ b/layout/base/FrameLayerBuilder.h
@@ -604,17 +604,17 @@ protected:
 
     nsDisplayItem* mItem;
 
     /**
      * If the display item is being rendered as an inactive
      * layer, then this stores the layer manager being
      * used for the inactive transaction.
      */
-    nsRefPtr<LayerManager> mInactiveLayer;
+    nsRefPtr<LayerManager> mInactiveLayerManager;
 
     Clip mClip;
     uint32_t mContainerLayerGeneration;
   };
 
   /**
    * We accumulate ClippedDisplayItem elements in a hashtable during
    * the paint process. This is the hashentry for that hashtable.