layout/generic/nsViewportFrame.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     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.
    23   */
    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   ViewportFrame(nsStyleContext* aContext)
    33     : nsContainerFrame(aContext)
    34   {}
    35   virtual ~ViewportFrame() { } // useful for debugging
    37   virtual void Init(nsIContent*      aContent,
    38                     nsIFrame*        aParent,
    39                     nsIFrame*        asPrevInFlow) MOZ_OVERRIDE;
    41   virtual nsresult SetInitialChildList(ChildListID     aListID,
    42                                        nsFrameList&    aChildList) MOZ_OVERRIDE;
    44   virtual nsresult AppendFrames(ChildListID     aListID,
    45                                 nsFrameList&    aFrameList) MOZ_OVERRIDE;
    47   virtual nsresult InsertFrames(ChildListID     aListID,
    48                                 nsIFrame*       aPrevFrame,
    49                                 nsFrameList&    aFrameList) MOZ_OVERRIDE;
    51   virtual nsresult RemoveFrame(ChildListID     aListID,
    52                                nsIFrame*       aOldFrame) MOZ_OVERRIDE;
    54   virtual void BuildDisplayList(nsDisplayListBuilder*   aBuilder,
    55                                 const nsRect&           aDirtyRect,
    56                                 const nsDisplayListSet& aLists) MOZ_OVERRIDE;
    58   virtual nscoord GetMinWidth(nsRenderingContext *aRenderingContext) MOZ_OVERRIDE;
    59   virtual nscoord GetPrefWidth(nsRenderingContext *aRenderingContext) MOZ_OVERRIDE;
    60   virtual nsresult Reflow(nsPresContext*          aPresContext,
    61                           nsHTMLReflowMetrics&     aDesiredSize,
    62                           const nsHTMLReflowState& aReflowState,
    63                           nsReflowStatus&          aStatus) MOZ_OVERRIDE;
    65   /**
    66    * Get the "type" of the frame
    67    *
    68    * @see nsGkAtoms::viewportFrame
    69    */
    70   virtual nsIAtom* GetType() const MOZ_OVERRIDE;
    72   /**
    73    * Adjust aReflowState to account for scrollbars and pres shell
    74    * GetScrollPositionClampingScrollPortSizeSet and
    75    * GetContentDocumentFixedPositionMargins adjustments.
    76    * @return the rect to use as containing block rect
    77    */
    78   nsRect AdjustReflowStateAsContainingBlock(nsHTMLReflowState* aReflowState) const;
    80 #ifdef DEBUG_FRAME_DUMP
    81   virtual nsresult GetFrameName(nsAString& aResult) const MOZ_OVERRIDE;
    82 #endif
    84 private:
    85   virtual mozilla::layout::FrameChildListID GetAbsoluteListID() const MOZ_OVERRIDE { return kFixedList; }
    87 protected:
    88   /**
    89    * Calculate how much room is available for fixed frames. That means
    90    * determining if the viewport is scrollable and whether the vertical and/or
    91    * horizontal scrollbars are visible.  Adjust the computed width/height and
    92    * available width for aReflowState accordingly.
    93    * @return the current scroll position, or 0,0 if not scrollable
    94    */
    95   nsPoint AdjustReflowStateForScrollbars(nsHTMLReflowState* aReflowState) const;
    96 };
    99 #endif // nsViewportFrame_h___

mercurial