nsPageContentFrame.h (2440B)
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___ 8 9 #include "mozilla/ViewportFrame.h" 10 11 class nsPageFrame; 12 class nsSharedPageData; 13 14 namespace mozilla { 15 class PresShell; 16 } // namespace mozilla 17 18 // Page content frame class. Represents a page's content, in paginated mode. 19 class nsPageContentFrame final : public mozilla::ViewportFrame { 20 public: 21 NS_DECL_FRAMEARENA_HELPERS(nsPageContentFrame) 22 23 friend nsPageContentFrame* NS_NewPageContentFrame( 24 mozilla::PresShell* aPresShell, ComputedStyle* aStyle, 25 already_AddRefed<const nsAtom> aPageName); 26 friend class nsPageFrame; 27 28 // nsIFrame 29 void Reflow(nsPresContext* aPresContext, ReflowOutput& aReflowOutput, 30 const ReflowInput& aReflowInput, 31 nsReflowStatus& aStatus) override; 32 33 const nsAtom* GetPageName() const { return mPageName; } 34 35 void SetSharedPageData(nsSharedPageData* aPD) { mPD = aPD; } 36 37 ComputeTransformFunction GetTransformGetter() const override; 38 void BuildDisplayList(nsDisplayListBuilder*, 39 const nsDisplayListSet&) override; 40 41 /** 42 * Return our canvas frame. 43 */ 44 void AppendDirectlyOwnedAnonBoxes(nsTArray<OwnedAnonBox>& aResult) override; 45 46 void EnsurePageName(); 47 48 #ifdef DEBUG_FRAME_DUMP 49 // Debugging 50 nsresult GetFrameName(nsAString& aResult) const override; 51 void ExtraContainerFrameInfo(nsACString& aTo, 52 bool aListOnlyDeterministic) const override; 53 #endif 54 55 protected: 56 explicit nsPageContentFrame(ComputedStyle* aStyle, 57 nsPresContext* aPresContext, 58 already_AddRefed<const nsAtom> aPageName) 59 : ViewportFrame(aStyle, aPresContext, kClassID), mPageName(aPageName) {} 60 61 RefPtr<const nsAtom> mPageName; 62 63 // Note: this will be set before reflow, and it's strongly owned by our 64 // nsPageSequenceFrame, which outlives us. 65 nsSharedPageData* mPD = nullptr; 66 67 // The combined InkOverflow from the previous and current page that does not 68 // yet have space allocated for it. 69 nscoord mRemainingOverflow = 0; 70 }; 71 72 #endif /* nsPageContentFrame_h___ */