Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/dist/include/mozilla/ViewportFrame.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
/*
8
 * rendering object that is the root of the frame tree, which contains
9
 * the document's scrollbars and contains fixed-positioned elements
10
 */
11
12
#ifndef mozilla_ViewportFrame_h
13
#define mozilla_ViewportFrame_h
14
15
#include "mozilla/Attributes.h"
16
#include "nsContainerFrame.h"
17
18
class nsPresContext;
19
20
namespace mozilla {
21
22
class ServoRestyleState;
23
24
/**
25
  * ViewportFrame is the parent of a single child - the doc root frame or a scroll frame
26
  * containing the doc root frame. ViewportFrame stores this child in its primary child
27
  * list.
28
  */
29
class ViewportFrame : public nsContainerFrame
30
{
31
public:
32
  NS_DECL_QUERYFRAME
33
  NS_DECL_FRAMEARENA_HELPERS(ViewportFrame)
34
35
  explicit ViewportFrame(ComputedStyle* aStyle)
36
    : ViewportFrame(aStyle, kClassID)
37
0
  {}
38
39
0
  virtual ~ViewportFrame() { } // useful for debugging
40
41
  virtual void Init(nsIContent*       aContent,
42
                    nsContainerFrame* aParent,
43
                    nsIFrame*         aPrevInFlow) override;
44
45
#ifdef DEBUG
46
  virtual void AppendFrames(ChildListID     aListID,
47
                            nsFrameList&    aFrameList) override;
48
  virtual void InsertFrames(ChildListID     aListID,
49
                            nsIFrame*       aPrevFrame,
50
                            nsFrameList&    aFrameList) override;
51
  virtual void RemoveFrame(ChildListID     aListID,
52
                           nsIFrame*       aOldFrame) override;
53
#endif
54
55
  virtual void BuildDisplayList(nsDisplayListBuilder*   aBuilder,
56
                                const nsDisplayListSet& aLists) override;
57
58
  void BuildDisplayListForTopLayer(nsDisplayListBuilder* aBuilder,
59
                                   nsDisplayList* aList);
60
61
  virtual nscoord GetMinISize(gfxContext *aRenderingContext) override;
62
  virtual nscoord GetPrefISize(gfxContext *aRenderingContext) override;
63
  virtual void Reflow(nsPresContext* aPresContext,
64
                      ReflowOutput& aDesiredSize,
65
                      const ReflowInput& aReflowInput,
66
                      nsReflowStatus& aStatus) override;
67
68
  virtual bool ComputeCustomOverflow(nsOverflowAreas& aOverflowAreas) override;
69
70
  /**
71
   * Adjust aReflowInput to account for scrollbars and pres shell
72
   * GetVisualViewportSizeSet and
73
   * GetContentDocumentFixedPositionMargins adjustments.
74
   * @return the rect to use as containing block rect
75
   */
76
  nsRect AdjustReflowInputAsContainingBlock(ReflowInput* aReflowInput) const;
77
78
  /**
79
   * Update our style (and recursively the styles of any anonymous boxes we
80
   * might own)
81
   */
82
  void UpdateStyle(ServoRestyleState& aStyleSet);
83
84
  /**
85
   * Return our single anonymous box child.
86
   */
87
  void AppendDirectlyOwnedAnonBoxes(nsTArray<OwnedAnonBox>& aResult) override;
88
89
#ifdef DEBUG_FRAME_DUMP
90
  virtual nsresult GetFrameName(nsAString& aResult) const override;
91
#endif
92
93
protected:
94
  ViewportFrame(ComputedStyle* aStyle, ClassID aID)
95
    : nsContainerFrame(aStyle, aID)
96
    , mView(nullptr)
97
0
  {}
98
99
  /**
100
   * Calculate how much room is available for fixed frames. That means
101
   * determining if the viewport is scrollable and whether the vertical and/or
102
   * horizontal scrollbars are visible.  Adjust the computed width/height and
103
   * available width for aReflowInput accordingly.
104
   * @return the current scroll position, or 0,0 if not scrollable
105
   */
106
  nsPoint AdjustReflowInputForScrollbars(ReflowInput* aReflowInput) const;
107
108
0
  nsView* GetViewInternal() const override { return mView; }
109
0
  void SetViewInternal(nsView* aView) override { mView = aView; }
110
111
private:
112
0
  virtual mozilla::layout::FrameChildListID GetAbsoluteListID() const override { return kFixedList; }
113
114
  nsView* mView;
115
};
116
117
} // namespace mozilla
118
119
#endif // mozilla_ViewportFrame_h