Bumping manifests a=b2g-bump
[gecko.git] / layout / generic / nsViewportFrame.h
blob2268734eab41a282632a5673171efa2f605f3844
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 /*
7 * rendering object that is the root of the frame tree, which contains
8 * the document's scrollbars and contains fixed-positioned elements
9 */
11 #ifndef nsViewportFrame_h___
12 #define nsViewportFrame_h___
14 #include "mozilla/Attributes.h"
15 #include "nsContainerFrame.h"
17 class nsPresContext;
19 /**
20 * ViewportFrame is the parent of a single child - the doc root frame or a scroll frame
21 * containing the doc root frame. ViewportFrame stores this child in its primary child
22 * list.
24 class ViewportFrame : public nsContainerFrame {
25 public:
26 NS_DECL_QUERYFRAME_TARGET(ViewportFrame)
27 NS_DECL_QUERYFRAME
28 NS_DECL_FRAMEARENA_HELPERS
30 typedef nsContainerFrame Super;
32 explicit ViewportFrame(nsStyleContext* aContext)
33 : nsContainerFrame(aContext)
35 virtual ~ViewportFrame() { } // useful for debugging
37 virtual void Init(nsIContent* aContent,
38 nsContainerFrame* aParent,
39 nsIFrame* aPrevInFlow) MOZ_OVERRIDE;
41 #ifdef DEBUG
42 virtual void SetInitialChildList(ChildListID aListID,
43 nsFrameList& aChildList) MOZ_OVERRIDE;
44 virtual void AppendFrames(ChildListID aListID,
45 nsFrameList& aFrameList) MOZ_OVERRIDE;
46 virtual void InsertFrames(ChildListID aListID,
47 nsIFrame* aPrevFrame,
48 nsFrameList& aFrameList) MOZ_OVERRIDE;
49 virtual void RemoveFrame(ChildListID aListID,
50 nsIFrame* aOldFrame) MOZ_OVERRIDE;
51 #endif
53 virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
54 const nsRect& aDirtyRect,
55 const nsDisplayListSet& aLists) MOZ_OVERRIDE;
57 virtual nscoord GetMinISize(nsRenderingContext *aRenderingContext) MOZ_OVERRIDE;
58 virtual nscoord GetPrefISize(nsRenderingContext *aRenderingContext) MOZ_OVERRIDE;
59 virtual void Reflow(nsPresContext* aPresContext,
60 nsHTMLReflowMetrics& aDesiredSize,
61 const nsHTMLReflowState& aReflowState,
62 nsReflowStatus& aStatus) MOZ_OVERRIDE;
64 /**
65 * Get the "type" of the frame
67 * @see nsGkAtoms::viewportFrame
69 virtual nsIAtom* GetType() const MOZ_OVERRIDE;
71 /**
72 * Adjust aReflowState to account for scrollbars and pres shell
73 * GetScrollPositionClampingScrollPortSizeSet and
74 * GetContentDocumentFixedPositionMargins adjustments.
75 * @return the rect to use as containing block rect
77 nsRect AdjustReflowStateAsContainingBlock(nsHTMLReflowState* aReflowState) const;
79 #ifdef DEBUG_FRAME_DUMP
80 virtual nsresult GetFrameName(nsAString& aResult) const MOZ_OVERRIDE;
81 #endif
83 private:
84 virtual mozilla::layout::FrameChildListID GetAbsoluteListID() const MOZ_OVERRIDE { return kFixedList; }
86 protected:
87 /**
88 * Calculate how much room is available for fixed frames. That means
89 * determining if the viewport is scrollable and whether the vertical and/or
90 * horizontal scrollbars are visible. Adjust the computed width/height and
91 * available width for aReflowState accordingly.
92 * @return the current scroll position, or 0,0 if not scrollable
94 nsPoint AdjustReflowStateForScrollbars(nsHTMLReflowState* aReflowState) const;
98 #endif // nsViewportFrame_h___