|
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/. */ |
|
5 |
|
6 // |
|
7 // Eric Vaughan |
|
8 // Netscape Communications |
|
9 // |
|
10 // See documentation in associated header file |
|
11 // |
|
12 |
|
13 #include "nsBox.h" |
|
14 #include "nsCOMPtr.h" |
|
15 #include "nsContainerFrame.h" |
|
16 #include "nsBoxLayout.h" |
|
17 |
|
18 void |
|
19 nsBoxLayout::AddBorderAndPadding(nsIFrame* aBox, nsSize& aSize) |
|
20 { |
|
21 nsBox::AddBorderAndPadding(aBox, aSize); |
|
22 } |
|
23 |
|
24 void |
|
25 nsBoxLayout::AddMargin(nsIFrame* aBox, nsSize& aSize) |
|
26 { |
|
27 nsBox::AddMargin(aBox, aSize); |
|
28 } |
|
29 |
|
30 void |
|
31 nsBoxLayout::AddMargin(nsSize& aSize, const nsMargin& aMargin) |
|
32 { |
|
33 nsBox::AddMargin(aSize, aMargin); |
|
34 } |
|
35 |
|
36 nsSize |
|
37 nsBoxLayout::GetPrefSize(nsIFrame* aBox, nsBoxLayoutState& aBoxLayoutState) |
|
38 { |
|
39 nsSize pref (0, 0); |
|
40 AddBorderAndPadding(aBox, pref); |
|
41 |
|
42 return pref; |
|
43 } |
|
44 |
|
45 nsSize |
|
46 nsBoxLayout::GetMinSize(nsIFrame* aBox, nsBoxLayoutState& aBoxLayoutState) |
|
47 { |
|
48 nsSize minSize (0,0); |
|
49 AddBorderAndPadding(aBox, minSize); |
|
50 return minSize; |
|
51 } |
|
52 |
|
53 nsSize |
|
54 nsBoxLayout::GetMaxSize(nsIFrame* aBox, nsBoxLayoutState& aBoxLayoutState) |
|
55 { |
|
56 //AddBorderAndPadding () never changes maxSize (NS_INTRINSICSIZE) |
|
57 //AddBorderAndPadding(aBox, maxSize); |
|
58 return nsSize (NS_INTRINSICSIZE,NS_INTRINSICSIZE); |
|
59 } |
|
60 |
|
61 |
|
62 nscoord |
|
63 nsBoxLayout::GetAscent(nsIFrame* aBox, nsBoxLayoutState& aBoxLayoutState) |
|
64 { |
|
65 return 0; |
|
66 } |
|
67 |
|
68 NS_IMETHODIMP |
|
69 nsBoxLayout::Layout(nsIFrame* aBox, nsBoxLayoutState& aBoxLayoutState) |
|
70 { |
|
71 return NS_OK; |
|
72 } |
|
73 |
|
74 void |
|
75 nsBoxLayout::AddLargestSize(nsSize& aSize, const nsSize& aSize2) |
|
76 { |
|
77 if (aSize2.width > aSize.width) |
|
78 aSize.width = aSize2.width; |
|
79 |
|
80 if (aSize2.height > aSize.height) |
|
81 aSize.height = aSize2.height; |
|
82 } |
|
83 |
|
84 void |
|
85 nsBoxLayout::AddSmallestSize(nsSize& aSize, const nsSize& aSize2) |
|
86 { |
|
87 if (aSize2.width < aSize.width) |
|
88 aSize.width = aSize2.width; |
|
89 |
|
90 if (aSize2.height < aSize.height) |
|
91 aSize.height = aSize2.height; |
|
92 } |
|
93 |
|
94 NS_IMPL_ISUPPORTS(nsBoxLayout, nsBoxLayout) |