Backed out changeset 496886cb30a5 (bug 1867152) for bc failures on browser_user_input...
[gecko.git] / layout / generic / nsPageContentFrame.h
blob6e57c11f4b6853839ec5c3737e563a94e0aae812
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef nsPageContentFrame_h___
7 #define nsPageContentFrame_h___
9 #include "mozilla/Attributes.h"
10 #include "mozilla/ViewportFrame.h"
12 class nsPageFrame;
13 class nsSharedPageData;
15 namespace mozilla {
16 class PresShell;
17 } // namespace mozilla
19 // Page content frame class. Represents a page's content, in paginated mode.
20 class nsPageContentFrame final : public mozilla::ViewportFrame {
21 public:
22 NS_DECL_FRAMEARENA_HELPERS(nsPageContentFrame)
24 friend nsPageContentFrame* NS_NewPageContentFrame(
25 mozilla::PresShell* aPresShell, ComputedStyle* aStyle,
26 already_AddRefed<const nsAtom> aPageName);
27 friend class nsPageFrame;
29 // nsIFrame
30 void Reflow(nsPresContext* aPresContext, ReflowOutput& aReflowOutput,
31 const ReflowInput& aReflowInput,
32 nsReflowStatus& aStatus) override;
34 const nsAtom* GetPageName() const { return mPageName; }
36 void SetSharedPageData(nsSharedPageData* aPD) { mPD = aPD; }
38 ComputeTransformFunction GetTransformGetter() const override;
39 void BuildDisplayList(nsDisplayListBuilder*,
40 const nsDisplayListSet&) override;
42 /**
43 * Return our canvas frame.
45 void AppendDirectlyOwnedAnonBoxes(nsTArray<OwnedAnonBox>& aResult) override;
47 void EnsurePageName();
49 // The default implementation of FirstContinuation in nsSplittableFrame is
50 // implemented in linear time, walking back through the linked list of
51 // continuations via mPrevContinuation.
52 // For nsPageContentFrames, we can find the first continuation through the
53 // frame tree structure in constant time.
54 nsIFrame* FirstContinuation() const final;
56 #ifdef DEBUG_FRAME_DUMP
57 // Debugging
58 nsresult GetFrameName(nsAString& aResult) const override;
59 void ExtraContainerFrameInfo(nsACString& aTo) const override;
60 #endif
62 protected:
63 explicit nsPageContentFrame(ComputedStyle* aStyle,
64 nsPresContext* aPresContext,
65 already_AddRefed<const nsAtom> aPageName)
66 : ViewportFrame(aStyle, aPresContext, kClassID), mPageName(aPageName) {}
68 RefPtr<const nsAtom> mPageName;
70 // Note: this will be set before reflow, and it's strongly owned by our
71 // nsPageSequenceFrame, which outlives us.
72 nsSharedPageData* mPD = nullptr;
74 // The combined InkOverflow from the previous and current page that does not
75 // yet have space allocated for it.
76 nscoord mRemainingOverflow = 0;
79 #endif /* nsPageContentFrame_h___ */