2017-10-27 10:33:53 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2012-05-21 12:12:37 +01: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 18:29:03 +00: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 11:14:29 +08:00
|
|
|
#ifndef mozilla_ViewportFrame_h
|
|
|
|
#define mozilla_ViewportFrame_h
|
2003-01-20 18:04:34 +00:00
|
|
|
|
2012-09-14 09:10:08 -07:00
|
|
|
#include "mozilla/Attributes.h"
|
2003-01-20 18:04:34 +00:00
|
|
|
#include "nsContainerFrame.h"
|
|
|
|
|
2010-04-10 16:10:12 -04:00
|
|
|
class nsPresContext;
|
|
|
|
|
2016-11-30 11:14:28 +08:00
|
|
|
namespace mozilla {
|
|
|
|
|
2021-07-19 11:28:20 +00:00
|
|
|
class nsDisplayWrapList;
|
2017-06-20 23:21:27 +02:00
|
|
|
class ServoRestyleState;
|
|
|
|
|
2003-01-20 18:04:34 +00:00
|
|
|
/**
|
2014-09-23 09: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 list.
|
2003-01-20 18:04:34 +00:00
|
|
|
*/
|
2018-09-06 01:23:14 +00:00
|
|
|
class ViewportFrame : public nsContainerFrame {
|
2003-01-20 18:04:34 +00:00
|
|
|
public:
|
2013-04-24 18:17:55 +02:00
|
|
|
NS_DECL_QUERYFRAME
|
2017-05-26 12:11:11 +02:00
|
|
|
NS_DECL_FRAMEARENA_HELPERS(ViewportFrame)
|
2009-09-12 17:49:24 +01:00
|
|
|
|
2019-02-05 17:45:54 +01:00
|
|
|
explicit ViewportFrame(ComputedStyle* aStyle, nsPresContext* aPresContext)
|
|
|
|
: ViewportFrame(aStyle, aPresContext, kClassID) {}
|
2017-04-30 17:30:08 +02:00
|
|
|
|
2020-03-17 09:38:32 +00:00
|
|
|
virtual ~ViewportFrame() = default; // useful for debugging
|
2003-01-20 18:04:34 +00:00
|
|
|
|
2023-09-08 15:11:17 +00:00
|
|
|
void Init(nsIContent* aContent, nsContainerFrame* aParent,
|
|
|
|
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 05:38:33 +00:00
|
|
|
|
2014-05-28 19:36:59 +00:00
|
|
|
#ifdef DEBUG
|
2022-11-01 21:15:54 +00:00
|
|
|
void AppendFrames(ChildListID aListID, nsFrameList&& aFrameList) override;
|
2022-11-01 21:15:55 +00:00
|
|
|
void InsertFrames(ChildListID aListID, nsIFrame* aPrevFrame,
|
|
|
|
const nsLineList::iterator* aPrevFrameLine,
|
|
|
|
nsFrameList&& aFrameList) override;
|
2023-09-08 15:11:17 +00:00
|
|
|
void RemoveFrame(DestroyContext&, ChildListID, nsIFrame*) override;
|
2014-05-28 19:36:59 +00:00
|
|
|
#endif
|
2003-01-20 18:04:34 +00:00
|
|
|
|
2023-09-08 15:11:17 +00:00
|
|
|
void BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsDisplayListSet& aLists) override;
|
2006-01-26 02:29:17 +00:00
|
|
|
|
2021-01-25 00:31:30 +00:00
|
|
|
nsDisplayWrapList* BuildDisplayListForTopLayer(nsDisplayListBuilder* aBuilder,
|
|
|
|
bool* aIsOpaque = nullptr);
|
2015-10-07 14:04:32 +11:00
|
|
|
|
2023-09-08 15:11:17 +00:00
|
|
|
nscoord GetMinISize(gfxContext* aRenderingContext) override;
|
|
|
|
nscoord GetPrefISize(gfxContext* aRenderingContext) override;
|
|
|
|
void Reflow(nsPresContext* aPresContext, ReflowOutput& aDesiredSize,
|
|
|
|
const ReflowInput& aReflowInput,
|
|
|
|
nsReflowStatus& aStatus) override;
|
2003-01-20 18:04:34 +00:00
|
|
|
|
2020-11-18 00:08:12 +00:00
|
|
|
bool ComputeCustomOverflow(mozilla::OverflowAreas&) override { return false; }
|
2014-09-23 09:44:00 -04:00
|
|
|
|
2013-04-24 18:17:55 +02:00
|
|
|
/**
|
2016-07-21 18:36:39 +08:00
|
|
|
* Adjust aReflowInput to account for scrollbars and pres shell
|
2018-07-22 21:49:38 +02:00
|
|
|
* GetVisualViewportSizeSet and
|
2013-04-24 18:17:55 +02:00
|
|
|
* GetContentDocumentFixedPositionMargins adjustments.
|
|
|
|
* @return the rect to use as containing block rect
|
|
|
|
*/
|
2016-07-21 18:36:39 +08:00
|
|
|
nsRect AdjustReflowInputAsContainingBlock(ReflowInput* aReflowInput) const;
|
2013-04-24 18:17:55 +02:00
|
|
|
|
2017-06-21 11:45:12 -04:00
|
|
|
/**
|
|
|
|
* Update our style (and recursively the styles of any anonymous boxes we
|
|
|
|
* might own)
|
|
|
|
*/
|
2017-06-20 23:21:27 +02:00
|
|
|
void UpdateStyle(ServoRestyleState& aStyleSet);
|
2017-06-21 11:45:12 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Return our single anonymous box child.
|
|
|
|
*/
|
|
|
|
void AppendDirectlyOwnedAnonBoxes(nsTArray<OwnedAnonBox>& aResult) override;
|
|
|
|
|
2019-09-05 01:15:05 +00:00
|
|
|
// Returns adjusted viewport size to reflect the positions that position:fixed
|
|
|
|
// elements are attached.
|
|
|
|
nsSize AdjustViewportSizeForFixedPosition(const nsRect& aViewportRect) const;
|
|
|
|
|
2014-01-05 23:31:14 +00:00
|
|
|
#ifdef DEBUG_FRAME_DUMP
|
2015-03-21 12:28:04 -04:00
|
|
|
virtual nsresult GetFrameName(nsAString& aResult) const override;
|
2003-01-20 18:04:34 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
protected:
|
2019-02-05 17:45:54 +01:00
|
|
|
ViewportFrame(ComputedStyle* aStyle, nsPresContext* aPresContext, ClassID aID)
|
|
|
|
: nsContainerFrame(aStyle, aPresContext, aID), mView(nullptr) {}
|
2017-04-30 17:30:08 +02:00
|
|
|
|
2013-04-24 18:17:55 +02: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 18:36:39 +08:00
|
|
|
* available width for aReflowInput accordingly.
|
2013-04-24 18:17:55 +02:00
|
|
|
* @return the current scroll position, or 0,0 if not scrollable
|
|
|
|
*/
|
2016-07-21 18:36:39 +08:00
|
|
|
nsPoint AdjustReflowInputForScrollbars(ReflowInput* aReflowInput) const;
|
2017-03-21 01:22:13 +01:00
|
|
|
|
|
|
|
nsView* GetViewInternal() const override { return mView; }
|
|
|
|
void SetViewInternal(nsView* aView) override { mView = aView; }
|
|
|
|
|
|
|
|
private:
|
2022-11-12 04:38:53 +00:00
|
|
|
mozilla::FrameChildListID GetAbsoluteListID() const override {
|
2022-11-12 04:38:53 +00:00
|
|
|
return FrameChildListID::Fixed;
|
2017-03-21 01:22:13 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
nsView* mView;
|
2003-01-20 18:04:34 +00:00
|
|
|
};
|
|
|
|
|
2016-11-30 11:14:28 +08:00
|
|
|
} // namespace mozilla
|
2003-01-20 18:04:34 +00:00
|
|
|
|
2016-11-30 11:14:29 +08:00
|
|
|
#endif // mozilla_ViewportFrame_h
|