2003-01-20 21:04:34 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 15:12:37 +04: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/. */
|
2006-03-29 22:29:03 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* rendering object that is the root of the frame tree, which contains
|
|
|
|
* the document's scrollbars and contains fixed-positioned elements
|
|
|
|
*/
|
|
|
|
|
2016-11-30 06:14:29 +03:00
|
|
|
#ifndef mozilla_ViewportFrame_h
|
|
|
|
#define mozilla_ViewportFrame_h
|
2003-01-20 21:04:34 +03:00
|
|
|
|
2012-09-14 20:10:08 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
2003-01-20 21:04:34 +03:00
|
|
|
#include "nsContainerFrame.h"
|
|
|
|
|
2010-04-11 00:10:12 +04:00
|
|
|
class nsPresContext;
|
|
|
|
|
2016-11-30 06:14:28 +03:00
|
|
|
namespace mozilla {
|
|
|
|
|
2017-06-21 00:21:27 +03:00
|
|
|
class ServoRestyleState;
|
|
|
|
|
2003-01-20 21:04:34 +03:00
|
|
|
/**
|
2014-09-23 17:44:00 +04: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-30 03:02:33 +04:00
|
|
|
* list.
|
2003-01-20 21:04:34 +03:00
|
|
|
*/
|
|
|
|
class ViewportFrame : public nsContainerFrame {
|
|
|
|
public:
|
2013-04-24 20:17:55 +04:00
|
|
|
NS_DECL_QUERYFRAME
|
2017-05-26 13:11:11 +03:00
|
|
|
NS_DECL_FRAMEARENA_HELPERS(ViewportFrame)
|
2009-09-12 20:49:24 +04:00
|
|
|
|
2014-09-01 07:36:37 +04:00
|
|
|
explicit ViewportFrame(nsStyleContext* aContext)
|
2017-05-26 13:11:11 +03:00
|
|
|
: ViewportFrame(aContext, kClassID)
|
2007-08-03 02:44:36 +04:00
|
|
|
{}
|
2017-04-30 18:30:08 +03:00
|
|
|
|
2003-01-20 21:04:34 +03:00
|
|
|
virtual ~ViewportFrame() { } // useful for debugging
|
|
|
|
|
2014-05-25 02:20:40 +04:00
|
|
|
virtual void Init(nsIContent* aContent,
|
|
|
|
nsContainerFrame* aParent,
|
2015-03-21 19:28:04 +03:00
|
|
|
nsIFrame* aPrevInFlow) override;
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 08:38:33 +03:00
|
|
|
|
2014-05-28 23:36:59 +04:00
|
|
|
#ifdef DEBUG
|
2014-05-28 23:36:58 +04:00
|
|
|
virtual void AppendFrames(ChildListID aListID,
|
2015-03-21 19:28:04 +03:00
|
|
|
nsFrameList& aFrameList) override;
|
2014-05-28 23:36:58 +04:00
|
|
|
virtual void InsertFrames(ChildListID aListID,
|
2014-05-28 23:36:58 +04:00
|
|
|
nsIFrame* aPrevFrame,
|
2015-03-21 19:28:04 +03:00
|
|
|
nsFrameList& aFrameList) override;
|
2014-05-28 23:36:58 +04:00
|
|
|
virtual void RemoveFrame(ChildListID aListID,
|
2015-03-21 19:28:04 +03:00
|
|
|
nsIFrame* aOldFrame) override;
|
2014-05-28 23:36:59 +04:00
|
|
|
#endif
|
2003-01-20 21:04:34 +03:00
|
|
|
|
2013-02-14 15:12:27 +04:00
|
|
|
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsRect& aDirtyRect,
|
2015-03-21 19:28:04 +03:00
|
|
|
const nsDisplayListSet& aLists) override;
|
2006-01-26 05:29:17 +03:00
|
|
|
|
2015-10-07 06:04:32 +03:00
|
|
|
void BuildDisplayListForTopLayer(nsDisplayListBuilder* aBuilder,
|
|
|
|
nsDisplayList* aList);
|
|
|
|
|
2017-06-09 22:14:53 +03:00
|
|
|
virtual nscoord GetMinISize(gfxContext *aRenderingContext) override;
|
|
|
|
virtual nscoord GetPrefISize(gfxContext *aRenderingContext) override;
|
2017-04-30 18:30:08 +03:00
|
|
|
virtual void Reflow(nsPresContext* aPresContext,
|
|
|
|
ReflowOutput& aDesiredSize,
|
2016-07-21 13:36:39 +03:00
|
|
|
const ReflowInput& aReflowInput,
|
2017-04-30 18:30:08 +03:00
|
|
|
nsReflowStatus& aStatus) override;
|
2003-01-20 21:04:34 +03:00
|
|
|
|
2016-05-04 03:27:43 +03:00
|
|
|
virtual bool ComputeCustomOverflow(nsOverflowAreas& aOverflowAreas) override;
|
2014-09-23 17:44:00 +04:00
|
|
|
|
2013-04-24 20:17:55 +04:00
|
|
|
/**
|
2016-07-21 13:36:39 +03:00
|
|
|
* Adjust aReflowInput to account for scrollbars and pres shell
|
2013-04-24 20:17:55 +04:00
|
|
|
* GetScrollPositionClampingScrollPortSizeSet and
|
|
|
|
* GetContentDocumentFixedPositionMargins adjustments.
|
|
|
|
* @return the rect to use as containing block rect
|
|
|
|
*/
|
2016-07-21 13:36:39 +03:00
|
|
|
nsRect AdjustReflowInputAsContainingBlock(ReflowInput* aReflowInput) const;
|
2013-04-24 20:17:55 +04:00
|
|
|
|
2017-06-21 18:45:12 +03:00
|
|
|
/**
|
|
|
|
* Update our style (and recursively the styles of any anonymous boxes we
|
|
|
|
* might own)
|
|
|
|
*/
|
2017-06-21 00:21:27 +03:00
|
|
|
void UpdateStyle(ServoRestyleState& aStyleSet);
|
2017-06-21 18:45:12 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Return our single anonymous box child.
|
|
|
|
*/
|
|
|
|
void AppendDirectlyOwnedAnonBoxes(nsTArray<OwnedAnonBox>& aResult) override;
|
|
|
|
|
2014-01-06 03:31:14 +04:00
|
|
|
#ifdef DEBUG_FRAME_DUMP
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsresult GetFrameName(nsAString& aResult) const override;
|
2003-01-20 21:04:34 +03:00
|
|
|
#endif
|
|
|
|
|
|
|
|
protected:
|
2017-05-26 13:11:11 +03:00
|
|
|
ViewportFrame(nsStyleContext* aContext, ClassID aID)
|
|
|
|
: nsContainerFrame(aContext, aID)
|
2017-04-30 18:30:08 +03:00
|
|
|
, mView(nullptr)
|
|
|
|
{}
|
|
|
|
|
2013-04-24 20:17:55 +04: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
|
2016-07-21 13:36:39 +03:00
|
|
|
* available width for aReflowInput accordingly.
|
2013-04-24 20:17:55 +04:00
|
|
|
* @return the current scroll position, or 0,0 if not scrollable
|
|
|
|
*/
|
2016-07-21 13:36:39 +03:00
|
|
|
nsPoint AdjustReflowInputForScrollbars(ReflowInput* aReflowInput) const;
|
2017-03-21 03:22:13 +03:00
|
|
|
|
|
|
|
nsView* GetViewInternal() const override { return mView; }
|
|
|
|
void SetViewInternal(nsView* aView) override { mView = aView; }
|
|
|
|
|
|
|
|
private:
|
|
|
|
virtual mozilla::layout::FrameChildListID GetAbsoluteListID() const override { return kFixedList; }
|
|
|
|
|
|
|
|
nsView* mView;
|
2003-01-20 21:04:34 +03:00
|
|
|
};
|
|
|
|
|
2016-11-30 06:14:28 +03:00
|
|
|
} // namespace mozilla
|
2003-01-20 21:04:34 +03:00
|
|
|
|
2016-11-30 06:14:29 +03:00
|
|
|
#endif // mozilla_ViewportFrame_h
|