2007-03-22 10:30:00 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 04:12:37 -07:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/*
|
|
|
|
* rendering object that is the root of the frame tree, which contains
|
|
|
|
* the document's scrollbars and contains fixed-positioned elements
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef nsViewportFrame_h___
|
|
|
|
#define nsViewportFrame_h___
|
|
|
|
|
2012-09-14 09:10:08 -07:00
|
|
|
#include "mozilla/Attributes.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
#include "nsContainerFrame.h"
|
|
|
|
|
2010-04-10 13:10:12 -07:00
|
|
|
class nsPresContext;
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
/**
|
|
|
|
* ViewportFrame is the parent of a single child - the doc root frame or a scroll frame
|
|
|
|
* containing the doc root frame. ViewportFrame stores this child in its primary child
|
2011-04-29 16:02:33 -07:00
|
|
|
* list.
|
2007-03-22 10:30:00 -07:00
|
|
|
*/
|
|
|
|
class ViewportFrame : public nsContainerFrame {
|
|
|
|
public:
|
2013-04-24 09:17:55 -07:00
|
|
|
NS_DECL_QUERYFRAME_TARGET(ViewportFrame)
|
|
|
|
NS_DECL_QUERYFRAME
|
2009-09-12 09:49:24 -07:00
|
|
|
NS_DECL_FRAMEARENA_HELPERS
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
typedef nsContainerFrame Super;
|
|
|
|
|
2007-08-02 15:44:36 -07:00
|
|
|
ViewportFrame(nsStyleContext* aContext)
|
|
|
|
: nsContainerFrame(aContext)
|
|
|
|
{}
|
2007-03-22 10:30:00 -07:00
|
|
|
virtual ~ViewportFrame() { } // useful for debugging
|
|
|
|
|
2014-05-24 15:20:40 -07:00
|
|
|
virtual void Init(nsIContent* aContent,
|
|
|
|
nsContainerFrame* aParent,
|
|
|
|
nsIFrame* aPrevInFlow) MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2014-05-28 12:36:59 -07:00
|
|
|
#ifdef DEBUG
|
2014-05-28 12:36:58 -07:00
|
|
|
virtual void SetInitialChildList(ChildListID aListID,
|
2014-05-28 12:36:58 -07:00
|
|
|
nsFrameList& aChildList) MOZ_OVERRIDE;
|
2014-05-28 12:36:58 -07:00
|
|
|
virtual void AppendFrames(ChildListID aListID,
|
2014-05-28 12:36:58 -07:00
|
|
|
nsFrameList& aFrameList) MOZ_OVERRIDE;
|
2014-05-28 12:36:58 -07:00
|
|
|
virtual void InsertFrames(ChildListID aListID,
|
2014-05-28 12:36:58 -07:00
|
|
|
nsIFrame* aPrevFrame,
|
|
|
|
nsFrameList& aFrameList) MOZ_OVERRIDE;
|
2014-05-28 12:36:58 -07:00
|
|
|
virtual void RemoveFrame(ChildListID aListID,
|
2014-05-28 12:36:58 -07:00
|
|
|
nsIFrame* aOldFrame) MOZ_OVERRIDE;
|
2014-05-28 12:36:59 -07:00
|
|
|
#endif
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2013-02-14 03:12:27 -08:00
|
|
|
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
const nsDisplayListSet& aLists) MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2014-07-24 10:03:25 -07:00
|
|
|
virtual nscoord GetMinISize(nsRenderingContext *aRenderingContext) MOZ_OVERRIDE;
|
|
|
|
virtual nscoord GetPrefISize(nsRenderingContext *aRenderingContext) MOZ_OVERRIDE;
|
2014-05-12 17:47:52 -07:00
|
|
|
virtual void Reflow(nsPresContext* aPresContext,
|
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
|
|
|
nsReflowStatus& aStatus) MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the "type" of the frame
|
|
|
|
*
|
|
|
|
* @see nsGkAtoms::viewportFrame
|
|
|
|
*/
|
2012-09-14 09:10:08 -07:00
|
|
|
virtual nsIAtom* GetType() const MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2013-04-24 09:17:55 -07:00
|
|
|
/**
|
|
|
|
* Adjust aReflowState to account for scrollbars and pres shell
|
|
|
|
* GetScrollPositionClampingScrollPortSizeSet and
|
|
|
|
* GetContentDocumentFixedPositionMargins adjustments.
|
|
|
|
* @return the rect to use as containing block rect
|
|
|
|
*/
|
|
|
|
nsRect AdjustReflowStateAsContainingBlock(nsHTMLReflowState* aReflowState) const;
|
|
|
|
|
2014-01-05 15:31:14 -08:00
|
|
|
#ifdef DEBUG_FRAME_DUMP
|
2014-02-17 23:47:48 -08:00
|
|
|
virtual nsresult GetFrameName(nsAString& aResult) const MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
#endif
|
|
|
|
|
2011-04-27 16:41:43 -07:00
|
|
|
private:
|
2013-05-14 09:33:23 -07:00
|
|
|
virtual mozilla::layout::FrameChildListID GetAbsoluteListID() const MOZ_OVERRIDE { return kFixedList; }
|
2011-04-27 16:41:43 -07:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
protected:
|
2013-04-24 09:17:55 -07:00
|
|
|
/**
|
|
|
|
* Calculate how much room is available for fixed frames. That means
|
|
|
|
* determining if the viewport is scrollable and whether the vertical and/or
|
|
|
|
* horizontal scrollbars are visible. Adjust the computed width/height and
|
|
|
|
* available width for aReflowState accordingly.
|
|
|
|
* @return the current scroll position, or 0,0 if not scrollable
|
|
|
|
*/
|
2007-03-22 10:30:00 -07:00
|
|
|
nsPoint AdjustReflowStateForScrollbars(nsHTMLReflowState* aReflowState) const;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif // nsViewportFrame_h___
|