Commit 486cc97c authored by Dorel Luca's avatar Dorel Luca
Browse files

Backed out changeset b3cf1b5c14cc (bug 1440966) for build bustages on a CLOSED TREE

--HG--
extra : histedit_source : f4408776ade25fc873da470bd5aa9d200a42163e
parent cb93c8b8
Loading
Loading
Loading
Loading
+30 −17
Original line number Diff line number Diff line
@@ -2011,6 +2011,19 @@ FrameLayerBuilder::DidBeginRetainedLayerTransaction(LayerManager* aManager)
  }
}

void
FrameLayerBuilder::StoreOptimizedLayerForFrame(nsDisplayItem* aItem, Layer* aLayer)
{
  if (!mRetainingManager) {
    return;
  }

  DisplayItemData* data = GetDisplayItemDataForManager(aItem, aLayer->Manager());
  NS_ASSERTION(data, "Must have already stored data for this item!");
  data->mOptLayer = aLayer;
  data->mItem = nullptr;
}

void
FrameLayerBuilder::DidEndTransaction()
{
@@ -3179,6 +3192,16 @@ void ContainerState::FinishPaintedLayerData(PaintedLayerData& aData, FindOpaqueB
    mNewChildLayers[data->mNewChildLayersIndex].mLayer = paintedLayer.forget();
  }

  for (auto& item : data->mAssignedDisplayItems) {
    MOZ_ASSERT(item.mItem->GetType() != DisplayItemType::TYPE_LAYER_EVENT_REGIONS);
    MOZ_ASSERT(item.mItem->GetType() != DisplayItemType::TYPE_COMPOSITOR_HITTEST_INFO);

    InvalidateForLayerChange(item.mItem, data->mLayer, item.mDisplayItemData);
    mLayerBuilder->AddPaintedDisplayItem(data, item, *this,
                                         data->mAnimatedGeometryRootOffset);
    item.mDisplayItemData = nullptr;
  }

  PaintedDisplayItemLayerUserData* userData = GetPaintedDisplayItemLayerUserData(data->mLayer);
  NS_ASSERTION(userData, "where did our user data go?");
  userData->mLastItemCount = data->mAssignedDisplayItems.Length();
@@ -3223,6 +3246,10 @@ void ContainerState::FinishPaintedLayerData(PaintedLayerData& aData, FindOpaqueB
      data->mLayer->SetVisibleRegion(LayerIntRegion());
      data->mLayer->InvalidateWholeLayer();
      data->mLayer->SetEventRegions(EventRegions());

      for (auto& item : data->mAssignedDisplayItems) {
        mLayerBuilder->StoreOptimizedLayerForFrame(item.mItem, layer);
      }
    }
  }

@@ -3233,15 +3260,6 @@ void ContainerState::FinishPaintedLayerData(PaintedLayerData& aData, FindOpaqueB
    FLB_LOG_PAINTED_LAYER_DECISION(data, "  Selected painted layer=%p\n", layer.get());
  }

  for (auto& item : data->mAssignedDisplayItems) {
    MOZ_ASSERT(item.mItem->GetType() != DisplayItemType::TYPE_LAYER_EVENT_REGIONS);
    MOZ_ASSERT(item.mItem->GetType() != DisplayItemType::TYPE_COMPOSITOR_HITTEST_INFO);

    InvalidateForLayerChange(item.mItem, data->mLayer, item.mDisplayItemData);
    mLayerBuilder->AddPaintedDisplayItem(data, item, *this, layer);
    item.mDisplayItemData = nullptr;
  }

  if (mLayerBuilder->IsBuildingRetainedLayers()) {
    newLayerEntry->mVisibleRegion = data->mVisibleRegion;
    newLayerEntry->mOpaqueRegion = data->mOpaqueRegion;
@@ -4766,7 +4784,8 @@ FrameLayerBuilder::ComputeGeometryChangeForItem(DisplayItemData* aData)
void
FrameLayerBuilder::AddPaintedDisplayItem(PaintedLayerData* aLayerData,
                                         AssignedDisplayItem& aItem,
                                         ContainerState& aContainerState)
                                         ContainerState& aContainerState,
                                         const nsPoint& aTopLeft)
{
  PaintedLayer* layer = aLayerData->mLayer;
  PaintedDisplayItemLayerUserData* paintedData =
@@ -4782,7 +4801,7 @@ FrameLayerBuilder::AddPaintedDisplayItem(PaintedLayerData* aLayerData,
      // We need to grab these before updating the DisplayItemData because it will overwrite them.
      nsRegion clip;
      if (aItem.mClip.ComputeRegionInClips(&aItem.mDisplayItemData->GetClip(),
                                     aLayerData->mAnimatedGeometryRootOffset - paintedData->mLastAnimatedGeometryRootOrigin,
                                     aTopLeft - paintedData->mLastAnimatedGeometryRootOrigin,
                                     &clip)) {
        intClip = clip.GetBounds().ScaleToOutsidePixels(paintedData->mXScale,
                                                        paintedData->mYScale,
@@ -4804,12 +4823,6 @@ FrameLayerBuilder::AddPaintedDisplayItem(PaintedLayerData* aLayerData,
      data = StoreDataForFrame(aItem.mItem, layer, aItem.mLayerState, nullptr);
    }
    data->mInactiveManager = tempManager;
    // We optimized this PaintedLayer into a ColorLayer/ImageLayer. Store the optimized
    // layer here.
    if (aLayer != layer) {
      data->mOptLayer = aLayer;
      data->mItem = nullptr;
    }
  }

  if (tempManager) {
+10 −2
Original line number Diff line number Diff line
@@ -510,10 +510,10 @@ public:
   * aItem must have an underlying frame.
   * @param aTopLeft offset from active scrolled root to reference frame
   */
  void AddPaintedDisplayItem(PaintedLayerData* aLayerData,
  void AddPaintedDisplayItem(PaintedLayerData* aLayer,
                             AssignedDisplayItem& aAssignedDisplayItem,
                             ContainerState& aContainerState,
                             Layer* aLayer);
                             const nsPoint& aTopLeft);

  /**
   * Calls GetOldLayerForFrame on the underlying frame of the display item,
@@ -590,6 +590,14 @@ public:
   */
  static gfxSize GetPaintedLayerScaleForFrame(nsIFrame* aFrame);

  /**
   * Stores a Layer as the dedicated layer in the DisplayItemData for a given frame/key pair.
   *
   * Used when we optimize a PaintedLayer into an ImageLayer and want to retroactively update the
   * DisplayItemData so we can retrieve the layer from within layout.
   */
  void StoreOptimizedLayerForFrame(nsDisplayItem* aItem, Layer* aLayer);

  static void RemoveFrameFromLayerManager(const nsIFrame* aFrame,
                                          SmallPointerArray<DisplayItemData>& aArray);