diff --git a/layout/base/nsCSSFrameConstructor.cpp b/layout/base/nsCSSFrameConstructor.cpp index f7f3a6862134..d69929275c02 100644 --- a/layout/base/nsCSSFrameConstructor.cpp +++ b/layout/base/nsCSSFrameConstructor.cpp @@ -95,6 +95,9 @@ #include "nsIDOMXULDocument.h" #include "nsIXULDocument.h" #endif +#ifdef MOZ_FLEXBOX +#include "nsFlexContainerFrame.h" +#endif #ifdef ACCESSIBILITY #include "nsAccessibilityService.h" #endif @@ -4293,17 +4296,6 @@ nsCSSFrameConstructor::BuildScrollFrame(nsFrameConstructorState& aState, 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, diff --git a/layout/generic/Makefile.in b/layout/generic/Makefile.in index 7fa4ecd697da..6a87bfe87e74 100644 --- a/layout/generic/Makefile.in +++ b/layout/generic/Makefile.in @@ -93,6 +93,12 @@ CPPSRCS = \ nsViewportFrame.cpp \ $(NULL) +ifdef MOZ_FLEXBOX +CPPSRCS += \ + nsFlexContainerFrame.cpp \ + $(NULL) +endif + ifdef MOZ_MEDIA CPPSRCS += \ nsVideoFrame.cpp \ diff --git a/layout/generic/nsFlexContainerFrame.cpp b/layout/generic/nsFlexContainerFrame.cpp new file mode 100644 index 000000000000..59f65142740e --- /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 diff --git a/layout/generic/nsFlexContainerFrame.h b/layout/generic/nsFlexContainerFrame.h new file mode 100644 index 000000000000..dcbbbca46535 --- /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___ */ diff --git a/layout/generic/nsFrameIdList.h b/layout/generic/nsFrameIdList.h index fda8522782c9..f37812b3b1db 100644 --- a/layout/generic/nsFrameIdList.h +++ b/layout/generic/nsFrameIdList.h @@ -22,6 +22,9 @@ 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)