1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef nsBoxLayout_h___
7 #define nsBoxLayout_h___
9 #include "nsISupports.h"
11 #include "nsFrameList.h"
14 class nsBoxLayoutState
;
18 #define NS_BOX_LAYOUT_IID \
19 { 0x09d522a7, 0x304c, 0x4137, \
20 { 0xaf, 0xc9, 0xe0, 0x80, 0x2e, 0x89, 0xb7, 0xe8 } }
24 class nsBoxLayout
: public nsISupports
{
27 virtual ~nsBoxLayout() {}
35 NS_DECLARE_STATIC_IID_ACCESSOR(NS_BOX_LAYOUT_IID
)
37 NS_IMETHOD
Layout(nsIFrame
* aBox
, nsBoxLayoutState
& aState
);
39 virtual nsSize
GetPrefSize(nsIFrame
* aBox
, nsBoxLayoutState
& aBoxLayoutState
);
40 virtual nsSize
GetMinSize(nsIFrame
* aBox
, nsBoxLayoutState
& aBoxLayoutState
);
41 virtual nsSize
GetMaxSize(nsIFrame
* aBox
, nsBoxLayoutState
& aBoxLayoutState
);
42 virtual nscoord
GetAscent(nsIFrame
* aBox
, nsBoxLayoutState
& aBoxLayoutState
);
43 virtual void ChildrenInserted(nsIFrame
* aBox
, nsBoxLayoutState
& aState
,
45 const nsFrameList::Slice
& aNewChildren
) {}
46 virtual void ChildrenAppended(nsIFrame
* aBox
, nsBoxLayoutState
& aState
,
47 const nsFrameList::Slice
& aNewChildren
) {}
48 virtual void ChildrenRemoved(nsIFrame
* aBox
, nsBoxLayoutState
& aState
, nsIFrame
* aChildList
) {}
49 virtual void ChildrenSet(nsIFrame
* aBox
, nsBoxLayoutState
& aState
, nsIFrame
* aChildList
) {}
50 virtual void IntrinsicISizesDirty(nsIFrame
* aBox
, nsBoxLayoutState
& aState
) {}
52 virtual void AddBorderAndPadding(nsIFrame
* aBox
, nsSize
& aSize
);
53 virtual void AddMargin(nsIFrame
* aChild
, nsSize
& aSize
);
54 virtual void AddMargin(nsSize
& aSize
, const nsMargin
& aMargin
);
56 virtual nsIGridPart
* AsGridPart() { return nullptr; }
58 static void AddLargestSize(nsSize
& aSize
, const nsSize
& aToAdd
);
59 static void AddSmallestSize(nsSize
& aSize
, const nsSize
& aToAdd
);
62 NS_DEFINE_STATIC_IID_ACCESSOR(nsBoxLayout
, NS_BOX_LAYOUT_IID
)