Thu, 15 Jan 2015 21:03:48 +0100
Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)
michael@0 | 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | // |
michael@0 | 7 | // Eric Vaughan |
michael@0 | 8 | // Netscape Communications |
michael@0 | 9 | // |
michael@0 | 10 | // See documentation in associated header file |
michael@0 | 11 | // |
michael@0 | 12 | |
michael@0 | 13 | #include "nsGridRowGroupFrame.h" |
michael@0 | 14 | #include "nsGridRowLeafLayout.h" |
michael@0 | 15 | #include "nsGridRow.h" |
michael@0 | 16 | #include "nsBoxLayoutState.h" |
michael@0 | 17 | #include "nsGridLayout2.h" |
michael@0 | 18 | |
michael@0 | 19 | already_AddRefed<nsBoxLayout> NS_NewGridRowGroupLayout(); |
michael@0 | 20 | |
michael@0 | 21 | nsIFrame* |
michael@0 | 22 | NS_NewGridRowGroupFrame(nsIPresShell* aPresShell, |
michael@0 | 23 | nsStyleContext* aContext) |
michael@0 | 24 | { |
michael@0 | 25 | nsCOMPtr<nsBoxLayout> layout = NS_NewGridRowGroupLayout(); |
michael@0 | 26 | return new (aPresShell) nsGridRowGroupFrame(aPresShell, aContext, layout); |
michael@0 | 27 | } |
michael@0 | 28 | |
michael@0 | 29 | NS_IMPL_FRAMEARENA_HELPERS(nsGridRowGroupFrame) |
michael@0 | 30 | |
michael@0 | 31 | |
michael@0 | 32 | /** |
michael@0 | 33 | * This is redefined because row groups have a funny property. If they are flexible |
michael@0 | 34 | * then their flex must be equal to the sum of their children's flexes. |
michael@0 | 35 | */ |
michael@0 | 36 | nscoord |
michael@0 | 37 | nsGridRowGroupFrame::GetFlex(nsBoxLayoutState& aState) |
michael@0 | 38 | { |
michael@0 | 39 | // if we are flexible out flexibility is determined by our columns. |
michael@0 | 40 | // so first get the our flex. If not 0 then our flex is the sum of |
michael@0 | 41 | // our columns flexes. |
michael@0 | 42 | |
michael@0 | 43 | if (!DoesNeedRecalc(mFlex)) |
michael@0 | 44 | return mFlex; |
michael@0 | 45 | |
michael@0 | 46 | if (nsBoxFrame::GetFlex(aState) == 0) |
michael@0 | 47 | return 0; |
michael@0 | 48 | |
michael@0 | 49 | // ok we are flexible add up our children |
michael@0 | 50 | nscoord totalFlex = 0; |
michael@0 | 51 | nsIFrame* child = GetChildBox(); |
michael@0 | 52 | while (child) |
michael@0 | 53 | { |
michael@0 | 54 | totalFlex += child->GetFlex(aState); |
michael@0 | 55 | child = child->GetNextBox(); |
michael@0 | 56 | } |
michael@0 | 57 | |
michael@0 | 58 | mFlex = totalFlex; |
michael@0 | 59 | |
michael@0 | 60 | return totalFlex; |
michael@0 | 61 | } |
michael@0 | 62 | |
michael@0 | 63 |