Tracer build fixes. (b=588021, r=dvander)
[mozilla-central.git] / layout / base / nsFrameManager.h
blob86f1c04766cbf5ffd7845bb249a89806ced40a26
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 * vim:cindent:ts=2:et:sw=2:
4 * ***** BEGIN LICENSE BLOCK *****
5 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
7 * The contents of this file are subject to the Mozilla Public License Version
8 * 1.1 (the "License"); you may not use this file except in compliance with
9 * the License. You may obtain a copy of the License at
10 * http://www.mozilla.org/MPL/
12 * Software distributed under the License is distributed on an "AS IS" basis,
13 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
14 * for the specific language governing rights and limitations under the
15 * License.
17 * The Original Code is mozilla.org code.
19 * The Initial Developer of the Original Code is
20 * Netscape Communications Corporation.
21 * Portions created by the Initial Developer are Copyright (C) 1998
22 * the Initial Developer. All Rights Reserved.
24 * Contributor(s):
25 * Pierre Phaneuf <pp@ludusdesign.com>
27 * Alternatively, the contents of this file may be used under the terms of
28 * either of the GNU General Public License Version 2 or later (the "GPL"),
29 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
30 * in which case the provisions of the GPL or the LGPL are applicable instead
31 * of those above. If you wish to allow use of your version of this file only
32 * under the terms of either the GPL or the LGPL, and not to allow others to
33 * use your version of this file under the terms of the MPL, indicate your
34 * decision by deleting the provisions above and replace them with the notice
35 * and other provisions required by the GPL or the LGPL. If you do not delete
36 * the provisions above, a recipient may use your version of this file under
37 * the terms of any one of the MPL, the GPL or the LGPL.
39 * ***** END LICENSE BLOCK *****
41 * This Original Code has been modified by IBM Corporation. Modifications made
42 * by IBM described herein are Copyright (c) International Business Machines
43 * Corporation, 2000. Modifications to Mozilla code or documentation identified
44 * per MPL Section 3.3
46 * Date Modified by Description of modification
47 * 04/20/2000 IBM Corp. OS/2 VisualAge build.
50 /* storage of the frame tree and information about it */
52 #ifndef _nsFrameManager_h_
53 #define _nsFrameManager_h_
55 #include "nsIFrame.h"
56 #include "nsIStatefulFrame.h"
57 #include "nsChangeHint.h"
58 #include "nsFrameManagerBase.h"
60 namespace mozilla {
61 namespace css {
62 class RestyleTracker;
63 } // namespace css
64 } // namespace mozilla
66 /**
67 * Frame manager interface. The frame manager serves two purposes:
68 * <li>provides a service for mapping from content to frame and from
69 * out-of-flow frame to placeholder frame.
70 * <li>handles structural modifications to the frame model. If the frame model
71 * lock can be acquired, then the changes are processed immediately; otherwise,
72 * they're queued and processed later.
74 * Do not add virtual methods to this class, or bryner will punish you.
77 class nsFrameManager : public nsFrameManagerBase
79 typedef mozilla::css::RestyleTracker RestyleTracker;
81 public:
82 nsFrameManager() NS_HIDDEN;
83 ~nsFrameManager() NS_HIDDEN;
85 void* operator new(size_t aSize, nsIPresShell* aHost) {
86 NS_ASSERTION(aSize == sizeof(nsFrameManager), "Unexpected subclass");
87 NS_ASSERTION(aSize == sizeof(nsFrameManagerBase),
88 "Superclass/subclass mismatch");
89 return aHost->FrameManager();
92 // Initialization
93 NS_HIDDEN_(nsresult) Init(nsIPresShell* aPresShell, nsStyleSet* aStyleSet);
96 * After Destroy is called, it is an error to call any FrameManager methods.
97 * Destroy should be called when the frame tree managed by the frame
98 * manager is no longer being displayed.
100 NS_HIDDEN_(void) Destroy();
102 // Placeholder frame functions
103 NS_HIDDEN_(nsPlaceholderFrame*) GetPlaceholderFrameFor(nsIFrame* aFrame);
104 NS_HIDDEN_(nsresult)
105 RegisterPlaceholderFrame(nsPlaceholderFrame* aPlaceholderFrame);
107 NS_HIDDEN_(void)
108 UnregisterPlaceholderFrame(nsPlaceholderFrame* aPlaceholderFrame);
110 NS_HIDDEN_(void) ClearPlaceholderFrameMap();
112 // Mapping undisplayed content
113 NS_HIDDEN_(nsStyleContext*) GetUndisplayedContent(nsIContent* aContent);
114 NS_HIDDEN_(void) SetUndisplayedContent(nsIContent* aContent,
115 nsStyleContext* aStyleContext);
116 NS_HIDDEN_(void) ChangeUndisplayedContent(nsIContent* aContent,
117 nsStyleContext* aStyleContext);
118 NS_HIDDEN_(void) ClearUndisplayedContentIn(nsIContent* aContent,
119 nsIContent* aParentContent);
120 NS_HIDDEN_(void) ClearAllUndisplayedContentIn(nsIContent* aParentContent);
122 // Functions for manipulating the frame model
123 NS_HIDDEN_(nsresult) AppendFrames(nsIFrame* aParentFrame,
124 nsIAtom* aListName,
125 nsFrameList& aFrameList)
127 return aParentFrame->AppendFrames(aListName, aFrameList);
130 NS_HIDDEN_(nsresult) InsertFrames(nsIFrame* aParentFrame,
131 nsIAtom* aListName,
132 nsIFrame* aPrevFrame,
133 nsFrameList& aFrameList);
135 NS_HIDDEN_(nsresult) RemoveFrame(nsIAtom* aListName,
136 nsIFrame* aOldFrame);
139 * Notification that a frame is about to be destroyed. This allows any
140 * outstanding references to the frame to be cleaned up.
142 NS_HIDDEN_(void) NotifyDestroyingFrame(nsIFrame* aFrame);
145 * Reparent the style contexts of this frame subtree. The parent frame of
146 * aFrame must be changed to the new parent before this function is called;
147 * the new parent style context will be automatically computed based on the
148 * new position in the frame tree.
150 * @param aFrame the root of the subtree to reparent. Must not be null.
152 NS_HIDDEN_(nsresult) ReparentStyleContext(nsIFrame* aFrame);
155 * Re-resolve the style contexts for a frame tree, building
156 * aChangeList based on the resulting style changes, plus aMinChange
157 * applied to aFrame.
159 NS_HIDDEN_(void)
160 ComputeStyleChangeFor(nsIFrame* aFrame,
161 nsStyleChangeList* aChangeList,
162 nsChangeHint aMinChange,
163 RestyleTracker& aRestyleTracker,
164 PRBool aRestyleDescendants);
167 * Capture/restore frame state for the frame subtree rooted at aFrame.
168 * aState is the document state storage object onto which each frame
169 * stores its state.
172 NS_HIDDEN_(void) CaptureFrameState(nsIFrame* aFrame,
173 nsILayoutHistoryState* aState);
175 NS_HIDDEN_(void) RestoreFrameState(nsIFrame* aFrame,
176 nsILayoutHistoryState* aState);
179 * Add/restore state for one frame
180 * (special, global type, like scroll position)
182 NS_HIDDEN_(void) CaptureFrameStateFor(nsIFrame* aFrame,
183 nsILayoutHistoryState* aState,
184 nsIStatefulFrame::SpecialStateID aID =
185 nsIStatefulFrame::eNoID);
187 NS_HIDDEN_(void) RestoreFrameStateFor(nsIFrame* aFrame,
188 nsILayoutHistoryState* aState,
189 nsIStatefulFrame::SpecialStateID aID =
190 nsIStatefulFrame::eNoID);
192 #ifdef NS_DEBUG
194 * DEBUG ONLY method to verify integrity of style tree versus frame tree
196 NS_HIDDEN_(void) DebugVerifyStyleTree(nsIFrame* aFrame);
197 #endif
199 NS_HIDDEN_(nsIPresShell*) GetPresShell() const { return mPresShell; }
200 NS_HIDDEN_(nsPresContext*) GetPresContext() const {
201 return mPresShell->GetPresContext();
204 private:
205 enum DesiredA11yNotifications {
206 eSkipNotifications,
207 eSendAllNotifications,
208 eNotifyIfShown
211 enum A11yNotificationType {
212 eDontNotify,
213 eNotifyShown,
214 eNotifyHidden
217 // Use eRestyle_Self for the aRestyleHint argument to mean
218 // "reresolve our style context but not kids", use eRestyle_Subtree
219 // to mean "reresolve our style context and kids", and use
220 // nsRestyleHint(0) to mean recompute a new style context for our
221 // current parent and existing rulenode, and the same for kids.
222 NS_HIDDEN_(nsChangeHint)
223 ReResolveStyleContext(nsPresContext *aPresContext,
224 nsIFrame *aFrame,
225 nsIContent *aParentContent,
226 nsStyleChangeList *aChangeList,
227 nsChangeHint aMinChange,
228 nsRestyleHint aRestyleHint,
229 RestyleTracker& aRestyleTracker,
230 DesiredA11yNotifications aDesiredA11yNotifications,
231 nsTArray<nsIContent*>& aVisibleKidsOfHiddenElement);
234 #endif