2001-09-28 20:14:13 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 11:12:37 +00: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
|
|
|
|
|
|
|
/*
|
|
|
|
* base class for rendering objects that can be split across lines,
|
|
|
|
* columns, or pages
|
|
|
|
*/
|
|
|
|
|
1998-04-13 20:24:54 +00:00
|
|
|
#ifndef nsSplittableFrame_h___
|
|
|
|
#define nsSplittableFrame_h___
|
|
|
|
|
2012-09-14 16:10:08 +00:00
|
|
|
#include "mozilla/Attributes.h"
|
1998-04-13 20:24:54 +00:00
|
|
|
#include "nsFrame.h"
|
|
|
|
|
|
|
|
// Derived class that allows splitting
|
|
|
|
class nsSplittableFrame : public nsFrame
|
|
|
|
{
|
|
|
|
public:
|
2009-09-12 16:49:24 +00:00
|
|
|
NS_DECL_FRAMEARENA_HELPERS
|
|
|
|
|
2013-03-20 01:47:48 +00:00
|
|
|
virtual void Init(nsIContent* aContent,
|
|
|
|
nsIFrame* aParent,
|
|
|
|
nsIFrame* aPrevInFlow) MOZ_OVERRIDE;
|
1999-02-25 03:27:57 +00:00
|
|
|
|
2013-05-14 16:33:23 +00:00
|
|
|
virtual nsSplittableType GetSplittableType() const MOZ_OVERRIDE;
|
2002-10-30 15:33:36 +00:00
|
|
|
|
2013-05-14 16:33:23 +00:00
|
|
|
virtual void DestroyFrom(nsIFrame* aDestructRoot) MOZ_OVERRIDE;
|
2002-10-30 15:33:36 +00:00
|
|
|
|
2006-02-21 21:33:47 +00:00
|
|
|
/*
|
|
|
|
* Frame continuations can be either fluid or not:
|
|
|
|
* Fluid continuations ("in-flows") are the result of line breaking,
|
|
|
|
* column breaking, or page breaking.
|
|
|
|
* Other (non-fluid) continuations can be the result of BiDi frame splitting.
|
|
|
|
* A "flow" is a chain of fluid continuations.
|
|
|
|
*/
|
|
|
|
|
|
|
|
// Get the previous/next continuation, regardless of its type (fluid or non-fluid).
|
2012-09-14 16:10:08 +00:00
|
|
|
virtual nsIFrame* GetPrevContinuation() const MOZ_OVERRIDE;
|
|
|
|
virtual nsIFrame* GetNextContinuation() const MOZ_OVERRIDE;
|
2006-02-21 21:33:47 +00:00
|
|
|
|
|
|
|
// Set a previous/next non-fluid continuation.
|
2013-09-25 17:54:55 +00:00
|
|
|
virtual void SetPrevContinuation(nsIFrame*) MOZ_OVERRIDE;
|
|
|
|
virtual void SetNextContinuation(nsIFrame*) MOZ_OVERRIDE;
|
2006-02-21 21:33:47 +00:00
|
|
|
|
|
|
|
// Get the first/last continuation for this frame.
|
2013-09-25 11:42:34 +00:00
|
|
|
virtual nsIFrame* FirstContinuation() const MOZ_OVERRIDE;
|
|
|
|
virtual nsIFrame* LastContinuation() const MOZ_OVERRIDE;
|
2006-02-21 21:33:47 +00:00
|
|
|
|
|
|
|
#ifdef DEBUG
|
|
|
|
// Can aFrame2 be reached from aFrame1 by following prev/next continuations?
|
2011-09-29 06:19:26 +00:00
|
|
|
static bool IsInPrevContinuationChain(nsIFrame* aFrame1, nsIFrame* aFrame2);
|
|
|
|
static bool IsInNextContinuationChain(nsIFrame* aFrame1, nsIFrame* aFrame2);
|
2006-02-21 21:33:47 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
// Get the previous/next continuation, only if it is fluid (an "in-flow").
|
|
|
|
nsIFrame* GetPrevInFlow() const;
|
|
|
|
nsIFrame* GetNextInFlow() const;
|
|
|
|
|
2012-09-14 16:10:08 +00:00
|
|
|
virtual nsIFrame* GetPrevInFlowVirtual() const MOZ_OVERRIDE { return GetPrevInFlow(); }
|
|
|
|
virtual nsIFrame* GetNextInFlowVirtual() const MOZ_OVERRIDE { return GetNextInFlow(); }
|
2006-02-21 21:33:47 +00:00
|
|
|
|
|
|
|
// Set a previous/next fluid continuation.
|
2013-09-25 17:54:55 +00:00
|
|
|
virtual void SetPrevInFlow(nsIFrame*) MOZ_OVERRIDE;
|
|
|
|
virtual void SetNextInFlow(nsIFrame*) MOZ_OVERRIDE;
|
1998-04-13 20:24:54 +00:00
|
|
|
|
2006-02-21 21:33:47 +00:00
|
|
|
// Get the first/last frame in the current flow.
|
2013-09-25 11:42:34 +00:00
|
|
|
virtual nsIFrame* FirstInFlow() const MOZ_OVERRIDE;
|
|
|
|
virtual nsIFrame* LastInFlow() const MOZ_OVERRIDE;
|
1998-04-13 20:24:54 +00:00
|
|
|
|
1999-10-22 14:53:52 +00:00
|
|
|
// Remove the frame from the flow. Connects the frame's prev-in-flow
|
2009-04-10 01:19:06 +00:00
|
|
|
// and its next-in-flow. This should only be called in frame Destroy() methods.
|
1999-10-22 14:53:52 +00:00
|
|
|
static void RemoveFromFlow(nsIFrame* aFrame);
|
1998-04-13 20:24:54 +00:00
|
|
|
|
|
|
|
protected:
|
2006-03-26 21:30:36 +00:00
|
|
|
nsSplittableFrame(nsStyleContext* aContext) : nsFrame(aContext) {}
|
|
|
|
|
2013-07-25 15:34:12 +00:00
|
|
|
/**
|
|
|
|
* Determine the height consumed by our previous-in-flows.
|
|
|
|
*
|
|
|
|
* @note (bz) This makes laying out a splittable frame with N in-flows
|
|
|
|
* O(N^2)! So, use this function with caution and minimize the number
|
|
|
|
* of calls to this method.
|
|
|
|
*/
|
|
|
|
nscoord GetConsumedHeight() const;
|
|
|
|
|
2013-07-25 15:34:16 +00:00
|
|
|
/**
|
|
|
|
* Retrieve the effective computed height of this frame, which is the computed
|
|
|
|
* height, minus the height consumed by any previous in-flows.
|
|
|
|
*/
|
|
|
|
nscoord GetEffectiveComputedHeight(const nsHTMLReflowState& aReflowState,
|
|
|
|
nscoord aConsumed = NS_INTRINSICSIZE) const;
|
|
|
|
|
2013-07-25 15:34:27 +00:00
|
|
|
/**
|
2014-03-13 07:39:33 +00:00
|
|
|
* @see nsIFrame::GetLogicalSkipSides()
|
|
|
|
* @see nsIFrame::ApplyLogicalSkipSides()
|
2013-07-25 15:34:27 +00:00
|
|
|
*/
|
2014-03-13 07:39:33 +00:00
|
|
|
virtual int GetLogicalSkipSides(const nsHTMLReflowState* aReflowState = nullptr) const MOZ_OVERRIDE;
|
2013-07-25 15:34:27 +00:00
|
|
|
|
1999-11-01 22:12:45 +00:00
|
|
|
#ifdef DEBUG
|
2012-09-14 16:10:08 +00:00
|
|
|
virtual void DumpBaseRegressionData(nsPresContext* aPresContext, FILE* out, int32_t aIndent) MOZ_OVERRIDE;
|
1999-11-01 22:12:45 +00:00
|
|
|
#endif
|
1998-11-19 18:51:53 +00:00
|
|
|
|
2006-02-21 21:33:47 +00:00
|
|
|
nsIFrame* mPrevContinuation;
|
|
|
|
nsIFrame* mNextContinuation;
|
1998-04-13 20:24:54 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* nsSplittableFrame_h___ */
|