Coverage Report

Created: 2018-09-25 14:53

/src/mozilla-central/layout/xul/grid/nsIGridPart.h
Line
Count
Source (jump to first uncovered line)
1
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
3
/* This Source Code Form is subject to the terms of the Mozilla Public
4
 * License, v. 2.0. If a copy of the MPL was not distributed with this
5
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6
7
#ifndef nsIGridPart_h___
8
#define nsIGridPart_h___
9
10
#include "nsISupports.h"
11
12
class nsGridRowGroupLayout;
13
class nsGrid;
14
class nsGridRowLayout;
15
class nsGridRow;
16
class nsGridLayout2;
17
18
// 07373ed7-e947-4a5e-b36c-69f7c195677b
19
#define NS_IGRIDPART_IID \
20
{ 0x07373ed7, 0xe947, 0x4a5e, \
21
  { 0xb3, 0x6c, 0x69, 0xf7, 0xc1, 0x95, 0x67, 0x7b } }
22
23
/**
24
 * An additional interface implemented by nsBoxLayout implementations
25
 * for parts of a grid (excluding cells, which are not special).
26
 */
27
class nsIGridPart : public nsISupports {
28
29
public:
30
31
  NS_DECLARE_STATIC_IID_ACCESSOR(NS_IGRIDPART_IID)
32
33
  virtual nsGridRowGroupLayout* CastToRowGroupLayout()=0;
34
  virtual nsGridLayout2* CastToGridLayout()=0;
35
36
  /**
37
   * @param aBox [IN] The other half of the |this| parameter, i.e., the box
38
   *                  whose layout manager is |this|.
39
   * @param aIndex [INOUT] For callers not setting aRequestor, the value
40
   *                       pointed to by aIndex is incremented by the index
41
   *                       of the row (aBox) within its row group; if aBox
42
   *                       is not a row/column, it is untouched.
43
   *                       The implementation does this by doing the aIndex
44
   *                       incrementing in the call to the parent row group
45
   *                       when aRequestor is non-null.
46
   * @param aRequestor [IN] Non-null if and only if this is a recursive
47
   *                   call from the GetGrid method on a child grid part,
48
   *                   in which case it is a pointer to that grid part.
49
   *                   (This may only be non-null for row groups and
50
   *                   grids.)
51
   * @return The grid of which aBox (a row, row group, or grid) is a part.
52
   */
53
  virtual nsGrid* GetGrid(nsIFrame* aBox, int32_t* aIndex, nsGridRowLayout* aRequestor=nullptr)=0;
54
55
  /**
56
   * @param aBox [IN] The other half of the |this| parameter, i.e., the box
57
   *                  whose layout manager is |this|.
58
   * @param aParentBox [OUT] The box representing the next level up in
59
   *                   the grid (i.e., row group for a row, grid for a
60
   *                   row group).
61
   * @returns The layout manager for aParentBox.
62
   */
63
  virtual nsIGridPart* GetParentGridPart(nsIFrame* aBox, nsIFrame** aParentBox) = 0;
64
65
  /**
66
   * @param aBox [IN] The other half of the |this| parameter, i.e., the box
67
   *                  whose layout manager is |this|.
68
   * @param aRowCount [INOUT] Row count
69
   * @param aComputedColumnCount [INOUT] Column count
70
   */
71
  virtual void CountRowsColumns(nsIFrame* aBox, int32_t& aRowCount, int32_t& aComputedColumnCount)=0;
72
  virtual void DirtyRows(nsIFrame* aBox, nsBoxLayoutState& aState)=0;
73
  virtual int32_t BuildRows(nsIFrame* aBox, nsGridRow* aRows)=0;
74
  virtual nsMargin GetTotalMargin(nsIFrame* aBox, bool aIsHorizontal)=0;
75
0
  virtual int32_t GetRowCount() { return 1; }
76
77
  /**
78
   * Return the level of the grid hierarchy this grid part represents.
79
   */
80
  enum Type { eGrid, eRowGroup, eRowLeaf };
81
  virtual Type GetType()=0;
82
83
  /**
84
   * Return whether this grid part is an appropriate parent for the argument.
85
   */
86
0
  bool CanContain(nsIGridPart* aPossibleChild) {
87
0
    Type thisType = GetType(), childType = aPossibleChild->GetType();
88
0
    return thisType + 1 == childType || (thisType == eRowGroup && childType == eRowGroup);
89
0
  }
90
91
};
92
93
NS_DEFINE_STATIC_IID_ACCESSOR(nsIGridPart, NS_IGRIDPART_IID)
94
95
#endif
96