From 4bf3881ba30c8b403ccb933630742b5d53ceec41 Mon Sep 17 00:00:00 2001 From: Neil Deakin Date: Mon, 11 Jul 2011 10:05:10 -0400 Subject: [PATCH] Bug 670148, remove nsIBoxLayout, r=roc --- layout/base/nsCSSFrameConstructor.cpp | 6 +- layout/generic/nsIFrame.h | 6 +- layout/xul/base/src/grid/nsGrid.cpp | 2 +- layout/xul/base/src/grid/nsGridLayout2.cpp | 2 +- layout/xul/base/src/grid/nsGridLayout2.h | 4 +- .../xul/base/src/grid/nsGridRowGroupFrame.cpp | 4 +- .../xul/base/src/grid/nsGridRowGroupFrame.h | 2 +- .../base/src/grid/nsGridRowGroupLayout.cpp | 4 +- .../xul/base/src/grid/nsGridRowGroupLayout.h | 4 +- layout/xul/base/src/grid/nsGridRowLayout.cpp | 2 +- layout/xul/base/src/grid/nsGridRowLayout.h | 4 +- .../xul/base/src/grid/nsGridRowLeafFrame.cpp | 4 +- layout/xul/base/src/grid/nsGridRowLeafFrame.h | 2 +- .../xul/base/src/grid/nsGridRowLeafLayout.cpp | 4 +- .../xul/base/src/grid/nsGridRowLeafLayout.h | 4 +- layout/xul/base/src/grid/nsIGridPart.h | 2 +- layout/xul/base/src/nsBox.cpp | 2 +- layout/xul/base/src/nsBoxFrame.cpp | 8 +- layout/xul/base/src/nsBoxFrame.h | 12 +-- layout/xul/base/src/nsBoxLayout.cpp | 47 +--------- layout/xul/base/src/nsBoxLayout.h | 27 ++++-- layout/xul/base/src/nsDeckFrame.cpp | 2 +- layout/xul/base/src/nsIBoxLayout.h | 85 ------------------- layout/xul/base/src/nsListBoxBodyFrame.cpp | 6 +- layout/xul/base/src/nsListBoxBodyFrame.h | 2 +- layout/xul/base/src/nsListBoxLayout.cpp | 6 +- layout/xul/base/src/nsListBoxLayout.h | 2 +- layout/xul/base/src/nsListItemFrame.cpp | 8 +- layout/xul/base/src/nsListItemFrame.h | 2 +- layout/xul/base/src/nsMenuPopupFrame.cpp | 1 - layout/xul/base/src/nsRootBoxFrame.cpp | 2 +- layout/xul/base/src/nsSprocketLayout.cpp | 4 +- layout/xul/base/src/nsSprocketLayout.h | 8 +- layout/xul/base/src/nsStackFrame.cpp | 2 +- layout/xul/base/src/nsStackLayout.cpp | 4 +- layout/xul/base/src/nsStackLayout.h | 6 +- 36 files changed, 86 insertions(+), 206 deletions(-) delete mode 100644 layout/xul/base/src/nsIBoxLayout.h diff --git a/layout/base/nsCSSFrameConstructor.cpp b/layout/base/nsCSSFrameConstructor.cpp index cc383f44ab6..4e15479d38c 100644 --- a/layout/base/nsCSSFrameConstructor.cpp +++ b/layout/base/nsCSSFrameConstructor.cpp @@ -107,7 +107,7 @@ #include "nsLayoutUtils.h" #include "nsAutoPtr.h" #include "nsBoxFrame.h" -#include "nsIBoxLayout.h" +#include "nsBoxLayout.h" #include "nsImageFrame.h" #include "nsIObjectLoadingContent.h" #include "nsContentErrors.h" @@ -318,7 +318,7 @@ NS_NewTreeBodyFrame (nsIPresShell* aPresShell, nsStyleContext* aContext); // grid nsresult -NS_NewGridLayout2 ( nsIPresShell* aPresShell, nsIBoxLayout** aNewLayout ); +NS_NewGridLayout2 ( nsIPresShell* aPresShell, nsBoxLayout** aNewLayout ); nsIFrame* NS_NewGridRowLeafFrame (nsIPresShell* aPresShell, nsStyleContext* aContext); nsIFrame* @@ -3947,7 +3947,7 @@ static nsIFrame* NS_NewGridBoxFrame(nsIPresShell* aPresShell, nsStyleContext* aStyleContext) { - nsCOMPtr layout; + nsCOMPtr layout; NS_NewGridLayout2(aPresShell, getter_AddRefs(layout)); if (!layout) { return nsnull; diff --git a/layout/generic/nsIFrame.h b/layout/generic/nsIFrame.h index a37c4dd7fc3..bafb97d73c4 100644 --- a/layout/generic/nsIFrame.h +++ b/layout/generic/nsIFrame.h @@ -91,7 +91,7 @@ class nsIWidget; class nsIDOMRange; class nsISelectionController; class nsBoxLayoutState; -class nsIBoxLayout; +class nsBoxLayout; class nsILineIterator; #ifdef ACCESSIBILITY class nsAccessible; @@ -2594,8 +2594,8 @@ NS_PTR_TO_INT32(frame->Properties().Get(nsIFrame::EmbeddingLevelProperty())) NS_IMETHOD GetBorder(nsMargin& aBorder)=0; NS_IMETHOD GetPadding(nsMargin& aBorderAndPadding)=0; NS_IMETHOD GetMargin(nsMargin& aMargin)=0; - virtual void SetLayoutManager(nsIBoxLayout* aLayout) { } - virtual nsIBoxLayout* GetLayoutManager() { return nsnull; } + virtual void SetLayoutManager(nsBoxLayout* aLayout) { } + virtual nsBoxLayout* GetLayoutManager() { return nsnull; } NS_HIDDEN_(nsresult) GetClientRect(nsRect& aContentRect); // For nsSprocketLayout diff --git a/layout/xul/base/src/grid/nsGrid.cpp b/layout/xul/base/src/grid/nsGrid.cpp index 5c28a1f9da8..b454cd9b420 100644 --- a/layout/xul/base/src/grid/nsGrid.cpp +++ b/layout/xul/base/src/grid/nsGrid.cpp @@ -596,7 +596,7 @@ nsGrid::GetPartFromBox(nsIBox* aBox) if (!aBox) return nsnull; - nsIBoxLayout* layout = aBox->GetLayoutManager(); + nsBoxLayout* layout = aBox->GetLayoutManager(); return layout ? layout->AsGridPart() : nsnull; } diff --git a/layout/xul/base/src/grid/nsGridLayout2.cpp b/layout/xul/base/src/grid/nsGridLayout2.cpp index b68420238ef..812368f9a76 100644 --- a/layout/xul/base/src/grid/nsGridLayout2.cpp +++ b/layout/xul/base/src/grid/nsGridLayout2.cpp @@ -50,7 +50,7 @@ #include "nsSprocketLayout.h" nsresult -NS_NewGridLayout2( nsIPresShell* aPresShell, nsIBoxLayout** aNewLayout) +NS_NewGridLayout2( nsIPresShell* aPresShell, nsBoxLayout** aNewLayout) { *aNewLayout = new nsGridLayout2(aPresShell); NS_IF_ADDREF(*aNewLayout); diff --git a/layout/xul/base/src/grid/nsGridLayout2.h b/layout/xul/base/src/grid/nsGridLayout2.h index 711f217b7ec..03f806fb237 100644 --- a/layout/xul/base/src/grid/nsGridLayout2.h +++ b/layout/xul/base/src/grid/nsGridLayout2.h @@ -53,14 +53,14 @@ class nsBoxLayoutState; class nsGridCell; /** - * The nsIBoxLayout implementation for a grid. + * The nsBoxLayout implementation for a grid. */ class nsGridLayout2 : public nsStackLayout, public nsIGridPart { public: - friend nsresult NS_NewGridLayout2(nsIPresShell* aPresShell, nsIBoxLayout** aNewLayout); + friend nsresult NS_NewGridLayout2(nsIPresShell* aPresShell, nsBoxLayout** aNewLayout); NS_DECL_ISUPPORTS_INHERITED diff --git a/layout/xul/base/src/grid/nsGridRowGroupFrame.cpp b/layout/xul/base/src/grid/nsGridRowGroupFrame.cpp index 1defe9f3de9..e33cc7ae392 100644 --- a/layout/xul/base/src/grid/nsGridRowGroupFrame.cpp +++ b/layout/xul/base/src/grid/nsGridRowGroupFrame.cpp @@ -48,13 +48,13 @@ #include "nsBoxLayoutState.h" #include "nsGridLayout2.h" -already_AddRefed NS_NewGridRowGroupLayout(); +already_AddRefed NS_NewGridRowGroupLayout(); nsIFrame* NS_NewGridRowGroupFrame(nsIPresShell* aPresShell, nsStyleContext* aContext) { - nsCOMPtr layout = NS_NewGridRowGroupLayout(); + nsCOMPtr layout = NS_NewGridRowGroupLayout(); if (!layout) { return nsnull; } diff --git a/layout/xul/base/src/grid/nsGridRowGroupFrame.h b/layout/xul/base/src/grid/nsGridRowGroupFrame.h index 05870e2a44c..419107f9b93 100644 --- a/layout/xul/base/src/grid/nsGridRowGroupFrame.h +++ b/layout/xul/base/src/grid/nsGridRowGroupFrame.h @@ -68,7 +68,7 @@ public: nsGridRowGroupFrame(nsIPresShell* aPresShell, nsStyleContext* aContext, - nsIBoxLayout* aLayoutManager): + nsBoxLayout* aLayoutManager): nsBoxFrame(aPresShell, aContext, PR_FALSE, aLayoutManager) {} virtual nscoord GetFlex(nsBoxLayoutState& aBoxLayoutState); diff --git a/layout/xul/base/src/grid/nsGridRowGroupLayout.cpp b/layout/xul/base/src/grid/nsGridRowGroupLayout.cpp index 415e5974ebd..038c8c629c1 100644 --- a/layout/xul/base/src/grid/nsGridRowGroupLayout.cpp +++ b/layout/xul/base/src/grid/nsGridRowGroupLayout.cpp @@ -54,9 +54,9 @@ #include "nsGridLayout2.h" #include "nsGridRow.h" -already_AddRefed NS_NewGridRowGroupLayout() +already_AddRefed NS_NewGridRowGroupLayout() { - nsIBoxLayout* layout = new nsGridRowGroupLayout(); + nsBoxLayout* layout = new nsGridRowGroupLayout(); NS_IF_ADDREF(layout); return layout; } diff --git a/layout/xul/base/src/grid/nsGridRowGroupLayout.h b/layout/xul/base/src/grid/nsGridRowGroupLayout.h index 563b0ea4f21..55c2f20ccad 100644 --- a/layout/xul/base/src/grid/nsGridRowGroupLayout.h +++ b/layout/xul/base/src/grid/nsGridRowGroupLayout.h @@ -48,13 +48,13 @@ #include "nsGridRowLayout.h" /** - * The nsIBoxLayout implementation for nsGridRowGroupFrame. + * The nsBoxLayout implementation for nsGridRowGroupFrame. */ class nsGridRowGroupLayout : public nsGridRowLayout { public: - friend already_AddRefed NS_NewGridRowGroupLayout(); + friend already_AddRefed NS_NewGridRowGroupLayout(); virtual nsGridRowGroupLayout* CastToRowGroupLayout() { return this; } virtual nsSize GetMinSize(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState); diff --git a/layout/xul/base/src/grid/nsGridRowLayout.cpp b/layout/xul/base/src/grid/nsGridRowLayout.cpp index fbe4bc22421..317d2ecbb5f 100644 --- a/layout/xul/base/src/grid/nsGridRowLayout.cpp +++ b/layout/xul/base/src/grid/nsGridRowLayout.cpp @@ -128,7 +128,7 @@ nsGridRowLayout::GetGrid(nsIBox* aBox, PRInt32* aIndex, nsGridRowLayout* aReques // if there is a scrollframe walk inside it to its child nsIBox* childBox = nsGrid::GetScrolledBox(child); - nsIBoxLayout* layout = childBox->GetLayoutManager(); + nsBoxLayout* layout = childBox->GetLayoutManager(); nsIGridPart* gridRow = nsGrid::GetPartFromBox(childBox); if (gridRow) { diff --git a/layout/xul/base/src/grid/nsGridRowLayout.h b/layout/xul/base/src/grid/nsGridRowLayout.h index 9060660388c..d84f1d3c158 100644 --- a/layout/xul/base/src/grid/nsGridRowLayout.h +++ b/layout/xul/base/src/grid/nsGridRowLayout.h @@ -53,8 +53,8 @@ class nsBoxLayoutState; class nsGrid; /** - * A common base class for nsGridRowLeafLayout (the nsIBoxLayout object - * for a grid row or column) and nsGridRowGroupLayout (the nsIBoxLayout + * A common base class for nsGridRowLeafLayout (the nsBoxLayout object + * for a grid row or column) and nsGridRowGroupLayout (the nsBoxLayout * object for a grid row group or column group). */ // XXXldb This needs a name that indicates that it's a base class for diff --git a/layout/xul/base/src/grid/nsGridRowLeafFrame.cpp b/layout/xul/base/src/grid/nsGridRowLeafFrame.cpp index 1d6ca0cc1be..f0aba6f16ce 100644 --- a/layout/xul/base/src/grid/nsGridRowLeafFrame.cpp +++ b/layout/xul/base/src/grid/nsGridRowLeafFrame.cpp @@ -48,13 +48,13 @@ #include "nsBoxLayoutState.h" #include "nsGridLayout2.h" -already_AddRefed NS_NewGridRowLeafLayout(); +already_AddRefed NS_NewGridRowLeafLayout(); nsIFrame* NS_NewGridRowLeafFrame(nsIPresShell* aPresShell, nsStyleContext* aContext) { - nsCOMPtr layout = NS_NewGridRowLeafLayout(); + nsCOMPtr layout = NS_NewGridRowLeafLayout(); if (!layout) { return nsnull; } diff --git a/layout/xul/base/src/grid/nsGridRowLeafFrame.h b/layout/xul/base/src/grid/nsGridRowLeafFrame.h index ac8b2d0490b..691c6cf9bf2 100644 --- a/layout/xul/base/src/grid/nsGridRowLeafFrame.h +++ b/layout/xul/base/src/grid/nsGridRowLeafFrame.h @@ -73,7 +73,7 @@ public: nsGridRowLeafFrame(nsIPresShell* aPresShell, nsStyleContext* aContext, PRBool aIsRoot, - nsIBoxLayout* aLayoutManager): + nsBoxLayout* aLayoutManager): nsBoxFrame(aPresShell, aContext, aIsRoot, aLayoutManager) {} NS_IMETHOD GetBorderAndPadding(nsMargin& aBorderAndPadding); diff --git a/layout/xul/base/src/grid/nsGridRowLeafLayout.cpp b/layout/xul/base/src/grid/nsGridRowLeafLayout.cpp index b946f584554..afdfab8e45f 100644 --- a/layout/xul/base/src/grid/nsGridRowLeafLayout.cpp +++ b/layout/xul/base/src/grid/nsGridRowLeafLayout.cpp @@ -51,9 +51,9 @@ #include "nsBoxFrame.h" #include "nsGridLayout2.h" -already_AddRefed NS_NewGridRowLeafLayout() +already_AddRefed NS_NewGridRowLeafLayout() { - nsIBoxLayout* layout = new nsGridRowLeafLayout(); + nsBoxLayout* layout = new nsGridRowLeafLayout(); NS_IF_ADDREF(layout); return layout; } diff --git a/layout/xul/base/src/grid/nsGridRowLeafLayout.h b/layout/xul/base/src/grid/nsGridRowLeafLayout.h index 61b3bf966a9..4866a709202 100644 --- a/layout/xul/base/src/grid/nsGridRowLeafLayout.h +++ b/layout/xul/base/src/grid/nsGridRowLeafLayout.h @@ -49,7 +49,7 @@ #include "nsCOMPtr.h" /** - * The nsIBoxLayout implementation for nsGridRowLeafFrame. + * The nsBoxLayout implementation for nsGridRowLeafFrame. */ // XXXldb This needs a better name that indicates that it's for any grid // row. @@ -57,7 +57,7 @@ class nsGridRowLeafLayout : public nsGridRowLayout { public: - friend already_AddRefed NS_NewGridRowLeafLayout(); + friend already_AddRefed NS_NewGridRowLeafLayout(); virtual nsSize GetPrefSize(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState); virtual nsSize GetMinSize(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState); diff --git a/layout/xul/base/src/grid/nsIGridPart.h b/layout/xul/base/src/grid/nsIGridPart.h index 16547b443a3..b07d1c31630 100644 --- a/layout/xul/base/src/grid/nsIGridPart.h +++ b/layout/xul/base/src/grid/nsIGridPart.h @@ -53,7 +53,7 @@ class nsGridLayout2; { 0xb3, 0x6c, 0x69, 0xf7, 0xc1, 0x95, 0x67, 0x7b } } /** - * An additional interface implemented by nsIBoxLayout implementations + * An additional interface implemented by nsBoxLayout implementations * for parts of a grid (excluding cells, which are not special). */ class nsIGridPart : public nsISupports { diff --git a/layout/xul/base/src/nsBox.cpp b/layout/xul/base/src/nsBox.cpp index 945c402ecfc..dd89935b220 100644 --- a/layout/xul/base/src/nsBox.cpp +++ b/layout/xul/base/src/nsBox.cpp @@ -53,7 +53,7 @@ #include "nsIDocument.h" #include "nsITheme.h" #include "nsIServiceManager.h" -#include "nsIBoxLayout.h" +#include "nsBoxLayout.h" #include "FrameLayerBuilder.h" using namespace mozilla; diff --git a/layout/xul/base/src/nsBoxFrame.cpp b/layout/xul/base/src/nsBoxFrame.cpp index 31aca4ca690..e911003a19a 100644 --- a/layout/xul/base/src/nsBoxFrame.cpp +++ b/layout/xul/base/src/nsBoxFrame.cpp @@ -78,7 +78,7 @@ #include "nsIPresShell.h" #include "nsCSSRendering.h" #include "nsIServiceManager.h" -#include "nsIBoxLayout.h" +#include "nsBoxLayout.h" #include "nsSprocketLayout.h" #include "nsIDocument.h" #include "nsIScrollableFrame.h" @@ -120,7 +120,7 @@ nsIBox* nsBoxFrame::mDebugChild = nsnull; #endif nsIFrame* -NS_NewBoxFrame(nsIPresShell* aPresShell, nsStyleContext* aContext, PRBool aIsRoot, nsIBoxLayout* aLayoutManager) +NS_NewBoxFrame(nsIPresShell* aPresShell, nsStyleContext* aContext, PRBool aIsRoot, nsBoxLayout* aLayoutManager) { return new (aPresShell) nsBoxFrame(aPresShell, aContext, aIsRoot, aLayoutManager); } @@ -136,7 +136,7 @@ NS_IMPL_FRAMEARENA_HELPERS(nsBoxFrame) nsBoxFrame::nsBoxFrame(nsIPresShell* aPresShell, nsStyleContext* aContext, PRBool aIsRoot, - nsIBoxLayout* aLayoutManager) : + nsBoxLayout* aLayoutManager) : nsContainerFrame(aContext) { mState |= NS_STATE_IS_HORIZONTAL; @@ -149,7 +149,7 @@ nsBoxFrame::nsBoxFrame(nsIPresShell* aPresShell, mHalign = hAlign_Left; // if no layout manager specified us the static sprocket layout - nsCOMPtr layout = aLayoutManager; + nsCOMPtr layout = aLayoutManager; if (layout == nsnull) { NS_NewSprocketLayout(aPresShell, layout); diff --git a/layout/xul/base/src/nsBoxFrame.h b/layout/xul/base/src/nsBoxFrame.h index 47481966f7f..b76bc4bd5a7 100644 --- a/layout/xul/base/src/nsBoxFrame.h +++ b/layout/xul/base/src/nsBoxFrame.h @@ -71,7 +71,7 @@ class nsBoxLayoutState; nsIFrame* NS_NewBoxFrame(nsIPresShell* aPresShell, nsStyleContext* aContext, PRBool aIsRoot, - nsIBoxLayout* aLayoutManager); + nsBoxLayout* aLayoutManager); nsIFrame* NS_NewBoxFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); @@ -83,7 +83,7 @@ public: friend nsIFrame* NS_NewBoxFrame(nsIPresShell* aPresShell, nsStyleContext* aContext, PRBool aIsRoot, - nsIBoxLayout* aLayoutManager); + nsBoxLayout* aLayoutManager); friend nsIFrame* NS_NewBoxFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); @@ -91,8 +91,8 @@ public: // call this method to get the rect so you don't draw on the debug border or outer border. // ------ nsIBox ------------- - virtual void SetLayoutManager(nsIBoxLayout* aLayout) { mLayoutManager = aLayout; } - virtual nsIBoxLayout* GetLayoutManager() { return mLayoutManager; } + virtual void SetLayoutManager(nsBoxLayout* aLayout) { mLayoutManager = aLayout; } + virtual nsBoxLayout* GetLayoutManager() { return mLayoutManager; } NS_IMETHOD RelayoutChildAtOrdinal(nsBoxLayoutState& aState, nsIBox* aChild); @@ -181,7 +181,7 @@ public: virtual ~nsBoxFrame(); - nsBoxFrame(nsIPresShell* aPresShell, nsStyleContext* aContext, PRBool aIsRoot = PR_FALSE, nsIBoxLayout* aLayoutManager = nsnull); + nsBoxFrame(nsIPresShell* aPresShell, nsStyleContext* aContext, PRBool aIsRoot = PR_FALSE, nsBoxLayout* aLayoutManager = nsnull); // virtual so nsStackFrame, nsButtonBoxFrame, nsSliderFrame and nsMenuFrame // can override it @@ -240,7 +240,7 @@ protected: nscoord mFlex; nscoord mAscent; - nsCOMPtr mLayoutManager; + nsCOMPtr mLayoutManager; protected: nsresult RegUnregAccessKey(PRBool aDoReg); diff --git a/layout/xul/base/src/nsBoxLayout.cpp b/layout/xul/base/src/nsBoxLayout.cpp index 50f66d9136a..fd04a8ed51a 100644 --- a/layout/xul/base/src/nsBoxLayout.cpp +++ b/layout/xul/base/src/nsBoxLayout.cpp @@ -44,17 +44,10 @@ // #include "nsBox.h" -#include "nsPresContext.h" #include "nsCOMPtr.h" -#include "nsIContent.h" #include "nsHTMLContainerFrame.h" -#include "nsIFrame.h" #include "nsBoxLayout.h" -nsBoxLayout::nsBoxLayout() -{ -} - void nsBoxLayout::AddBorderAndPadding(nsIBox* aBox, nsSize& aSize) { @@ -131,42 +124,4 @@ nsBoxLayout::AddSmallestSize(nsSize& aSize, const nsSize& aSize2) aSize.height = aSize2.height; } -void -nsBoxLayout::ChildrenInserted(nsIBox* aBox, nsBoxLayoutState& aState, - nsIBox* aPrevBox, - const nsFrameList::Slice& aNewChildren) -{ -} - -void -nsBoxLayout::ChildrenAppended(nsIBox* aBox, nsBoxLayoutState& aState, - const nsFrameList::Slice& aNewChildren) -{ -} - -void -nsBoxLayout::ChildrenRemoved(nsIBox* aBox, nsBoxLayoutState& aState, nsIBox* aChildList) -{ -} - -void -nsBoxLayout::ChildrenSet(nsIBox* aBox, nsBoxLayoutState& aState, nsIBox* aChildList) -{ -} - -void -nsBoxLayout::IntrinsicWidthsDirty(nsIBox* aBox, nsBoxLayoutState& aState) -{ -} - -// nsISupports -NS_IMPL_ADDREF(nsBoxLayout) -NS_IMPL_RELEASE(nsBoxLayout) - -// -// QueryInterface -// -NS_INTERFACE_MAP_BEGIN(nsBoxLayout) - NS_INTERFACE_MAP_ENTRY(nsIBoxLayout) - NS_INTERFACE_MAP_ENTRY(nsISupports) -NS_INTERFACE_MAP_END +NS_IMPL_ISUPPORTS1(nsBoxLayout, nsBoxLayout) diff --git a/layout/xul/base/src/nsBoxLayout.h b/layout/xul/base/src/nsBoxLayout.h index fe054bb1f8d..de3d5ef2733 100644 --- a/layout/xul/base/src/nsBoxLayout.h +++ b/layout/xul/base/src/nsBoxLayout.h @@ -38,17 +38,26 @@ #ifndef nsBoxLayout_h___ #define nsBoxLayout_h___ -#include "nsIBoxLayout.h" +#include "nsISupports.h" +#include "nsIFrame.h" -class nsBoxLayout : public nsIBoxLayout { +#define NS_BOX_LAYOUT_IID \ +{ 0x09d522a7, 0x304c, 0x4137, \ + { 0xaf, 0xc9, 0xe0, 0x80, 0x2e, 0x89, 0xb7, 0xe8 } } + +class nsIGridPart; + +class nsBoxLayout : public nsISupports { public: - nsBoxLayout(); + nsBoxLayout() {} virtual ~nsBoxLayout() {} NS_DECL_ISUPPORTS + NS_DECLARE_STATIC_IID_ACCESSOR(NS_BOX_LAYOUT_IID) + NS_IMETHOD Layout(nsIBox* aBox, nsBoxLayoutState& aState); virtual nsSize GetPrefSize(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState); @@ -57,12 +66,12 @@ public: virtual nscoord GetAscent(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState); virtual void ChildrenInserted(nsIBox* aBox, nsBoxLayoutState& aState, nsIBox* aPrevBox, - const nsFrameList::Slice& aNewChildren); + const nsFrameList::Slice& aNewChildren) {} virtual void ChildrenAppended(nsIBox* aBox, nsBoxLayoutState& aState, - const nsFrameList::Slice& aNewChildren); - virtual void ChildrenRemoved(nsIBox* aBox, nsBoxLayoutState& aState, nsIBox* aChildList); - virtual void ChildrenSet(nsIBox* aBox, nsBoxLayoutState& aState, nsIBox* aChildList); - virtual void IntrinsicWidthsDirty(nsIBox* aBox, nsBoxLayoutState& aState); + const nsFrameList::Slice& aNewChildren) {} + virtual void ChildrenRemoved(nsIBox* aBox, nsBoxLayoutState& aState, nsIBox* aChildList) {} + virtual void ChildrenSet(nsIBox* aBox, nsBoxLayoutState& aState, nsIBox* aChildList) {} + virtual void IntrinsicWidthsDirty(nsIBox* aBox, nsBoxLayoutState& aState) {} virtual void AddBorderAndPadding(nsIBox* aBox, nsSize& aSize); virtual void AddMargin(nsIBox* aChild, nsSize& aSize); @@ -74,5 +83,7 @@ public: static void AddSmallestSize(nsSize& aSize, const nsSize& aToAdd); }; +NS_DEFINE_STATIC_IID_ACCESSOR(nsBoxLayout, NS_BOX_LAYOUT_IID) + #endif diff --git a/layout/xul/base/src/nsDeckFrame.cpp b/layout/xul/base/src/nsDeckFrame.cpp index e23b41940c3..01b921cc697 100644 --- a/layout/xul/base/src/nsDeckFrame.cpp +++ b/layout/xul/base/src/nsDeckFrame.cpp @@ -70,7 +70,7 @@ NS_IMPL_FRAMEARENA_HELPERS(nsDeckFrame) nsDeckFrame::nsDeckFrame(nsIPresShell* aPresShell, nsStyleContext* aContext) : nsBoxFrame(aPresShell, aContext), mIndex(0) { - nsCOMPtr layout; + nsCOMPtr layout; NS_NewStackLayout(aPresShell, layout); SetLayoutManager(layout); } diff --git a/layout/xul/base/src/nsIBoxLayout.h b/layout/xul/base/src/nsIBoxLayout.h deleted file mode 100644 index 63a03e84611..00000000000 --- a/layout/xul/base/src/nsIBoxLayout.h +++ /dev/null @@ -1,85 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Mozilla Communicator client code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 1998 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * Alternatively, the contents of this file may be used under the terms of - * either of the GNU General Public License Version 2 or later (the "GPL"), - * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -#ifndef nsIBoxLayout_h___ -#define nsIBoxLayout_h___ - -#include "nsISupports.h" -#include "nsIFrame.h" - -class nsBoxLayout; -class nsBoxLayoutState; -class nsRenderingContext; -class nsIGridPart; -struct nsRect; - -// 6a529924-c73d-4fae-af7a-0e8084e701d5 -#define NS_IBOX_LAYOUT_IID \ -{ 0x6a529924, 0xc73d, 0x4fae, \ - { 0xaf, 0x7a, 0x0e, 0x80, 0x84, 0xe7, 0x01, 0xd5 } } - -class nsIBoxLayout : public nsISupports { - -public: - - NS_DECLARE_STATIC_IID_ACCESSOR(NS_IBOX_LAYOUT_IID) - - NS_IMETHOD Layout(nsIBox* aBox, nsBoxLayoutState& aState)=0; - - virtual nsSize GetPrefSize(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState)=0; - virtual nsSize GetMinSize(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState)=0; - virtual nsSize GetMaxSize(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState)=0; - virtual nscoord GetAscent(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState)=0; - - // FIXME: Bug 507416. The Children* notifications don't actually - // use all those arguments. Can we just simplify the signatures? - virtual void ChildrenInserted(nsIBox* aBox, nsBoxLayoutState& aState, - nsIBox* aPrevBox, - const nsFrameList::Slice& aNewChildren)=0; - virtual void ChildrenAppended(nsIBox* aBox, nsBoxLayoutState& aState, - const nsFrameList::Slice& aNewChildren)=0; - virtual void ChildrenRemoved(nsIBox* aBox, nsBoxLayoutState& aState, nsIBox* aChildList)=0; - virtual void ChildrenSet(nsIBox* aBox, nsBoxLayoutState& aState, nsIBox* aChildList)=0; - virtual void IntrinsicWidthsDirty(nsIBox* aBox, nsBoxLayoutState& aState)=0; - - // Returns this if it is an nsIGridPart, not refcounted - virtual nsIGridPart* AsGridPart() = 0; -}; - -NS_DEFINE_STATIC_IID_ACCESSOR(nsIBoxLayout, NS_IBOX_LAYOUT_IID) - -#endif diff --git a/layout/xul/base/src/nsListBoxBodyFrame.cpp b/layout/xul/base/src/nsListBoxBodyFrame.cpp index 6fbc19a0015..7876b3216da 100644 --- a/layout/xul/base/src/nsListBoxBodyFrame.cpp +++ b/layout/xul/base/src/nsListBoxBodyFrame.cpp @@ -164,7 +164,7 @@ NS_IMPL_ISUPPORTS1(nsListScrollSmoother, nsITimerCallback) nsListBoxBodyFrame::nsListBoxBodyFrame(nsIPresShell* aPresShell, nsStyleContext* aContext, - nsIBoxLayout* aLayoutManager) + nsBoxLayout* aLayoutManager) : nsBoxFrame(aPresShell, aContext, PR_FALSE, aLayoutManager), mTopFrame(nsnull), mBottomFrame(nsnull), @@ -1508,12 +1508,12 @@ nsListBoxBodyFrame::RemoveChildFrame(nsBoxLayoutState &aState, // Creation Routines /////////////////////////////////////////////////////////////////////// -already_AddRefed NS_NewListBoxLayout(); +already_AddRefed NS_NewListBoxLayout(); nsIFrame* NS_NewListBoxBodyFrame(nsIPresShell* aPresShell, nsStyleContext* aContext) { - nsCOMPtr layout = NS_NewListBoxLayout(); + nsCOMPtr layout = NS_NewListBoxLayout(); if (!layout) { return nsnull; } diff --git a/layout/xul/base/src/nsListBoxBodyFrame.h b/layout/xul/base/src/nsListBoxBodyFrame.h index 493f9f39c94..d7679be991c 100644 --- a/layout/xul/base/src/nsListBoxBodyFrame.h +++ b/layout/xul/base/src/nsListBoxBodyFrame.h @@ -60,7 +60,7 @@ class nsListBoxBodyFrame : public nsBoxFrame, public nsIReflowCallback { nsListBoxBodyFrame(nsIPresShell* aPresShell, nsStyleContext* aContext, - nsIBoxLayout* aLayoutManager); + nsBoxLayout* aLayoutManager); virtual ~nsListBoxBodyFrame(); public: diff --git a/layout/xul/base/src/nsListBoxLayout.cpp b/layout/xul/base/src/nsListBoxLayout.cpp index c05eead0d66..662287fe471 100644 --- a/layout/xul/base/src/nsListBoxLayout.cpp +++ b/layout/xul/base/src/nsListBoxLayout.cpp @@ -53,7 +53,7 @@ nsListBoxLayout::nsListBoxLayout() : nsGridRowGroupLayout() { } -////////// nsIBoxLayout ////////////// +////////// nsBoxLayout ////////////// nsSize nsListBoxLayout::GetPrefSize(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState) @@ -242,9 +242,9 @@ nsListBoxLayout::LayoutInternal(nsIBox* aBox, nsBoxLayoutState& aState) // Creation Routines /////////////////////////////////////////////////////////////////////// -already_AddRefed NS_NewListBoxLayout() +already_AddRefed NS_NewListBoxLayout() { - nsIBoxLayout* layout = new nsListBoxLayout(); + nsBoxLayout* layout = new nsListBoxLayout(); NS_IF_ADDREF(layout); return layout; } diff --git a/layout/xul/base/src/nsListBoxLayout.h b/layout/xul/base/src/nsListBoxLayout.h index 7050f3c56eb..aad501c0a65 100644 --- a/layout/xul/base/src/nsListBoxLayout.h +++ b/layout/xul/base/src/nsListBoxLayout.h @@ -50,7 +50,7 @@ class nsListBoxLayout : public nsGridRowGroupLayout public: nsListBoxLayout(); - // nsIBoxLayout + // nsBoxLayout NS_IMETHOD Layout(nsIBox* aBox, nsBoxLayoutState& aState); virtual nsSize GetPrefSize(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState); virtual nsSize GetMinSize(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState); diff --git a/layout/xul/base/src/nsListItemFrame.cpp b/layout/xul/base/src/nsListItemFrame.cpp index b866eba9f07..037308cbce5 100644 --- a/layout/xul/base/src/nsListItemFrame.cpp +++ b/layout/xul/base/src/nsListItemFrame.cpp @@ -43,12 +43,12 @@ #include "nsINameSpaceManager.h" #include "nsGkAtoms.h" #include "nsDisplayList.h" -#include "nsIBoxLayout.h" +#include "nsBoxLayout.h" nsListItemFrame::nsListItemFrame(nsIPresShell* aPresShell, nsStyleContext* aContext, PRBool aIsRoot, - nsIBoxLayout* aLayoutManager) + nsBoxLayout* aLayoutManager) : nsGridRowLeafFrame(aPresShell, aContext, aIsRoot, aLayoutManager) { } @@ -85,12 +85,12 @@ nsListItemFrame::BuildDisplayListForChildren(nsDisplayListBuilder* aBuilder, // Creation Routine /////////////////////////////////////////////////////////////////////// -already_AddRefed NS_NewGridRowLeafLayout(); +already_AddRefed NS_NewGridRowLeafLayout(); nsIFrame* NS_NewListItemFrame(nsIPresShell* aPresShell, nsStyleContext* aContext) { - nsCOMPtr layout = NS_NewGridRowLeafLayout(); + nsCOMPtr layout = NS_NewGridRowLeafLayout(); if (!layout) { return nsnull; } diff --git a/layout/xul/base/src/nsListItemFrame.h b/layout/xul/base/src/nsListItemFrame.h index 5e89e432175..60f4c26f3e2 100644 --- a/layout/xul/base/src/nsListItemFrame.h +++ b/layout/xul/base/src/nsListItemFrame.h @@ -64,7 +64,7 @@ protected: nsListItemFrame(nsIPresShell* aPresShell, nsStyleContext *aContext, PRBool aIsRoot = nsnull, - nsIBoxLayout* aLayoutManager = nsnull); + nsBoxLayout* aLayoutManager = nsnull); virtual ~nsListItemFrame(); }; // class nsListItemFrame diff --git a/layout/xul/base/src/nsMenuPopupFrame.cpp b/layout/xul/base/src/nsMenuPopupFrame.cpp index 72c72e13a0d..998b659177e 100644 --- a/layout/xul/base/src/nsMenuPopupFrame.cpp +++ b/layout/xul/base/src/nsMenuPopupFrame.cpp @@ -74,7 +74,6 @@ #include "nsContentUtils.h" #include "nsCSSFrameConstructor.h" #include "nsEventStateManager.h" -#include "nsIBoxLayout.h" #include "nsIPopupBoxObject.h" #include "nsPIWindowRoot.h" #include "nsIReflowCallback.h" diff --git a/layout/xul/base/src/nsRootBoxFrame.cpp b/layout/xul/base/src/nsRootBoxFrame.cpp index 281ce625d6c..ed39330d638 100644 --- a/layout/xul/base/src/nsRootBoxFrame.cpp +++ b/layout/xul/base/src/nsRootBoxFrame.cpp @@ -149,7 +149,7 @@ nsRootBoxFrame::nsRootBoxFrame(nsIPresShell* aShell, nsStyleContext* aContext): { mPopupSetFrame = nsnull; - nsCOMPtr layout; + nsCOMPtr layout; NS_NewStackLayout(aShell, layout); SetLayoutManager(layout); } diff --git a/layout/xul/base/src/nsSprocketLayout.cpp b/layout/xul/base/src/nsSprocketLayout.cpp index 5ec8744ebcd..9fe12cb2a0e 100644 --- a/layout/xul/base/src/nsSprocketLayout.cpp +++ b/layout/xul/base/src/nsSprocketLayout.cpp @@ -54,7 +54,7 @@ #include "nsBoxFrame.h" #include "nsBoxFrame.h" -nsIBoxLayout* nsSprocketLayout::gInstance = nsnull; +nsBoxLayout* nsSprocketLayout::gInstance = nsnull; //#define DEBUG_GROW @@ -64,7 +64,7 @@ nsIBoxLayout* nsSprocketLayout::gInstance = nsnull; nsresult -NS_NewSprocketLayout( nsIPresShell* aPresShell, nsCOMPtr& aNewLayout) +NS_NewSprocketLayout( nsIPresShell* aPresShell, nsCOMPtr& aNewLayout) { if (!nsSprocketLayout::gInstance) { nsSprocketLayout::gInstance = new nsSprocketLayout(); diff --git a/layout/xul/base/src/nsSprocketLayout.h b/layout/xul/base/src/nsSprocketLayout.h index 87952301e75..b8b75432d76 100644 --- a/layout/xul/base/src/nsSprocketLayout.h +++ b/layout/xul/base/src/nsSprocketLayout.h @@ -89,13 +89,13 @@ public: #define SET_COORD(aX, aY, coord, isHorizontal) if (isHorizontal) { aX = (coord); } else { aY = (coord); } -nsresult NS_NewSprocketLayout(nsIPresShell* aPresShell, nsCOMPtr& aNewLayout); +nsresult NS_NewSprocketLayout(nsIPresShell* aPresShell, nsCOMPtr& aNewLayout); class nsSprocketLayout : public nsBoxLayout { public: - friend nsresult NS_NewSprocketLayout(nsIPresShell* aPresShell, nsCOMPtr& aNewLayout); + friend nsresult NS_NewSprocketLayout(nsIPresShell* aPresShell, nsCOMPtr& aNewLayout); static void Shutdown(); NS_IMETHOD Layout(nsIBox* aBox, nsBoxLayoutState& aState); @@ -162,8 +162,8 @@ private: // because the sprocket layout manager has no instance variables. We - // can make a static on and reuse it everywhere. - static nsIBoxLayout* gInstance; + // can make a static one and reuse it everywhere. + static nsBoxLayout* gInstance; }; diff --git a/layout/xul/base/src/nsStackFrame.cpp b/layout/xul/base/src/nsStackFrame.cpp index 1f3048056ed..0f1c77c4add 100644 --- a/layout/xul/base/src/nsStackFrame.cpp +++ b/layout/xul/base/src/nsStackFrame.cpp @@ -64,7 +64,7 @@ NS_IMPL_FRAMEARENA_HELPERS(nsStackFrame) nsStackFrame::nsStackFrame(nsIPresShell* aPresShell, nsStyleContext* aContext): nsBoxFrame(aPresShell, aContext) { - nsCOMPtr layout; + nsCOMPtr layout; NS_NewStackLayout(aPresShell, layout); SetLayoutManager(layout); } diff --git a/layout/xul/base/src/nsStackLayout.cpp b/layout/xul/base/src/nsStackLayout.cpp index 80a55205a0b..e58e982095a 100644 --- a/layout/xul/base/src/nsStackLayout.cpp +++ b/layout/xul/base/src/nsStackLayout.cpp @@ -52,7 +52,7 @@ #include "nsIContent.h" #include "nsINameSpaceManager.h" -nsIBoxLayout* nsStackLayout::gInstance = nsnull; +nsBoxLayout* nsStackLayout::gInstance = nsnull; #define SPECIFIED_LEFT (1 << NS_SIDE_LEFT) #define SPECIFIED_RIGHT (1 << NS_SIDE_RIGHT) @@ -60,7 +60,7 @@ nsIBoxLayout* nsStackLayout::gInstance = nsnull; #define SPECIFIED_BOTTOM (1 << NS_SIDE_BOTTOM) nsresult -NS_NewStackLayout( nsIPresShell* aPresShell, nsCOMPtr& aNewLayout) +NS_NewStackLayout( nsIPresShell* aPresShell, nsCOMPtr& aNewLayout) { if (!nsStackLayout::gInstance) { nsStackLayout::gInstance = new nsStackLayout(); diff --git a/layout/xul/base/src/nsStackLayout.h b/layout/xul/base/src/nsStackLayout.h index 81d21e2cc1c..4bdfaf894f7 100644 --- a/layout/xul/base/src/nsStackLayout.h +++ b/layout/xul/base/src/nsStackLayout.h @@ -50,13 +50,13 @@ #include "nsBoxLayout.h" #include "nsCOMPtr.h" -nsresult NS_NewStackLayout(nsIPresShell* aPresShell, nsCOMPtr& aNewLayout); +nsresult NS_NewStackLayout(nsIPresShell* aPresShell, nsCOMPtr& aNewLayout); class nsStackLayout : public nsBoxLayout { public: - friend nsresult NS_NewStackLayout(nsIPresShell* aPresShell, nsCOMPtr& aNewLayout); + friend nsresult NS_NewStackLayout(nsIPresShell* aPresShell, nsCOMPtr& aNewLayout); static void Shutdown(); nsStackLayout(); @@ -75,7 +75,7 @@ public: static PRUint8 GetOffset(nsBoxLayoutState& aState, nsIBox* aChild, nsMargin& aMargin); private: - static nsIBoxLayout* gInstance; + static nsBoxLayout* gInstance; }; // class nsStackLayout