Coverage Report

Created: 2018-09-25 14:53

/src/mozilla-central/layout/xul/grid/nsGridLayout2.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 nsGridLayout2_h___
8
#define nsGridLayout2_h___
9
10
#include "mozilla/Attributes.h"
11
#include "nsStackLayout.h"
12
#include "nsIGridPart.h"
13
#include "nsCoord.h"
14
#include "nsGrid.h"
15
16
class nsGridRowGroupLayout;
17
class nsGridRowLayout;
18
class nsGridRow;
19
class nsBoxLayoutState;
20
21
/**
22
 * The nsBoxLayout implementation for a grid.
23
 */
24
class nsGridLayout2 final : public nsStackLayout,
25
                            public nsIGridPart
26
{
27
public:
28
29
  friend nsresult NS_NewGridLayout2(nsIPresShell* aPresShell, nsBoxLayout** aNewLayout);
30
31
  NS_DECL_ISUPPORTS_INHERITED
32
33
  NS_IMETHOD XULLayout(nsIFrame* aBox, nsBoxLayoutState& aBoxLayoutState) override;
34
  virtual void IntrinsicISizesDirty(nsIFrame* aBox, nsBoxLayoutState& aBoxLayoutState) override;
35
36
0
  virtual nsGridRowGroupLayout* CastToRowGroupLayout() override { return nullptr; }
37
0
  virtual nsGridLayout2* CastToGridLayout() override { return this; }
38
  virtual nsGrid* GetGrid(nsIFrame* aBox, int32_t* aIndex, nsGridRowLayout* aRequestor=nullptr) override;
39
0
  virtual nsIGridPart* GetParentGridPart(nsIFrame* aBox, nsIFrame** aParentBox) override {
40
0
    MOZ_ASSERT_UNREACHABLE("Should not be called"); return nullptr;
41
0
  }
42
  virtual nsSize GetXULMinSize(nsIFrame* aBox, nsBoxLayoutState& aBoxLayoutState) override;
43
  virtual nsSize GetXULMaxSize(nsIFrame* aBox, nsBoxLayoutState& aBoxLayoutState) override;
44
  virtual nsSize GetXULPrefSize(nsIFrame* aBox, nsBoxLayoutState& aBoxLayoutState) override;
45
0
  virtual void CountRowsColumns(nsIFrame* aBox, int32_t& aRowCount, int32_t& aComputedColumnCount) override { aRowCount++; }
46
0
  virtual void DirtyRows(nsIFrame* aBox, nsBoxLayoutState& aState) override { }
47
  virtual int32_t BuildRows(nsIFrame* aBox, nsGridRow* aRows) override;
48
  virtual nsMargin GetTotalMargin(nsIFrame* aBox, bool aIsHorizontal) override;
49
0
  virtual Type GetType() override { return eGrid; }
50
  virtual void ChildrenInserted(nsIFrame* aBox, nsBoxLayoutState& aState,
51
                                nsIFrame* aPrevBox,
52
                                const nsFrameList::Slice& aNewChildren) override;
53
  virtual void ChildrenAppended(nsIFrame* aBox, nsBoxLayoutState& aState,
54
                                const nsFrameList::Slice& aNewChildren) override;
55
  virtual void ChildrenRemoved(nsIFrame* aBox, nsBoxLayoutState& aState,
56
                               nsIFrame* aChildList) override;
57
  virtual void ChildrenSet(nsIFrame* aBox, nsBoxLayoutState& aState,
58
                           nsIFrame* aChildList) override;
59
60
0
  virtual nsIGridPart* AsGridPart() override { return this; }
61
62
  static void AddOffset(nsIFrame* aChild, nsSize& aSize);
63
64
protected:
65
66
  explicit nsGridLayout2(nsIPresShell* aShell);
67
  virtual ~nsGridLayout2();
68
  nsGrid mGrid;
69
70
private:
71
  void AddWidth(nsSize& aSize, nscoord aSize2, bool aIsHorizontal);
72
73
74
}; // class nsGridLayout2
75
76
77
#endif
78