/src/mozilla-central/layout/xul/grid/nsGridRowGroupFrame.cpp
Line | Count | Source (jump to first uncovered line) |
1 | | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
2 | | /* vim: set ts=8 sts=2 et sw=2 tw=80: */ |
3 | | /* This Source Code Form is subject to the terms of the Mozilla Public |
4 | | * License, v. 2.0. If a copy of the MPL was not distributed with this |
5 | | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
6 | | |
7 | | // |
8 | | // Eric Vaughan |
9 | | // Netscape Communications |
10 | | // |
11 | | // See documentation in associated header file |
12 | | // |
13 | | |
14 | | #include "nsGridRowGroupFrame.h" |
15 | | #include "nsGridRowLeafLayout.h" |
16 | | #include "nsGridRow.h" |
17 | | #include "nsBoxLayoutState.h" |
18 | | #include "nsGridLayout2.h" |
19 | | |
20 | | already_AddRefed<nsBoxLayout> NS_NewGridRowGroupLayout(); |
21 | | |
22 | | nsIFrame* |
23 | | NS_NewGridRowGroupFrame(nsIPresShell* aPresShell, |
24 | | ComputedStyle* aStyle) |
25 | 0 | { |
26 | 0 | nsCOMPtr<nsBoxLayout> layout = NS_NewGridRowGroupLayout(); |
27 | 0 | return new (aPresShell) nsGridRowGroupFrame(aStyle, layout); |
28 | 0 | } |
29 | | |
30 | | NS_IMPL_FRAMEARENA_HELPERS(nsGridRowGroupFrame) |
31 | | |
32 | | |
33 | | /** |
34 | | * This is redefined because row groups have a funny property. If they are flexible |
35 | | * then their flex must be equal to the sum of their children's flexes. |
36 | | */ |
37 | | nscoord |
38 | | nsGridRowGroupFrame::GetXULFlex() |
39 | 0 | { |
40 | 0 | // if we are flexible out flexibility is determined by our columns. |
41 | 0 | // so first get the our flex. If not 0 then our flex is the sum of |
42 | 0 | // our columns flexes. |
43 | 0 |
|
44 | 0 | if (!DoesNeedRecalc(mFlex)) |
45 | 0 | return mFlex; |
46 | 0 | |
47 | 0 | if (nsBoxFrame::GetXULFlex() == 0) |
48 | 0 | return 0; |
49 | 0 | |
50 | 0 | // ok we are flexible add up our children |
51 | 0 | nscoord totalFlex = 0; |
52 | 0 | nsIFrame* child = nsBox::GetChildXULBox(this); |
53 | 0 | while (child) |
54 | 0 | { |
55 | 0 | totalFlex += child->GetXULFlex(); |
56 | 0 | child = GetNextXULBox(child); |
57 | 0 | } |
58 | 0 |
|
59 | 0 | mFlex = totalFlex; |
60 | 0 |
|
61 | 0 | return totalFlex; |
62 | 0 | } |
63 | | |
64 | | |