diff --git a/layout/base/ActiveLayerTracker.cpp b/layout/base/ActiveLayerTracker.cpp index 00fce77fc46..d0bf4eb7cef 100644 --- a/layout/base/ActiveLayerTracker.cpp +++ b/layout/base/ActiveLayerTracker.cpp @@ -107,8 +107,13 @@ LayerActivity::~LayerActivity() } } +static void DestroyLayerActivity(void* aPropertyValue) +{ + delete static_cast(aPropertyValue); +} + // Frames with this property have NS_FRAME_HAS_LAYER_ACTIVITY_PROPERTY set -NS_DECLARE_FRAME_PROPERTY(LayerActivityProperty, DeleteValue) +NS_DECLARE_FRAME_PROPERTY(LayerActivityProperty, DestroyLayerActivity) void LayerActivityTracker::NotifyExpired(LayerActivity* aObject) diff --git a/layout/base/nsDisplayList.h b/layout/base/nsDisplayList.h index 3fc300cb83d..8f043dfc079 100644 --- a/layout/base/nsDisplayList.h +++ b/layout/base/nsDisplayList.h @@ -707,10 +707,13 @@ public: DisplayItemClip mContainingBlockClip; nsRect mDirtyRect; }; + static void DestroyOutOfFlowDisplayData(void* aPropertyValue) + { + delete static_cast(aPropertyValue); + } - NS_DECLARE_FRAME_PROPERTY(OutOfFlowDisplayDataProperty, - DeleteValue) - NS_DECLARE_FRAME_PROPERTY(Preserve3DDirtyRectProperty, DeleteValue) + NS_DECLARE_FRAME_PROPERTY(OutOfFlowDisplayDataProperty, DestroyOutOfFlowDisplayData) + NS_DECLARE_FRAME_PROPERTY(Preserve3DDirtyRectProperty, nsIFrame::DestroyRect) nsPresContext* CurrentPresContext() { return CurrentPresShellState()->mPresShell->GetPresContext(); diff --git a/layout/forms/nsTextControlFrame.h b/layout/forms/nsTextControlFrame.h index 587006550ef..c8d70d34d13 100644 --- a/layout/forms/nsTextControlFrame.h +++ b/layout/forms/nsTextControlFrame.h @@ -32,7 +32,7 @@ class nsTextControlFrame MOZ_FINAL : public nsContainerFrame, public: NS_DECL_FRAMEARENA_HELPERS - NS_DECLARE_FRAME_PROPERTY(ContentScrollPos, DeleteValue) + NS_DECLARE_FRAME_PROPERTY(ContentScrollPos, DestroyPoint) explicit nsTextControlFrame(nsStyleContext* aContext); virtual ~nsTextControlFrame(); diff --git a/layout/generic/StickyScrollContainer.cpp b/layout/generic/StickyScrollContainer.cpp index 285656b4d24..3b5b60263c2 100644 --- a/layout/generic/StickyScrollContainer.cpp +++ b/layout/generic/StickyScrollContainer.cpp @@ -17,8 +17,13 @@ namespace mozilla { +void DestroyStickyScrollContainer(void* aPropertyValue) +{ + delete static_cast(aPropertyValue); +} + NS_DECLARE_FRAME_PROPERTY(StickyScrollContainerProperty, - DeleteValue) + DestroyStickyScrollContainer) StickyScrollContainer::StickyScrollContainer(nsIScrollableFrame* aScrollFrame) : mScrollFrame(aScrollFrame) diff --git a/layout/generic/StickyScrollContainer.h b/layout/generic/StickyScrollContainer.h index d936e464c63..eb818d5bc9e 100644 --- a/layout/generic/StickyScrollContainer.h +++ b/layout/generic/StickyScrollContainer.h @@ -99,7 +99,7 @@ private: void ComputeStickyLimits(nsIFrame* aFrame, nsRect* aStick, nsRect* aContain) const; - friend void DeleteValue(void* aPropertyValue); + friend void DestroyStickyScrollContainer(void* aPropertyValue); nsIScrollableFrame* const mScrollFrame; nsTArray mFrames; diff --git a/layout/generic/nsFloatManager.cpp b/layout/generic/nsFloatManager.cpp index fbe6c0a8348..480914ba00d 100644 --- a/layout/generic/nsFloatManager.cpp +++ b/layout/generic/nsFloatManager.cpp @@ -307,7 +307,7 @@ nsFloatManager::CalculateRegionFor(WritingMode aWM, return region; } -NS_DECLARE_FRAME_PROPERTY(FloatRegionProperty, DeleteValue) +NS_DECLARE_FRAME_PROPERTY(FloatRegionProperty, nsIFrame::DestroyMargin) LogicalRect nsFloatManager::GetRegionFor(WritingMode aWM, nsIFrame* aFloat, diff --git a/layout/generic/nsFontInflationData.cpp b/layout/generic/nsFontInflationData.cpp index 9e33034d19e..0873e1bc7f5 100644 --- a/layout/generic/nsFontInflationData.cpp +++ b/layout/generic/nsFontInflationData.cpp @@ -16,8 +16,13 @@ using namespace mozilla; using namespace mozilla::layout; -NS_DECLARE_FRAME_PROPERTY(FontInflationDataProperty, - DeleteValue) +static void +DestroyFontInflationData(void *aPropertyValue) +{ + delete static_cast(aPropertyValue); +} + +NS_DECLARE_FRAME_PROPERTY(FontInflationDataProperty, DestroyFontInflationData) /* static */ nsFontInflationData* nsFontInflationData::FindFontInflationDataFor(const nsIFrame *aFrame) diff --git a/layout/generic/nsFrame.cpp b/layout/generic/nsFrame.cpp index adb3ce07371..1d3d38c3c7d 100644 --- a/layout/generic/nsFrame.cpp +++ b/layout/generic/nsFrame.cpp @@ -152,7 +152,13 @@ static void RefreshContentFrames(nsPresContext* aPresContext, nsIContent * aStar #include "prenv.h" -NS_DECLARE_FRAME_PROPERTY(BoxMetricsProperty, DeleteValue) +static void +DestroyBoxMetrics(void* aPropertyValue) +{ + delete static_cast(aPropertyValue); +} + +NS_DECLARE_FRAME_PROPERTY(BoxMetricsProperty, DestroyBoxMetrics) static void InitBoxMetrics(nsIFrame* aFrame, bool aClear) @@ -244,8 +250,13 @@ nsFrame::GetLogModuleInfo() #endif -NS_DECLARE_FRAME_PROPERTY(AbsoluteContainingBlockProperty, - DeleteValue) +static void +DestroyAbsoluteContainingBlock(void* aPropertyValue) +{ + delete static_cast(aPropertyValue); +} + +NS_DECLARE_FRAME_PROPERTY(AbsoluteContainingBlockProperty, DestroyAbsoluteContainingBlock) bool nsIFrame::HasAbsolutelyPositionedChildren() const { @@ -7111,7 +7122,8 @@ nsFrame::AccessibleType() } #endif -NS_DECLARE_FRAME_PROPERTY(OverflowAreasProperty, DeleteValue) +NS_DECLARE_FRAME_PROPERTY(OverflowAreasProperty, + nsIFrame::DestroyOverflowAreas) bool nsIFrame::ClearOverflowRects() @@ -8760,6 +8772,24 @@ nsIFrame::IsSelected() const IsFrameSelected() : false; } +void +nsIFrame::DestroySurface(void* aPropertyValue) +{ + static_cast(aPropertyValue)->Release(); +} + +void +nsIFrame::DestroyDT(void* aPropertyValue) +{ + static_cast(aPropertyValue)->Release(); +} + +void +nsIFrame::DestroyRegion(void* aPropertyValue) +{ + delete static_cast(aPropertyValue); +} + /*static*/ void nsIFrame::DestroyContentArray(void* aPropertyValue) { diff --git a/layout/generic/nsGridContainerFrame.cpp b/layout/generic/nsGridContainerFrame.cpp index fb4d9ae05ca..de103401684 100644 --- a/layout/generic/nsGridContainerFrame.cpp +++ b/layout/generic/nsGridContainerFrame.cpp @@ -64,6 +64,12 @@ NS_NewGridContainerFrame(nsIPresShell* aPresShell, // nsGridContainerFrame Method Implementations // =========================================== +/* static */ void +nsGridContainerFrame::DestroyImplicitNamedAreas(void* aPropertyValue) +{ + delete static_cast(aPropertyValue); +} + void nsGridContainerFrame::AddImplicitNamedAreas( const nsTArray>& aLineNameLists) diff --git a/layout/generic/nsGridContainerFrame.h b/layout/generic/nsGridContainerFrame.h index aa0e06aa7a9..aa98ab918f6 100644 --- a/layout/generic/nsGridContainerFrame.h +++ b/layout/generic/nsGridContainerFrame.h @@ -49,14 +49,14 @@ protected: * grid-template-columns / grid-template-rows are stored in this frame * property when needed, as a ImplicitNamedAreas* value. */ - NS_DECLARE_FRAME_PROPERTY(ImplicitNamedAreasProperty, - DeleteValue) + NS_DECLARE_FRAME_PROPERTY(ImplicitNamedAreasProperty, DestroyImplicitNamedAreas) void InitImplicitNamedAreas(const nsStylePosition* aStyle); void AddImplicitNamedAreas(const nsTArray>& aLineNameLists); typedef nsTHashtable ImplicitNamedAreas; ImplicitNamedAreas* GetImplicitNamedAreas() const { return static_cast(Properties().Get(ImplicitNamedAreasProperty())); } + static void DestroyImplicitNamedAreas(void* aPropertyValue); #ifdef DEBUG void SanityCheckAnonymousGridItems() const; diff --git a/layout/generic/nsIFrame.h b/layout/generic/nsIFrame.h index 29a54e8580c..8273ae77506 100644 --- a/layout/generic/nsIFrame.h +++ b/layout/generic/nsIFrame.h @@ -367,20 +367,6 @@ struct IntrinsicSize { }; } -/// Generic destructor for frame properties. Calls delete. -template -static void DeleteValue(void* aPropertyValue) -{ - delete static_cast(aPropertyValue); -} - -/// Generic destructor for frame properties. Calls Release(). -template -static void ReleaseValue(void* aPropertyValue) -{ - static_cast(aPropertyValue)->Release(); -} - //---------------------------------------------------------------------- /** @@ -797,6 +783,30 @@ public: nsPoint GetPositionIgnoringScrolling(); + static void DestroyRegion(void* aPropertyValue); + + static void DestroyMargin(void* aPropertyValue) + { + delete static_cast(aPropertyValue); + } + + static void DestroyRect(void* aPropertyValue) + { + delete static_cast(aPropertyValue); + } + + static void DestroyPoint(void* aPropertyValue) + { + delete static_cast(aPropertyValue); + } + + static void DestroyOverflowAreas(void* aPropertyValue) + { + delete static_cast(aPropertyValue); + } + + static void DestroySurface(void* aPropertyValue); + static void DestroyDT(void* aPropertyValue); static void DestroyContentArray(void* aPropertyValue); #ifdef _MSC_VER @@ -822,19 +832,18 @@ public: NS_DECLARE_FRAME_PROPERTY(IBSplitSibling, nullptr) NS_DECLARE_FRAME_PROPERTY(IBSplitPrevSibling, nullptr) - NS_DECLARE_FRAME_PROPERTY(NormalPositionProperty, DeleteValue) - NS_DECLARE_FRAME_PROPERTY(ComputedOffsetProperty, DeleteValue) + NS_DECLARE_FRAME_PROPERTY(NormalPositionProperty, DestroyPoint) + NS_DECLARE_FRAME_PROPERTY(ComputedOffsetProperty, DestroyMargin) - NS_DECLARE_FRAME_PROPERTY(OutlineInnerRectProperty, DeleteValue) - NS_DECLARE_FRAME_PROPERTY(PreEffectsBBoxProperty, DeleteValue) + NS_DECLARE_FRAME_PROPERTY(OutlineInnerRectProperty, DestroyRect) + NS_DECLARE_FRAME_PROPERTY(PreEffectsBBoxProperty, DestroyRect) NS_DECLARE_FRAME_PROPERTY(PreTransformOverflowAreasProperty, - DeleteValue) + DestroyOverflowAreas) // The initial overflow area passed to FinishAndStoreOverflow. This is only set // on frames that Preserve3D() or HasPerspective() or IsTransformed(), and // when at least one of the overflow areas differs from the frame bound rect. - NS_DECLARE_FRAME_PROPERTY(InitialOverflowProperty, - DeleteValue) + NS_DECLARE_FRAME_PROPERTY(InitialOverflowProperty, DestroyOverflowAreas) #ifdef DEBUG // InitialOverflowPropertyDebug is added to the frame to indicate that either @@ -843,19 +852,18 @@ public: NS_DECLARE_FRAME_PROPERTY(DebugInitialOverflowPropertyApplied, nullptr) #endif - NS_DECLARE_FRAME_PROPERTY(UsedMarginProperty, DeleteValue) - NS_DECLARE_FRAME_PROPERTY(UsedPaddingProperty, DeleteValue) - NS_DECLARE_FRAME_PROPERTY(UsedBorderProperty, DeleteValue) + NS_DECLARE_FRAME_PROPERTY(UsedMarginProperty, DestroyMargin) + NS_DECLARE_FRAME_PROPERTY(UsedPaddingProperty, DestroyMargin) + NS_DECLARE_FRAME_PROPERTY(UsedBorderProperty, DestroyMargin) NS_DECLARE_FRAME_PROPERTY(ScrollLayerCount, nullptr) NS_DECLARE_FRAME_PROPERTY(LineBaselineOffset, nullptr) - NS_DECLARE_FRAME_PROPERTY(CachedBackgroundImage, ReleaseValue) - NS_DECLARE_FRAME_PROPERTY(CachedBackgroundImageDT, - ReleaseValue) + NS_DECLARE_FRAME_PROPERTY(CachedBackgroundImage, DestroySurface) + NS_DECLARE_FRAME_PROPERTY(CachedBackgroundImageDT, DestroyDT) - NS_DECLARE_FRAME_PROPERTY(InvalidationRect, DeleteValue) + NS_DECLARE_FRAME_PROPERTY(InvalidationRect, DestroyRect) NS_DECLARE_FRAME_PROPERTY(RefusedAsyncAnimation, nullptr) diff --git a/layout/generic/nsTextFrame.cpp b/layout/generic/nsTextFrame.cpp index 75a10cb0b9b..497741f16f5 100644 --- a/layout/generic/nsTextFrame.cpp +++ b/layout/generic/nsTextFrame.cpp @@ -181,7 +181,12 @@ TabWidthStore::ApplySpacing(gfxTextRun::PropertyProvider::Spacing *aSpacing, } } -NS_DECLARE_FRAME_PROPERTY(TabWidthProperty, DeleteValue) +static void DestroyTabWidth(void* aPropertyValue) +{ + delete static_cast(aPropertyValue); +} + +NS_DECLARE_FRAME_PROPERTY(TabWidthProperty, DestroyTabWidth) NS_DECLARE_FRAME_PROPERTY(OffsetToFrameProperty, nullptr) @@ -199,14 +204,18 @@ private: nsTextFrame* mFrame; }; +static void DestroyGlyphObserverList(void* aPropertyValue) +{ + delete static_cast >*>(aPropertyValue); +} + /** * This property is set on text frames with TEXT_IN_TEXTRUN_USER_DATA set that * have potentially-animated glyphs. * The only reason this list is in a property is to automatically destroy the * list when the frame is deleted, unregistering the observers. */ -NS_DECLARE_FRAME_PROPERTY(TextFrameGlyphObservers, - DeleteValue>>); +NS_DECLARE_FRAME_PROPERTY(TextFrameGlyphObservers, DestroyGlyphObserverList); static const nsFrameState TEXT_REFLOW_FLAGS = TEXT_FIRST_LETTER | diff --git a/layout/mathml/nsMathMLContainerFrame.cpp b/layout/mathml/nsMathMLContainerFrame.cpp index 4e670011873..efec3ba36a9 100644 --- a/layout/mathml/nsMathMLContainerFrame.cpp +++ b/layout/mathml/nsMathMLContainerFrame.cpp @@ -129,8 +129,13 @@ IsForeignChild(const nsIFrame* aFrame) aFrame->GetType() == nsGkAtoms::blockFrame; } -NS_DECLARE_FRAME_PROPERTY(HTMLReflowMetricsProperty, - DeleteValue) +static void +DestroyHTMLReflowMetrics(void *aPropertyValue) +{ + delete static_cast(aPropertyValue); +} + +NS_DECLARE_FRAME_PROPERTY(HTMLReflowMetricsProperty, DestroyHTMLReflowMetrics) /* static */ void nsMathMLContainerFrame::SaveReflowAndBoundingMetricsFor(nsIFrame* aFrame, diff --git a/layout/mathml/nsMathMLmtableFrame.cpp b/layout/mathml/nsMathMLmtableFrame.cpp index c2145d9aa5d..8bb701669e3 100644 --- a/layout/mathml/nsMathMLmtableFrame.cpp +++ b/layout/mathml/nsMathMLmtableFrame.cpp @@ -130,10 +130,16 @@ static nsresult ReportParseError(nsIFrame* aFrame, const char16_t* aAttribute, // stored in the property table. Row/Cell frames query the property table // to see what values apply to them. -NS_DECLARE_FRAME_PROPERTY(RowAlignProperty, DeleteValue>) -NS_DECLARE_FRAME_PROPERTY(RowLinesProperty, DeleteValue>) -NS_DECLARE_FRAME_PROPERTY(ColumnAlignProperty, DeleteValue>) -NS_DECLARE_FRAME_PROPERTY(ColumnLinesProperty, DeleteValue>) +static void +DestroyStylePropertyList(void* aPropertyValue) +{ + delete static_cast*>(aPropertyValue); +} + +NS_DECLARE_FRAME_PROPERTY(RowAlignProperty, DestroyStylePropertyList) +NS_DECLARE_FRAME_PROPERTY(RowLinesProperty, DestroyStylePropertyList) +NS_DECLARE_FRAME_PROPERTY(ColumnAlignProperty, DestroyStylePropertyList) +NS_DECLARE_FRAME_PROPERTY(ColumnLinesProperty, DestroyStylePropertyList) static const FramePropertyDescriptor* AttributeToProperty(nsIAtom* aAttribute) diff --git a/layout/svg/SVGTextFrame.cpp b/layout/svg/SVGTextFrame.cpp index 31fa9ee3c5d..cad5f23997a 100644 --- a/layout/svg/SVGTextFrame.cpp +++ b/layout/svg/SVGTextFrame.cpp @@ -1286,8 +1286,12 @@ struct TextNodeCorrespondence uint32_t mUndisplayedCharacters; }; -NS_DECLARE_FRAME_PROPERTY(TextNodeCorrespondenceProperty, - DeleteValue) +static void DestroyTextNodeCorrespondence(void* aPropertyValue) +{ + delete static_cast(aPropertyValue); +} + +NS_DECLARE_FRAME_PROPERTY(TextNodeCorrespondenceProperty, DestroyTextNodeCorrespondence) /** * Returns the number of undisplayed characters before the specified diff --git a/layout/svg/nsSVGEffects.h b/layout/svg/nsSVGEffects.h index 6c000d1b9f8..667a5203042 100644 --- a/layout/svg/nsSVGEffects.h +++ b/layout/svg/nsSVGEffects.h @@ -390,6 +390,11 @@ public: typedef nsInterfaceHashtable URIObserverHashtable; + static void DestroySupports(void* aPropertyValue) + { + (static_cast(aPropertyValue))->Release(); + } + static void DestroyFilterProperty(void* aPropertyValue) { auto* prop = static_cast(aPropertyValue); @@ -402,17 +407,21 @@ public: prop->Release(); } + static void DestroyHashtable(void* aPropertyValue) + { + delete static_cast (aPropertyValue); + } + NS_DECLARE_FRAME_PROPERTY(FilterProperty, DestroyFilterProperty) - NS_DECLARE_FRAME_PROPERTY(MaskProperty, ReleaseValue) - NS_DECLARE_FRAME_PROPERTY(ClipPathProperty, ReleaseValue) - NS_DECLARE_FRAME_PROPERTY(MarkerBeginProperty, ReleaseValue) - NS_DECLARE_FRAME_PROPERTY(MarkerMiddleProperty, ReleaseValue) - NS_DECLARE_FRAME_PROPERTY(MarkerEndProperty, ReleaseValue) - NS_DECLARE_FRAME_PROPERTY(FillProperty, ReleaseValue) - NS_DECLARE_FRAME_PROPERTY(StrokeProperty, ReleaseValue) - NS_DECLARE_FRAME_PROPERTY(HrefProperty, ReleaseValue) - NS_DECLARE_FRAME_PROPERTY(BackgroundImageProperty, - DeleteValue) + NS_DECLARE_FRAME_PROPERTY(MaskProperty, DestroySupports) + NS_DECLARE_FRAME_PROPERTY(ClipPathProperty, DestroySupports) + NS_DECLARE_FRAME_PROPERTY(MarkerBeginProperty, DestroySupports) + NS_DECLARE_FRAME_PROPERTY(MarkerMiddleProperty, DestroySupports) + NS_DECLARE_FRAME_PROPERTY(MarkerEndProperty, DestroySupports) + NS_DECLARE_FRAME_PROPERTY(FillProperty, DestroySupports) + NS_DECLARE_FRAME_PROPERTY(StrokeProperty, DestroySupports) + NS_DECLARE_FRAME_PROPERTY(HrefProperty, DestroySupports) + NS_DECLARE_FRAME_PROPERTY(BackgroundImageProperty, DestroyHashtable) /** * Get the paint server for a aTargetFrame. diff --git a/layout/tables/nsTableFrame.cpp b/layout/tables/nsTableFrame.cpp index a4520ea5744..9a5a3370eb0 100644 --- a/layout/tables/nsTableFrame.cpp +++ b/layout/tables/nsTableFrame.cpp @@ -260,6 +260,13 @@ nsTableFrame::PageBreakAfter(nsIFrame* aSourceFrame, typedef nsTArray FrameTArray; +/* static */ void +nsTableFrame::DestroyPositionedTablePartArray(void* aPropertyValue) +{ + auto positionedObjs = static_cast(aPropertyValue); + delete positionedObjs; +} + /* static */ void nsTableFrame::RegisterPositionedTablePart(nsIFrame* aFrame) { @@ -2542,7 +2549,14 @@ nsTableFrame::GetUsedMargin() const return nsMargin(0, 0, 0, 0); } -NS_DECLARE_FRAME_PROPERTY(TableBCProperty, DeleteValue) +// Destructor function for BCPropertyData properties +static void +DestroyBCProperty(void* aPropertyValue) +{ + delete static_cast(aPropertyValue); +} + +NS_DECLARE_FRAME_PROPERTY(TableBCProperty, DestroyBCProperty) BCPropertyData* nsTableFrame::GetBCProperty(bool aCreateIfNecessary) const diff --git a/layout/tables/nsTableFrame.h b/layout/tables/nsTableFrame.h index fc254901b30..95640a7ef3d 100644 --- a/layout/tables/nsTableFrame.h +++ b/layout/tables/nsTableFrame.h @@ -109,8 +109,8 @@ class nsTableFrame : public nsContainerFrame public: NS_DECL_FRAMEARENA_HELPERS - NS_DECLARE_FRAME_PROPERTY(PositionedTablePartArray, - DeleteValue>) + static void DestroyPositionedTablePartArray(void* aPropertyValue); + NS_DECLARE_FRAME_PROPERTY(PositionedTablePartArray, DestroyPositionedTablePartArray) /** nsTableOuterFrame has intimate knowledge of the inner table frame */ friend class nsTableOuterFrame; diff --git a/layout/tables/nsTableRowGroupFrame.cpp b/layout/tables/nsTableRowGroupFrame.cpp index 5820c8d7011..35e29268d5f 100644 --- a/layout/tables/nsTableRowGroupFrame.cpp +++ b/layout/tables/nsTableRowGroupFrame.cpp @@ -1832,8 +1832,13 @@ nsTableRowGroupFrame::GetNextSiblingOnLine(nsIFrame*& aFrame, //end nsLineIterator methods -NS_DECLARE_FRAME_PROPERTY(RowCursorProperty, - DeleteValue) +static void +DestroyFrameCursorData(void* aPropertyValue) +{ + delete static_cast(aPropertyValue); +} + +NS_DECLARE_FRAME_PROPERTY(RowCursorProperty, DestroyFrameCursorData) void nsTableRowGroupFrame::ClearRowCursor()