LCOV - code coverage report
Current view: top level - layout/xul/grid - nsGridCell.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 0 48 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 6 0.0 %
Legend: Lines: hit not hit

          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 "nsGridCell.h"
      14             : #include "nsFrame.h"
      15             : #include "nsBox.h"
      16             : #include "nsGridLayout2.h"
      17             : 
      18             : 
      19           0 : nsGridCell::nsGridCell():mBoxInColumn(nullptr),mBoxInRow(nullptr)
      20             : {
      21           0 :     MOZ_COUNT_CTOR(nsGridCell);
      22           0 : }
      23             : 
      24           0 : nsGridCell::~nsGridCell()
      25             : {
      26           0 :     MOZ_COUNT_DTOR(nsGridCell);
      27           0 : }
      28             : 
      29             : nsSize
      30           0 : nsGridCell::GetXULPrefSize(nsBoxLayoutState& aState)
      31             : {
      32           0 :   nsSize sum(0,0);
      33             : 
      34             :   // take our 2 children and add them up.
      35             :   // we are as wide as the widest child plus its left offset
      36             :   // we are tall as the tallest child plus its top offset
      37             : 
      38           0 :   if (mBoxInColumn) {
      39           0 :     nsSize pref = mBoxInColumn->GetXULPrefSize(aState);
      40             : 
      41           0 :     nsBox::AddMargin(mBoxInColumn, pref);
      42           0 :     nsGridLayout2::AddOffset(mBoxInColumn, pref);
      43             : 
      44           0 :     nsBoxLayout::AddLargestSize(sum, pref);
      45             :   }
      46             : 
      47           0 :   if (mBoxInRow) {
      48           0 :     nsSize pref = mBoxInRow->GetXULPrefSize(aState);
      49             : 
      50           0 :     nsBox::AddMargin(mBoxInRow, pref);
      51           0 :     nsGridLayout2::AddOffset(mBoxInRow, pref);
      52             : 
      53           0 :     nsBoxLayout::AddLargestSize(sum, pref);
      54             :   }
      55             : 
      56           0 :   return sum;
      57             : }
      58             : 
      59             : nsSize
      60           0 : nsGridCell::GetXULMinSize(nsBoxLayoutState& aState)
      61             : {
      62           0 :   nsSize sum(0, 0);
      63             : 
      64             :   // take our 2 children and add them up.
      65             :   // we are as wide as the widest child plus its left offset
      66             :   // we are tall as the tallest child plus its top offset
      67             : 
      68           0 :   if (mBoxInColumn) {
      69           0 :     nsSize min = mBoxInColumn->GetXULMinSize(aState);
      70             : 
      71           0 :     nsBox::AddMargin(mBoxInColumn, min);
      72           0 :     nsGridLayout2::AddOffset(mBoxInColumn, min);
      73             : 
      74           0 :     nsBoxLayout::AddLargestSize(sum, min);
      75             :   }
      76             : 
      77           0 :   if (mBoxInRow) {
      78           0 :     nsSize min = mBoxInRow->GetXULMinSize(aState);
      79             : 
      80           0 :     nsBox::AddMargin(mBoxInRow, min);
      81           0 :     nsGridLayout2::AddOffset(mBoxInRow, min);
      82             : 
      83           0 :     nsBoxLayout::AddLargestSize(sum, min);
      84             :   }
      85             : 
      86           0 :   return sum;
      87             : }
      88             : 
      89             : nsSize
      90           0 : nsGridCell::GetXULMaxSize(nsBoxLayoutState& aState)
      91             : {
      92           0 :   nsSize sum(NS_INTRINSICSIZE, NS_INTRINSICSIZE);
      93             : 
      94             :   // take our 2 children and add them up.
      95             :   // we are as wide as the smallest child plus its left offset
      96             :   // we are tall as the shortest child plus its top offset
      97             : 
      98           0 :   if (mBoxInColumn) {
      99           0 :     nsSize max = mBoxInColumn->GetXULMaxSize(aState);
     100             : 
     101           0 :     nsBox::AddMargin(mBoxInColumn, max);
     102           0 :     nsGridLayout2::AddOffset(mBoxInColumn, max);
     103             : 
     104           0 :     nsBoxLayout::AddSmallestSize(sum, max);
     105             :   }
     106             : 
     107           0 :   if (mBoxInRow) {
     108           0 :     nsSize max = mBoxInRow->GetXULMaxSize(aState);
     109             : 
     110           0 :     nsBox::AddMargin(mBoxInRow, max);
     111           0 :     nsGridLayout2::AddOffset(mBoxInRow, max);
     112             : 
     113           0 :     nsBoxLayout::AddSmallestSize(sum, max);
     114             :   }
     115             : 
     116           0 :   return sum;
     117             : }
     118             : 
     119             : 
     120             : bool
     121           0 : nsGridCell::IsXULCollapsed()
     122             : {
     123           0 :   return ((mBoxInColumn && mBoxInColumn->IsXULCollapsed()) ||
     124           0 :           (mBoxInRow && mBoxInRow->IsXULCollapsed()));
     125             : }
     126             : 
     127             : 

Generated by: LCOV version 1.13