Bug 960277. Part 2: Move nsFieldSetFrame declaration to nsFieldSetFrame.h. r=mats
authorRobert O'Callahan <robert@ocallahan.org>
Thu, 16 Jan 2014 15:20:20 +1300
changeset 164131 0cb7841990d8de527acc92dafacfca106c68b74d
parent 164130 997c9994cf6ba0c242c49e8a0d060507109eca52
child 164132 6ce27f9e743f961f892b9e4998ae5ef70559f6c4
push id26026
push userphilringnalda@gmail.com
push dateSat, 18 Jan 2014 23:17:27 +0000
treeherdermozilla-central@61fd0f987cf2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmats
bugs960277
milestone29.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 960277. Part 2: Move nsFieldSetFrame declaration to nsFieldSetFrame.h. r=mats
layout/forms/nsFieldSetFrame.cpp
layout/forms/nsFieldSetFrame.h
--- a/layout/forms/nsFieldSetFrame.cpp
+++ b/layout/forms/nsFieldSetFrame.cpp
@@ -1,15 +1,16 @@
 /* -*- 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/. */
 
+#include "nsFieldSetFrame.h"
+
 #include "nsCSSAnonBoxes.h"
-#include "nsContainerFrame.h"
 #include "nsLegendFrame.h"
 #include "nsCSSRendering.h"
 #include <algorithm>
 #include "nsIFrame.h"
 #include "nsPresContext.h"
 #include "RestyleManager.h"
 #include "nsGkAtoms.h"
 #include "nsStyleConsts.h"
@@ -17,134 +18,16 @@
 #include "nsRenderingContext.h"
 #include "nsIScrollableFrame.h"
 #include "mozilla/Likely.h"
 #include "mozilla/Maybe.h"
 
 using namespace mozilla;
 using namespace mozilla::layout;
 
-class nsFieldSetFrame MOZ_FINAL : public nsContainerFrame {
-public:
-  NS_DECL_FRAMEARENA_HELPERS
-
-  nsFieldSetFrame(nsStyleContext* aContext);
-
-  NS_HIDDEN_(nscoord)
-    GetIntrinsicWidth(nsRenderingContext* aRenderingContext,
-                      nsLayoutUtils::IntrinsicWidthType);
-  virtual nscoord GetMinWidth(nsRenderingContext* aRenderingContext);
-  virtual nscoord GetPrefWidth(nsRenderingContext* aRenderingContext);
-  virtual nsSize ComputeSize(nsRenderingContext *aRenderingContext,
-                             nsSize aCBSize, nscoord aAvailableWidth,
-                             nsSize aMargin, nsSize aBorder, nsSize aPadding,
-                             uint32_t aFlags) MOZ_OVERRIDE;
-  virtual nscoord GetBaseline() const;
-
-  /**
-   * The area to paint box-shadows around.  It's the border rect except
-   * when there's a <legend> we offset the y-position to the center of it.
-   */
-  virtual nsRect VisualBorderRectRelativeToSelf() const MOZ_OVERRIDE {
-    nscoord topBorder = StyleBorder()->GetComputedBorderWidth(NS_SIDE_TOP);
-    nsRect r(nsPoint(0,0), GetSize());
-    if (topBorder < mLegendRect.height) {
-      nscoord yoff = (mLegendRect.height - topBorder) / 2;
-      r.y += yoff;
-      r.height -= yoff;
-    }
-    return r;
-  }
-
-  NS_IMETHOD Reflow(nsPresContext*           aPresContext,
-                    nsHTMLReflowMetrics&     aDesiredSize,
-                    const nsHTMLReflowState& aReflowState,
-                    nsReflowStatus&          aStatus);
-                               
-  virtual void BuildDisplayList(nsDisplayListBuilder*   aBuilder,
-                                const nsRect&           aDirtyRect,
-                                const nsDisplayListSet& aLists) MOZ_OVERRIDE;
-
-  void PaintBorderBackground(nsRenderingContext& aRenderingContext,
-    nsPoint aPt, const nsRect& aDirtyRect, uint32_t aBGFlags);
-
-  NS_IMETHOD AppendFrames(ChildListID    aListID,
-                          nsFrameList&   aFrameList);
-  NS_IMETHOD InsertFrames(ChildListID    aListID,
-                          nsIFrame*      aPrevFrame,
-                          nsFrameList&   aFrameList);
-  NS_IMETHOD RemoveFrame(ChildListID    aListID,
-                         nsIFrame*      aOldFrame);
-
-  virtual nsIAtom* GetType() const;
-  virtual bool IsFrameOfType(uint32_t aFlags) const
-  {
-    return nsContainerFrame::IsFrameOfType(aFlags &
-             ~nsIFrame::eCanContainOverflowContainers);
-  }
-  virtual nsIScrollableFrame* GetScrollTargetFrame() MOZ_OVERRIDE
-  {
-    return do_QueryFrame(GetInner());
-  }
-
-#ifdef ACCESSIBILITY  
-  virtual mozilla::a11y::AccType AccessibleType() MOZ_OVERRIDE;
-#endif
-
-#ifdef DEBUG
-  NS_IMETHOD SetInitialChildList(ChildListID    aListID,
-                                 nsFrameList&   aChildList);
-#endif
-
-#ifdef DEBUG_FRAME_DUMP
-  NS_IMETHOD GetFrameName(nsAString& aResult) const {
-    return MakeFrameName(NS_LITERAL_STRING("FieldSet"), aResult);
-  }
-#endif
-
-protected:
-
-  /**
-   * Return the anonymous frame that contains all descendants except
-   * the legend frame.  This is currently always a block frame with
-   * pseudo nsCSSAnonBoxes::fieldsetContent -- this may change in the
-   * future when we add support for CSS overflow for <fieldset>.
-   */
-  nsIFrame* GetInner() const
-  {
-    nsIFrame* last = mFrames.LastChild();
-    if (last &&
-        last->StyleContext()->GetPseudo() == nsCSSAnonBoxes::fieldsetContent) {
-      return last;
-    }
-    MOZ_ASSERT(mFrames.LastChild() == mFrames.FirstChild());
-    return nullptr;
-  }
-
-  /**
-   * Return the frame that represents the legend if any.  This may be
-   * a nsLegendFrame or a nsHTMLScrollFrame with the nsLegendFrame as the
-   * scrolled frame (aka content insertion frame).
-   */
-  nsIFrame* GetLegend() const
-  {
-    if (mFrames.FirstChild() == GetInner()) {
-      MOZ_ASSERT(mFrames.LastChild() == mFrames.FirstChild());
-      return nullptr;
-    }
-    MOZ_ASSERT(mFrames.FirstChild() &&
-               mFrames.FirstChild()->GetContentInsertionFrame()->GetType() ==
-                 nsGkAtoms::legendFrame);
-    return mFrames.FirstChild();
-  }
-
-  nsRect    mLegendRect;
-  nscoord   mLegendSpace;
-};
-
 nsIFrame*
 NS_NewFieldSetFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
 {
   return new (aPresShell) nsFieldSetFrame(aContext);
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsFieldSetFrame)
 
@@ -166,16 +49,54 @@ nsFieldSetFrame::SetInitialChildList(Chi
                                      nsFrameList&   aChildList)
 {
   nsresult rv = nsContainerFrame::SetInitialChildList(kPrincipalList, aChildList);
   MOZ_ASSERT(GetInner());
   return rv;
 }
 #endif
 
+nsRect
+nsFieldSetFrame::VisualBorderRectRelativeToSelf() const
+{
+  nscoord topBorder = StyleBorder()->GetComputedBorderWidth(NS_SIDE_TOP);
+  nsRect r(nsPoint(0,0), GetSize());
+  if (topBorder < mLegendRect.height) {
+    nscoord yoff = (mLegendRect.height - topBorder) / 2;
+    r.y += yoff;
+    r.height -= yoff;
+  }
+  return r;
+}
+
+nsIFrame*
+nsFieldSetFrame::GetInner() const
+{
+  nsIFrame* last = mFrames.LastChild();
+  if (last &&
+      last->StyleContext()->GetPseudo() == nsCSSAnonBoxes::fieldsetContent) {
+    return last;
+  }
+  MOZ_ASSERT(mFrames.LastChild() == mFrames.FirstChild());
+  return nullptr;
+}
+
+nsIFrame*
+nsFieldSetFrame::GetLegend() const
+{
+  if (mFrames.FirstChild() == GetInner()) {
+    MOZ_ASSERT(mFrames.LastChild() == mFrames.FirstChild());
+    return nullptr;
+  }
+  MOZ_ASSERT(mFrames.FirstChild() &&
+             mFrames.FirstChild()->GetContentInsertionFrame()->GetType() ==
+               nsGkAtoms::legendFrame);
+  return mFrames.FirstChild();
+}
+
 class nsDisplayFieldSetBorderBackground : public nsDisplayItem {
 public:
   nsDisplayFieldSetBorderBackground(nsDisplayListBuilder* aBuilder,
                                     nsFieldSetFrame* aFrame)
     : nsDisplayItem(aBuilder, aFrame) {
     MOZ_COUNT_CTOR(nsDisplayFieldSetBorderBackground);
   }
 #ifdef NS_BUILD_REFCNT_LOGGING
new file mode 100644
--- /dev/null
+++ b/layout/forms/nsFieldSetFrame.h
@@ -0,0 +1,101 @@
+/* -*- 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/. */
+
+#ifndef nsFieldSetFrame_h___
+#define nsFieldSetFrame_h___
+
+#include "nsContainerFrame.h"
+
+class nsFieldSetFrame MOZ_FINAL : public nsContainerFrame
+{
+public:
+  NS_DECL_FRAMEARENA_HELPERS
+
+  nsFieldSetFrame(nsStyleContext* aContext);
+
+  NS_HIDDEN_(nscoord)
+    GetIntrinsicWidth(nsRenderingContext* aRenderingContext,
+                      nsLayoutUtils::IntrinsicWidthType);
+  virtual nscoord GetMinWidth(nsRenderingContext* aRenderingContext);
+  virtual nscoord GetPrefWidth(nsRenderingContext* aRenderingContext);
+  virtual nsSize ComputeSize(nsRenderingContext *aRenderingContext,
+                             nsSize aCBSize, nscoord aAvailableWidth,
+                             nsSize aMargin, nsSize aBorder, nsSize aPadding,
+                             uint32_t aFlags) MOZ_OVERRIDE;
+  virtual nscoord GetBaseline() const;
+
+  /**
+   * The area to paint box-shadows around.  It's the border rect except
+   * when there's a <legend> we offset the y-position to the center of it.
+   */
+  virtual nsRect VisualBorderRectRelativeToSelf() const MOZ_OVERRIDE;
+
+  NS_IMETHOD Reflow(nsPresContext*           aPresContext,
+                    nsHTMLReflowMetrics&     aDesiredSize,
+                    const nsHTMLReflowState& aReflowState,
+                    nsReflowStatus&          aStatus);
+                               
+  virtual void BuildDisplayList(nsDisplayListBuilder*   aBuilder,
+                                const nsRect&           aDirtyRect,
+                                const nsDisplayListSet& aLists) MOZ_OVERRIDE;
+
+  void PaintBorderBackground(nsRenderingContext& aRenderingContext,
+    nsPoint aPt, const nsRect& aDirtyRect, uint32_t aBGFlags);
+
+  NS_IMETHOD AppendFrames(ChildListID    aListID,
+                          nsFrameList&   aFrameList);
+  NS_IMETHOD InsertFrames(ChildListID    aListID,
+                          nsIFrame*      aPrevFrame,
+                          nsFrameList&   aFrameList);
+  NS_IMETHOD RemoveFrame(ChildListID    aListID,
+                         nsIFrame*      aOldFrame);
+
+  virtual nsIAtom* GetType() const;
+  virtual bool IsFrameOfType(uint32_t aFlags) const
+  {
+    return nsContainerFrame::IsFrameOfType(aFlags &
+             ~nsIFrame::eCanContainOverflowContainers);
+  }
+  virtual nsIScrollableFrame* GetScrollTargetFrame() MOZ_OVERRIDE
+  {
+    return do_QueryFrame(GetInner());
+  }
+
+#ifdef ACCESSIBILITY  
+  virtual mozilla::a11y::AccType AccessibleType() MOZ_OVERRIDE;
+#endif
+
+#ifdef DEBUG
+  NS_IMETHOD SetInitialChildList(ChildListID    aListID,
+                                 nsFrameList&   aChildList);
+#endif
+
+#ifdef DEBUG_FRAME_DUMP
+  NS_IMETHOD GetFrameName(nsAString& aResult) const {
+    return MakeFrameName(NS_LITERAL_STRING("FieldSet"), aResult);
+  }
+#endif
+
+  /**
+   * Return the anonymous frame that contains all descendants except
+   * the legend frame.  This is currently always a block frame with
+   * pseudo nsCSSAnonBoxes::fieldsetContent -- this may change in the
+   * future when we add support for CSS overflow for <fieldset>.
+   */
+  nsIFrame* GetInner() const;
+
+  /**
+   * Return the frame that represents the legend if any.  This may be
+   * a nsLegendFrame or a nsHTMLScrollFrame with the nsLegendFrame as the
+   * scrolled frame (aka content insertion frame).
+   */
+  nsIFrame* GetLegend() const;
+
+protected:
+  nsRect    mLegendRect;
+  nscoord   mLegendSpace;
+};
+
+#endif // nsFieldSetFrame_h___