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"
13 class nsSharedPageData
;
17 } // namespace mozilla
19 // Page content frame class. Represents a page's content, in paginated mode.
20 class nsPageContentFrame final
: public mozilla::ViewportFrame
{
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
;
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
;
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
58 nsresult
GetFrameName(nsAString
& aResult
) const override
;
59 void ExtraContainerFrameInfo(nsACString
& aTo
) const override
;
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___ */