Bug 1277129 Part 3a - Move nsTableReflowState, nsRowGroupReflowState, and nsTableCellReflowState into mozilla namespace. r=dbaron
authorTing-Yu Lin <tlin@mozilla.com>
Thu, 21 Jul 2016 18:36:36 +0800
changeset 306068 64eb9c0b65c78c59609f6aaffb0f02148ff6b037
parent 306067 d8ef49c1d01eaf977a88583c6f65a4b1552363d2
child 306069 63e083e58002523052fb230dfe974ed8689cc73d
push id30474
push usercbook@mozilla.com
push dateThu, 21 Jul 2016 14:25:10 +0000
treeherdermozilla-central@6b180266ac16 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdbaron
bugs1277129
milestone50.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1277129 Part 3a - Move nsTableReflowState, nsRowGroupReflowState, and nsTableCellReflowState into mozilla namespace. r=dbaron Also move the definition of nsRowGroupReflowState from .h into .cpp as other two classes did since forward declaration in header is enough. MozReview-Commit-ID: 9p1vIk1Ewji
layout/tables/nsTableFrame.cpp
layout/tables/nsTableFrame.h
layout/tables/nsTableRowFrame.cpp
layout/tables/nsTableRowFrame.h
layout/tables/nsTableRowGroupFrame.cpp
layout/tables/nsTableRowGroupFrame.h
--- a/layout/tables/nsTableFrame.cpp
+++ b/layout/tables/nsTableFrame.cpp
@@ -51,16 +51,18 @@
 using namespace mozilla;
 using namespace mozilla::image;
 using namespace mozilla::layout;
 
 /********************************************************************************
  ** nsTableReflowState                                                         **
  ********************************************************************************/
 
+namespace mozilla {
+
 struct nsTableReflowState {
 
   // the real reflow state
   const ReflowInput& reflowState;
 
   // The table's available size (in reflowState's writing mode)
   LogicalSize availSize;
 
@@ -98,16 +100,18 @@ struct nsTableReflowState {
       availSize.BSize(wm) -= borderPadding.BStartEnd(wm) +
                              table->GetRowSpacing(-1) +
                              table->GetRowSpacing(table->GetRowCount());
       availSize.BSize(wm) = std::max(0, availSize.BSize(wm));
     }
   }
 };
 
+} // namespace mozilla
+
 /********************************************************************************
  ** nsTableFrame                                                               **
  ********************************************************************************/
 
 struct BCPropertyData
 {
   BCPropertyData() : mBStartBorderWidth(0), mIEndBorderWidth(0),
                      mBEndBorderWidth(0), mIStartBorderWidth(0),
--- a/layout/tables/nsTableFrame.h
+++ b/layout/tables/nsTableFrame.h
@@ -23,19 +23,19 @@ class nsTableColFrame;
 class nsTableRowGroupFrame;
 class nsTableRowFrame;
 class nsTableColGroupFrame;
 class nsITableLayoutStrategy;
 class nsStyleContext;
 namespace mozilla {
 class WritingMode;
 class LogicalMargin;
+struct nsTableReflowState;
 } // namespace mozilla
 
-struct nsTableReflowState;
 struct BCPropertyData;
 
 static inline bool IS_TABLE_CELL(nsIAtom* frameType) {
   return nsGkAtoms::tableCellFrame == frameType ||
     nsGkAtoms::bcTableCellFrame == frameType;
 }
 
 static inline bool FrameHasBorderOrBackground(nsIFrame* f) {
@@ -127,16 +127,17 @@ enum nsTableColType {
   * The principal child list contains row group frames. There is also an
   * additional child list, kColGroupList, which contains the col group frames.
   */
 class nsTableFrame : public nsContainerFrame
 {
   typedef mozilla::image::DrawResult DrawResult;
   typedef mozilla::WritingMode WritingMode;
   typedef mozilla::LogicalMargin LogicalMargin;
+  typedef mozilla::nsTableReflowState nsTableReflowState;
 
 public:
   NS_DECL_QUERYFRAME_TARGET(nsTableFrame)
   NS_DECL_FRAMEARENA_HELPERS
 
   typedef nsTArray<nsIFrame*> FrameTArray;
   NS_DECLARE_FRAME_PROPERTY_DELETABLE(PositionedTablePartArray, FrameTArray)
 
--- a/layout/tables/nsTableRowFrame.cpp
+++ b/layout/tables/nsTableRowFrame.cpp
@@ -21,31 +21,35 @@
 #include "nsTableColFrame.h"
 #include "nsCOMPtr.h"
 #include "nsDisplayList.h"
 #include "nsIFrameInlines.h"
 #include <algorithm>
 
 using namespace mozilla;
 
+namespace mozilla {
+
 struct nsTableCellReflowState : public ReflowInput
 {
   nsTableCellReflowState(nsPresContext*           aPresContext,
                          const ReflowInput& aParentReflowState,
                          nsIFrame*                aFrame,
                          const LogicalSize&       aAvailableSpace,
                          uint32_t                 aFlags = 0)
     : ReflowInput(aPresContext, aParentReflowState, aFrame,
                         aAvailableSpace, nullptr, aFlags)
   {
   }
 
   void FixUp(const LogicalSize& aAvailSpace);
 };
 
+} // namespace mozilla
+
 void nsTableCellReflowState::FixUp(const LogicalSize& aAvailSpace)
 {
   // fix the mComputed values during a pass 2 reflow since the cell can be a percentage base
   NS_WARN_IF_FALSE(NS_UNCONSTRAINEDSIZE != aAvailSpace.ISize(mWritingMode),
                    "have unconstrained inline-size; this should only result from "
                    "very large sizes, not attempts at intrinsic inline size "
                    "calculation");
   if (NS_UNCONSTRAINEDSIZE != ComputedISize()) {
--- a/layout/tables/nsTableRowFrame.h
+++ b/layout/tables/nsTableRowFrame.h
@@ -8,30 +8,34 @@
 #include "mozilla/Attributes.h"
 #include "nscore.h"
 #include "nsContainerFrame.h"
 #include "nsTablePainter.h"
 #include "nsTableRowGroupFrame.h"
 #include "mozilla/WritingModes.h"
 
 class  nsTableCellFrame;
+namespace mozilla {
 struct nsTableCellReflowState;
+} // namespace mozilla
 
 /**
  * nsTableRowFrame is the frame that maps table rows 
  * (HTML tag TR). This class cannot be reused
  * outside of an nsTableRowGroupFrame.  It assumes that its parent is an nsTableRowGroupFrame,  
  * and its children are nsTableCellFrames.
  * 
  * @see nsTableFrame
  * @see nsTableRowGroupFrame
  * @see nsTableCellFrame
  */
 class nsTableRowFrame : public nsContainerFrame
 {
+  using nsTableCellReflowState = mozilla::nsTableCellReflowState;
+
 public:
   NS_DECL_QUERYFRAME_TARGET(nsTableRowFrame)
   NS_DECL_QUERYFRAME
   NS_DECL_FRAMEARENA_HELPERS
 
   virtual ~nsTableRowFrame();
 
   virtual void Init(nsIContent*       aContent,
--- a/layout/tables/nsTableRowGroupFrame.cpp
+++ b/layout/tables/nsTableRowGroupFrame.cpp
@@ -19,16 +19,45 @@
 #include "nsDisplayList.h"
 
 #include "nsCellMap.h"//table cell navigation
 #include <algorithm>
 
 using namespace mozilla;
 using namespace mozilla::layout;
 
+namespace mozilla {
+
+struct nsRowGroupReflowState {
+  const ReflowInput& reflowState;  // Our reflow state
+
+  nsTableFrame* tableFrame;
+
+  // The available size (computed from the parent)
+  mozilla::LogicalSize availSize;
+
+  // Running block-offset
+  nscoord bCoord;
+
+  nsRowGroupReflowState(const ReflowInput& aReflowState,
+                        nsTableFrame*            aTableFrame)
+      : reflowState(aReflowState)
+      , tableFrame(aTableFrame)
+      , availSize(aReflowState.GetWritingMode(),
+                  aReflowState.AvailableISize(),
+                  aReflowState.AvailableBSize())
+      , bCoord(0)
+  {
+  }
+
+  ~nsRowGroupReflowState() {}
+};
+
+} // namespace mozilla
+
 nsTableRowGroupFrame::nsTableRowGroupFrame(nsStyleContext* aContext):
   nsContainerFrame(aContext)
 {
   SetRepeatable(false);
 }
 
 nsTableRowGroupFrame::~nsTableRowGroupFrame()
 {
--- a/layout/tables/nsTableRowGroupFrame.h
+++ b/layout/tables/nsTableRowGroupFrame.h
@@ -11,59 +11,37 @@
 #include "nsIAtom.h"
 #include "nsILineIterator.h"
 #include "nsTablePainter.h"
 #include "nsTArray.h"
 #include "nsTableFrame.h"
 #include "mozilla/WritingModes.h"
 
 class nsTableRowFrame;
-
-struct nsRowGroupReflowState {
-  using ReflowInput = mozilla::ReflowInput;
-
-  const ReflowInput& reflowState;  // Our reflow state
-
-  nsTableFrame* tableFrame;
-
-  // The available size (computed from the parent)
-  mozilla::LogicalSize availSize;
-
-  // Running block-offset
-  nscoord bCoord;
-
-  nsRowGroupReflowState(const ReflowInput& aReflowState,
-                        nsTableFrame*            aTableFrame)
-      : reflowState(aReflowState)
-      , tableFrame(aTableFrame)
-      , availSize(aReflowState.GetWritingMode(),
-                  aReflowState.AvailableISize(),
-                  aReflowState.AvailableBSize())
-      , bCoord(0)
-  {
-  }
-
-  ~nsRowGroupReflowState() {}
-};
+namespace mozilla {
+struct nsRowGroupReflowState;
+} // namespace mozilla
 
 #define MIN_ROWS_NEEDING_CURSOR 20
 
 /**
  * nsTableRowGroupFrame is the frame that maps row groups
  * (HTML tags THEAD, TFOOT, and TBODY). This class cannot be reused
  * outside of an nsTableFrame.  It assumes that its parent is an nsTableFrame, and
  * its children are nsTableRowFrames.
  *
  * @see nsTableFrame
  * @see nsTableRowFrame
  */
 class nsTableRowGroupFrame final
   : public nsContainerFrame
   , public nsILineIterator
 {
+  using nsRowGroupReflowState = mozilla::nsRowGroupReflowState;
+
 public:
   NS_DECL_QUERYFRAME_TARGET(nsTableRowGroupFrame)
   NS_DECL_QUERYFRAME
   NS_DECL_FRAMEARENA_HELPERS
 
   /** instantiate a new instance of nsTableRowFrame.
     * @param aPresShell the pres shell for this frame
     *