Bug 1436279 - Remove unneeded 'friend class' statements - r?mattwoodrow draft
authorGerald Squelart <gsquelart@mozilla.com>
Wed, 13 Dec 2017 09:21:14 -0600
changeset 751955 42e754e6fecc2032bea2855ad935dde5e00fa06d
parent 751954 098b05545c01b9d4273aab129fe9211136295869
push id98104
push usergsquelart@mozilla.com
push dateWed, 07 Feb 2018 07:44:14 +0000
reviewersmattwoodrow
bugs1436279
milestone60.0a1
Bug 1436279 - Remove unneeded 'friend class' statements - r?mattwoodrow Inner classes already have the same visibility as member function of the outer class, so there's no need to explicitly make them friends. MozReview-Commit-ID: 3Aovsj0JO2S
layout/painting/DisplayListClipState.h
layout/painting/nsDisplayList.h
--- a/layout/painting/DisplayListClipState.h
+++ b/layout/painting/DisplayListClipState.h
@@ -47,23 +47,20 @@ public:
   }
 
   const ActiveScrolledRoot* GetContentClipASR() const
   {
     return mClipChainContentDescendants ? mClipChainContentDescendants->mASR : nullptr;
   }
 
   class AutoSaveRestore;
-  friend class AutoSaveRestore;
 
   class AutoClipContainingBlockDescendantsToContentBox;
-  friend class AutoClipContainingBlockDescendantsToContentBox;
 
   class AutoClipMultiple;
-  friend class AutoClipMultiple;
 
   enum {
     ASSUME_DRAWING_RESTRICTED_TO_CONTENT_RECT = 0x01
   };
 
 private:
 
   void Clear()
--- a/layout/painting/nsDisplayList.h
+++ b/layout/painting/nsDisplayList.h
@@ -1019,18 +1019,16 @@ public:
   nsDisplayItem* MergeItems(nsTArray<nsDisplayItem*>& aMergedItems);
 
   /**
    * A helper class to temporarily set the value of
    * mIsAtRootOfPseudoStackingContext, and temporarily
    * set mCurrentFrame and related state. Also temporarily sets mDirtyRect.
    * aDirtyRect is relative to aForChild.
    */
-  class AutoBuildingDisplayList;
-  friend class AutoBuildingDisplayList;
   class AutoBuildingDisplayList {
   public:
     AutoBuildingDisplayList(nsDisplayListBuilder* aBuilder,
                             nsIFrame* aForChild,
                             const nsRect& aVisibleRect,
                             const nsRect& aDirtyRect,
                             bool aIsRoot)
       : mBuilder(aBuilder),
@@ -1112,18 +1110,16 @@ public:
     bool                  mPrevAncestorHasApzAwareEventHandler;
     bool                  mPrevBuildingInvisibleItems;
     bool                  mPrevInInvalidSubtree;
   };
 
   /**
    * A helper class to temporarily set the value of mInTransform.
    */
-  class AutoInTransformSetter;
-  friend class AutoInTransformSetter;
   class AutoInTransformSetter {
   public:
     AutoInTransformSetter(nsDisplayListBuilder* aBuilder, bool aInTransform)
       : mBuilder(aBuilder), mOldValue(aBuilder->mInTransform) {
       aBuilder->mInTransform = aInTransform;
     }
     ~AutoInTransformSetter() {
       mBuilder->mInTransform = mOldValue;
@@ -1131,18 +1127,16 @@ public:
   private:
     nsDisplayListBuilder* mBuilder;
     bool                  mOldValue;
   };
 
   /**
    * A helper class to temporarily set the value of mFilterASR.
    */
-  class AutoFilterASRSetter;
-  friend class AutoFilterASRSetter;
   class AutoFilterASRSetter {
   public:
     AutoFilterASRSetter(nsDisplayListBuilder* aBuilder, bool aUsingFilter)
       : mBuilder(aBuilder), mOldValue(aBuilder->mFilterASR)
     {
       if (!aBuilder->mFilterASR && aUsingFilter) {
         aBuilder->mFilterASR = aBuilder->CurrentActiveScrolledRoot();
       }
@@ -1150,18 +1144,16 @@ public:
     ~AutoFilterASRSetter() {
       mBuilder->mFilterASR = mOldValue;
     }
   private:
     nsDisplayListBuilder* mBuilder;
     const ActiveScrolledRoot* mOldValue;
   };
 
-  class AutoSaveRestorePerspectiveIndex;
-  friend class AutoSaveRestorePerspectiveIndex;
   class AutoSaveRestorePerspectiveIndex {
   public:
     AutoSaveRestorePerspectiveIndex(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame)
       : mBuilder(nullptr)
     {
       if (aFrame->ChildrenHavePerspective()) {
         mBuilder = aBuilder;
         mCachedItemIndex = aBuilder->mPerspectiveItemIndex;
@@ -1179,18 +1171,16 @@ public:
   private:
     nsDisplayListBuilder* mBuilder;
     uint32_t mCachedItemIndex;
   };
 
   /**
    * A helper class to temporarily set the value of mCurrentScrollParentId.
    */
-  class AutoCurrentScrollParentIdSetter;
-  friend class AutoCurrentScrollParentIdSetter;
   class AutoCurrentScrollParentIdSetter {
   public:
     AutoCurrentScrollParentIdSetter(nsDisplayListBuilder* aBuilder, ViewID aScrollId)
       : mBuilder(aBuilder)
       , mOldValue(aBuilder->mCurrentScrollParentId)
       , mOldForceLayer(aBuilder->mForceLayerForScrollParent) {
       // If this AutoCurrentScrollParentIdSetter has the same scrollId as the
       // previous one on the stack, then that means the scrollframe that
@@ -1225,18 +1215,16 @@ public:
     bool                  mOldForceLayer;
     bool                  mCanBeScrollParent;
   };
 
   /**
    * Used to update the current active scrolled root on the display list
    * builder, and to create new active scrolled roots.
    */
-  class AutoCurrentActiveScrolledRootSetter;
-  friend class AutoCurrentActiveScrolledRootSetter;
   class AutoCurrentActiveScrolledRootSetter {
   public:
     explicit AutoCurrentActiveScrolledRootSetter(nsDisplayListBuilder* aBuilder)
       : mBuilder(aBuilder)
       , mSavedActiveScrolledRoot(aBuilder->mCurrentActiveScrolledRoot)
       , mContentClipASR(aBuilder->ClipState().GetContentClipASR())
       , mDescendantsStartIndex(aBuilder->mActiveScrolledRoots.Length())
       , mUsed(false)
@@ -1291,18 +1279,16 @@ public:
 
   /**
    * Keeps track of the innermost ASR that can be used as the ASR for a
    * container item that wraps all items that were created while this
    * object was on the stack.
    * The rule is: all child items of the container item need to have
    * clipped bounds with respect to the container ASR.
    */
-  class AutoContainerASRTracker;
-  friend class AutoContainerASRTracker;
   class AutoContainerASRTracker {
   public:
     explicit AutoContainerASRTracker(nsDisplayListBuilder* aBuilder)
       : mBuilder(aBuilder)
       , mSavedContainerASR(aBuilder->mCurrentContainerASR)
     {
       mBuilder->mCurrentContainerASR = ActiveScrolledRoot::PickDescendant(
         mBuilder->ClipState().GetContentClipASR(),
@@ -1324,18 +1310,16 @@ public:
     nsDisplayListBuilder* mBuilder;
     const ActiveScrolledRoot* mSavedContainerASR;
   };
 
   /**
    * A helper class to temporarily set the value of mCurrentScrollbarTarget
    * and mCurrentScrollbarFlags.
    */
-  class AutoCurrentScrollbarInfoSetter;
-  friend class AutoCurrentScrollbarInfoSetter;
   class AutoCurrentScrollbarInfoSetter {
   public:
     AutoCurrentScrollbarInfoSetter(nsDisplayListBuilder* aBuilder, ViewID aScrollTargetID,
                                    nsDisplayOwnLayerFlags aScrollbarFlags, bool aWillHaveLayer)
      : mBuilder(aBuilder) {
       aBuilder->mIsBuildingScrollbar = true;
       aBuilder->mCurrentScrollbarTarget = aScrollTargetID;
       aBuilder->mCurrentScrollbarFlags = aScrollbarFlags;
@@ -1356,18 +1340,16 @@ public:
    * A helper class to track current effective transform for items.
    *
    * For frames that is Combines3DTransformWithAncestors(), we need to
    * apply all transforms of ancestors on the same preserves3D chain
    * on the bounds of current frame to the coordination of the 3D
    * context root.  The 3D context root computes it's bounds from
    * these transformed bounds.
    */
-  class AutoAccumulateTransform;
-  friend class AutoAccumulateTransform;
   class AutoAccumulateTransform {
   public:
     typedef mozilla::gfx::Matrix4x4 Matrix4x4;
 
     explicit AutoAccumulateTransform(nsDisplayListBuilder* aBuilder)
       : mBuilder(aBuilder)
       , mSavedTransform(aBuilder->mPreserves3DCtx.mAccumulatedTransform) {}
 
@@ -1397,18 +1379,16 @@ public:
    * A helper class to collect bounds rects of descendants.
    *
    * For a 3D context root, it's bounds is computed from the bounds of
    * descendants.  If we transform bounds frame by frame applying
    * transforms, the bounds may turn to empty for any singular
    * transform on the path, but it is not empty for the accumulated
    * transform.
    */
-  class AutoAccumulateRect;
-  friend class AutoAccumulateRect;
   class AutoAccumulateRect {
   public:
     explicit AutoAccumulateRect(nsDisplayListBuilder* aBuilder)
       : mBuilder(aBuilder)
       , mSavedRect(aBuilder->mPreserves3DCtx.mAccumulatedRect) {
       aBuilder->mPreserves3DCtx.mAccumulatedRect = nsRect();
       aBuilder->mPreserves3DCtx.mAccumulatedRectLevels++;
     }
@@ -1681,18 +1661,16 @@ public:
    * A helper class to install/restore nsDisplayListBuilder::mPreserves3DCtx.
    *
    * mPreserves3DCtx is used by class AutoAccumulateTransform &
    * AutoAccumulateRect to passing data between frames in the 3D
    * context.  If a frame create a new 3D context, it should restore
    * the value of mPreserves3DCtx before returning back to the parent.
    * This class do it for the users.
    */
-  class AutoPreserves3DContext;
-  friend class AutoPreserves3DContext;
   class AutoPreserves3DContext {
   public:
     explicit AutoPreserves3DContext(nsDisplayListBuilder* aBuilder)
       : mBuilder(aBuilder)
       , mSavedCtx(aBuilder->mPreserves3DCtx) {}
     ~AutoPreserves3DContext() {
       mBuilder->mPreserves3DCtx = mSavedCtx;
     }