layout/xul/grid/nsGridRowGroupFrame.cpp

Wed, 31 Dec 2014 07:22:50 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 07:22:50 +0100
branch
TOR_BUG_3246
changeset 4
fc2d59ddac77
permissions
-rw-r--r--

Correct previous dual key logic pending first delivery installment.

     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/. */
     6 //
     7 // Eric Vaughan
     8 // Netscape Communications
     9 //
    10 // See documentation in associated header file
    11 //
    13 #include "nsGridRowGroupFrame.h"
    14 #include "nsGridRowLeafLayout.h"
    15 #include "nsGridRow.h"
    16 #include "nsBoxLayoutState.h"
    17 #include "nsGridLayout2.h"
    19 already_AddRefed<nsBoxLayout> NS_NewGridRowGroupLayout();
    21 nsIFrame*
    22 NS_NewGridRowGroupFrame(nsIPresShell* aPresShell,
    23                         nsStyleContext* aContext)
    24 {
    25   nsCOMPtr<nsBoxLayout> layout = NS_NewGridRowGroupLayout();
    26   return new (aPresShell) nsGridRowGroupFrame(aPresShell, aContext, layout);
    27 }
    29 NS_IMPL_FRAMEARENA_HELPERS(nsGridRowGroupFrame)
    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 nsGridRowGroupFrame::GetFlex(nsBoxLayoutState& aState)
    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.
    43   if (!DoesNeedRecalc(mFlex))
    44      return mFlex;
    46   if (nsBoxFrame::GetFlex(aState) == 0)
    47     return 0;
    49   // ok we are flexible add up our children
    50   nscoord totalFlex = 0;
    51   nsIFrame* child = GetChildBox();
    52   while (child)
    53   {
    54     totalFlex += child->GetFlex(aState);
    55     child = child->GetNextBox();
    56   }
    58   mFlex = totalFlex;
    60   return totalFlex;
    61 }

mercurial