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/. */
8 // Netscape Communications
10 // See documentation in associated header file
15 #include "nsContainerFrame.h"
16 #include "nsBoxLayout.h"
19 nsBoxLayout::AddBorderAndPadding(nsIFrame
* aBox
, nsSize
& aSize
)
21 nsBox::AddBorderAndPadding(aBox
, aSize
);
25 nsBoxLayout::AddMargin(nsIFrame
* aBox
, nsSize
& aSize
)
27 nsBox::AddMargin(aBox
, aSize
);
31 nsBoxLayout::AddMargin(nsSize
& aSize
, const nsMargin
& aMargin
)
33 nsBox::AddMargin(aSize
, aMargin
);
37 nsBoxLayout::GetPrefSize(nsIFrame
* aBox
, nsBoxLayoutState
& aBoxLayoutState
)
40 AddBorderAndPadding(aBox
, pref
);
46 nsBoxLayout::GetMinSize(nsIFrame
* aBox
, nsBoxLayoutState
& aBoxLayoutState
)
49 AddBorderAndPadding(aBox
, minSize
);
54 nsBoxLayout::GetMaxSize(nsIFrame
* aBox
, nsBoxLayoutState
& aBoxLayoutState
)
56 //AddBorderAndPadding () never changes maxSize (NS_INTRINSICSIZE)
57 //AddBorderAndPadding(aBox, maxSize);
58 return nsSize (NS_INTRINSICSIZE
,NS_INTRINSICSIZE
);
63 nsBoxLayout::GetAscent(nsIFrame
* aBox
, nsBoxLayoutState
& aBoxLayoutState
)
69 nsBoxLayout::Layout(nsIFrame
* aBox
, nsBoxLayoutState
& aBoxLayoutState
)
75 nsBoxLayout::AddLargestSize(nsSize
& aSize
, const nsSize
& aSize2
)
77 if (aSize2
.width
> aSize
.width
)
78 aSize
.width
= aSize2
.width
;
80 if (aSize2
.height
> aSize
.height
)
81 aSize
.height
= aSize2
.height
;
85 nsBoxLayout::AddSmallestSize(nsSize
& aSize
, const nsSize
& aSize2
)
87 if (aSize2
.width
< aSize
.width
)
88 aSize
.width
= aSize2
.width
;
90 if (aSize2
.height
< aSize
.height
)
91 aSize
.height
= aSize2
.height
;
94 NS_IMPL_ISUPPORTS(nsBoxLayout
, nsBoxLayout
)