gecko-dev/layout/xul/grid/nsGridRowGroupFrame.cpp

64 строки
1.6 KiB
C++
Исходник Обычный вид История

2001-10-20 00:47:36 +04:00
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2012-05-21 15:12:37 +04:00
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
2001-10-20 00:47:36 +04:00
//
// Eric Vaughan
// Netscape Communications
//
// See documentation in associated header file
//
#include "nsGridRowGroupFrame.h"
#include "nsGridRowLeafLayout.h"
#include "nsGridRow.h"
#include "nsBoxLayoutState.h"
#include "nsGridLayout2.h"
2011-07-11 18:05:10 +04:00
already_AddRefed<nsBoxLayout> NS_NewGridRowGroupLayout();
nsIFrame*
NS_NewGridRowGroupFrame(nsIPresShell* aPresShell,
nsStyleContext* aContext)
2001-10-20 00:47:36 +04:00
{
2011-07-11 18:05:10 +04:00
nsCOMPtr<nsBoxLayout> layout = NS_NewGridRowGroupLayout();
return new (aPresShell) nsGridRowGroupFrame(aContext, layout);
}
NS_IMPL_FRAMEARENA_HELPERS(nsGridRowGroupFrame)
2001-10-20 00:47:36 +04:00
/**
* This is redefined because row groups have a funny property. If they are flexible
* then their flex must be equal to the sum of their children's flexes.
*/
nscoord
nsGridRowGroupFrame::GetXULFlex()
2001-10-20 00:47:36 +04:00
{
// if we are flexible out flexibility is determined by our columns.
// so first get the our flex. If not 0 then our flex is the sum of
// our columns flexes.
if (!DoesNeedRecalc(mFlex))
return mFlex;
2001-10-20 00:47:36 +04:00
if (nsBoxFrame::GetXULFlex() == 0)
return 0;
2001-10-20 00:47:36 +04:00
// ok we are flexible add up our children
nscoord totalFlex = 0;
nsIFrame* child = nsBox::GetChildXULBox(this);
2001-10-20 00:47:36 +04:00
while (child)
{
totalFlex += child->GetXULFlex();
child = GetNextXULBox(child);
2001-10-20 00:47:36 +04:00
}
mFlex = totalFlex;
2001-10-20 00:47:36 +04:00
return totalFlex;
2001-10-20 00:47:36 +04:00
}