From 5c1dd3958323934ab69871c53aa1d0942138dc27 Mon Sep 17 00:00:00 2001 From: Jonathan Watt Date: Thu, 30 Aug 2018 13:15:47 +0100 Subject: [PATCH] Bug 1494285 p3. Rename nsDisplayFilter to nsDisplayFilters. r=miko Differential Revision: https://phabricator.services.mozilla.com/D7008 --HG-- extra : rebase_source : 89a1bd3e34666a09bd9d9d26329f183ebc28a1c3 extra : amend_source : 71c0eacf545383c23533ae05c46561159567d667 extra : histedit_source : a1047949377d690bba5cfcf86b16cb2be0610af0 --- gfx/layers/wr/WebRenderCommandBuilder.cpp | 12 +++--- layout/base/nsLayoutDebugger.cpp | 2 +- layout/generic/nsFrame.cpp | 4 +- layout/painting/FrameLayerBuilder.cpp | 2 +- layout/painting/nsDisplayList.cpp | 38 +++++++++---------- layout/painting/nsDisplayList.h | 28 ++++++++------ layout/painting/nsDisplayListInvalidation.cpp | 4 +- layout/painting/nsDisplayListInvalidation.h | 10 ++--- layout/reftests/bugs/1406183-1-ref.html | 2 +- layout/reftests/bugs/1406183-1.html | 2 +- 10 files changed, 54 insertions(+), 50 deletions(-) diff --git a/gfx/layers/wr/WebRenderCommandBuilder.cpp b/gfx/layers/wr/WebRenderCommandBuilder.cpp index 3ebf4ebf4897..3c61fe956da1 100644 --- a/gfx/layers/wr/WebRenderCommandBuilder.cpp +++ b/gfx/layers/wr/WebRenderCommandBuilder.cpp @@ -922,13 +922,13 @@ Grouper::PaintContainerItem(DIGroup* aGroup, nsDisplayItem* aItem, const IntRect } case DisplayItemType::TYPE_FILTER: { GP("Paint Filter\n"); - // We don't currently support doing invalidation inside nsDisplayFilter + // We don't currently support doing invalidation inside nsDisplayFilters // for now just paint it as a single item BlobItemData* data = GetBlobItemDataForGroup(aItem, aGroup); if (data->mLayerManager->GetRoot()) { data->mLayerManager->BeginTransaction(); - static_cast(aItem)->PaintAsLayer(mDisplayListBuilder, - aContext, data->mLayerManager); + static_cast(aItem)->PaintAsLayer(mDisplayListBuilder, + aContext, data->mLayerManager); if (data->mLayerManager->InTransaction()) { data->mLayerManager->AbortTransaction(); } @@ -1742,8 +1742,8 @@ PaintItemByDrawTarget(nsDisplayItem* aItem, { context->SetMatrix(context->CurrentMatrix().PreTranslate(-aOffset.x, -aOffset.y)); isInvalidated = PaintByLayer(aItem, aDisplayListBuilder, aManager, context, aScale, [&]() { - static_cast(aItem)->PaintAsLayer(aDisplayListBuilder, - context, aManager); + static_cast(aItem)->PaintAsLayer(aDisplayListBuilder, + context, aManager); }); break; } @@ -1856,7 +1856,7 @@ WebRenderCommandBuilder::GenerateFallbackData(nsDisplayItem* aItem, LayerRect paintRect = LayerRect(LayerPoint(0, 0), LayerSize(paintSize)); nsDisplayItemGeometry* geometry = fallbackData->GetGeometry(); - // nsDisplayFilter is rendered via BasicLayerManager which means the invalidate + // nsDisplayFilters is rendered via BasicLayerManager which means the invalidate // region is unknown until we traverse the displaylist contained by it. if (geometry && !fallbackData->IsInvalid() && aItem->GetType() != DisplayItemType::TYPE_FILTER && diff --git a/layout/base/nsLayoutDebugger.cpp b/layout/base/nsLayoutDebugger.cpp index c5aa6e37a74d..efe7d338c6ef 100644 --- a/layout/base/nsLayoutDebugger.cpp +++ b/layout/base/nsLayoutDebugger.cpp @@ -211,7 +211,7 @@ PrintDisplayItemTo(nsDisplayListBuilder* aBuilder, nsDisplayItem* aItem, if (aItem->GetType() == DisplayItemType::TYPE_FILTER) { nsCString str; - (static_cast(aItem))->PrintEffects(str); + (static_cast(aItem))->PrintEffects(str); aStream << str.get(); } #endif diff --git a/layout/generic/nsFrame.cpp b/layout/generic/nsFrame.cpp index c9249b4ea0f5..429a56783328 100644 --- a/layout/generic/nsFrame.cpp +++ b/layout/generic/nsFrame.cpp @@ -3201,8 +3201,8 @@ nsIFrame::BuildDisplayListForStackingContext(nsDisplayListBuilder* aBuilder, /* List now emptied, so add the new list to the top. */ resultList.AppendToTop( - MakeDisplayItem(aBuilder, this, &resultList, - handleOpacity)); + MakeDisplayItem(aBuilder, this, &resultList, + handleOpacity)); } if (usingMask) { diff --git a/layout/painting/FrameLayerBuilder.cpp b/layout/painting/FrameLayerBuilder.cpp index fadd5a3ce23a..a81954e7e9d3 100644 --- a/layout/painting/FrameLayerBuilder.cpp +++ b/layout/painting/FrameLayerBuilder.cpp @@ -4450,7 +4450,7 @@ PaintInactiveLayer(nsDisplayListBuilder* aBuilder, basic->AbortTransaction(); } } else if (aItem->GetType() == DisplayItemType::TYPE_FILTER) { - static_cast(aItem)->PaintAsLayer(aBuilder, aCtx, basic); + static_cast(aItem)->PaintAsLayer(aBuilder, aCtx, basic); if (basic->InTransaction()) { basic->AbortTransaction(); } diff --git a/layout/painting/nsDisplayList.cpp b/layout/painting/nsDisplayList.cpp index fef3f075b101..a4744f739b82 100644 --- a/layout/painting/nsDisplayList.cpp +++ b/layout/painting/nsDisplayList.cpp @@ -10071,18 +10071,18 @@ nsDisplayMasksAndClipPaths::PrintEffects(nsACString& aTo) } #endif -nsDisplayFilter::nsDisplayFilter(nsDisplayListBuilder* aBuilder, - nsIFrame* aFrame, - nsDisplayList* aList, - bool aHandleOpacity) +nsDisplayFilters::nsDisplayFilters(nsDisplayListBuilder* aBuilder, + nsIFrame* aFrame, + nsDisplayList* aList, + bool aHandleOpacity) : nsDisplayEffectsBase(aBuilder, aFrame, aList, aHandleOpacity) , mEffectsBounds(aFrame->GetVisualOverflowRectRelativeToSelf()) { - MOZ_COUNT_CTOR(nsDisplayFilter); + MOZ_COUNT_CTOR(nsDisplayFilters); } already_AddRefed -nsDisplayFilter::BuildLayer( +nsDisplayFilters::BuildLayer( nsDisplayListBuilder* aBuilder, LayerManager* aManager, const ContainerLayerParameters& aContainerParameters) @@ -10121,16 +10121,16 @@ nsDisplayFilter::BuildLayer( } LayerState -nsDisplayFilter::GetLayerState(nsDisplayListBuilder* aBuilder, - LayerManager* aManager, - const ContainerLayerParameters& aParameters) +nsDisplayFilters::GetLayerState(nsDisplayListBuilder* aBuilder, + LayerManager* aManager, + const ContainerLayerParameters& aParameters) { return LAYER_SVG_EFFECTS; } bool -nsDisplayFilter::ComputeVisibility(nsDisplayListBuilder* aBuilder, - nsRegion* aVisibleRegion) +nsDisplayFilters::ComputeVisibility(nsDisplayListBuilder* aBuilder, + nsRegion* aVisibleRegion) { nsPoint offset = ToReferenceFrame(); nsRect dirtyRect = nsSVGIntegrationUtils::GetRequiredSourceForInvalidArea( @@ -10147,7 +10147,7 @@ nsDisplayFilter::ComputeVisibility(nsDisplayListBuilder* aBuilder, } void -nsDisplayFilter::ComputeInvalidationRegion( +nsDisplayFilters::ComputeInvalidationRegion( nsDisplayListBuilder* aBuilder, const nsDisplayItemGeometry* aGeometry, nsRegion* aInvalidRegion) const @@ -10155,7 +10155,7 @@ nsDisplayFilter::ComputeInvalidationRegion( nsDisplayEffectsBase::ComputeInvalidationRegion( aBuilder, aGeometry, aInvalidRegion); - auto* geometry = static_cast(aGeometry); + auto* geometry = static_cast(aGeometry); if (aBuilder->ShouldSyncDecodeImages() && geometry->ShouldInvalidateToSyncDecodeImages()) { @@ -10166,9 +10166,9 @@ nsDisplayFilter::ComputeInvalidationRegion( } void -nsDisplayFilter::PaintAsLayer(nsDisplayListBuilder* aBuilder, - gfxContext* aCtx, - LayerManager* aManager) +nsDisplayFilters::PaintAsLayer(nsDisplayListBuilder* aBuilder, + gfxContext* aCtx, + LayerManager* aManager) { imgDrawingParams imgParams(aBuilder->ShouldSyncDecodeImages() ? imgIContainer::FLAG_SYNC_DECODE @@ -10183,7 +10183,7 @@ nsDisplayFilter::PaintAsLayer(nsDisplayListBuilder* aBuilder, mHandleOpacity, imgParams); nsSVGIntegrationUtils::PaintFilter(params); - nsDisplayFilterGeometry::UpdateDrawResult(this, imgParams.result); + nsDisplayFiltersGeometry::UpdateDrawResult(this, imgParams.result); } static float @@ -10194,7 +10194,7 @@ ClampStdDeviation(float aStdDeviation) } bool -nsDisplayFilter::CreateWebRenderCommands( +nsDisplayFilters::CreateWebRenderCommands( mozilla::wr::DisplayListBuilder& aBuilder, mozilla::wr::IpcResourceUpdateQueue& aResources, const StackingContextHelper& aSc, @@ -10318,7 +10318,7 @@ nsDisplayFilter::CreateWebRenderCommands( #ifdef MOZ_DUMP_PAINTING void -nsDisplayFilter::PrintEffects(nsACString& aTo) +nsDisplayFilters::PrintEffects(nsACString& aTo) { nsIFrame* firstFrame = nsLayoutUtils::FirstContinuationOrIBSplitSibling(mFrame); diff --git a/layout/painting/nsDisplayList.h b/layout/painting/nsDisplayList.h index a2f786d59385..917906bff1c4 100644 --- a/layout/painting/nsDisplayList.h +++ b/layout/painting/nsDisplayList.h @@ -907,7 +907,7 @@ public: /** * Returns true if we're currently building a display list that's - * under an nsDisplayFilter. + * under an nsDisplayFilters. */ bool IsInFilter() const { return mInFilter; } @@ -6840,31 +6840,35 @@ private: /** * A display item to paint a stacking context with filter effects set by the * stacking context root frame's style. + * + * Note that the filters may just be simple CSS filter functions. That is, + * they won't necessarily be references to SVG 'filter' elements. */ -class nsDisplayFilter : public nsDisplayEffectsBase +class nsDisplayFilters : public nsDisplayEffectsBase { public: - nsDisplayFilter(nsDisplayListBuilder* aBuilder, - nsIFrame* aFrame, - nsDisplayList* aList, - bool aHandleOpacity); + nsDisplayFilters(nsDisplayListBuilder* aBuilder, + nsIFrame* aFrame, + nsDisplayList* aList, + bool aHandleOpacity); - nsDisplayFilter(nsDisplayListBuilder* aBuilder, const nsDisplayFilter& aOther) + nsDisplayFilters(nsDisplayListBuilder* aBuilder, + const nsDisplayFilters& aOther) : nsDisplayEffectsBase(aBuilder, aOther) , mEffectsBounds(aOther.mEffectsBounds) { } #ifdef NS_BUILD_REFCNT_LOGGING - ~nsDisplayFilter() override { MOZ_COUNT_DTOR(nsDisplayFilter); } + ~nsDisplayFilters() override { MOZ_COUNT_DTOR(nsDisplayFilters); } #endif NS_DISPLAY_DECL_NAME("Filter", TYPE_FILTER) nsDisplayWrapList* Clone(nsDisplayListBuilder* aBuilder) const override { - MOZ_COUNT_CTOR(nsDisplayFilter); - return MakeDisplayItem(aBuilder, *this); + MOZ_COUNT_CTOR(nsDisplayFilters); + return MakeDisplayItem(aBuilder, *this); } bool CanMerge(const nsDisplayItem* aItem) const override @@ -6879,7 +6883,7 @@ public: { nsDisplayWrapList::Merge(aItem); - const nsDisplayFilter* other = static_cast(aItem); + const nsDisplayFilters* other = static_cast(aItem); mEffectsBounds.UnionRect(mEffectsBounds, other->mEffectsBounds + other->mFrame->GetOffsetTo(mFrame)); @@ -6906,7 +6910,7 @@ public: nsDisplayItemGeometry* AllocateGeometry( nsDisplayListBuilder* aBuilder) override { - return new nsDisplayFilterGeometry(this, aBuilder); + return new nsDisplayFiltersGeometry(this, aBuilder); } void ComputeInvalidationRegion(nsDisplayListBuilder* aBuilder, diff --git a/layout/painting/nsDisplayListInvalidation.cpp b/layout/painting/nsDisplayListInvalidation.cpp index f37519126f25..c42850446e3d 100644 --- a/layout/painting/nsDisplayListInvalidation.cpp +++ b/layout/painting/nsDisplayListInvalidation.cpp @@ -152,8 +152,8 @@ nsDisplayMasksAndClipPathsGeometry::nsDisplayMasksAndClipPathsGeometry( { } -nsDisplayFilterGeometry::nsDisplayFilterGeometry(nsDisplayFilter* aItem, - nsDisplayListBuilder* aBuilder) +nsDisplayFiltersGeometry::nsDisplayFiltersGeometry(nsDisplayFilters* aItem, + nsDisplayListBuilder* aBuilder) : nsDisplaySVGEffectGeometry(aItem, aBuilder) , nsImageGeometryMixin(aItem, aBuilder) { diff --git a/layout/painting/nsDisplayListInvalidation.h b/layout/painting/nsDisplayListInvalidation.h index d2c39b2cb448..a678bdb872c5 100644 --- a/layout/painting/nsDisplayListInvalidation.h +++ b/layout/painting/nsDisplayListInvalidation.h @@ -23,7 +23,7 @@ class nsDisplayTableItem; class nsDisplayThemedBackground; class nsDisplayEffectsBase; class nsDisplayMasksAndClipPaths; -class nsDisplayFilter; +class nsDisplayFilters; namespace mozilla { namespace gfx { @@ -322,13 +322,13 @@ public: bool mHandleOpacity; }; -class nsDisplayFilterGeometry +class nsDisplayFiltersGeometry : public nsDisplaySVGEffectGeometry - , public nsImageGeometryMixin + , public nsImageGeometryMixin { public: - nsDisplayFilterGeometry(nsDisplayFilter* aItem, - nsDisplayListBuilder* aBuilder); + nsDisplayFiltersGeometry(nsDisplayFilters* aItem, + nsDisplayListBuilder* aBuilder); bool InvalidateForSyncDecodeImages() const override { diff --git a/layout/reftests/bugs/1406183-1-ref.html b/layout/reftests/bugs/1406183-1-ref.html index f9383b77b8c5..a7a225b34d39 100644 --- a/layout/reftests/bugs/1406183-1-ref.html +++ b/layout/reftests/bugs/1406183-1-ref.html @@ -1,7 +1,7 @@ -Reference for bug 1406183: ImageLayer inside inactive BasicLayerManager for fallback nsDisplayFilter is drawn at the wrong position +Reference for bug 1406183: ImageLayer inside inactive BasicLayerManager for fallback nsDisplayFilters is drawn at the wrong position