diff --git a/layout/forms/nsFormControlFrame.cpp b/layout/forms/nsFormControlFrame.cpp index 4abc71f7120a..41f741106a1f 100644 --- a/layout/forms/nsFormControlFrame.cpp +++ b/layout/forms/nsFormControlFrame.cpp @@ -44,8 +44,6 @@ NS_QUERYFRAME_HEAD(nsFormControlFrame) NS_QUERYFRAME_ENTRY(nsIFormControlFrame) NS_QUERYFRAME_TAIL_INHERITING(nsLeafFrame) -NS_IMPL_FRAMEARENA_HELPERS(nsFormControlFrame) - nscoord nsFormControlFrame::GetIntrinsicISize() { diff --git a/layout/forms/nsFormControlFrame.h b/layout/forms/nsFormControlFrame.h index 4c57b2b77a6c..b3f2bece0c95 100644 --- a/layout/forms/nsFormControlFrame.h +++ b/layout/forms/nsFormControlFrame.h @@ -35,7 +35,7 @@ public: } NS_DECL_QUERYFRAME - NS_DECL_FRAMEARENA_HELPERS + NS_DECL_ABSTRACT_FRAME(nsFormControlFrame) /** * Respond to a gui event diff --git a/layout/generic/nsContainerFrame.cpp b/layout/generic/nsContainerFrame.cpp index 930345002a93..2dcba6521cd9 100644 --- a/layout/generic/nsContainerFrame.cpp +++ b/layout/generic/nsContainerFrame.cpp @@ -42,8 +42,6 @@ using namespace mozilla; using namespace mozilla::dom; using namespace mozilla::layout; -NS_IMPL_FRAMEARENA_HELPERS(nsContainerFrame) - nsContainerFrame::~nsContainerFrame() { } diff --git a/layout/generic/nsContainerFrame.h b/layout/generic/nsContainerFrame.h index 54f45daad2fa..6438d3476526 100644 --- a/layout/generic/nsContainerFrame.h +++ b/layout/generic/nsContainerFrame.h @@ -44,7 +44,7 @@ class FramePropertyTable; class nsContainerFrame : public nsSplittableFrame { public: - NS_DECL_FRAMEARENA_HELPERS + NS_DECL_ABSTRACT_FRAME(nsContainerFrame) NS_DECL_QUERYFRAME_TARGET(nsContainerFrame) NS_DECL_QUERYFRAME diff --git a/layout/generic/nsFrame.h b/layout/generic/nsFrame.h index 57bc6f564d12..1add4e8687f3 100644 --- a/layout/generic/nsFrame.h +++ b/layout/generic/nsFrame.h @@ -78,11 +78,14 @@ #define NS_FRAME_TRACE_REFLOW_OUT(_method, _status) #endif -// Frame allocation boilerplate macros. Every subclass of nsFrame -// must define its own operator new and GetFrameId. If they do -// not, the per-frame recycler lists in nsPresArena will not work -// correctly, with potentially catastrophic consequences (not enough -// memory is allocated for a frame object). +// Frame allocation boilerplate macros. Every subclass of nsFrame must +// either use NS_{DECL,IMPL}_FRAMEARENA_HELPERS pair for allocating +// memory correctly, or use NS_DECL_ABSTRACT_FRAME to declare a frame +// class abstract and stop it from being instantiated. If a frame class +// without its own operator new and GetFrameId gets instantiated, the +// per-frame recycler lists in nsPresArena will not work correctly, +// with potentially catastrophic consequences (not enough memory is +// allocated for a frame object). #define NS_DECL_FRAMEARENA_HELPERS \ void* operator new(size_t, nsIPresShell*) MOZ_MUST_OVERRIDE; \ @@ -94,6 +97,10 @@ nsQueryFrame::FrameIID class::GetFrameId() \ { return nsQueryFrame::class##_id; } +#define NS_DECL_ABSTRACT_FRAME(class) \ + void* operator new(size_t, nsIPresShell*) MOZ_MUST_OVERRIDE = delete; \ + virtual nsQueryFrame::FrameIID GetFrameId() override MOZ_MUST_OVERRIDE = 0; + //---------------------------------------------------------------------- struct nsBoxLayoutMetrics; diff --git a/layout/generic/nsLeafFrame.cpp b/layout/generic/nsLeafFrame.cpp index bd30b5cb8425..1650852054ea 100644 --- a/layout/generic/nsLeafFrame.cpp +++ b/layout/generic/nsLeafFrame.cpp @@ -14,8 +14,6 @@ nsLeafFrame::~nsLeafFrame() { } -NS_IMPL_FRAMEARENA_HELPERS(nsLeafFrame) - /* virtual */ nscoord nsLeafFrame::GetMinISize(nsRenderingContext *aRenderingContext) { diff --git a/layout/generic/nsLeafFrame.h b/layout/generic/nsLeafFrame.h index 5c8b69088b70..57606b9e0ea6 100644 --- a/layout/generic/nsLeafFrame.h +++ b/layout/generic/nsLeafFrame.h @@ -20,7 +20,7 @@ */ class nsLeafFrame : public nsFrame { public: - NS_DECL_FRAMEARENA_HELPERS + NS_DECL_ABSTRACT_FRAME(nsLeafFrame) // nsIFrame replacements virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder, diff --git a/layout/generic/nsRubyContentFrame.cpp b/layout/generic/nsRubyContentFrame.cpp index 12f9bc9c7777..ce806553c011 100644 --- a/layout/generic/nsRubyContentFrame.cpp +++ b/layout/generic/nsRubyContentFrame.cpp @@ -15,13 +15,6 @@ using namespace mozilla; //---------------------------------------------------------------------- -// Frame class boilerplate -// ======================= - -NS_IMPL_FRAMEARENA_HELPERS(nsRubyContentFrame) - -//---------------------------------------------------------------------- - // nsRubyContentFrame Method Implementations // ====================================== diff --git a/layout/generic/nsRubyContentFrame.h b/layout/generic/nsRubyContentFrame.h index 1a2b47e7ecd9..b33e6b0993b6 100644 --- a/layout/generic/nsRubyContentFrame.h +++ b/layout/generic/nsRubyContentFrame.h @@ -16,7 +16,7 @@ typedef nsInlineFrame nsRubyContentFrameSuper; class nsRubyContentFrame : public nsRubyContentFrameSuper { public: - NS_DECL_FRAMEARENA_HELPERS + NS_DECL_ABSTRACT_FRAME(nsRubyContentFrame) // nsIFrame overrides virtual bool IsFrameOfType(uint32_t aFlags) const override; diff --git a/layout/generic/nsSplittableFrame.cpp b/layout/generic/nsSplittableFrame.cpp index 7e018322b94a..eb2331d34695 100644 --- a/layout/generic/nsSplittableFrame.cpp +++ b/layout/generic/nsSplittableFrame.cpp @@ -14,8 +14,6 @@ using namespace mozilla; -NS_IMPL_FRAMEARENA_HELPERS(nsSplittableFrame) - void nsSplittableFrame::Init(nsIContent* aContent, nsContainerFrame* aParent, diff --git a/layout/generic/nsSplittableFrame.h b/layout/generic/nsSplittableFrame.h index 634f05eccb6a..9a12a33e840c 100644 --- a/layout/generic/nsSplittableFrame.h +++ b/layout/generic/nsSplittableFrame.h @@ -18,7 +18,7 @@ class nsSplittableFrame : public nsFrame { public: - NS_DECL_FRAMEARENA_HELPERS + NS_DECL_ABSTRACT_FRAME(nsSplittableFrame) virtual void Init(nsIContent* aContent, nsContainerFrame* aParent, diff --git a/layout/mathml/nsMathMLContainerFrame.cpp b/layout/mathml/nsMathMLContainerFrame.cpp index 62d8a6f3b677..7a4c7fa13a07 100644 --- a/layout/mathml/nsMathMLContainerFrame.cpp +++ b/layout/mathml/nsMathMLContainerFrame.cpp @@ -30,8 +30,6 @@ using namespace mozilla::gfx; // nsMathMLContainerFrame implementation // -NS_IMPL_FRAMEARENA_HELPERS(nsMathMLContainerFrame) - NS_QUERYFRAME_HEAD(nsMathMLContainerFrame) NS_QUERYFRAME_ENTRY(nsIMathMLFrame) NS_QUERYFRAME_ENTRY(nsMathMLContainerFrame) diff --git a/layout/mathml/nsMathMLContainerFrame.h b/layout/mathml/nsMathMLContainerFrame.h index 9f2383938caf..fc11071f57a9 100644 --- a/layout/mathml/nsMathMLContainerFrame.h +++ b/layout/mathml/nsMathMLContainerFrame.h @@ -38,7 +38,7 @@ public: NS_DECL_QUERYFRAME_TARGET(nsMathMLContainerFrame) NS_DECL_QUERYFRAME - NS_DECL_FRAMEARENA_HELPERS + NS_DECL_ABSTRACT_FRAME(nsMathMLContainerFrame) // -------------------------------------------------------------------------- // Overloaded nsMathMLFrame methods -- see documentation in nsIMathMLFrame.h diff --git a/layout/svg/moz.build b/layout/svg/moz.build index 5fba8a3c8226..a59e8f0e2bbb 100644 --- a/layout/svg/moz.build +++ b/layout/svg/moz.build @@ -36,7 +36,6 @@ UNIFIED_SOURCES += [ 'nsSVGMarkerFrame.cpp', 'nsSVGMaskFrame.cpp', 'nsSVGOuterSVGFrame.cpp', - 'nsSVGPaintServerFrame.cpp', 'nsSVGPathGeometryFrame.cpp', 'nsSVGPatternFrame.cpp', 'nsSVGStopFrame.cpp', diff --git a/layout/svg/nsSVGGradientFrame.cpp b/layout/svg/nsSVGGradientFrame.cpp index e2ea80835c27..8de01d5a50b1 100644 --- a/layout/svg/nsSVGGradientFrame.cpp +++ b/layout/svg/nsSVGGradientFrame.cpp @@ -55,8 +55,6 @@ nsSVGGradientFrame::nsSVGGradientFrame(nsStyleContext* aContext) : { } -NS_IMPL_FRAMEARENA_HELPERS(nsSVGGradientFrame) - //---------------------------------------------------------------------- // nsIFrame methods: diff --git a/layout/svg/nsSVGGradientFrame.h b/layout/svg/nsSVGGradientFrame.h index 591b83089b1c..8e6eba9766c9 100644 --- a/layout/svg/nsSVGGradientFrame.h +++ b/layout/svg/nsSVGGradientFrame.h @@ -45,7 +45,7 @@ protected: explicit nsSVGGradientFrame(nsStyleContext* aContext); public: - NS_DECL_FRAMEARENA_HELPERS + NS_DECL_ABSTRACT_FRAME(nsSVGGradientFrame) // nsSVGPaintServerFrame methods: virtual already_AddRefed diff --git a/layout/svg/nsSVGPaintServerFrame.cpp b/layout/svg/nsSVGPaintServerFrame.cpp deleted file mode 100644 index b065c2864bf1..000000000000 --- a/layout/svg/nsSVGPaintServerFrame.cpp +++ /dev/null @@ -1,13 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -// Main header first: -#include "nsSVGPaintServerFrame.h" - -// Keep others in (case-insensitive) order: -#include "gfxContext.h" -#include "nsSVGElement.h" - -NS_IMPL_FRAMEARENA_HELPERS(nsSVGPaintServerFrame) diff --git a/layout/svg/nsSVGPaintServerFrame.h b/layout/svg/nsSVGPaintServerFrame.h index bf0006b3bcce..caf6a82164f3 100644 --- a/layout/svg/nsSVGPaintServerFrame.h +++ b/layout/svg/nsSVGPaintServerFrame.h @@ -40,7 +40,7 @@ protected: } public: - NS_DECL_FRAMEARENA_HELPERS + NS_DECL_ABSTRACT_FRAME(nsSVGPaintServerFrame) /** * Constructs a gfxPattern of the paint server rendering.