1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/layout/generic/nsViewportFrame.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,99 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +/* 1.10 + * rendering object that is the root of the frame tree, which contains 1.11 + * the document's scrollbars and contains fixed-positioned elements 1.12 + */ 1.13 + 1.14 +#ifndef nsViewportFrame_h___ 1.15 +#define nsViewportFrame_h___ 1.16 + 1.17 +#include "mozilla/Attributes.h" 1.18 +#include "nsContainerFrame.h" 1.19 + 1.20 +class nsPresContext; 1.21 + 1.22 +/** 1.23 + * ViewportFrame is the parent of a single child - the doc root frame or a scroll frame 1.24 + * containing the doc root frame. ViewportFrame stores this child in its primary child 1.25 + * list. 1.26 + */ 1.27 +class ViewportFrame : public nsContainerFrame { 1.28 +public: 1.29 + NS_DECL_QUERYFRAME_TARGET(ViewportFrame) 1.30 + NS_DECL_QUERYFRAME 1.31 + NS_DECL_FRAMEARENA_HELPERS 1.32 + 1.33 + typedef nsContainerFrame Super; 1.34 + 1.35 + ViewportFrame(nsStyleContext* aContext) 1.36 + : nsContainerFrame(aContext) 1.37 + {} 1.38 + virtual ~ViewportFrame() { } // useful for debugging 1.39 + 1.40 + virtual void Init(nsIContent* aContent, 1.41 + nsIFrame* aParent, 1.42 + nsIFrame* asPrevInFlow) MOZ_OVERRIDE; 1.43 + 1.44 + virtual nsresult SetInitialChildList(ChildListID aListID, 1.45 + nsFrameList& aChildList) MOZ_OVERRIDE; 1.46 + 1.47 + virtual nsresult AppendFrames(ChildListID aListID, 1.48 + nsFrameList& aFrameList) MOZ_OVERRIDE; 1.49 + 1.50 + virtual nsresult InsertFrames(ChildListID aListID, 1.51 + nsIFrame* aPrevFrame, 1.52 + nsFrameList& aFrameList) MOZ_OVERRIDE; 1.53 + 1.54 + virtual nsresult RemoveFrame(ChildListID aListID, 1.55 + nsIFrame* aOldFrame) MOZ_OVERRIDE; 1.56 + 1.57 + virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder, 1.58 + const nsRect& aDirtyRect, 1.59 + const nsDisplayListSet& aLists) MOZ_OVERRIDE; 1.60 + 1.61 + virtual nscoord GetMinWidth(nsRenderingContext *aRenderingContext) MOZ_OVERRIDE; 1.62 + virtual nscoord GetPrefWidth(nsRenderingContext *aRenderingContext) MOZ_OVERRIDE; 1.63 + virtual nsresult Reflow(nsPresContext* aPresContext, 1.64 + nsHTMLReflowMetrics& aDesiredSize, 1.65 + const nsHTMLReflowState& aReflowState, 1.66 + nsReflowStatus& aStatus) MOZ_OVERRIDE; 1.67 + 1.68 + /** 1.69 + * Get the "type" of the frame 1.70 + * 1.71 + * @see nsGkAtoms::viewportFrame 1.72 + */ 1.73 + virtual nsIAtom* GetType() const MOZ_OVERRIDE; 1.74 + 1.75 + /** 1.76 + * Adjust aReflowState to account for scrollbars and pres shell 1.77 + * GetScrollPositionClampingScrollPortSizeSet and 1.78 + * GetContentDocumentFixedPositionMargins adjustments. 1.79 + * @return the rect to use as containing block rect 1.80 + */ 1.81 + nsRect AdjustReflowStateAsContainingBlock(nsHTMLReflowState* aReflowState) const; 1.82 + 1.83 +#ifdef DEBUG_FRAME_DUMP 1.84 + virtual nsresult GetFrameName(nsAString& aResult) const MOZ_OVERRIDE; 1.85 +#endif 1.86 + 1.87 +private: 1.88 + virtual mozilla::layout::FrameChildListID GetAbsoluteListID() const MOZ_OVERRIDE { return kFixedList; } 1.89 + 1.90 +protected: 1.91 + /** 1.92 + * Calculate how much room is available for fixed frames. That means 1.93 + * determining if the viewport is scrollable and whether the vertical and/or 1.94 + * horizontal scrollbars are visible. Adjust the computed width/height and 1.95 + * available width for aReflowState accordingly. 1.96 + * @return the current scroll position, or 0,0 if not scrollable 1.97 + */ 1.98 + nsPoint AdjustReflowStateForScrollbars(nsHTMLReflowState* aReflowState) const; 1.99 +}; 1.100 + 1.101 + 1.102 +#endif // nsViewportFrame_h___