Line data Source code
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 "nsGridRowGroupFrame.h"
14 : #include "nsGridRowLeafLayout.h"
15 : #include "nsGridRow.h"
16 : #include "nsBoxLayoutState.h"
17 : #include "nsGridLayout2.h"
18 :
19 : already_AddRefed<nsBoxLayout> NS_NewGridRowGroupLayout();
20 :
21 : nsIFrame*
22 0 : NS_NewGridRowGroupFrame(nsIPresShell* aPresShell,
23 : nsStyleContext* aContext)
24 : {
25 0 : nsCOMPtr<nsBoxLayout> layout = NS_NewGridRowGroupLayout();
26 0 : return new (aPresShell) nsGridRowGroupFrame(aContext, layout);
27 : }
28 :
29 0 : NS_IMPL_FRAMEARENA_HELPERS(nsGridRowGroupFrame)
30 :
31 :
32 : /**
33 : * This is redefined because row groups have a funny property. If they are flexible
34 : * then their flex must be equal to the sum of their children's flexes.
35 : */
36 : nscoord
37 0 : nsGridRowGroupFrame::GetXULFlex()
38 : {
39 : // if we are flexible out flexibility is determined by our columns.
40 : // so first get the our flex. If not 0 then our flex is the sum of
41 : // our columns flexes.
42 :
43 0 : if (!DoesNeedRecalc(mFlex))
44 0 : return mFlex;
45 :
46 0 : if (nsBoxFrame::GetXULFlex() == 0)
47 0 : return 0;
48 :
49 : // ok we are flexible add up our children
50 0 : nscoord totalFlex = 0;
51 0 : nsIFrame* child = nsBox::GetChildXULBox(this);
52 0 : while (child)
53 : {
54 0 : totalFlex += child->GetXULFlex();
55 0 : child = GetNextXULBox(child);
56 : }
57 :
58 0 : mFlex = totalFlex;
59 :
60 0 : return totalFlex;
61 : }
62 :
63 :
|