# HG changeset patch # User Matt Woodrow # Date 1518997021 -46800 # Node ID 4c62cca5f3ecb2ee93b4d50a4c9427b3fa8f8ccd # Parent 825ed4c84ee5d677e66c194afbd5f5355d75c01b Bug 1440177 - Part 5: Don't call GetDisplayItemDataForManager in AddPaintedDisplayItem since we already have it passed in as a parameter. r=jnicol MozReview-Commit-ID: CfHL0Kqto6X diff --git a/layout/painting/DisplayItemClip.cpp b/layout/painting/DisplayItemClip.cpp --- a/layout/painting/DisplayItemClip.cpp +++ b/layout/painting/DisplayItemClip.cpp @@ -405,17 +405,17 @@ DisplayItemClip::GetCommonRoundedRectCou void DisplayItemClip::AppendRoundedRects(nsTArray* aArray, uint32_t aCount) const { size_t count = std::min(mRoundedClipRects.Length(), size_t(aCount)); aArray->AppendElements(mRoundedClipRects.Elements(), count); } bool -DisplayItemClip::ComputeRegionInClips(DisplayItemClip* aOldClip, +DisplayItemClip::ComputeRegionInClips(const DisplayItemClip* aOldClip, const nsPoint& aShift, nsRegion* aCombined) const { if (!mHaveClipRect || (aOldClip && !aOldClip->mHaveClipRect)) { return false; } if (aOldClip) { diff --git a/layout/painting/DisplayItemClip.h b/layout/painting/DisplayItemClip.h --- a/layout/painting/DisplayItemClip.h +++ b/layout/painting/DisplayItemClip.h @@ -116,17 +116,17 @@ public: /* * Computes a region which contains the clipped area of this DisplayItemClip, * or if aOldClip is non-null, the union of the clipped area of this * DisplayItemClip with the clipped area of aOldClip translated by aShift. * The result is stored in aCombined. If the result would be infinite * (because one or both of the clips does no clipping), returns false. */ - bool ComputeRegionInClips(DisplayItemClip* aOldClip, + bool ComputeRegionInClips(const DisplayItemClip* aOldClip, const nsPoint& aShift, nsRegion* aCombined) const; // Returns false if aRect is definitely not clipped by a rounded corner in // this clip. Returns true if aRect is clipped by a rounded corner in this // clip or it can not be quickly determined that it is not clipped by a // rounded corner in this clip. bool IsRectClippedByRoundedCorner(const nsRect& aRect) const; diff --git a/layout/painting/FrameLayerBuilder.cpp b/layout/painting/FrameLayerBuilder.cpp --- a/layout/painting/FrameLayerBuilder.cpp +++ b/layout/painting/FrameLayerBuilder.cpp @@ -4830,37 +4830,32 @@ FrameLayerBuilder::AddPaintedDisplayItem PaintedLayer* layer = aLayerData->mLayer; PaintedDisplayItemLayerUserData* paintedData = static_cast (layer->GetUserData(&gPaintedDisplayItemLayerUserData)); RefPtr tempManager; nsIntRect intClip; bool hasClip = false; if (aLayerState != LAYER_NONE) { - DisplayItemData *data = GetDisplayItemDataForManager(aItem, layer->Manager()); - if (data) { - tempManager = data->mInactiveManager; + if (aData) { + tempManager = aData->mInactiveManager; + + // We need to grab these before calling AddLayerDisplayItem because it will overwrite them. + nsRegion clip; + if (aClip.ComputeRegionInClips(&aData->GetClip(), + aTopLeft - paintedData->mLastAnimatedGeometryRootOrigin, + &clip)) { + intClip = clip.GetBounds().ScaleToOutsidePixels(paintedData->mXScale, + paintedData->mYScale, + paintedData->mAppUnitsPerDevPixel); + } } if (!tempManager) { tempManager = new BasicLayerManager(BasicLayerManager::BLM_INACTIVE); } - - // We need to grab these before calling AddLayerDisplayItem because it will overwrite them. - nsRegion clip; - DisplayItemClip* oldClip = nullptr; - GetOldLayerFor(aItem, nullptr, &oldClip); - hasClip = aClip.ComputeRegionInClips(oldClip, - aTopLeft - paintedData->mLastAnimatedGeometryRootOrigin, - &clip); - - if (hasClip) { - intClip = clip.GetBounds().ScaleToOutsidePixels(paintedData->mXScale, - paintedData->mYScale, - paintedData->mAppUnitsPerDevPixel); - } } AddLayerDisplayItem(layer, aItem, aLayerState, tempManager, aData); if (tempManager) { FLB_LOG_PAINTED_LAYER_DECISION(aLayerData, "Creating nested FLB for item %p\n", aItem); FrameLayerBuilder* layerBuilder = new FrameLayerBuilder(); layerBuilder->Init(mDisplayListBuilder, tempManager, aLayerData, true, diff --git a/layout/painting/FrameLayerBuilder.h b/layout/painting/FrameLayerBuilder.h --- a/layout/painting/FrameLayerBuilder.h +++ b/layout/painting/FrameLayerBuilder.h @@ -64,16 +64,17 @@ class PaintedDisplayItemLayerUserData; class DisplayItemData final { public: friend class FrameLayerBuilder; friend class ContainerState; uint32_t GetDisplayItemKey() { return mDisplayItemKey; } layers::Layer* GetLayer() const { return mLayer; } nsDisplayItemGeometry* GetGeometry() const { return mGeometry.get(); } + const DisplayItemClip& GetClip() const { return mClip; } void Invalidate() { mIsInvalid = true; } void ClearAnimationCompositorState(); bool HasMergedFrames() const { return mFrameList.Length() > 1; } static DisplayItemData* AssertDisplayItemData(DisplayItemData* aData); void* operator new(size_t sz, nsPresContext* aPresContext)