Bug 1448535 part 2 - Remove arena-related code from style structs. r?emilio draft
authorXidorn Quan <me@upsuper.org>
Mon, 26 Mar 2018 11:55:14 +1100
changeset 772911 f08304fc5116b30936b0a9cf023112c53ae2b5b8
parent 772910 e2cbe41afd02b6321e2dd6d7e36f7ad1be59fdf2
child 772912 ae97a4674ae1633a068e8e5eb596cfd79c6df035
push id104086
push userxquan@mozilla.com
push dateTue, 27 Mar 2018 05:15:17 +0000
reviewersemilio
bugs1448535
milestone61.0a1
Bug 1448535 part 2 - Remove arena-related code from style structs. r?emilio MozReview-Commit-ID: LlmauyL3goU
layout/base/nsPresArena.cpp
layout/base/nsPresArenaObjectList.h
layout/style/nsStyleStruct.cpp
layout/style/nsStyleStruct.h
--- a/layout/base/nsPresArena.cpp
+++ b/layout/base/nsPresArena.cpp
@@ -204,25 +204,16 @@ nsPresArena::AddSizeOfExcludingThis(nsWi
         aSizes.mArenaSizes.mLineBoxes += totalSize;
         break;
       case eArenaObjectID_nsRuleNode:
         aSizes.mArenaSizes.mRuleNodes += totalSize;
         break;
       case eArenaObjectID_GeckoComputedStyle:
         aSizes.mArenaSizes.mComputedStyles += totalSize;
         break;
-#define STYLE_STRUCT(name_) \
-      case eArenaObjectID_nsStyle##name_: \
-        aSizes.mArenaSizes.mGeckoStyleSizes.NS_STYLE_SIZES_FIELD(name_) += \
-          totalSize; \
-        break;
-#define STYLE_STRUCT_LIST_IGNORE_VARIABLES
-#include "nsStyleStructList.h"
-#undef STYLE_STRUCT
-#undef STYLE_STRUCT_LIST_IGNORE_VARIABLES
       default:
         continue;
     }
 
     totalSizeInFreeLists += totalSize;
   }
 
   aSizes.mLayoutPresShellSize += mallocSize - totalSizeInFreeLists;
--- a/layout/base/nsPresArenaObjectList.h
+++ b/layout/base/nsPresArenaObjectList.h
@@ -2,20 +2,16 @@
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* 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/. */
 
 /* a list of all types that can be allocated in an nsPresArena, for
    preprocessing */
 
-#ifdef STYLE_STRUCT
-#error Sorry nsPresArenaObjectList.h needs to use STYLE_STRUCT!
-#endif
-
 // These are objects that can be stored in the pres arena
 
 PRES_ARENA_OBJECT(GeckoComputedStyle)
 
 PRES_ARENA_OBJECT(nsLineBox)
 PRES_ARENA_OBJECT(nsRuleNode)
 PRES_ARENA_OBJECT(DisplayItemData)
 PRES_ARENA_OBJECT(nsInheritedStyleData)
@@ -24,13 +20,8 @@ PRES_ARENA_OBJECT(nsConditionalResetStyl
 PRES_ARENA_OBJECT(nsConditionalResetStyleDataEntry)
 PRES_ARENA_OBJECT(nsFrameList)
 PRES_ARENA_OBJECT(CustomCounterStyle)
 PRES_ARENA_OBJECT(DependentBuiltinCounterStyle)
 PRES_ARENA_OBJECT(nsCallbackEventRequest)
 PRES_ARENA_OBJECT(nsIntervalSet_Interval)
 PRES_ARENA_OBJECT(CellData)
 PRES_ARENA_OBJECT(BCCellData)
-
-#define STYLE_STRUCT(name_) \
-  PRES_ARENA_OBJECT(nsStyle##name_)
-#include "nsStyleStructList.h"
-#undef STYLE_STRUCT
--- a/layout/style/nsStyleStruct.cpp
+++ b/layout/style/nsStyleStruct.cpp
@@ -163,23 +163,16 @@ nsStyleFont::nsStyleFont(const nsPresCon
   if (minimumFontSize > 0 && !aContext->IsChrome()) {
     mFont.size = std::max(mSize, minimumFontSize);
   } else {
     mFont.size = mSize;
   }
 }
 
 void
-nsStyleFont::Destroy(nsPresContext* aContext) {
-  this->~nsStyleFont();
-  aContext->PresShell()->
-    FreeByObjectID(eArenaObjectID_nsStyleFont, this);
-}
-
-void
 nsStyleFont::EnableZoom(nsPresContext* aContext, bool aEnable)
 {
   if (mAllowZoom == aEnable) {
     return;
   }
   mAllowZoom = aEnable;
   if (mAllowZoom) {
     mSize = nsStyleFont::ZoomText(aContext, mSize);
@@ -272,23 +265,16 @@ nsStyleMargin::nsStyleMargin(const nsPre
 }
 
 nsStyleMargin::nsStyleMargin(const nsStyleMargin& aSrc)
   : mMargin(aSrc.mMargin)
 {
   MOZ_COUNT_CTOR(nsStyleMargin);
 }
 
-void
-nsStyleMargin::Destroy(nsPresContext* aContext) {
-  this->~nsStyleMargin();
-  aContext->PresShell()->
-    FreeByObjectID(eArenaObjectID_nsStyleMargin, this);
-}
-
 nsChangeHint
 nsStyleMargin::CalcDifference(const nsStyleMargin& aNewData) const
 {
   if (mMargin == aNewData.mMargin) {
     return nsChangeHint(0);
   }
   // Margin differences can't affect descendant intrinsic sizes and
   // don't need to force children to reflow.
@@ -307,23 +293,16 @@ nsStylePadding::nsStylePadding(const nsP
 }
 
 nsStylePadding::nsStylePadding(const nsStylePadding& aSrc)
   : mPadding(aSrc.mPadding)
 {
   MOZ_COUNT_CTOR(nsStylePadding);
 }
 
-void
-nsStylePadding::Destroy(nsPresContext* aContext) {
-  this->~nsStylePadding();
-  aContext->PresShell()->
-    FreeByObjectID(eArenaObjectID_nsStylePadding, this);
-}
-
 nsChangeHint
 nsStylePadding::CalcDifference(const nsStylePadding& aNewData) const
 {
   if (mPadding == aNewData.mPadding) {
     return nsChangeHint(0);
   }
   // Padding differences can't affect descendant intrinsic sizes, but do need
   // to force children to reflow so that we can reposition them, since their
@@ -424,24 +403,16 @@ nsStyleBorder::GetImageOutset() const
         value = 0;
         break;
     }
     outset.Side(s) = value;
   }
   return outset;
 }
 
-void
-nsStyleBorder::Destroy(nsPresContext* aContext)
-{
-  this->~nsStyleBorder();
-  aContext->PresShell()->
-    FreeByObjectID(eArenaObjectID_nsStyleBorder, this);
-}
-
 nsChangeHint
 nsStyleBorder::CalcDifference(const nsStyleBorder& aNewData) const
 {
   // FIXME: XXXbz: As in nsStylePadding::CalcDifference, many of these
   // differences should not need to clear descendant intrinsics.
   // FIXME: It would be good to return a weaker hint for the
   // GetComputedBorder() differences (and perhaps others) that doesn't
   // force reflow of all descendants, but the hint would need to force
@@ -1289,24 +1260,16 @@ nsStyleSVGReset::nsStyleSVGReset(const n
   , mDominantBaseline(aSource.mDominantBaseline)
   , mVectorEffect(aSource.mVectorEffect)
   , mMaskType(aSource.mMaskType)
 {
   MOZ_COUNT_CTOR(nsStyleSVGReset);
 }
 
 void
-nsStyleSVGReset::Destroy(nsPresContext* aContext)
-{
-  this->~nsStyleSVGReset();
-  aContext->PresShell()->
-    FreeByObjectID(mozilla::eArenaObjectID_nsStyleSVGReset, this);
-}
-
-void
 nsStyleSVGReset::FinishStyle(nsPresContext* aPresContext, const nsStyleSVGReset* aOldStyle)
 {
   MOZ_ASSERT(NS_IsMainThread());
   MOZ_ASSERT(aPresContext->StyleSet()->IsServo());
 
   NS_FOR_VISIBLE_IMAGE_LAYERS_BACK_TO_FRONT(i, mMask) {
     nsStyleImage& image = mMask.mLayers[i].mImage;
     if (image.GetType() == eStyleImageType_Image) {
@@ -3356,24 +3319,16 @@ nsStyleBackground::nsStyleBackground(con
 }
 
 nsStyleBackground::~nsStyleBackground()
 {
   MOZ_COUNT_DTOR(nsStyleBackground);
 }
 
 void
-nsStyleBackground::Destroy(nsPresContext* aContext)
-{
-  this->~nsStyleBackground();
-  aContext->PresShell()->
-    FreeByObjectID(eArenaObjectID_nsStyleBackground, this);
-}
-
-void
 nsStyleBackground::FinishStyle(
   nsPresContext* aPresContext, const nsStyleBackground* aOldStyle)
 {
   MOZ_ASSERT(NS_IsMainThread());
   MOZ_ASSERT(aPresContext->StyleSet()->IsServo());
 
   mImage.ResolveImages(aPresContext, aOldStyle ? &aOldStyle->mImage : nullptr);
 }
@@ -4276,23 +4231,16 @@ nsStyleContent::nsStyleContent(const nsP
 }
 
 nsStyleContent::~nsStyleContent()
 {
   MOZ_COUNT_DTOR(nsStyleContent);
 }
 
 void
-nsStyleContent::Destroy(nsPresContext* aContext)
-{
-  this->~nsStyleContent();
-  aContext->PresShell()->FreeByObjectID(eArenaObjectID_nsStyleContent, this);
-}
-
-void
 nsStyleContent::FinishStyle(nsPresContext* aPresContext, const nsStyleContent* aOldStyle)
 {
   for (size_t i = 0; i < mContents.Length(); ++i) {
     const nsStyleContentData* oldData =
       (aOldStyle && aOldStyle->mContents.Length() > i)
       ? &aOldStyle->mContents[i]
       : nullptr;
     mContents[i].Resolve(aPresContext, oldData);
--- a/layout/style/nsStyleStruct.h
+++ b/layout/style/nsStyleStruct.h
@@ -7,17 +7,16 @@
 /*
  * structs that contain the data provided by ComputedStyle, the
  * internal API for computed style data for an element
  */
 
 #ifndef nsStyleStruct_h___
 #define nsStyleStruct_h___
 
-#include "mozilla/ArenaObjectID.h"
 #include "mozilla/Attributes.h"
 #include "mozilla/Maybe.h"
 #include "mozilla/SheetType.h"
 #include "mozilla/StaticPtr.h"
 #include "mozilla/StyleComplexColor.h"
 #include "mozilla/UniquePtr.h"
 #include "nsColor.h"
 #include "nsCoord.h"
@@ -128,17 +127,16 @@ struct Position {
   }
   bool operator!=(const Position& aOther) const {
     return !(*this == aOther);
   }
 };
 
 } // namespace mozilla
 
-// The lifetime of these objects is managed by the presshell's arena.
 struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleFont
 {
   nsStyleFont(const nsFont& aFont, const nsPresContext* aContext);
   nsStyleFont(const nsStyleFont& aStyleFont);
   explicit nsStyleFont(const nsPresContext* aContext);
   ~nsStyleFont() {
     MOZ_COUNT_DTOR(nsStyleFont);
   }
@@ -156,23 +154,16 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsSt
   /**
    * Return aSize divided by the current text zoom factor (in aPresContext).
    * aSize is allowed to be negative, but the caller is expected to deal with
    * negative results.  The result is clamped to nscoord_MIN .. nscoord_MAX.
    */
   static nscoord UnZoomText(nsPresContext* aPresContext, nscoord aSize);
   static already_AddRefed<nsAtom> GetLanguage(const nsPresContext* aPresContext);
 
-  void* operator new(size_t sz, nsStyleFont* aSelf) { return aSelf; }
-  void* operator new(size_t sz, nsPresContext* aContext) {
-    return aContext->PresShell()->
-      AllocateByObjectID(mozilla::eArenaObjectID_nsStyleFont, sz);
-  }
-  void Destroy(nsPresContext* aContext);
-
   void EnableZoom(nsPresContext* aContext, bool aEnable);
 
   nsFont  mFont;        // [inherited]
   nscoord mSize;        // [inherited] Our "computed size". Can be different
                         // from mFont.size which is our "actual size" and is
                         // enforced to be >= the user's preferred min-size.
                         // mFont.size should be used for display purposes
                         // while mSize is the value to return in
@@ -579,27 +570,16 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsSt
 
   nscolor CalcComplexColor(const mozilla::StyleComplexColor& aColor) const {
     return mozilla::LinearBlendColors(aColor.mColor, mColor,
                                       aColor.mForegroundRatio);
   }
 
   nsChangeHint CalcDifference(const nsStyleColor& aNewData) const;
 
-  void* operator new(size_t sz, nsStyleColor* aSelf) { return aSelf; }
-  void* operator new(size_t sz, nsPresContext* aContext) {
-    return aContext->PresShell()->
-      AllocateByObjectID(mozilla::eArenaObjectID_nsStyleColor, sz);
-  }
-  void Destroy(nsPresContext* aContext) {
-    this->~nsStyleColor();
-    aContext->PresShell()->
-      FreeByObjectID(mozilla::eArenaObjectID_nsStyleColor, this);
-  }
-
   // Don't add ANY members to this struct!  We can achieve caching in the rule
   // tree (rather than the style tree) by letting color stay by itself! -dwh
   nscolor mColor;                 // [inherited]
 };
 
 struct nsStyleImageLayers {
   // Indices into kBackgroundLayerTable and kMaskLayerTable
   enum {
@@ -853,23 +833,16 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsSt
   ~nsStyleBackground();
 
   // Resolves and tracks the images in mImage.  Only called with a Servo-backed
   // style system, where those images must be resolved later than the OMT
   // nsStyleBackground constructor call.
   void FinishStyle(nsPresContext*, const nsStyleBackground*);
   const static bool kHasFinishStyle = true;
 
-  void* operator new(size_t sz, nsStyleBackground* aSelf) { return aSelf; }
-  void* operator new(size_t sz, nsPresContext* aContext) {
-    return aContext->PresShell()->
-      AllocateByObjectID(mozilla::eArenaObjectID_nsStyleBackground, sz);
-  }
-  void Destroy(nsPresContext* aContext);
-
   nsChangeHint CalcDifference(const nsStyleBackground& aNewData) const;
 
   // Return the background color as nscolor.
   nscolor BackgroundColor(const nsIFrame* aFrame) const;
   nscolor BackgroundColor(mozilla::ComputedStyle* aStyle) const;
 
   // True if this background is completely transparent.
   bool IsTransparent(const nsIFrame* aFrame) const;
@@ -896,23 +869,16 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsSt
   explicit nsStyleMargin(const nsPresContext* aContext);
   nsStyleMargin(const nsStyleMargin& aMargin);
   ~nsStyleMargin() {
     MOZ_COUNT_DTOR(nsStyleMargin);
   }
   void FinishStyle(nsPresContext*, const nsStyleMargin*) {}
   const static bool kHasFinishStyle = false;
 
-  void* operator new(size_t sz, nsStyleMargin* aSelf) { return aSelf; }
-  void* operator new(size_t sz, nsPresContext* aContext) {
-    return aContext->PresShell()->
-      AllocateByObjectID(mozilla::eArenaObjectID_nsStyleMargin, sz);
-  }
-  void Destroy(nsPresContext* aContext);
-
   nsChangeHint CalcDifference(const nsStyleMargin& aNewData) const;
 
   bool GetMargin(nsMargin& aMargin) const
   {
     if (!mMargin.ConvertsToLength()) {
       return false;
     }
 
@@ -935,23 +901,16 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsSt
   explicit nsStylePadding(const nsPresContext* aContext);
   nsStylePadding(const nsStylePadding& aPadding);
   ~nsStylePadding() {
     MOZ_COUNT_DTOR(nsStylePadding);
   }
   void FinishStyle(nsPresContext*, const nsStylePadding*) {}
   const static bool kHasFinishStyle = false;
 
-  void* operator new(size_t sz, nsStylePadding* aSelf) { return aSelf; }
-  void* operator new(size_t sz, nsPresContext* aContext) {
-    return aContext->PresShell()->
-      AllocateByObjectID(mozilla::eArenaObjectID_nsStylePadding, sz);
-  }
-  void Destroy(nsPresContext* aContext);
-
   nsChangeHint CalcDifference(const nsStylePadding& aNewData) const;
 
   nsStyleSides  mPadding;         // [reset] coord, percent, calc
 
   bool IsWidthDependent() const {
     return !mPadding.ConvertsToLength();
   }
 
@@ -1102,23 +1061,16 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsSt
   ~nsStyleBorder();
 
   // Resolves and tracks mBorderImageSource.  Only called with a Servo-backed
   // style system, where those images must be resolved later than the OMT
   // nsStyleBorder constructor call.
   void FinishStyle(nsPresContext*, const nsStyleBorder*);
   const static bool kHasFinishStyle = true;
 
-  void* operator new(size_t sz, nsStyleBorder* aSelf) { return aSelf; }
-  void* operator new(size_t sz, nsPresContext* aContext) {
-    return aContext->PresShell()->
-      AllocateByObjectID(mozilla::eArenaObjectID_nsStyleBorder, sz);
-  }
-  void Destroy(nsPresContext* aContext);
-
   nsChangeHint CalcDifference(const nsStyleBorder& aNewData) const;
 
   // Return whether aStyle is a visible style.  Invisible styles cause
   // the relevant computed border width to be 0.
   // Note that this does *not* consider the effects of 'border-image':
   // if border-style is none, but there is a loaded border image,
   // HasVisibleStyle will be false even though there *is* a border.
   bool HasVisibleStyle(mozilla::Side aSide) const
@@ -1280,27 +1232,16 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsSt
   explicit nsStyleOutline(const nsPresContext* aContext);
   nsStyleOutline(const nsStyleOutline& aOutline);
   ~nsStyleOutline() {
     MOZ_COUNT_DTOR(nsStyleOutline);
   }
   void FinishStyle(nsPresContext*, const nsStyleOutline*) {}
   const static bool kHasFinishStyle = false;
 
-  void* operator new(size_t sz, nsStyleOutline* aSelf) { return aSelf; }
-  void* operator new(size_t sz, nsPresContext* aContext) {
-    return aContext->PresShell()->
-      AllocateByObjectID(mozilla::eArenaObjectID_nsStyleOutline, sz);
-  }
-  void Destroy(nsPresContext* aContext) {
-    this->~nsStyleOutline();
-    aContext->PresShell()->
-      FreeByObjectID(mozilla::eArenaObjectID_nsStyleOutline, this);
-  }
-
   void RecalcData();
   nsChangeHint CalcDifference(const nsStyleOutline& aNewData) const;
 
   nsStyleCorners  mOutlineRadius; // [reset] coord, percent, calc
 
   // This is the specified value of outline-width, but with length values
   // computed to absolute.  mActualOutlineWidth stores the outline-width
   // value used by layout.  (We must store mOutlineWidth for the same
@@ -1352,27 +1293,16 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsSt
 {
   explicit nsStyleList(const nsPresContext* aContext);
   nsStyleList(const nsStyleList& aStyleList);
   ~nsStyleList();
 
   void FinishStyle(nsPresContext*, const nsStyleList*);
   const static bool kHasFinishStyle = true;
 
-  void* operator new(size_t sz, nsStyleList* aSelf) { return aSelf; }
-  void* operator new(size_t sz, nsPresContext* aContext) {
-    return aContext->PresShell()->
-      AllocateByObjectID(mozilla::eArenaObjectID_nsStyleList, sz);
-  }
-  void Destroy(nsPresContext* aContext) {
-    this->~nsStyleList();
-    aContext->PresShell()->
-      FreeByObjectID(mozilla::eArenaObjectID_nsStyleList, this);
-  }
-
   nsChangeHint CalcDifference(const nsStyleList& aNewData,
                               const nsStyleDisplay* aOldDisplay) const;
 
   static void Shutdown() {
     sInitialQuotes = nullptr;
     sNoneQuotes = nullptr;
   }
 
@@ -1554,27 +1484,16 @@ struct nsStyleGridTemplate
 struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStylePosition
 {
   explicit nsStylePosition(const nsPresContext* aContext);
   nsStylePosition(const nsStylePosition& aOther);
   ~nsStylePosition();
   void FinishStyle(nsPresContext*, const nsStylePosition*) {}
   const static bool kHasFinishStyle = false;
 
-  void* operator new(size_t sz, nsStylePosition* aSelf) { return aSelf; }
-  void* operator new(size_t sz, nsPresContext* aContext) {
-    return aContext->PresShell()->
-      AllocateByObjectID(mozilla::eArenaObjectID_nsStylePosition, sz);
-  }
-  void Destroy(nsPresContext* aContext) {
-    this->~nsStylePosition();
-    aContext->PresShell()->
-      FreeByObjectID(mozilla::eArenaObjectID_nsStylePosition, this);
-  }
-
   nsChangeHint CalcDifference(const nsStylePosition& aNewData,
                               const nsStyleVisibility* aOldStyleVisibility) const;
 
   /**
    * Return the used value for 'align-self' given our parent ComputedStyle
    * aParent (or null for the root).
    */
   uint8_t UsedAlignSelf(mozilla::ComputedStyle* aParent) const;
@@ -1779,27 +1698,16 @@ struct nsStyleTextOverflow
 struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleTextReset
 {
   explicit nsStyleTextReset(const nsPresContext* aContext);
   nsStyleTextReset(const nsStyleTextReset& aOther);
   ~nsStyleTextReset();
   void FinishStyle(nsPresContext*, const nsStyleTextReset*) {}
   const static bool kHasFinishStyle = false;
 
-  void* operator new(size_t sz, nsStyleTextReset* aSelf) { return aSelf; }
-  void* operator new(size_t sz, nsPresContext* aContext) {
-    return aContext->PresShell()->
-      AllocateByObjectID(mozilla::eArenaObjectID_nsStyleTextReset, sz);
-  }
-  void Destroy(nsPresContext* aContext) {
-    this->~nsStyleTextReset();
-    aContext->PresShell()->
-      FreeByObjectID(mozilla::eArenaObjectID_nsStyleTextReset, this);
-  }
-
   // Note the difference between this and
   // ComputedStyle::HasTextDecorationLines.
   bool HasTextDecorationLines() const {
     return mTextDecorationLine != NS_STYLE_TEXT_DECORATION_LINE_NONE &&
            mTextDecorationLine != NS_STYLE_TEXT_DECORATION_LINE_OVERRIDE_ALL;
   }
 
   nsChangeHint CalcDifference(const nsStyleTextReset& aNewData) const;
@@ -1817,27 +1725,16 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsSt
 struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleText
 {
   explicit nsStyleText(const nsPresContext* aContext);
   nsStyleText(const nsStyleText& aOther);
   ~nsStyleText();
   void FinishStyle(nsPresContext*, const nsStyleText*) {}
   const static bool kHasFinishStyle = false;
 
-  void* operator new(size_t sz, nsStyleText* aSelf) { return aSelf; }
-  void* operator new(size_t sz, nsPresContext* aContext) {
-    return aContext->PresShell()->
-      AllocateByObjectID(mozilla::eArenaObjectID_nsStyleText, sz);
-  }
-  void Destroy(nsPresContext* aContext) {
-    this->~nsStyleText();
-    aContext->PresShell()->
-      FreeByObjectID(mozilla::eArenaObjectID_nsStyleText, this);
-  }
-
   nsChangeHint CalcDifference(const nsStyleText& aNewData) const;
 
   uint8_t mTextAlign;                   // [inherited] see nsStyleConsts.h
   uint8_t mTextAlignLast;               // [inherited] see nsStyleConsts.h
   bool mTextAlignTrue : 1;              // [inherited] see nsStyleConsts.h
   bool mTextAlignLastTrue : 1;          // [inherited] see nsStyleConsts.h
   mozilla::StyleTextJustify mTextJustify;   // [inherited]
   uint8_t mTextTransform;               // [inherited] see nsStyleConsts.h
@@ -2037,27 +1934,16 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsSt
   explicit nsStyleVisibility(const nsPresContext* aContext);
   nsStyleVisibility(const nsStyleVisibility& aVisibility);
   ~nsStyleVisibility() {
     MOZ_COUNT_DTOR(nsStyleVisibility);
   }
   void FinishStyle(nsPresContext*, const nsStyleVisibility*) {}
   const static bool kHasFinishStyle = false;
 
-  void* operator new(size_t sz, nsStyleVisibility* aSelf) { return aSelf; }
-  void* operator new(size_t sz, nsPresContext* aContext) {
-    return aContext->PresShell()->
-      AllocateByObjectID(mozilla::eArenaObjectID_nsStyleVisibility, sz);
-  }
-  void Destroy(nsPresContext* aContext) {
-    this->~nsStyleVisibility();
-    aContext->PresShell()->
-      FreeByObjectID(mozilla::eArenaObjectID_nsStyleVisibility, this);
-  }
-
   nsChangeHint CalcDifference(const nsStyleVisibility& aNewData) const;
 
   nsStyleImageOrientation mImageOrientation;  // [inherited]
   uint8_t mDirection;                  // [inherited] see nsStyleConsts.h NS_STYLE_DIRECTION_*
   uint8_t mVisible;                    // [inherited]
   uint8_t mImageRendering;             // [inherited] see nsStyleConsts.h
   uint8_t mWritingMode;                // [inherited] see nsStyleConsts.h
   uint8_t mTextOrientation;            // [inherited] see nsStyleConsts.h
@@ -2345,27 +2231,16 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsSt
 
   explicit nsStyleDisplay(const nsPresContext* aContext);
   nsStyleDisplay(const nsStyleDisplay& aOther);
   ~nsStyleDisplay();
 
   void FinishStyle(nsPresContext*, const nsStyleDisplay*);
   const static bool kHasFinishStyle = true;
 
-  void* operator new(size_t sz, nsStyleDisplay* aSelf) { return aSelf; }
-  void* operator new(size_t sz, nsPresContext* aContext) {
-    return aContext->PresShell()->
-      AllocateByObjectID(mozilla::eArenaObjectID_nsStyleDisplay, sz);
-  }
-  void Destroy(nsPresContext* aContext) {
-    this->~nsStyleDisplay();
-    aContext->PresShell()->
-      FreeByObjectID(mozilla::eArenaObjectID_nsStyleDisplay, this);
-  }
-
   nsChangeHint CalcDifference(const nsStyleDisplay& aNewData) const;
 
   // We guarantee that if mBinding is non-null, so are mBinding->GetURI() and
   // mBinding->mOriginPrincipal.
   RefPtr<mozilla::css::URLValue> mBinding; // [reset]
   mozilla::StyleDisplay mDisplay;          // [reset] see nsStyleConsts.h StyleDisplay
   mozilla::StyleDisplay mOriginalDisplay;  // [reset] saved mDisplay for
                                            //         position:absolute/fixed
@@ -2740,52 +2615,30 @@ public:
 struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleTable
 {
   explicit nsStyleTable(const nsPresContext* aContext);
   nsStyleTable(const nsStyleTable& aOther);
   ~nsStyleTable();
   void FinishStyle(nsPresContext*, const nsStyleTable*) {}
   const static bool kHasFinishStyle = false;
 
-  void* operator new(size_t sz, nsStyleTable* aSelf) { return aSelf; }
-  void* operator new(size_t sz, nsPresContext* aContext) {
-    return aContext->PresShell()->
-      AllocateByObjectID(mozilla::eArenaObjectID_nsStyleTable, sz);
-  }
-  void Destroy(nsPresContext* aContext) {
-    this->~nsStyleTable();
-    aContext->PresShell()->
-      FreeByObjectID(mozilla::eArenaObjectID_nsStyleTable, this);
-  }
-
   nsChangeHint CalcDifference(const nsStyleTable& aNewData) const;
 
   uint8_t       mLayoutStrategy;// [reset] see nsStyleConsts.h NS_STYLE_TABLE_LAYOUT_*
   int32_t       mSpan;          // [reset] the number of columns spanned by a colgroup or col
 };
 
 struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleTableBorder
 {
   explicit nsStyleTableBorder(const nsPresContext* aContext);
   nsStyleTableBorder(const nsStyleTableBorder& aOther);
   ~nsStyleTableBorder();
   void FinishStyle(nsPresContext*, const nsStyleTableBorder*) {}
   const static bool kHasFinishStyle = false;
 
-  void* operator new(size_t sz, nsStyleTableBorder* aSelf) { return aSelf; }
-  void* operator new(size_t sz, nsPresContext* aContext) {
-    return aContext->PresShell()->
-      AllocateByObjectID(mozilla::eArenaObjectID_nsStyleTableBorder, sz);
-  }
-  void Destroy(nsPresContext* aContext) {
-    this->~nsStyleTableBorder();
-    aContext->PresShell()->
-      FreeByObjectID(mozilla::eArenaObjectID_nsStyleTableBorder, this);
-  }
-
   nsChangeHint CalcDifference(const nsStyleTableBorder& aNewData) const;
 
   nscoord       mBorderSpacingCol;// [inherited]
   nscoord       mBorderSpacingRow;// [inherited]
   uint8_t       mBorderCollapse;// [inherited]
   uint8_t       mCaptionSide;   // [inherited]
   uint8_t       mEmptyCells;    // [inherited]
 };
@@ -2941,23 +2794,16 @@ struct nsStyleCounterData
 struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleContent
 {
   explicit nsStyleContent(const nsPresContext* aContext);
   nsStyleContent(const nsStyleContent& aContent);
   ~nsStyleContent();
   void FinishStyle(nsPresContext*, const nsStyleContent*);
   const static bool kHasFinishStyle = true;
 
-  void* operator new(size_t sz, nsStyleContent* aSelf) { return aSelf; }
-  void* operator new(size_t sz, nsPresContext* aContext) {
-    return aContext->PresShell()->
-      AllocateByObjectID(mozilla::eArenaObjectID_nsStyleContent, sz);
-  }
-  void Destroy(nsPresContext* aContext);
-
   nsChangeHint CalcDifference(const nsStyleContent& aNewData) const;
 
   uint32_t ContentCount() const { return mContents.Length(); } // [reset]
 
   const nsStyleContentData& ContentAt(uint32_t aIndex) const {
     return mContents[aIndex];
   }
 
@@ -3012,27 +2858,16 @@ protected:
 struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleUIReset
 {
   explicit nsStyleUIReset(const nsPresContext* aContext);
   nsStyleUIReset(const nsStyleUIReset& aOther);
   ~nsStyleUIReset();
   void FinishStyle(nsPresContext*, const nsStyleUIReset*) {}
   const static bool kHasFinishStyle = false;
 
-  void* operator new(size_t sz, nsStyleUIReset* aSelf) { return aSelf; }
-  void* operator new(size_t sz, nsPresContext* aContext) {
-    return aContext->PresShell()->
-      AllocateByObjectID(mozilla::eArenaObjectID_nsStyleUIReset, sz);
-  }
-  void Destroy(nsPresContext* aContext) {
-    this->~nsStyleUIReset();
-    aContext->PresShell()->
-      FreeByObjectID(mozilla::eArenaObjectID_nsStyleUIReset, this);
-  }
-
   nsChangeHint CalcDifference(const nsStyleUIReset& aNewData) const;
 
   mozilla::StyleUserSelect     mUserSelect;     // [reset](selection-style)
   uint8_t mForceBrokenImageIcon; // [reset] (0 if not forcing, otherwise forcing)
   uint8_t                      mIMEMode;        // [reset]
   mozilla::StyleWindowDragging mWindowDragging; // [reset]
   uint8_t                      mWindowShadow;   // [reset]
   float                        mWindowOpacity;  // [reset]
@@ -3066,27 +2901,16 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsSt
 {
   explicit nsStyleUserInterface(const nsPresContext* aContext);
   nsStyleUserInterface(const nsStyleUserInterface& aOther);
   ~nsStyleUserInterface();
 
   void FinishStyle(nsPresContext*, const nsStyleUserInterface*);
   const static bool kHasFinishStyle = true;
 
-  void* operator new(size_t sz, nsStyleUserInterface* aSelf) { return aSelf; }
-  void* operator new(size_t sz, nsPresContext* aContext) {
-    return aContext->PresShell()->
-      AllocateByObjectID(mozilla::eArenaObjectID_nsStyleUserInterface, sz);
-  }
-  void Destroy(nsPresContext* aContext) {
-    this->~nsStyleUserInterface();
-    aContext->PresShell()->
-      FreeByObjectID(mozilla::eArenaObjectID_nsStyleUserInterface, this);
-  }
-
   nsChangeHint CalcDifference(const nsStyleUserInterface& aNewData) const;
 
   mozilla::StyleUserInput   mUserInput;       // [inherited]
   mozilla::StyleUserModify  mUserModify;      // [inherited] (modify-content)
   mozilla::StyleUserFocus   mUserFocus;       // [inherited] (auto-select)
   uint8_t                   mPointerEvents;   // [inherited] see nsStyleConsts.h
 
   uint8_t mCursor;                            // [inherited] See nsStyleConsts.h
@@ -3099,27 +2923,16 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsSt
 struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleXUL
 {
   explicit nsStyleXUL(const nsPresContext* aContext);
   nsStyleXUL(const nsStyleXUL& aSource);
   ~nsStyleXUL();
   void FinishStyle(nsPresContext*, const nsStyleXUL*) {}
   const static bool kHasFinishStyle = false;
 
-  void* operator new(size_t sz, nsStyleXUL* aSelf) { return aSelf; }
-  void* operator new(size_t sz, nsPresContext* aContext) {
-    return aContext->PresShell()->
-      AllocateByObjectID(mozilla::eArenaObjectID_nsStyleXUL, sz);
-  }
-  void Destroy(nsPresContext* aContext) {
-    this->~nsStyleXUL();
-    aContext->PresShell()->
-      FreeByObjectID(mozilla::eArenaObjectID_nsStyleXUL, this);
-  }
-
   nsChangeHint CalcDifference(const nsStyleXUL& aNewData) const;
 
   float         mBoxFlex;               // [reset] see nsStyleConsts.h
   uint32_t      mBoxOrdinal;            // [reset] see nsStyleConsts.h
   mozilla::StyleBoxAlign mBoxAlign;         // [reset]
   mozilla::StyleBoxDirection mBoxDirection; // [reset]
   mozilla::StyleBoxOrient mBoxOrient;       // [reset]
   mozilla::StyleBoxPack mBoxPack;           // [reset]
@@ -3129,27 +2942,16 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsSt
 struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleColumn
 {
   explicit nsStyleColumn(const nsPresContext* aContext);
   nsStyleColumn(const nsStyleColumn& aSource);
   ~nsStyleColumn();
   void FinishStyle(nsPresContext*, const nsStyleColumn*) {}
   const static bool kHasFinishStyle = false;
 
-  void* operator new(size_t sz, nsStyleColumn* aSelf) { return aSelf; }
-  void* operator new(size_t sz, nsPresContext* aContext) {
-    return aContext->PresShell()->
-      AllocateByObjectID(mozilla::eArenaObjectID_nsStyleColumn, sz);
-  }
-  void Destroy(nsPresContext* aContext) {
-    this->~nsStyleColumn();
-    aContext->PresShell()->
-      FreeByObjectID(mozilla::eArenaObjectID_nsStyleColumn, this);
-  }
-
   nsChangeHint CalcDifference(const nsStyleColumn& aNewData) const;
 
   /**
    * This is the maximum number of columns we can process. It's used in both
    * nsColumnSetFrame and nsRuleNode.
    */
   static const uint32_t kMaxColumnCount = 1000;
 
@@ -3264,27 +3066,16 @@ private:
 struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleSVG
 {
   explicit nsStyleSVG(const nsPresContext* aContext);
   nsStyleSVG(const nsStyleSVG& aSource);
   ~nsStyleSVG();
   void FinishStyle(nsPresContext*, const nsStyleSVG*) {}
   const static bool kHasFinishStyle = false;
 
-  void* operator new(size_t sz, nsStyleSVG* aSelf) { return aSelf; }
-  void* operator new(size_t sz, nsPresContext* aContext) {
-    return aContext->PresShell()->
-      AllocateByObjectID(mozilla::eArenaObjectID_nsStyleSVG, sz);
-  }
-  void Destroy(nsPresContext* aContext) {
-    this->~nsStyleSVG();
-    aContext->PresShell()->
-      FreeByObjectID(mozilla::eArenaObjectID_nsStyleSVG, this);
-  }
-
   nsChangeHint CalcDifference(const nsStyleSVG& aNewData) const;
 
   nsStyleSVGPaint  mFill;             // [inherited]
   nsStyleSVGPaint  mStroke;           // [inherited]
   RefPtr<mozilla::css::URLValue> mMarkerEnd;   // [inherited]
   RefPtr<mozilla::css::URLValue> mMarkerMid;   // [inherited]
   RefPtr<mozilla::css::URLValue> mMarkerStart; // [inherited]
   nsTArray<nsStyleCoord> mStrokeDasharray;  // [inherited] coord, percent, factor
@@ -3463,23 +3254,16 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsSt
   ~nsStyleSVGReset();
 
   // Resolves and tracks the images in mMask.  Only called with a Servo-backed
   // style system, where those images must be resolved later than the OMT
   // nsStyleSVGReset constructor call.
   void FinishStyle(nsPresContext*, const nsStyleSVGReset*);
   const static bool kHasFinishStyle = true;
 
-  void* operator new(size_t sz, nsStyleSVGReset* aSelf) { return aSelf; }
-  void* operator new(size_t sz, nsPresContext* aContext) {
-    return aContext->PresShell()->
-      AllocateByObjectID(mozilla::eArenaObjectID_nsStyleSVGReset, sz);
-  }
-  void Destroy(nsPresContext* aContext);
-
   nsChangeHint CalcDifference(const nsStyleSVGReset& aNewData) const;
 
   bool HasClipPath() const {
     return mClipPath.GetType() != mozilla::StyleShapeSourceType::None;
   }
 
   bool HasMask() const;
 
@@ -3506,50 +3290,28 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsSt
 {
   nsStyleVariables();
   explicit nsStyleVariables(const nsPresContext* aContext);
   nsStyleVariables(const nsStyleVariables& aSource);
   ~nsStyleVariables();
   void FinishStyle(nsPresContext*, const nsStyleVariables*) {}
   const static bool kHasFinishStyle = false;
 
-  void* operator new(size_t sz, nsStyleVariables* aSelf) { return aSelf; }
-  void* operator new(size_t sz, nsPresContext* aContext) {
-    return aContext->PresShell()->
-      AllocateByObjectID(mozilla::eArenaObjectID_nsStyleVariables, sz);
-  }
-  void Destroy(nsPresContext* aContext) {
-    this->~nsStyleVariables();
-    aContext->PresShell()->
-      FreeByObjectID(mozilla::eArenaObjectID_nsStyleVariables, this);
-  }
-
   nsChangeHint CalcDifference(const nsStyleVariables& aNewData) const;
 
 };
 
 struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleEffects
 {
   explicit nsStyleEffects(const nsPresContext* aContext);
   nsStyleEffects(const nsStyleEffects& aSource);
   ~nsStyleEffects();
   void FinishStyle(nsPresContext*, const nsStyleEffects*) {}
   const static bool kHasFinishStyle = false;
 
-  void* operator new(size_t sz, nsStyleEffects* aSelf) { return aSelf; }
-  void* operator new(size_t sz, nsPresContext* aContext) {
-    return aContext->PresShell()->
-      AllocateByObjectID(mozilla::eArenaObjectID_nsStyleEffects, sz);
-  }
-  void Destroy(nsPresContext* aContext) {
-    this->~nsStyleEffects();
-    aContext->PresShell()->
-      FreeByObjectID(mozilla::eArenaObjectID_nsStyleEffects, this);
-  }
-
   nsChangeHint CalcDifference(const nsStyleEffects& aNewData) const;
 
   bool HasFilters() const {
     return !mFilters.IsEmpty();
   }
 
   nsTArray<nsStyleFilter>  mFilters;   // [reset]
   RefPtr<nsCSSShadowArray> mBoxShadow; // [reset] nullptr for 'none'