Coverage Report

Created: 2018-09-25 14:53

/src/mozilla-central/layout/xul/nsBox.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 nsBox_h___
8
#define nsBox_h___
9
10
#include "mozilla/Attributes.h"
11
#include "mozilla/StaticPtr.h"
12
#include "nsIFrame.h"
13
14
class nsITheme;
15
16
class nsBox : public nsIFrame {
17
18
public:
19
20
  friend class nsIFrame;
21
22
  static void Shutdown();
23
24
  virtual nsSize GetXULPrefSize(nsBoxLayoutState& aBoxLayoutState) override;
25
  virtual nsSize GetXULMinSize(nsBoxLayoutState& aBoxLayoutState) override;
26
  virtual nsSize GetXULMaxSize(nsBoxLayoutState& aBoxLayoutState) override;
27
  virtual nscoord GetXULFlex() override;
28
  virtual nscoord GetXULBoxAscent(nsBoxLayoutState& aBoxLayoutState) override;
29
30
  virtual nsSize GetXULMinSizeForScrollArea(nsBoxLayoutState& aBoxLayoutState) override;
31
32
  virtual bool IsXULCollapsed() override;
33
34
  virtual void SetXULBounds(nsBoxLayoutState& aBoxLayoutState, const nsRect& aRect,
35
                            bool aRemoveOverflowAreas = false) override;
36
37
  virtual nsresult GetXULBorder(nsMargin& aBorderAndPadding) override;
38
  virtual nsresult GetXULPadding(nsMargin& aBorderAndPadding) override;
39
  virtual nsresult GetXULMargin(nsMargin& aMargin) override;
40
41
0
  virtual Valignment GetXULVAlign() const override { return vAlign_Top; }
42
0
  virtual Halignment GetXULHAlign() const override { return hAlign_Left; }
43
44
  virtual nsresult XULRelayoutChildAtOrdinal(nsIFrame* aChild) override;
45
46
  nsBox(ClassID aID);
47
  virtual ~nsBox();
48
49
  /**
50
   * Returns true if this box clips its children, e.g., if this box is an scrollbox.
51
  */
52
  virtual bool DoesClipChildren();
53
  virtual bool ComputesOwnOverflowArea() = 0;
54
55
  nsresult SyncLayout(nsBoxLayoutState& aBoxLayoutState);
56
57
  bool DoesNeedRecalc(const nsSize& aSize);
58
  bool DoesNeedRecalc(nscoord aCoord);
59
  void SizeNeedsRecalc(nsSize& aSize);
60
  void CoordNeedsRecalc(nscoord& aCoord);
61
62
  void AddBorderAndPadding(nsSize& aSize);
63
64
  static void AddBorderAndPadding(nsIFrame* aBox, nsSize& aSize);
65
  static void AddMargin(nsIFrame* aChild, nsSize& aSize);
66
  static void AddMargin(nsSize& aSize, const nsMargin& aMargin);
67
68
  static nsSize BoundsCheckMinMax(const nsSize& aMinSize, const nsSize& aMaxSize);
69
  static nsSize BoundsCheck(const nsSize& aMinSize, const nsSize& aPrefSize, const nsSize& aMaxSize);
70
  static nscoord BoundsCheck(nscoord aMinSize, nscoord aPrefSize, nscoord aMaxSize);
71
72
  static nsIFrame* GetChildXULBox(const nsIFrame* aFrame);
73
  static nsIFrame* GetNextXULBox(const nsIFrame* aFrame);
74
  static nsIFrame* GetParentXULBox(const nsIFrame* aFrame);
75
76
protected:
77
78
  nsresult BeginXULLayout(nsBoxLayoutState& aState);
79
  NS_IMETHOD DoXULLayout(nsBoxLayoutState& aBoxLayoutState);
80
  nsresult EndXULLayout(nsBoxLayoutState& aState);
81
82
  static bool gGotTheme;
83
  static mozilla::StaticRefPtr<nsITheme> gTheme;
84
85
  enum eMouseThrough {
86
    unset,
87
    never,
88
    always
89
  };
90
};
91
92
#endif
93