layout/generic/nsSplittableFrame.h

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

michael@0 1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6 /*
michael@0 7 * base class for rendering objects that can be split across lines,
michael@0 8 * columns, or pages
michael@0 9 */
michael@0 10
michael@0 11 #ifndef nsSplittableFrame_h___
michael@0 12 #define nsSplittableFrame_h___
michael@0 13
michael@0 14 #include "mozilla/Attributes.h"
michael@0 15 #include "nsFrame.h"
michael@0 16
michael@0 17 // Derived class that allows splitting
michael@0 18 class nsSplittableFrame : public nsFrame
michael@0 19 {
michael@0 20 public:
michael@0 21 NS_DECL_FRAMEARENA_HELPERS
michael@0 22
michael@0 23 virtual void Init(nsIContent* aContent,
michael@0 24 nsIFrame* aParent,
michael@0 25 nsIFrame* aPrevInFlow) MOZ_OVERRIDE;
michael@0 26
michael@0 27 virtual nsSplittableType GetSplittableType() const MOZ_OVERRIDE;
michael@0 28
michael@0 29 virtual void DestroyFrom(nsIFrame* aDestructRoot) MOZ_OVERRIDE;
michael@0 30
michael@0 31 /*
michael@0 32 * Frame continuations can be either fluid or not:
michael@0 33 * Fluid continuations ("in-flows") are the result of line breaking,
michael@0 34 * column breaking, or page breaking.
michael@0 35 * Other (non-fluid) continuations can be the result of BiDi frame splitting.
michael@0 36 * A "flow" is a chain of fluid continuations.
michael@0 37 */
michael@0 38
michael@0 39 // Get the previous/next continuation, regardless of its type (fluid or non-fluid).
michael@0 40 virtual nsIFrame* GetPrevContinuation() const MOZ_OVERRIDE;
michael@0 41 virtual nsIFrame* GetNextContinuation() const MOZ_OVERRIDE;
michael@0 42
michael@0 43 // Set a previous/next non-fluid continuation.
michael@0 44 virtual void SetPrevContinuation(nsIFrame*) MOZ_OVERRIDE;
michael@0 45 virtual void SetNextContinuation(nsIFrame*) MOZ_OVERRIDE;
michael@0 46
michael@0 47 // Get the first/last continuation for this frame.
michael@0 48 virtual nsIFrame* FirstContinuation() const MOZ_OVERRIDE;
michael@0 49 virtual nsIFrame* LastContinuation() const MOZ_OVERRIDE;
michael@0 50
michael@0 51 #ifdef DEBUG
michael@0 52 // Can aFrame2 be reached from aFrame1 by following prev/next continuations?
michael@0 53 static bool IsInPrevContinuationChain(nsIFrame* aFrame1, nsIFrame* aFrame2);
michael@0 54 static bool IsInNextContinuationChain(nsIFrame* aFrame1, nsIFrame* aFrame2);
michael@0 55 #endif
michael@0 56
michael@0 57 // Get the previous/next continuation, only if it is fluid (an "in-flow").
michael@0 58 nsIFrame* GetPrevInFlow() const;
michael@0 59 nsIFrame* GetNextInFlow() const;
michael@0 60
michael@0 61 virtual nsIFrame* GetPrevInFlowVirtual() const MOZ_OVERRIDE { return GetPrevInFlow(); }
michael@0 62 virtual nsIFrame* GetNextInFlowVirtual() const MOZ_OVERRIDE { return GetNextInFlow(); }
michael@0 63
michael@0 64 // Set a previous/next fluid continuation.
michael@0 65 virtual void SetPrevInFlow(nsIFrame*) MOZ_OVERRIDE;
michael@0 66 virtual void SetNextInFlow(nsIFrame*) MOZ_OVERRIDE;
michael@0 67
michael@0 68 // Get the first/last frame in the current flow.
michael@0 69 virtual nsIFrame* FirstInFlow() const MOZ_OVERRIDE;
michael@0 70 virtual nsIFrame* LastInFlow() const MOZ_OVERRIDE;
michael@0 71
michael@0 72 // Remove the frame from the flow. Connects the frame's prev-in-flow
michael@0 73 // and its next-in-flow. This should only be called in frame Destroy() methods.
michael@0 74 static void RemoveFromFlow(nsIFrame* aFrame);
michael@0 75
michael@0 76 protected:
michael@0 77 nsSplittableFrame(nsStyleContext* aContext) : nsFrame(aContext) {}
michael@0 78
michael@0 79 /**
michael@0 80 * Determine the height consumed by our previous-in-flows.
michael@0 81 *
michael@0 82 * @note (bz) This makes laying out a splittable frame with N in-flows
michael@0 83 * O(N^2)! So, use this function with caution and minimize the number
michael@0 84 * of calls to this method.
michael@0 85 */
michael@0 86 nscoord GetConsumedHeight() const;
michael@0 87
michael@0 88 /**
michael@0 89 * Retrieve the effective computed height of this frame, which is the computed
michael@0 90 * height, minus the height consumed by any previous in-flows.
michael@0 91 */
michael@0 92 nscoord GetEffectiveComputedHeight(const nsHTMLReflowState& aReflowState,
michael@0 93 nscoord aConsumed = NS_INTRINSICSIZE) const;
michael@0 94
michael@0 95 /**
michael@0 96 * @see nsIFrame::GetLogicalSkipSides()
michael@0 97 * @see nsIFrame::ApplyLogicalSkipSides()
michael@0 98 */
michael@0 99 virtual int GetLogicalSkipSides(const nsHTMLReflowState* aReflowState = nullptr) const MOZ_OVERRIDE;
michael@0 100
michael@0 101 #ifdef DEBUG
michael@0 102 virtual void DumpBaseRegressionData(nsPresContext* aPresContext, FILE* out, int32_t aIndent) MOZ_OVERRIDE;
michael@0 103 #endif
michael@0 104
michael@0 105 nsIFrame* mPrevContinuation;
michael@0 106 nsIFrame* mNextContinuation;
michael@0 107 };
michael@0 108
michael@0 109 #endif /* nsSplittableFrame_h___ */

mercurial