Bug 666041 patch 3: Create boilerplate nsFlexContainerFrame class. r=bz
authorDaniel Holbert <dholbert@cs.stanford.edu>
Tue, 26 Jun 2012 15:12:13 -0700
changeset 97718 89465e472cf097cbdd727461f714636ea99d734e
parent 97717 4a363e159fb6704dca6d66cb6148df2d09b43942
child 97719 2ee8a6148b943a6df6b4d1f36b2f6dbc472b8d9b
push id11189
push userdholbert@mozilla.com
push dateTue, 26 Jun 2012 22:12:55 +0000
treeherdermozilla-inbound@89465e472cf0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs666041
milestone16.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 666041 patch 3: Create boilerplate nsFlexContainerFrame class. r=bz
layout/base/nsCSSFrameConstructor.cpp
layout/generic/Makefile.in
layout/generic/nsFlexContainerFrame.cpp
layout/generic/nsFlexContainerFrame.h
layout/generic/nsFrameIdList.h
--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -90,16 +90,19 @@
 #include "nsRenderingContext.h"
 
 #ifdef MOZ_XUL
 #include "nsIRootBox.h"
 #include "nsIDOMXULCommandDispatcher.h"
 #include "nsIDOMXULDocument.h"
 #include "nsIXULDocument.h"
 #endif
+#ifdef MOZ_FLEXBOX
+#include "nsFlexContainerFrame.h"
+#endif
 #ifdef ACCESSIBILITY
 #include "nsAccessibilityService.h"
 #endif
 
 #include "nsInlineFrame.h"
 #include "nsBlockFrame.h"
 
 #include "nsIScrollableFrame.h"
@@ -4288,27 +4291,16 @@ nsCSSFrameConstructor::BuildScrollFrame(
     
     aScrolledFrame->SetStyleContextWithoutNotification(scrolledContentStyle);
     InitAndRestoreFrame(aState, aContent, aNewFrame, nsnull, aScrolledFrame);
 
     FinishBuildingScrollFrame(aNewFrame, aScrolledFrame);
     return NS_OK;
 }
 
-#ifdef MOZ_FLEXBOX
-// TEMPORARY CHUNK: No-op constructor, so we can compile at this
-// intermediate state.  Removed in subsequent patch.
-nsIFrame*
-NS_NewFlexContainerFrame(nsIPresShell* aPresShell,
-                         nsStyleContext* aContext)
-{
-  return nsnull;
-}
-#endif // MOZ_FLEXBOX
-
 const nsCSSFrameConstructor::FrameConstructionData*
 nsCSSFrameConstructor::FindDisplayData(const nsStyleDisplay* aDisplay,
                                        Element* aElement,
                                        nsStyleContext* aStyleContext)
 {
   PR_STATIC_ASSERT(eParentTypeCount < (1 << (32 - FCDATA_PARENT_TYPE_OFFSET)));
 
   // The style system ensures that floated and positioned frames are
--- a/layout/generic/Makefile.in
+++ b/layout/generic/Makefile.in
@@ -88,16 +88,22 @@ CPPSRCS		= \
 		nsSubDocumentFrame.cpp \
 		nsTextFrameThebes.cpp \
 		nsTextFrameUtils.cpp \
 		TextOverflow.cpp \
 		nsTextRunTransformations.cpp \
 		nsViewportFrame.cpp \
 		$(NULL)
 
+ifdef MOZ_FLEXBOX
+CPPSRCS		+= \
+		nsFlexContainerFrame.cpp \
+		$(NULL)
+endif
+
 ifdef MOZ_MEDIA
 CPPSRCS		+= \
 		nsVideoFrame.cpp \
 		$(NULL)
 endif
 
 ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
 CMMSRCS		+= \
new file mode 100644
--- /dev/null
+++ b/layout/generic/nsFlexContainerFrame.cpp
@@ -0,0 +1,58 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=2 et sw=2 tw=80: */
+
+/* This Source Code is subject to the terms of the Mozilla Public License
+ * version 2.0 (the "License"). You can obtain a copy of the License at
+ * http://mozilla.org/MPL/2.0/. */
+
+/* rendering object for CSS display: -moz-flex */
+
+#include "nsFlexContainerFrame.h"
+#include "nsPresContext.h"
+#include "nsStyleContext.h"
+#include "prlog.h"
+
+#ifdef PR_LOGGING 
+static PRLogModuleInfo* nsFlexContainerFrameLM = PR_NewLogModule("nsFlexContainerFrame");
+#endif /* PR_LOGGING */
+
+NS_IMPL_FRAMEARENA_HELPERS(nsFlexContainerFrame)
+
+nsIFrame*
+NS_NewFlexContainerFrame(nsIPresShell* aPresShell,
+                         nsStyleContext* aContext)
+{
+  return new (aPresShell) nsFlexContainerFrame(aContext);
+}
+
+//----------------------------------------------------------------------
+
+/* virtual */
+nsFlexContainerFrame::~nsFlexContainerFrame()
+{
+}
+
+NS_QUERYFRAME_HEAD(nsFlexContainerFrame)
+  NS_QUERYFRAME_ENTRY(nsFlexContainerFrame)
+NS_QUERYFRAME_TAIL_INHERITING(nsFlexContainerFrameSuper)
+
+void
+nsFlexContainerFrame::DestroyFrom(nsIFrame* aDestructRoot)
+{
+  DestroyAbsoluteFrames(aDestructRoot);
+  nsFlexContainerFrameSuper::DestroyFrom(aDestructRoot);
+}
+
+nsIAtom*
+nsFlexContainerFrame::GetType() const
+{
+  return nsGkAtoms::flexContainerFrame;
+}
+
+#ifdef DEBUG
+NS_IMETHODIMP
+nsFlexContainerFrame::GetFrameName(nsAString& aResult) const
+{
+  return MakeFrameName(NS_LITERAL_STRING("FlexContainer"), aResult);
+}
+#endif // DEBUG
new file mode 100644
--- /dev/null
+++ b/layout/generic/nsFlexContainerFrame.h
@@ -0,0 +1,46 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=2 et sw=2 tw=80: */
+
+/* This Source Code is subject to the terms of the Mozilla Public License
+ * version 2.0 (the "License"). You can obtain a copy of the License at
+ * http://mozilla.org/MPL/2.0/. */
+
+/* rendering object for CSS display: -moz-flex */
+
+#ifndef nsFlexContainerFrame_h___
+#define nsFlexContainerFrame_h___
+
+#include "nsContainerFrame.h"
+#include "mozilla/Types.h"
+
+nsIFrame* NS_NewFlexContainerFrame(nsIPresShell* aPresShell,
+                                   nsStyleContext* aContext);
+
+typedef nsContainerFrame nsFlexContainerFrameSuper;
+
+class nsFlexContainerFrame : public nsFlexContainerFrameSuper {
+  NS_DECL_FRAMEARENA_HELPERS
+  NS_DECL_QUERYFRAME_TARGET(nsFlexContainerFrame)
+  NS_DECL_QUERYFRAME
+
+  // Factory method:
+  friend nsIFrame* NS_NewFlexContainerFrame(nsIPresShell* aPresShell,
+                                            nsStyleContext* aContext);
+
+  // nsIFrame overrides
+  virtual nsIAtom* GetType() const MOZ_OVERRIDE;
+#ifdef DEBUG
+  NS_IMETHOD GetFrameName(nsAString& aResult) const MOZ_OVERRIDE;
+#endif
+
+protected:
+  // Protected constructor & destructor
+  nsFlexContainerFrame(nsStyleContext* aContext) : nsFlexContainerFrameSuper(aContext) {}
+  virtual ~nsFlexContainerFrame();
+
+  // Protected nsIFrame overrides:
+  virtual void DestroyFrom(nsIFrame* aDestructRoot);
+
+};
+
+#endif /* nsFlexContainerFrame_h___ */
--- a/layout/generic/nsFrameIdList.h
+++ b/layout/generic/nsFrameIdList.h
@@ -17,16 +17,19 @@ FRAME_ID(nsComboboxDisplayFrame)
 FRAME_ID(nsContainerFrame)
 FRAME_ID(nsContinuingTextFrame)
 FRAME_ID(nsDeckFrame)
 FRAME_ID(nsDocElementBoxFrame)
 FRAME_ID(nsFieldSetFrame)
 FRAME_ID(nsFileControlFrame)
 FRAME_ID(nsFirstLetterFrame)
 FRAME_ID(nsFirstLineFrame)
+#ifdef MOZ_FLEXBOX
+FRAME_ID(nsFlexContainerFrame)
+#endif // MOZ_FLEXBOX
 FRAME_ID(nsFormControlFrame)
 FRAME_ID(nsFrame)
 FRAME_ID(nsGfxButtonControlFrame)
 FRAME_ID(nsGfxCheckboxControlFrame)
 FRAME_ID(nsGfxRadioControlFrame)
 FRAME_ID(nsGridRowGroupFrame)
 FRAME_ID(nsGridRowLeafFrame)
 FRAME_ID(nsGroupBoxFrame)