Bug 1277129 Part 1a - Move nsHTMLReflowState and nsCSSOffsetState into mozilla namespace. r=dbaron
authorTing-Yu Lin <tlin@mozilla.com>
Thu, 21 Jul 2016 18:36:34 +0800
changeset 331125 b13f7e9f8107b2c58a22065d9b2862a5de665fba
parent 331124 efcf012e6cfc24413bea5078650e4528be361205
child 331126 999402eb1b15f1c23038d201036b2578c424fab5
push id9858
push userjlund@mozilla.com
push dateMon, 01 Aug 2016 14:37:10 +0000
treeherdermozilla-aurora@203106ef6cb6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdbaron
bugs1277129
milestone50.0a1
Bug 1277129 Part 1a - Move nsHTMLReflowState and nsCSSOffsetState into mozilla namespace. r=dbaron MozReview-Commit-ID: DJfEQRCgNo3
layout/base/nsIPercentBSizeObserver.h
layout/generic/nsAbsoluteContainingBlock.h
layout/generic/nsBlockReflowContext.h
layout/generic/nsBlockReflowState.h
layout/generic/nsFloatManager.h
layout/generic/nsFontInflationData.h
layout/generic/nsFrame.h
layout/generic/nsFrameSetFrame.h
layout/generic/nsHTMLReflowMetrics.h
layout/generic/nsHTMLReflowState.h
layout/generic/nsIFrame.h
layout/generic/nsImageFrame.h
layout/generic/nsLineLayout.h
layout/tables/nsITableLayoutStrategy.h
layout/tables/nsTableRowGroupFrame.h
layout/xul/nsBoxLayoutState.h
--- a/layout/base/nsIPercentBSizeObserver.h
+++ b/layout/base/nsIPercentBSizeObserver.h
@@ -3,29 +3,31 @@
  * 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/. */
 
 #ifndef nsIPercentBSizeObserver_h___
 #define nsIPercentBSizeObserver_h___
 
 #include "nsQueryFrame.h"
 
+namespace mozilla {
 struct nsHTMLReflowState;
+} // namespace mozilla
 
 /**
  * This interface is supported by frames that need to provide computed bsize
  * values to children during reflow which would otherwise not happen. Currently
  * only table cells support this.
  */
 class nsIPercentBSizeObserver
 {
 public:
   NS_DECL_QUERYFRAME_TARGET(nsIPercentBSizeObserver)
 
   // Notify the observer that aReflowState has no computed bsize,
   // but it has a percent bsize
-  virtual void NotifyPercentBSize(const nsHTMLReflowState& aReflowState) = 0;
+  virtual void NotifyPercentBSize(const mozilla::nsHTMLReflowState& aReflowState) = 0;
 
   // Ask the observer if it should observe aReflowState.frame
-  virtual bool NeedsToObserve(const nsHTMLReflowState& aReflowState) = 0;
+  virtual bool NeedsToObserve(const mozilla::nsHTMLReflowState& aReflowState) = 0;
 };
 
 #endif // nsIPercentBSizeObserver_h___ 
--- a/layout/generic/nsAbsoluteContainingBlock.h
+++ b/layout/generic/nsAbsoluteContainingBlock.h
@@ -11,17 +11,16 @@
 #ifndef nsAbsoluteContainingBlock_h___
 #define nsAbsoluteContainingBlock_h___
 
 #include "nsFrameList.h"
 #include "nsIFrame.h"
 #include "mozilla/TypedEnumBits.h"
 
 class nsContainerFrame;
-struct nsHTMLReflowState;
 class nsPresContext;
 
 /**
  * This class contains the logic for being an absolute containing block.  This
  * class is used within viewport frames (for frames representing content with
  * fixed position) and blocks (for frames representing absolutely positioned
  * content), since each set of frames is absolutely positioned with respect to
  * its parent.
--- a/layout/generic/nsBlockReflowContext.h
+++ b/layout/generic/nsBlockReflowContext.h
@@ -8,24 +8,25 @@
 
 #ifndef nsBlockReflowContext_h___
 #define nsBlockReflowContext_h___
 
 #include "nsIFrame.h"
 #include "nsHTMLReflowMetrics.h"
 
 class nsBlockReflowState;
-struct nsHTMLReflowState;
 class nsLineBox;
 class nsPresContext;
 
 /**
  * An encapsulation of the state and algorithm for reflowing block frames.
  */
 class nsBlockReflowContext {
+  using nsHTMLReflowState = mozilla::nsHTMLReflowState;
+
 public:
   nsBlockReflowContext(nsPresContext* aPresContext,
                        const nsHTMLReflowState& aParentRS);
   ~nsBlockReflowContext() { }
 
   void ReflowBlock(const mozilla::LogicalRect& aSpace,
                    bool                        aApplyBStartMargin,
                    nsCollapsingMargin&         aPrevMargin,
--- a/layout/generic/nsBlockReflowState.h
+++ b/layout/generic/nsBlockReflowState.h
@@ -70,16 +70,18 @@ class nsOverflowContinuationTracker;
 // Set when the pref layout.float-fragments-inside-column.enabled is true.
 #define BRS_FLOAT_FRAGMENTS_INSIDE_COLUMN_ENABLED 0x00000400
 #define BRS_LASTFLAG              BRS_FLOAT_FRAGMENTS_INSIDE_COLUMN_ENABLED
 
 // nsBlockReflowState contains additional reflow state information that the
 // block frame uses along with nsHTMLReflowState. Like nsHTMLReflowState, this
 // is read-only data that is passed down from a parent frame to its children.
 class nsBlockReflowState {
+  using nsHTMLReflowState = mozilla::nsHTMLReflowState;
+
 public:
   nsBlockReflowState(const nsHTMLReflowState& aReflowState,
                      nsPresContext* aPresContext,
                      nsBlockFrame* aFrame,
                      bool aBStartMarginRoot, bool aBEndMarginRoot,
                      bool aBlockNeedsFloatManager,
                      nscoord aConsumedBSize = NS_INTRINSICSIZE);
 
--- a/layout/generic/nsFloatManager.h
+++ b/layout/generic/nsFloatManager.h
@@ -13,18 +13,20 @@
 #include "mozilla/WritingModes.h"
 #include "nsCoord.h"
 #include "nsFrameList.h" // for DEBUG_FRAME_DUMP
 #include "nsIntervalSet.h"
 #include "nsTArray.h"
 
 class nsIPresShell;
 class nsIFrame;
+class nsPresContext;
+namespace mozilla {
 struct nsHTMLReflowState;
-class nsPresContext;
+} // namespace mozilla
 
 /**
  * The available space for content not occupied by floats is divided
  * into a sequence of rectangles in the block direction.  However, we
  * need to know not only the rectangle, but also whether it was reduced
  * (from the content rectangle) by floats that actually intruded into
  * the content rectangle.
  */
@@ -366,16 +368,18 @@ private:
 };
 
 /**
  * A helper class to manage maintenance of the float manager during
  * nsBlockFrame::Reflow. It automatically restores the old float
  * manager in the reflow state when the object goes out of scope.
  */
 class nsAutoFloatManager {
+  using nsHTMLReflowState = mozilla::nsHTMLReflowState;
+
 public:
   explicit nsAutoFloatManager(nsHTMLReflowState& aReflowState)
     : mReflowState(aReflowState),
       mNew(nullptr),
       mOld(nullptr) {}
 
   ~nsAutoFloatManager();
 
--- a/layout/generic/nsFontInflationData.h
+++ b/layout/generic/nsFontInflationData.h
@@ -5,20 +5,20 @@
 
 /* Per-block-formatting-context manager of font size inflation for pan and zoom UI. */
 
 #ifndef nsFontInflationData_h_
 #define nsFontInflationData_h_
 
 #include "nsContainerFrame.h"
 
-struct nsHTMLReflowState;
-
 class nsFontInflationData
 {
+  using nsHTMLReflowState = mozilla::nsHTMLReflowState;
+
 public:
 
   static nsFontInflationData* FindFontInflationDataFor(const nsIFrame *aFrame);
 
   // Returns whether the effective width changed (which requires the
   // caller to mark its descendants dirty
   static bool
     UpdateFontInflationDataISizeFor(const nsHTMLReflowState& aReflowState);
--- a/layout/generic/nsFrame.h
+++ b/layout/generic/nsFrame.h
@@ -764,25 +764,25 @@ public:
 };
 
 // Start Display Reflow Debugging
 #ifdef DEBUG
 
   struct DR_cookie {
     DR_cookie(nsPresContext*          aPresContext,
               nsIFrame*                aFrame, 
-              const nsHTMLReflowState& aReflowState,
+              const mozilla::nsHTMLReflowState& aReflowState,
               nsHTMLReflowMetrics&     aMetrics,
               nsReflowStatus&          aStatus);     
     ~DR_cookie();
     void Change() const;
 
     nsPresContext*          mPresContext;
     nsIFrame*                mFrame;
-    const nsHTMLReflowState& mReflowState;
+    const mozilla::nsHTMLReflowState& mReflowState;
     nsHTMLReflowMetrics&     mMetrics;
     nsReflowStatus&          mStatus;    
     void*                    mValue;
   };
 
   struct DR_layout_cookie {
     explicit DR_layout_cookie(nsIFrame* aFrame);
     ~DR_layout_cookie();
@@ -809,45 +809,45 @@ public:
 
     nsIFrame* mFrame;
     const char* mType;
     nsSize& mResult;
     void* mValue;
   };
 
   struct DR_init_constraints_cookie {
-    DR_init_constraints_cookie(nsIFrame* aFrame, nsHTMLReflowState* aState,
+    DR_init_constraints_cookie(nsIFrame* aFrame, mozilla::nsHTMLReflowState* aState,
                                nscoord aCBWidth, nscoord aCBHeight,
                                const nsMargin* aBorder,
                                const nsMargin* aPadding);
     ~DR_init_constraints_cookie();
 
     nsIFrame* mFrame;
-    nsHTMLReflowState* mState;
+    mozilla::nsHTMLReflowState* mState;
     void* mValue;
   };
 
   struct DR_init_offsets_cookie {
-    DR_init_offsets_cookie(nsIFrame* aFrame, nsCSSOffsetState* aState,
+    DR_init_offsets_cookie(nsIFrame* aFrame, mozilla::nsCSSOffsetState* aState,
                            const mozilla::LogicalSize& aPercentBasis,
                            const nsMargin* aBorder,
                            const nsMargin* aPadding);
     ~DR_init_offsets_cookie();
 
     nsIFrame* mFrame;
-    nsCSSOffsetState* mState;
+    mozilla::nsCSSOffsetState* mState;
     void* mValue;
   };
 
   struct DR_init_type_cookie {
-    DR_init_type_cookie(nsIFrame* aFrame, nsHTMLReflowState* aState);
+    DR_init_type_cookie(nsIFrame* aFrame, mozilla::nsHTMLReflowState* aState);
     ~DR_init_type_cookie();
 
     nsIFrame* mFrame;
-    nsHTMLReflowState* mState;
+    mozilla::nsHTMLReflowState* mState;
     void* mValue;
   };
 
 #define DISPLAY_REFLOW(dr_pres_context, dr_frame, dr_rf_state, dr_rf_metrics, dr_rf_status) \
   DR_cookie dr_cookie(dr_pres_context, dr_frame, dr_rf_state, dr_rf_metrics, dr_rf_status); 
 #define DISPLAY_REFLOW_CHANGE() \
   dr_cookie.Change();
 #define DISPLAY_LAYOUT(dr_frame) \
--- a/layout/generic/nsFrameSetFrame.h
+++ b/layout/generic/nsFrameSetFrame.h
@@ -11,17 +11,16 @@
 #include "mozilla/Attributes.h"
 #include "mozilla/UniquePtr.h"
 #include "nsContainerFrame.h"
 #include "nsColor.h"
 
 class  nsIContent;
 class  nsPresContext;
 struct nsRect;
-struct nsHTMLReflowState;
 struct nsSize;
 class  nsIAtom;
 class  nsHTMLFramesetBorderFrame;
 class  nsHTMLFramesetFrame;
 
 #define NO_COLOR 0xFFFFFFFA
 
 // defined at HTMLFrameSetElement.h
--- a/layout/generic/nsHTMLReflowMetrics.h
+++ b/layout/generic/nsHTMLReflowMetrics.h
@@ -9,17 +9,19 @@
 #define nsHTMLReflowMetrics_h___
 
 #include "mozilla/WritingModes.h"
 #include "nsBoundingMetrics.h"
 #include "nsRect.h"
 
 //----------------------------------------------------------------------
 
+namespace mozilla {
 struct nsHTMLReflowState;
+} // namespace mozilla
 
 // Option flags
 #define NS_REFLOW_CALC_BOUNDING_METRICS  0x0001
 
 /**
  * When we store overflow areas as an array of scrollable and visual
  * overflow, we use these indices.
  *
@@ -192,16 +194,18 @@ struct nsCollapsingMargin {
 
 /**
  * Reflow metrics used to return the frame's desired size and alignment
  * information.
  *
  * @see #Reflow()
  */
 class nsHTMLReflowMetrics {
+  using nsHTMLReflowState = mozilla::nsHTMLReflowState;
+
 public:
   // XXXldb Should |aFlags| generally be passed from parent to child?
   // Some places do it, and some don't.  |aFlags| should perhaps go away
   // entirely.
   // XXX width/height/ascent are OUT parameters and so they shouldn't
   // have to be initialized, but there are some bad frame classes that
   // aren't properly setting them when returning from Reflow()...
   explicit nsHTMLReflowMetrics(mozilla::WritingMode aWritingMode, uint32_t aFlags = 0)
--- a/layout/generic/nsHTMLReflowState.h
+++ b/layout/generic/nsHTMLReflowState.h
@@ -1,17 +1,17 @@
 /* -*- 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/. */
 
 /* struct containing the input to nsIFrame::Reflow */
 
-#ifndef nsHTMLReflowState_h___
-#define nsHTMLReflowState_h___
+#ifndef mozilla_nsHTMLReflowState_h
+#define mozilla_nsHTMLReflowState_h
 
 #include "nsMargin.h"
 #include "nsStyleCoord.h"
 #include "nsIFrame.h"
 #include "mozilla/Assertions.h"
 #include <algorithm>
 
 class nsPresContext;
@@ -89,16 +89,18 @@ typedef uint32_t  nsCSSFrameType;
 
 /**
  * A macro to extract the type. Masks off the 'replaced' bit-flag
  */
 #define NS_FRAME_GET_TYPE(_ft)                           \
   ((_ft) & ~(NS_CSS_FRAME_TYPE_REPLACED |                \
              NS_CSS_FRAME_TYPE_REPLACED_CONTAINS_BLOCK))
 
+namespace mozilla {
+
 // A base class of nsHTMLReflowState that computes only the padding,
 // border, and margin, since those values are needed more often.
 struct nsCSSOffsetState {
 public:
   typedef mozilla::WritingMode WritingMode;
   typedef mozilla::LogicalMargin LogicalMargin;
 
   // the frame being reflowed
@@ -965,10 +967,11 @@ protected:
   void CalculateBorderPaddingMargin(mozilla::LogicalAxis aAxis,
                                     nscoord aContainingBlockSize,
                                     nscoord* aInsideBoxSizing,
                                     nscoord* aOutsideBoxSizing) const;
 
   void CalculateBlockSideMargins(nsIAtom* aFrameType);
 };
 
-#endif /* nsHTMLReflowState_h___ */
+} // namespace mozilla
 
+#endif // mozilla_nsHTMLReflowState_h
--- a/layout/generic/nsIFrame.h
+++ b/layout/generic/nsIFrame.h
@@ -56,17 +56,16 @@
  * 4. if you move a frame (outside of the reflow process, or after reflowing it),
  *    then you must make sure that its view (or its child frame's views) are re-positioned
  *    as well. It's reasonable to not position the view until after all reflowing the
  *    entire line, for example, but the frame should still be positioned and sized (and
  *    the view sized) during the reflow (i.e., before sending the DidReflow() notification)
  * 5. the view system handles moving of widgets, i.e., it's not our problem
  */
 
-struct nsHTMLReflowState;
 class nsIAtom;
 class nsPresContext;
 class nsIPresShell;
 class nsRenderingContext;
 class nsView;
 class nsIWidget;
 class nsISelectionController;
 class nsBoxLayoutState;
@@ -89,16 +88,17 @@ struct nsRect;
 struct nsSize;
 struct nsMargin;
 struct CharacterDataChangeInfo;
 
 namespace mozilla {
 
 enum class CSSPseudoElementType : uint8_t;
 class EventStates;
+struct nsHTMLReflowState;
 
 namespace layers {
 class Layer;
 } // namespace layers
 
 namespace gfx {
 class Matrix;
 } // namespace gfx
@@ -418,16 +418,17 @@ static void ReleaseValue(T* aPropertyVal
 class nsIFrame : public nsQueryFrame
 {
 public:
   template <typename T> using Maybe = mozilla::Maybe<T>;
   using Nothing = mozilla::Nothing;
   using OnNonvisible = mozilla::OnNonvisible;
   template<typename T=void>
   using PropertyDescriptor = const mozilla::FramePropertyDescriptor<T>*;
+  using nsHTMLReflowState = mozilla::nsHTMLReflowState;
   using Visibility = mozilla::Visibility;
   using VisibilityCounter = mozilla::VisibilityCounter;
 
   typedef mozilla::FrameProperties FrameProperties;
   typedef mozilla::layers::Layer Layer;
   typedef mozilla::layout::FrameChildList ChildList;
   typedef mozilla::layout::FrameChildListID ChildListID;
   typedef mozilla::layout::FrameChildListIDs ChildListIDs;
--- a/layout/generic/nsImageFrame.h
+++ b/layout/generic/nsImageFrame.h
@@ -20,17 +20,16 @@
 #include "mozilla/DebugOnly.h"
 #include "nsIReflowCallback.h"
 #include "nsTObserverArray.h"
 
 class nsFontMetrics;
 class nsImageMap;
 class nsIURI;
 class nsILoadGroup;
-struct nsHTMLReflowState;
 class nsHTMLReflowMetrics;
 class nsDisplayImage;
 class nsPresContext;
 class nsImageFrame;
 class nsTransform2D;
 class nsImageLoadingContent;
 
 namespace mozilla {
--- a/layout/generic/nsLineLayout.h
+++ b/layout/generic/nsLineLayout.h
@@ -23,16 +23,18 @@
 #include "nsBlockReflowState.h"
 #include "nsLineBox.h"
 #include "plarena.h"
 
 class nsFloatManager;
 struct nsStyleText;
 
 class nsLineLayout {
+  using nsHTMLReflowState = mozilla::nsHTMLReflowState;
+
 public:
   /**
    * @param aBaseLineLayout the nsLineLayout for ruby base,
    * nullptr if no separate base nsLineLayout is needed.
    */
   nsLineLayout(nsPresContext* aPresContext,
                nsFloatManager* aFloatManager,
                const nsHTMLReflowState* aOuterReflowState,
--- a/layout/tables/nsITableLayoutStrategy.h
+++ b/layout/tables/nsITableLayoutStrategy.h
@@ -11,21 +11,25 @@
 
 #ifndef nsITableLayoutStrategy_h_
 #define nsITableLayoutStrategy_h_
 
 #include "nscore.h"
 #include "nsCoord.h"
 
 class nsRenderingContext;
+namespace mozilla {
 struct nsHTMLReflowState;
+} // namespace mozilla
 
 class nsITableLayoutStrategy
 {
 public:
+    using nsHTMLReflowState = mozilla::nsHTMLReflowState;
+
     virtual ~nsITableLayoutStrategy() {}
 
     /** Implement nsIFrame::GetMinISize for the table */
     virtual nscoord GetMinISize(nsRenderingContext* aRenderingContext) = 0;
 
     /** Implement nsIFrame::GetPrefISize for the table */
     virtual nscoord GetPrefISize(nsRenderingContext* aRenderingContext,
                                  bool aComputingSize) = 0;
--- a/layout/tables/nsTableRowGroupFrame.h
+++ b/layout/tables/nsTableRowGroupFrame.h
@@ -13,16 +13,18 @@
 #include "nsTablePainter.h"
 #include "nsTArray.h"
 #include "nsTableFrame.h"
 #include "mozilla/WritingModes.h"
 
 class nsTableRowFrame;
 
 struct nsRowGroupReflowState {
+  using nsHTMLReflowState = mozilla::nsHTMLReflowState;
+
   const nsHTMLReflowState& reflowState;  // Our reflow state
 
   nsTableFrame* tableFrame;
 
   // The available size (computed from the parent)
   mozilla::LogicalSize availSize;
 
   // Running block-offset
--- a/layout/xul/nsBoxLayoutState.h
+++ b/layout/xul/nsBoxLayoutState.h
@@ -13,20 +13,25 @@
 #ifndef nsBoxLayoutState_h___
 #define nsBoxLayoutState_h___
 
 #include "nsCOMPtr.h"
 #include "nsPresContext.h"
 #include "nsIPresShell.h"
 
 class nsRenderingContext;
+namespace mozilla {
 struct nsHTMLReflowState;
+} // namespace mozilla
+
 
 class MOZ_STACK_CLASS nsBoxLayoutState
 {
+  using nsHTMLReflowState = mozilla::nsHTMLReflowState;
+
 public:
   explicit nsBoxLayoutState(nsPresContext* aPresContext,
                             nsRenderingContext* aRenderingContext = nullptr,
                             // see OuterReflowState() below
                             const nsHTMLReflowState* aOuterReflowState = nullptr,
                             uint16_t aReflowDepth = 0);
   nsBoxLayoutState(const nsBoxLayoutState& aState);