~ubuntu-branches/ubuntu/precise/kompozer/precise

« back to all changes in this revision

Viewing changes to mozilla/layout/xul/base/src/nsBoxLayout.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Anthony Yarusso
  • Date: 2007-08-27 01:11:03 UTC
  • Revision ID: james.westby@ubuntu.com-20070827011103-2jgf4s6532gqu2ka
Tags: upstream-0.7.10
ImportĀ upstreamĀ versionĀ 0.7.10

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 
2
/* ***** BEGIN LICENSE BLOCK *****
 
3
 * Version: NPL 1.1/GPL 2.0/LGPL 2.1
 
4
 *
 
5
 * The contents of this file are subject to the Netscape Public License
 
6
 * Version 1.1 (the "License"); you may not use this file except in
 
7
 * compliance with the License. You may obtain a copy of the License at
 
8
 * http://www.mozilla.org/NPL/
 
9
 *
 
10
 * Software distributed under the License is distributed on an "AS IS" basis,
 
11
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
 
12
 * for the specific language governing rights and limitations under the
 
13
 * License.
 
14
 *
 
15
 * The Original Code is Mozilla Communicator client code.
 
16
 *
 
17
 * The Initial Developer of the Original Code is 
 
18
 * Netscape Communications Corporation.
 
19
 * Portions created by the Initial Developer are Copyright (C) 1998
 
20
 * the Initial Developer. All Rights Reserved.
 
21
 *
 
22
 * Contributor(s):
 
23
 *   Pierre Phaneuf <pp@ludusdesign.com>
 
24
 *
 
25
 * Alternatively, the contents of this file may be used under the terms of
 
26
 * either the GNU General Public License Version 2 or later (the "GPL"), or 
 
27
 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
 
28
 * in which case the provisions of the GPL or the LGPL are applicable instead
 
29
 * of those above. If you wish to allow use of your version of this file only
 
30
 * under the terms of either the GPL or the LGPL, and not to allow others to
 
31
 * use your version of this file under the terms of the NPL, indicate your
 
32
 * decision by deleting the provisions above and replace them with the notice
 
33
 * and other provisions required by the GPL or the LGPL. If you do not delete
 
34
 * the provisions above, a recipient may use your version of this file under
 
35
 * the terms of any one of the NPL, the GPL or the LGPL.
 
36
 *
 
37
 * ***** END LICENSE BLOCK ***** */
 
38
 
 
39
//
 
40
// Eric Vaughan
 
41
// Netscape Communications
 
42
//
 
43
// See documentation in associated header file
 
44
//
 
45
 
 
46
#include "nsBox.h"
 
47
#include "nsIPresContext.h"
 
48
#include "nsCOMPtr.h"
 
49
#include "nsIContent.h"
 
50
#include "nsIViewManager.h"
 
51
#include "nsIView.h"
 
52
#include "nsIPresShell.h"
 
53
#include "nsHTMLContainerFrame.h"
 
54
#include "nsIFrame.h"
 
55
#include "nsBoxLayout.h"
 
56
 
 
57
nsBoxLayout::nsBoxLayout()
 
58
{
 
59
}
 
60
 
 
61
void
 
62
nsBoxLayout::GetParentLayout(nsIBox* aBox, nsIBoxLayout** aParent)
 
63
{
 
64
  nsIBox* parent = nsnull;
 
65
  aBox->GetParentBox(&parent);
 
66
  if (parent)
 
67
  {
 
68
    parent->GetLayoutManager(aParent);
 
69
    return;
 
70
  }
 
71
 
 
72
  *aParent = nsnull;
 
73
}
 
74
 
 
75
void
 
76
nsBoxLayout::AddBorderAndPadding(nsIBox* aBox, nsSize& aSize)
 
77
{
 
78
  nsBox::AddBorderAndPadding(aBox, aSize);
 
79
}
 
80
 
 
81
void
 
82
nsBoxLayout::AddMargin(nsIBox* aBox, nsSize& aSize)
 
83
{
 
84
  nsBox::AddMargin(aBox, aSize);
 
85
}
 
86
 
 
87
void
 
88
nsBoxLayout::AddMargin(nsSize& aSize, const nsMargin& aMargin)
 
89
{
 
90
  nsBox::AddMargin(aSize, aMargin);
 
91
}
 
92
 
 
93
void
 
94
nsBoxLayout::AddInset(nsIBox* aBox, nsSize& aSize)
 
95
{
 
96
  nsBox::AddInset(aBox, aSize);
 
97
}
 
98
 
 
99
NS_IMETHODIMP
 
100
nsBoxLayout::GetFlex(nsIBox* aBox, nsBoxLayoutState& aState, nscoord& aFlex)
 
101
{
 
102
  return aBox->GetFlex(aState, aFlex);
 
103
}
 
104
 
 
105
 
 
106
NS_IMETHODIMP
 
107
nsBoxLayout::IsCollapsed(nsIBox* aBox, nsBoxLayoutState& aState, PRBool& aCollapsed)
 
108
{
 
109
  return aBox->IsCollapsed(aState, aCollapsed);
 
110
}
 
111
 
 
112
NS_IMETHODIMP
 
113
nsBoxLayout::GetPrefSize(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState, nsSize& aSize)
 
114
{
 
115
  aSize.width = 0;
 
116
  aSize.height = 0;
 
117
  AddBorderAndPadding(aBox, aSize);
 
118
  AddInset(aBox, aSize);
 
119
 
 
120
  return NS_OK;
 
121
}
 
122
 
 
123
NS_IMETHODIMP
 
124
nsBoxLayout::GetMinSize(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState, nsSize& aSize)
 
125
{
 
126
  aSize.width = 0;
 
127
  aSize.height = 0;
 
128
  AddBorderAndPadding(aBox, aSize);
 
129
  AddInset(aBox, aSize);
 
130
  return NS_OK;
 
131
}
 
132
 
 
133
NS_IMETHODIMP
 
134
nsBoxLayout::GetMaxSize(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState, nsSize& aSize)
 
135
{
 
136
  aSize.width = NS_INTRINSICSIZE;
 
137
  aSize.height = NS_INTRINSICSIZE;
 
138
  AddBorderAndPadding(aBox, aSize);
 
139
  AddInset(aBox, aSize);
 
140
  return NS_OK;
 
141
}
 
142
 
 
143
 
 
144
NS_IMETHODIMP
 
145
nsBoxLayout::GetAscent(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState, nscoord& aAscent)
 
146
{
 
147
  aAscent = 0;
 
148
  return NS_OK;
 
149
}
 
150
 
 
151
 
 
152
NS_IMETHODIMP
 
153
nsBoxLayout::Layout(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState)
 
154
{
 
155
  return NS_OK;
 
156
}
 
157
 
 
158
void
 
159
nsBoxLayout::AddLargestSize(nsSize& aSize, const nsSize& aSize2)
 
160
{
 
161
  if (aSize2.width > aSize.width)
 
162
     aSize.width = aSize2.width;
 
163
 
 
164
  if (aSize2.height > aSize.height)
 
165
     aSize.height = aSize2.height;
 
166
}
 
167
 
 
168
void
 
169
nsBoxLayout::AddSmallestSize(nsSize& aSize, const nsSize& aSize2)
 
170
{
 
171
  if (aSize2.width < aSize.width)
 
172
     aSize.width = aSize2.width;
 
173
 
 
174
  if (aSize2.height < aSize.height)
 
175
     aSize.height = aSize2.height;
 
176
}
 
177
 
 
178
NS_IMETHODIMP
 
179
nsBoxLayout::ChildrenInserted(nsIBox* aBox, nsBoxLayoutState& aState, nsIBox* aPrevBox, nsIBox* aChildList)
 
180
{
 
181
  return NS_OK;
 
182
}
 
183
 
 
184
NS_IMETHODIMP
 
185
nsBoxLayout::ChildrenAppended(nsIBox* aBox, nsBoxLayoutState& aState, nsIBox* aChildList)
 
186
{
 
187
  return NS_OK;
 
188
}
 
189
 
 
190
NS_IMETHODIMP
 
191
nsBoxLayout::ChildrenRemoved(nsIBox* aBox, nsBoxLayoutState& aState, nsIBox* aChildList)
 
192
{
 
193
  return NS_OK;
 
194
}
 
195
 
 
196
NS_IMETHODIMP
 
197
nsBoxLayout::ChildrenSet(nsIBox* aBox, nsBoxLayoutState& aState, nsIBox* aChildList)
 
198
{
 
199
  return NS_OK;
 
200
}
 
201
 
 
202
NS_IMETHODIMP
 
203
nsBoxLayout::ChildBecameDirty(nsIBox* aBox, nsBoxLayoutState& aState, nsIBox* aChild)
 
204
{
 
205
  return NS_OK;
 
206
}
 
207
 
 
208
NS_IMETHODIMP
 
209
nsBoxLayout::BecameDirty(nsIBox* aBox, nsBoxLayoutState& aState)
 
210
{
 
211
  return NS_OK;
 
212
}
 
213
 
 
214
// nsISupports
 
215
NS_IMPL_ADDREF(nsBoxLayout)
 
216
NS_IMPL_RELEASE(nsBoxLayout)
 
217
 
 
218
//
 
219
// QueryInterface
 
220
//
 
221
NS_INTERFACE_MAP_BEGIN(nsBoxLayout)
 
222
  NS_INTERFACE_MAP_ENTRY(nsIBoxLayout)
 
223
  NS_INTERFACE_MAP_ENTRY(nsISupports)
 
224
NS_INTERFACE_MAP_END