layout/generic/nsViewportFrame.h

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

michael@0 1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6 /*
michael@0 7 * rendering object that is the root of the frame tree, which contains
michael@0 8 * the document's scrollbars and contains fixed-positioned elements
michael@0 9 */
michael@0 10
michael@0 11 #ifndef nsViewportFrame_h___
michael@0 12 #define nsViewportFrame_h___
michael@0 13
michael@0 14 #include "mozilla/Attributes.h"
michael@0 15 #include "nsContainerFrame.h"
michael@0 16
michael@0 17 class nsPresContext;
michael@0 18
michael@0 19 /**
michael@0 20 * ViewportFrame is the parent of a single child - the doc root frame or a scroll frame
michael@0 21 * containing the doc root frame. ViewportFrame stores this child in its primary child
michael@0 22 * list.
michael@0 23 */
michael@0 24 class ViewportFrame : public nsContainerFrame {
michael@0 25 public:
michael@0 26 NS_DECL_QUERYFRAME_TARGET(ViewportFrame)
michael@0 27 NS_DECL_QUERYFRAME
michael@0 28 NS_DECL_FRAMEARENA_HELPERS
michael@0 29
michael@0 30 typedef nsContainerFrame Super;
michael@0 31
michael@0 32 ViewportFrame(nsStyleContext* aContext)
michael@0 33 : nsContainerFrame(aContext)
michael@0 34 {}
michael@0 35 virtual ~ViewportFrame() { } // useful for debugging
michael@0 36
michael@0 37 virtual void Init(nsIContent* aContent,
michael@0 38 nsIFrame* aParent,
michael@0 39 nsIFrame* asPrevInFlow) MOZ_OVERRIDE;
michael@0 40
michael@0 41 virtual nsresult SetInitialChildList(ChildListID aListID,
michael@0 42 nsFrameList& aChildList) MOZ_OVERRIDE;
michael@0 43
michael@0 44 virtual nsresult AppendFrames(ChildListID aListID,
michael@0 45 nsFrameList& aFrameList) MOZ_OVERRIDE;
michael@0 46
michael@0 47 virtual nsresult InsertFrames(ChildListID aListID,
michael@0 48 nsIFrame* aPrevFrame,
michael@0 49 nsFrameList& aFrameList) MOZ_OVERRIDE;
michael@0 50
michael@0 51 virtual nsresult RemoveFrame(ChildListID aListID,
michael@0 52 nsIFrame* aOldFrame) MOZ_OVERRIDE;
michael@0 53
michael@0 54 virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
michael@0 55 const nsRect& aDirtyRect,
michael@0 56 const nsDisplayListSet& aLists) MOZ_OVERRIDE;
michael@0 57
michael@0 58 virtual nscoord GetMinWidth(nsRenderingContext *aRenderingContext) MOZ_OVERRIDE;
michael@0 59 virtual nscoord GetPrefWidth(nsRenderingContext *aRenderingContext) MOZ_OVERRIDE;
michael@0 60 virtual nsresult Reflow(nsPresContext* aPresContext,
michael@0 61 nsHTMLReflowMetrics& aDesiredSize,
michael@0 62 const nsHTMLReflowState& aReflowState,
michael@0 63 nsReflowStatus& aStatus) MOZ_OVERRIDE;
michael@0 64
michael@0 65 /**
michael@0 66 * Get the "type" of the frame
michael@0 67 *
michael@0 68 * @see nsGkAtoms::viewportFrame
michael@0 69 */
michael@0 70 virtual nsIAtom* GetType() const MOZ_OVERRIDE;
michael@0 71
michael@0 72 /**
michael@0 73 * Adjust aReflowState to account for scrollbars and pres shell
michael@0 74 * GetScrollPositionClampingScrollPortSizeSet and
michael@0 75 * GetContentDocumentFixedPositionMargins adjustments.
michael@0 76 * @return the rect to use as containing block rect
michael@0 77 */
michael@0 78 nsRect AdjustReflowStateAsContainingBlock(nsHTMLReflowState* aReflowState) const;
michael@0 79
michael@0 80 #ifdef DEBUG_FRAME_DUMP
michael@0 81 virtual nsresult GetFrameName(nsAString& aResult) const MOZ_OVERRIDE;
michael@0 82 #endif
michael@0 83
michael@0 84 private:
michael@0 85 virtual mozilla::layout::FrameChildListID GetAbsoluteListID() const MOZ_OVERRIDE { return kFixedList; }
michael@0 86
michael@0 87 protected:
michael@0 88 /**
michael@0 89 * Calculate how much room is available for fixed frames. That means
michael@0 90 * determining if the viewport is scrollable and whether the vertical and/or
michael@0 91 * horizontal scrollbars are visible. Adjust the computed width/height and
michael@0 92 * available width for aReflowState accordingly.
michael@0 93 * @return the current scroll position, or 0,0 if not scrollable
michael@0 94 */
michael@0 95 nsPoint AdjustReflowStateForScrollbars(nsHTMLReflowState* aReflowState) const;
michael@0 96 };
michael@0 97
michael@0 98
michael@0 99 #endif // nsViewportFrame_h___

mercurial