Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
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 #ifndef nsIGridPart_h___
7 #define nsIGridPart_h___
9 #include "nsISupports.h"
11 class nsGridRowGroupLayout;
12 class nsGrid;
13 class nsGridRowLayout;
14 class nsGridRow;
15 class nsGridLayout2;
17 // 07373ed7-e947-4a5e-b36c-69f7c195677b
18 #define NS_IGRIDPART_IID \
19 { 0x07373ed7, 0xe947, 0x4a5e, \
20 { 0xb3, 0x6c, 0x69, 0xf7, 0xc1, 0x95, 0x67, 0x7b } }
22 /**
23 * An additional interface implemented by nsBoxLayout implementations
24 * for parts of a grid (excluding cells, which are not special).
25 */
26 class nsIGridPart : public nsISupports {
28 public:
30 NS_DECLARE_STATIC_IID_ACCESSOR(NS_IGRIDPART_IID)
32 virtual nsGridRowGroupLayout* CastToRowGroupLayout()=0;
33 virtual nsGridLayout2* CastToGridLayout()=0;
35 /**
36 * @param aBox [IN] The other half of the |this| parameter, i.e., the box
37 * whose layout manager is |this|.
38 * @param aIndex [INOUT] For callers not setting aRequestor, the value
39 * pointed to by aIndex is incremented by the index
40 * of the row (aBox) within its row group; if aBox
41 * is not a row/column, it is untouched.
42 * The implementation does this by doing the aIndex
43 * incrementing in the call to the parent row group
44 * when aRequestor is non-null.
45 * @param aRequestor [IN] Non-null if and only if this is a recursive
46 * call from the GetGrid method on a child grid part,
47 * in which case it is a pointer to that grid part.
48 * (This may only be non-null for row groups and
49 * grids.)
50 * @return The grid of which aBox (a row, row group, or grid) is a part.
51 */
52 virtual nsGrid* GetGrid(nsIFrame* aBox, int32_t* aIndex, nsGridRowLayout* aRequestor=nullptr)=0;
54 /**
55 * @param aBox [IN] The other half of the |this| parameter, i.e., the box
56 * whose layout manager is |this|.
57 * @param aParentBox [OUT] The box representing the next level up in
58 * the grid (i.e., row group for a row, grid for a
59 * row group).
60 * @returns The layout manager for aParentBox.
61 */
62 virtual nsIGridPart* GetParentGridPart(nsIFrame* aBox, nsIFrame** aParentBox) = 0;
64 /**
65 * @param aBox [IN] The other half of the |this| parameter, i.e., the box
66 * whose layout manager is |this|.
67 * @param aRowCount [INOUT] Row count
68 * @param aComputedColumnCount [INOUT] Column count
69 */
70 virtual void CountRowsColumns(nsIFrame* aBox, int32_t& aRowCount, int32_t& aComputedColumnCount)=0;
71 virtual void DirtyRows(nsIFrame* aBox, nsBoxLayoutState& aState)=0;
72 virtual int32_t BuildRows(nsIFrame* aBox, nsGridRow* aRows)=0;
73 virtual nsMargin GetTotalMargin(nsIFrame* aBox, bool aIsHorizontal)=0;
74 virtual int32_t GetRowCount() { return 1; }
76 /**
77 * Return the level of the grid hierarchy this grid part represents.
78 */
79 enum Type { eGrid, eRowGroup, eRowLeaf };
80 virtual Type GetType()=0;
82 /**
83 * Return whether this grid part is an appropriate parent for the argument.
84 */
85 bool CanContain(nsIGridPart* aPossibleChild) {
86 Type thisType = GetType(), childType = aPossibleChild->GetType();
87 return thisType + 1 == childType || (thisType == eRowGroup && childType == eRowGroup);
88 }
90 };
92 NS_DEFINE_STATIC_IID_ACCESSOR(nsIGridPart, NS_IGRIDPART_IID)
94 #endif