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/. */
7 * rendering object that is the root of the frame tree, which contains
8 * the document's scrollbars and contains fixed-positioned elements
11 #ifndef nsViewportFrame_h___
12 #define nsViewportFrame_h___
14 #include "mozilla/Attributes.h"
15 #include "nsContainerFrame.h"
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
24 class ViewportFrame
: public nsContainerFrame
{
26 NS_DECL_QUERYFRAME_TARGET(ViewportFrame
)
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
;
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
,
48 nsFrameList
& aFrameList
) MOZ_OVERRIDE
;
49 virtual void RemoveFrame(ChildListID aListID
,
50 nsIFrame
* aOldFrame
) MOZ_OVERRIDE
;
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
;
65 * Get the "type" of the frame
67 * @see nsGkAtoms::viewportFrame
69 virtual nsIAtom
* GetType() const MOZ_OVERRIDE
;
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
;
84 virtual mozilla::layout::FrameChildListID
GetAbsoluteListID() const MOZ_OVERRIDE
{ return kFixedList
; }
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___