1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
15 * The Original Code is mozilla.org code.
17 * The Initial Developer of the Original Code is
18 * Netscape Communications Corporation.
19 * Portions created by the Initial Developer are Copyright (C) 1998
20 * the Initial Developer. All Rights Reserved.
24 * Alternatively, the contents of this file may be used under the terms of
25 * either of the GNU General Public License Version 2 or later (the "GPL"),
26 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 * in which case the provisions of the GPL or the LGPL are applicable instead
28 * of those above. If you wish to allow use of your version of this file only
29 * under the terms of either the GPL or the LGPL, and not to allow others to
30 * use your version of this file under the terms of the MPL, indicate your
31 * decision by deleting the provisions above and replace them with the notice
32 * and other provisions required by the GPL or the LGPL. If you do not delete
33 * the provisions above, a recipient may use your version of this file under
34 * the terms of any one of the MPL, the GPL or the LGPL.
36 * ***** END LICENSE BLOCK ***** */
39 * base class for rendering objects that can be split across lines,
43 #ifndef nsSplittableFrame_h___
44 #define nsSplittableFrame_h___
48 // Derived class that allows splitting
49 class nsSplittableFrame
: public nsFrame
52 NS_IMETHOD
Init(nsIContent
* aContent
,
54 nsIFrame
* aPrevInFlow
);
56 virtual nsSplittableType
GetSplittableType() const;
58 virtual void Destroy();
61 * Frame continuations can be either fluid or not:
62 * Fluid continuations ("in-flows") are the result of line breaking,
63 * column breaking, or page breaking.
64 * Other (non-fluid) continuations can be the result of BiDi frame splitting.
65 * A "flow" is a chain of fluid continuations.
68 // Get the previous/next continuation, regardless of its type (fluid or non-fluid).
69 virtual nsIFrame
* GetPrevContinuation() const;
70 virtual nsIFrame
* GetNextContinuation() const;
72 // Set a previous/next non-fluid continuation.
73 NS_IMETHOD
SetPrevContinuation(nsIFrame
*);
74 NS_IMETHOD
SetNextContinuation(nsIFrame
*);
76 // Get the first/last continuation for this frame.
77 virtual nsIFrame
* GetFirstContinuation() const;
78 virtual nsIFrame
* GetLastContinuation() const;
81 // Can aFrame2 be reached from aFrame1 by following prev/next continuations?
82 static PRBool
IsInPrevContinuationChain(nsIFrame
* aFrame1
, nsIFrame
* aFrame2
);
83 static PRBool
IsInNextContinuationChain(nsIFrame
* aFrame1
, nsIFrame
* aFrame2
);
86 // Get the previous/next continuation, only if it is fluid (an "in-flow").
87 nsIFrame
* GetPrevInFlow() const;
88 nsIFrame
* GetNextInFlow() const;
90 virtual nsIFrame
* GetPrevInFlowVirtual() const { return GetPrevInFlow(); }
91 virtual nsIFrame
* GetNextInFlowVirtual() const { return GetNextInFlow(); }
93 // Set a previous/next fluid continuation.
94 NS_IMETHOD
SetPrevInFlow(nsIFrame
*);
95 NS_IMETHOD
SetNextInFlow(nsIFrame
*);
97 // Get the first/last frame in the current flow.
98 virtual nsIFrame
* GetFirstInFlow() const;
99 virtual nsIFrame
* GetLastInFlow() const;
101 // Remove the frame from the flow. Connects the frame's prev-in-flow
102 // and its next-in-flow
103 static void RemoveFromFlow(nsIFrame
* aFrame
);
105 // Detach from previous frame in flow
106 static void BreakFromPrevFlow(nsIFrame
* aFrame
);
109 nsSplittableFrame(nsStyleContext
* aContext
) : nsFrame(aContext
) {}
112 virtual void DumpBaseRegressionData(nsPresContext
* aPresContext
, FILE* out
, PRInt32 aIndent
, PRBool aIncludeStyleData
);
115 nsIFrame
* mPrevContinuation
;
116 nsIFrame
* mNextContinuation
;
119 #endif /* nsSplittableFrame_h___ */