Bug 473390 part 11. Make some of the nsIBoxLayout constructors have nicer signatures. r+sr=roc

This commit is contained in:
Boris Zbarsky 2009-01-19 13:31:33 -05:00
parent f3a2fedf99
commit 0ae5192503
12 changed files with 30 additions and 46 deletions

View File

@ -48,15 +48,13 @@
#include "nsBoxLayoutState.h"
#include "nsGridLayout2.h"
nsresult
NS_NewGridRowGroupLayout(nsIPresShell* aPresShell, nsIBoxLayout** aNewLayout);
already_AddRefed<nsIBoxLayout> NS_NewGridRowGroupLayout();
nsIFrame*
NS_NewGridRowGroupFrame(nsIPresShell* aPresShell,
nsStyleContext* aContext)
{
nsCOMPtr<nsIBoxLayout> layout;
NS_NewGridRowGroupLayout(aPresShell, getter_AddRefs(layout));
nsCOMPtr<nsIBoxLayout> layout = NS_NewGridRowGroupLayout();
if (!layout) {
return nsnull;
}

View File

@ -54,17 +54,14 @@
#include "nsGridLayout2.h"
#include "nsGridRow.h"
nsresult
NS_NewGridRowGroupLayout( nsIPresShell* aPresShell, nsIBoxLayout** aNewLayout)
already_AddRefed<nsIBoxLayout> NS_NewGridRowGroupLayout()
{
*aNewLayout = new nsGridRowGroupLayout(aPresShell);
NS_IF_ADDREF(*aNewLayout);
return NS_OK;
nsIBoxLayout* layout = new nsGridRowGroupLayout();
NS_IF_ADDREF(layout);
return layout;
}
nsGridRowGroupLayout::nsGridRowGroupLayout(nsIPresShell* aPresShell):nsGridRowLayout(aPresShell), mRowCount(0)
nsGridRowGroupLayout::nsGridRowGroupLayout():nsGridRowLayout(), mRowCount(0)
{
}

View File

@ -54,7 +54,7 @@ class nsGridRowGroupLayout : public nsGridRowLayout
{
public:
friend nsresult NS_NewGridRowGroupLayout(nsIPresShell* aPresShell, nsIBoxLayout** aNewLayout);
friend already_AddRefed<nsIBoxLayout> NS_NewGridRowGroupLayout();
virtual nsGridRowGroupLayout* CastToRowGroupLayout() { return this; }
virtual nsSize GetMinSize(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState);
@ -68,7 +68,7 @@ public:
virtual Type GetType() { return eRowGroup; }
protected:
nsGridRowGroupLayout(nsIPresShell* aShell);
nsGridRowGroupLayout();
virtual ~nsGridRowGroupLayout();
virtual void ChildAddedOrRemoved(nsIBox* aBox, nsBoxLayoutState& aState);

View File

@ -49,7 +49,7 @@
#include "nsStackLayout.h"
#include "nsGrid.h"
nsGridRowLayout::nsGridRowLayout(nsIPresShell* aPresShell):nsSprocketLayout()
nsGridRowLayout::nsGridRowLayout():nsSprocketLayout()
{
}

View File

@ -79,7 +79,7 @@ public:
protected:
virtual void ChildAddedOrRemoved(nsIBox* aBox, nsBoxLayoutState& aState)=0;
nsGridRowLayout(nsIPresShell* aShell);
nsGridRowLayout();
};
#endif

View File

@ -48,15 +48,13 @@
#include "nsBoxLayoutState.h"
#include "nsGridLayout2.h"
nsresult
NS_NewGridRowLeafLayout(nsIPresShell* aPresShell, nsIBoxLayout** aNewLayout);
already_AddRefed<nsIBoxLayout> NS_NewGridRowLeafLayout();
nsIFrame*
NS_NewGridRowLeafFrame(nsIPresShell* aPresShell,
nsStyleContext* aContext)
{
nsCOMPtr<nsIBoxLayout> layout;
NS_NewGridRowLeafLayout(aPresShell, getter_AddRefs(layout));
nsCOMPtr<nsIBoxLayout> layout = NS_NewGridRowLeafLayout();
if (!layout) {
return nsnull;
}

View File

@ -51,17 +51,14 @@
#include "nsBoxFrame.h"
#include "nsGridLayout2.h"
nsresult
NS_NewGridRowLeafLayout( nsIPresShell* aPresShell, nsIBoxLayout** aNewLayout)
already_AddRefed<nsIBoxLayout> NS_NewGridRowLeafLayout()
{
*aNewLayout = new nsGridRowLeafLayout(aPresShell);
NS_IF_ADDREF(*aNewLayout);
return NS_OK;
nsIBoxLayout* layout = new nsGridRowLeafLayout();
NS_IF_ADDREF(layout);
return layout;
}
nsGridRowLeafLayout::nsGridRowLeafLayout(nsIPresShell* aPresShell):nsGridRowLayout(aPresShell)
nsGridRowLeafLayout::nsGridRowLeafLayout():nsGridRowLayout()
{
}

View File

@ -57,7 +57,7 @@ class nsGridRowLeafLayout : public nsGridRowLayout
{
public:
friend nsresult NS_NewGridRowLeafLayout(nsIPresShell* aPresShell, nsIBoxLayout** aNewLayout);
friend already_AddRefed<nsIBoxLayout> NS_NewGridRowLeafLayout();
virtual nsSize GetPrefSize(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState);
virtual nsSize GetMinSize(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState);
@ -79,7 +79,7 @@ protected:
nsComputedBoxSize*& aComputedBoxSizes);
nsGridRowLeafLayout(nsIPresShell* aShell);
nsGridRowLeafLayout();
virtual ~nsGridRowLeafLayout();
//virtual void AddBorderAndPadding(nsIBox* aBox, nsSize& aSize);

View File

@ -1496,14 +1496,12 @@ nsListBoxBodyFrame::RemoveChildFrame(nsBoxLayoutState &aState,
// Creation Routines ///////////////////////////////////////////////////////////////////////
nsresult
NS_NewListBoxLayout ( nsIPresShell* aPresShell, nsCOMPtr<nsIBoxLayout>& aNewLayout );
already_AddRefed<nsIBoxLayout> NS_NewListBoxLayout();
nsIFrame*
NS_NewListBoxBodyFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
{
nsCOMPtr<nsIBoxLayout> layout;
NS_NewListBoxLayout(aPresShell, layout);
nsCOMPtr<nsIBoxLayout> layout = NS_NewListBoxLayout();
if (!layout) {
return nsnull;
}

View File

@ -49,8 +49,7 @@
#include "nsGkAtoms.h"
#include "nsContentUtils.h"
nsListBoxLayout::nsListBoxLayout(nsIPresShell* aPresShell)
: nsGridRowGroupLayout(aPresShell)
nsListBoxLayout::nsListBoxLayout() : nsGridRowGroupLayout()
{
}
@ -262,10 +261,9 @@ nsListBoxLayout::LayoutInternal(nsIBox* aBox, nsBoxLayoutState& aState)
// Creation Routines ///////////////////////////////////////////////////////////////////////
nsresult
NS_NewListBoxLayout( nsIPresShell* aPresShell, nsCOMPtr<nsIBoxLayout>& aNewLayout)
already_AddRefed<nsIBoxLayout> NS_NewListBoxLayout()
{
aNewLayout = new nsListBoxLayout(aPresShell);
return NS_OK;
nsIBoxLayout* layout = new nsListBoxLayout();
NS_IF_ADDREF(layout);
return layout;
}

View File

@ -48,7 +48,7 @@ class nsBoxLayoutState;
class nsListBoxLayout : public nsGridRowGroupLayout
{
public:
nsListBoxLayout(nsIPresShell* aShell);
nsListBoxLayout();
// nsIBoxLayout
NS_IMETHOD Layout(nsIBox* aBox, nsBoxLayoutState& aState);

View File

@ -85,14 +85,12 @@ nsListItemFrame::BuildDisplayListForChildren(nsDisplayListBuilder* aBuilder,
// Creation Routine ///////////////////////////////////////////////////////////////////////
nsresult
NS_NewGridRowLeafLayout(nsIPresShell* aPresShell, nsIBoxLayout** aNewLayout);
already_AddRefed<nsIBoxLayout> NS_NewGridRowLeafLayout();
nsIFrame*
NS_NewListItemFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
{
nsCOMPtr<nsIBoxLayout> layout;
NS_NewGridRowLeafLayout(aPresShell, getter_AddRefs(layout));
nsCOMPtr<nsIBoxLayout> layout = NS_NewGridRowLeafLayout();
if (!layout) {
return nsnull;
}