LCOV - code coverage report
Current view: top level - layout/xul/grid - nsGridRowLeafFrame.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 0 38 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 3 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 "nsGridRowLeafFrame.h"
      14             : #include "nsGridRowLeafLayout.h"
      15             : #include "nsGridRow.h"
      16             : #include "nsBoxLayoutState.h"
      17             : #include "nsGridLayout2.h"
      18             : 
      19             : already_AddRefed<nsBoxLayout> NS_NewGridRowLeafLayout();
      20             : 
      21             : nsIFrame*
      22           0 : NS_NewGridRowLeafFrame(nsIPresShell* aPresShell,
      23             :                        nsStyleContext* aContext)
      24             : {
      25           0 :   nsCOMPtr<nsBoxLayout> layout = NS_NewGridRowLeafLayout();
      26           0 :   return new (aPresShell) nsGridRowLeafFrame(aContext, false, layout);
      27             : }
      28             : 
      29           0 : NS_IMPL_FRAMEARENA_HELPERS(nsGridRowLeafFrame)
      30             : 
      31             : /*
      32             :  * Our border and padding could be affected by our columns or rows.
      33             :  * Let's go check it out.
      34             :  */
      35             : nsresult
      36           0 : nsGridRowLeafFrame::GetXULBorderAndPadding(nsMargin& aBorderAndPadding)
      37             : {
      38             :   // if our columns have made our padding larger add it in.
      39           0 :   nsresult rv = nsBoxFrame::GetXULBorderAndPadding(aBorderAndPadding);
      40             : 
      41           0 :   nsIGridPart* part = nsGrid::GetPartFromBox(this);
      42           0 :   if (!part)
      43           0 :     return rv;
      44             : 
      45           0 :   int32_t index = 0;
      46           0 :   nsGrid* grid = part->GetGrid(this, &index);
      47             : 
      48           0 :   if (!grid)
      49           0 :     return rv;
      50             : 
      51           0 :   bool isHorizontal = IsXULHorizontal();
      52             : 
      53           0 :   int32_t firstIndex = 0;
      54           0 :   int32_t lastIndex = 0;
      55           0 :   nsGridRow* firstRow = nullptr;
      56           0 :   nsGridRow* lastRow = nullptr;
      57           0 :   grid->GetFirstAndLastRow(firstIndex, lastIndex, firstRow, lastRow, isHorizontal);
      58             : 
      59             :   // only the first and last rows can be affected.
      60           0 :   if (firstRow && firstRow->GetBox() == this) {
      61             : 
      62           0 :     nscoord top = 0;
      63           0 :     nscoord bottom = 0;
      64           0 :     grid->GetRowOffsets(firstIndex, top, bottom, isHorizontal);
      65             : 
      66           0 :     if (isHorizontal) {
      67           0 :       if (top > aBorderAndPadding.top)
      68           0 :         aBorderAndPadding.top = top;
      69             :     } else {
      70           0 :       if (top > aBorderAndPadding.left)
      71           0 :         aBorderAndPadding.left = top;
      72             :     }
      73             :   }
      74             : 
      75           0 :   if (lastRow && lastRow->GetBox() == this) {
      76             : 
      77           0 :     nscoord top = 0;
      78           0 :     nscoord bottom = 0;
      79           0 :     grid->GetRowOffsets(lastIndex, top, bottom, isHorizontal);
      80             : 
      81           0 :     if (isHorizontal) {
      82           0 :       if (bottom > aBorderAndPadding.bottom)
      83           0 :         aBorderAndPadding.bottom = bottom;
      84             :     } else {
      85           0 :       if (bottom > aBorderAndPadding.right)
      86           0 :         aBorderAndPadding.right = bottom;
      87             :     }
      88             : 
      89             :   }
      90             : 
      91           0 :   return rv;
      92             : }
      93             : 
      94             : 

Generated by: LCOV version 1.13