2001-09-29 00:14:13 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
|
|
|
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
1999-08-04 07:39:34 +04:00
|
|
|
*
|
2001-09-29 00:14:13 +04:00
|
|
|
* The contents of this file are subject to the Netscape Public License
|
|
|
|
* Version 1.1 (the "License"); you may not use this file except in
|
|
|
|
* compliance with the License. You may obtain a copy of the License at
|
|
|
|
* http://www.mozilla.org/NPL/
|
1999-08-04 07:39:34 +04:00
|
|
|
*
|
2001-09-29 00:14:13 +04:00
|
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* License.
|
1999-08-04 07:39:34 +04:00
|
|
|
*
|
1999-11-06 06:40:37 +03:00
|
|
|
* The Original Code is mozilla.org code.
|
|
|
|
*
|
2001-09-29 00:14:13 +04:00
|
|
|
* The Initial Developer of the Original Code is
|
|
|
|
* Netscape Communications Corporation.
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 1998
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
1999-11-06 06:40:37 +03:00
|
|
|
*
|
2001-09-29 00:14:13 +04:00
|
|
|
* Contributor(s):
|
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
|
|
|
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
|
|
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
|
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
|
|
* of those above. If you wish to allow use of your version of this file only
|
|
|
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
|
|
* use your version of this file under the terms of the NPL, indicate your
|
|
|
|
* decision by deleting the provisions above and replace them with the notice
|
|
|
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
|
|
* the provisions above, a recipient may use your version of this file under
|
|
|
|
* the terms of any one of the NPL, the GPL or the LGPL.
|
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
1999-08-04 07:39:34 +04:00
|
|
|
#ifndef nsIFrameManager_h___
|
|
|
|
#define nsIFrameManager_h___
|
|
|
|
|
|
|
|
#include "nsISupports.h"
|
2000-06-15 04:35:46 +04:00
|
|
|
#include "nsIStatefulFrame.h"
|
2001-05-30 15:26:21 +04:00
|
|
|
#include "nsString.h"
|
2002-08-24 18:41:28 +04:00
|
|
|
#include "nsChangeHint.h"
|
2002-12-04 03:58:52 +03:00
|
|
|
#include "nsIFrame.h"
|
1999-08-04 07:39:34 +04:00
|
|
|
|
|
|
|
class nsIAtom;
|
|
|
|
class nsIContent;
|
|
|
|
class nsIPresContext;
|
|
|
|
class nsIPresShell;
|
1999-08-06 00:17:44 +04:00
|
|
|
class nsIStyleSet;
|
2003-02-22 03:32:13 +03:00
|
|
|
class nsStyleContext;
|
1999-08-31 18:35:50 +04:00
|
|
|
class nsILayoutHistoryState;
|
1999-09-21 11:48:57 +04:00
|
|
|
class nsStyleChangeList;
|
2001-12-06 08:45:07 +03:00
|
|
|
class nsPlaceholderFrame;
|
1999-08-04 07:39:34 +04:00
|
|
|
|
|
|
|
#define NS_IFRAMEMANAGER_IID \
|
|
|
|
{ 0xa6cf9107, 0x15b3, 0x11d2, \
|
|
|
|
{0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32} }
|
1999-10-16 04:55:48 +04:00
|
|
|
|
1999-10-19 08:52:33 +04:00
|
|
|
// Option flags for GetFrameProperty() member function
|
1999-10-21 09:11:43 +04:00
|
|
|
#define NS_IFRAME_MGR_REMOVE_PROP 0x0001
|
|
|
|
|
1999-08-04 07:39:34 +04:00
|
|
|
/**
|
|
|
|
* Frame manager interface. The frame manager serves two purposes:
|
2002-04-16 22:13:13 +04:00
|
|
|
* <li>provides a service for mapping from content to frame and from out-of-flow
|
|
|
|
* frame to placeholder frame.
|
1999-08-04 07:39:34 +04:00
|
|
|
* <li>handles structural modifications to the frame model. If the frame model
|
|
|
|
* lock can be acquired, then the changes are processed immediately; otherwise,
|
2002-04-16 22:13:13 +04:00
|
|
|
* they're queued and processed later.
|
1999-08-04 07:39:34 +04:00
|
|
|
*/
|
|
|
|
class nsIFrameManager : public nsISupports {
|
|
|
|
public:
|
2002-06-26 07:38:55 +04:00
|
|
|
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IFRAMEMANAGER_IID)
|
1999-08-04 07:39:34 +04:00
|
|
|
|
|
|
|
// Initialization
|
1999-08-06 00:17:44 +04:00
|
|
|
NS_IMETHOD Init(nsIPresShell* aPresShell, nsIStyleSet* aStyleSet) = 0;
|
1999-08-04 07:39:34 +04:00
|
|
|
|
2001-03-06 04:46:03 +03:00
|
|
|
/**
|
|
|
|
* After Destroy is called, all methods should return
|
|
|
|
* NS_ERROR_NOT_AVAILABLE. Destroy should be called when the
|
|
|
|
* frame tree managed by the frame manager is no longer being
|
|
|
|
* displayed.
|
|
|
|
*/
|
|
|
|
NS_IMETHOD Destroy() = 0;
|
|
|
|
|
1999-10-19 02:20:37 +04:00
|
|
|
// Gets and sets the root frame (typically the viewport). The lifetime of the
|
|
|
|
// root frame is controlled by the frame manager. When the frame manager is
|
2002-04-16 22:13:13 +04:00
|
|
|
// destroyed it destroys the entire frame hierarchy.
|
1999-10-19 02:20:37 +04:00
|
|
|
NS_IMETHOD GetRootFrame(nsIFrame** aRootFrame) const = 0;
|
|
|
|
NS_IMETHOD SetRootFrame(nsIFrame* aRootFrame) = 0;
|
|
|
|
|
2000-06-01 02:33:12 +04:00
|
|
|
// Get the canvas frame. The canvas frame may or may not exist, so the
|
|
|
|
// argument aCanvasFrame may be nsnull.
|
|
|
|
NS_IMETHOD GetCanvasFrame(nsIPresContext* aPresContext, nsIFrame** aCanvasFrame) const = 0;
|
|
|
|
|
1999-08-04 07:39:34 +04:00
|
|
|
// Primary frame functions
|
1999-08-05 07:09:22 +04:00
|
|
|
NS_IMETHOD GetPrimaryFrameFor(nsIContent* aContent, nsIFrame** aPrimaryFrame) = 0;
|
1999-08-04 07:39:34 +04:00
|
|
|
NS_IMETHOD SetPrimaryFrameFor(nsIContent* aContent,
|
|
|
|
nsIFrame* aPrimaryFrame) = 0;
|
|
|
|
NS_IMETHOD ClearPrimaryFrameMap() = 0;
|
|
|
|
|
|
|
|
// Placeholder frame functions
|
|
|
|
NS_IMETHOD GetPlaceholderFrameFor(nsIFrame* aFrame,
|
|
|
|
nsIFrame** aPlaceholderFrame) const = 0;
|
2001-12-06 08:45:07 +03:00
|
|
|
NS_IMETHOD RegisterPlaceholderFrame(nsPlaceholderFrame *aPlaceholderFrame) = 0;
|
|
|
|
NS_IMETHOD UnregisterPlaceholderFrame(nsPlaceholderFrame *aPlaceholderFrame) = 0;
|
1999-08-04 07:39:34 +04:00
|
|
|
NS_IMETHOD ClearPlaceholderFrameMap() = 0;
|
|
|
|
|
1999-10-02 08:26:24 +04:00
|
|
|
// Mapping undisplayed content
|
2003-02-22 03:32:13 +03:00
|
|
|
virtual nsStyleContext* GetUndisplayedContent(nsIContent* aContent) = 0;
|
|
|
|
virtual void SetUndisplayedContent(nsIContent* aContent,
|
|
|
|
nsStyleContext* aStyleContext) = 0;
|
1999-10-02 08:26:24 +04:00
|
|
|
NS_IMETHOD ClearUndisplayedContentIn(nsIContent* aContent, nsIContent* aParentContent) = 0;
|
|
|
|
NS_IMETHOD ClearAllUndisplayedContentIn(nsIContent* aParentContent) = 0;
|
|
|
|
NS_IMETHOD ClearUndisplayedContentMap() = 0;
|
|
|
|
|
1999-08-04 07:39:34 +04:00
|
|
|
// Functions for manipulating the frame model
|
1999-11-24 09:03:41 +03:00
|
|
|
NS_IMETHOD AppendFrames(nsIPresContext* aPresContext,
|
1999-08-04 07:39:34 +04:00
|
|
|
nsIPresShell& aPresShell,
|
|
|
|
nsIFrame* aParentFrame,
|
|
|
|
nsIAtom* aListName,
|
|
|
|
nsIFrame* aFrameList) = 0;
|
1999-11-24 09:03:41 +03:00
|
|
|
NS_IMETHOD InsertFrames(nsIPresContext* aPresContext,
|
1999-08-04 07:39:34 +04:00
|
|
|
nsIPresShell& aPresShell,
|
|
|
|
nsIFrame* aParentFrame,
|
|
|
|
nsIAtom* aListName,
|
|
|
|
nsIFrame* aPrevFrame,
|
|
|
|
nsIFrame* aFrameList) = 0;
|
1999-11-24 09:03:41 +03:00
|
|
|
NS_IMETHOD RemoveFrame(nsIPresContext* aPresContext,
|
1999-08-04 07:39:34 +04:00
|
|
|
nsIPresShell& aPresShell,
|
|
|
|
nsIFrame* aParentFrame,
|
|
|
|
nsIAtom* aListName,
|
|
|
|
nsIFrame* aOldFrame) = 0;
|
1999-11-24 09:03:41 +03:00
|
|
|
NS_IMETHOD ReplaceFrame(nsIPresContext* aPresContext,
|
1999-08-04 07:39:34 +04:00
|
|
|
nsIPresShell& aPresShell,
|
|
|
|
nsIFrame* aParentFrame,
|
|
|
|
nsIAtom* aListName,
|
|
|
|
nsIFrame* aOldFrame,
|
|
|
|
nsIFrame* aNewFrame) = 0;
|
1999-08-06 00:17:44 +04:00
|
|
|
|
|
|
|
// Notification that we were unable to render a replaced element
|
|
|
|
NS_IMETHOD CantRenderReplacedElement(nsIPresContext* aPresContext,
|
|
|
|
nsIFrame* aFrame) = 0;
|
|
|
|
|
|
|
|
// Notification that a frame is about to be destroyed. This allows any outstanding
|
|
|
|
// references to the frame to be cleaned up
|
|
|
|
NS_IMETHOD NotifyDestroyingFrame(nsIFrame* aFrame) = 0;
|
1999-08-31 18:35:50 +04:00
|
|
|
|
1999-09-04 03:35:41 +04:00
|
|
|
// reparent the style contexts of this frame sub tree to live under the
|
|
|
|
// new given parent style context
|
1999-11-24 09:03:41 +03:00
|
|
|
NS_IMETHOD ReParentStyleContext(nsIPresContext* aPresContext,
|
1999-09-04 03:35:41 +04:00
|
|
|
nsIFrame* aFrame,
|
2003-02-22 03:32:13 +03:00
|
|
|
nsStyleContext* aNewParentContext) = 0;
|
1999-09-04 03:35:41 +04:00
|
|
|
|
1999-09-21 11:48:57 +04:00
|
|
|
// Re-resolve style contexts for frame tree
|
1999-11-24 09:03:41 +03:00
|
|
|
NS_IMETHOD ComputeStyleChangeFor(nsIPresContext* aPresContext,
|
1999-09-21 11:48:57 +04:00
|
|
|
nsIFrame* aFrame,
|
1999-10-16 03:16:45 +04:00
|
|
|
PRInt32 aAttrNameSpaceID,
|
|
|
|
nsIAtom* aAttribute,
|
1999-09-21 11:48:57 +04:00
|
|
|
nsStyleChangeList& aChangeList,
|
2002-08-24 18:41:28 +04:00
|
|
|
nsChangeHint aMinChange,
|
|
|
|
nsChangeHint& aTopLevelChange) = 0;
|
1999-09-21 11:48:57 +04:00
|
|
|
|
2000-05-16 06:43:33 +04:00
|
|
|
// Determine whether an attribute affects style
|
2003-02-22 19:10:53 +03:00
|
|
|
NS_IMETHOD HasAttributeDependentStyle(nsIPresContext* aPresContext,
|
|
|
|
nsIContent *aContent,
|
|
|
|
nsIAtom *aAttribute,
|
|
|
|
PRInt32 aModType,
|
|
|
|
PRBool *aResult) = 0;
|
2000-05-16 06:43:33 +04:00
|
|
|
|
1999-08-31 18:35:50 +04:00
|
|
|
/**
|
|
|
|
* Capture/restore frame state for the frame subtree rooted at aFrame.
|
|
|
|
* aState is the document state storage object onto which each frame
|
|
|
|
* stores its state.
|
|
|
|
*/
|
1999-10-26 08:44:41 +04:00
|
|
|
NS_IMETHOD CaptureFrameState(nsIPresContext* aPresContext,
|
|
|
|
nsIFrame* aFrame,
|
|
|
|
nsILayoutHistoryState* aState) = 0;
|
|
|
|
NS_IMETHOD RestoreFrameState(nsIPresContext* aPresContext,
|
|
|
|
nsIFrame* aFrame,
|
|
|
|
nsILayoutHistoryState* aState) = 0;
|
2000-06-15 04:35:46 +04:00
|
|
|
// Add/restore state for one frame (special, global type, like scroll position)
|
|
|
|
NS_IMETHOD CaptureFrameStateFor(nsIPresContext* aPresContext,
|
|
|
|
nsIFrame* aFrame,
|
|
|
|
nsILayoutHistoryState* aState,
|
|
|
|
nsIStatefulFrame::SpecialStateID aID = nsIStatefulFrame::eNoID) = 0;
|
|
|
|
NS_IMETHOD RestoreFrameStateFor(nsIPresContext* aPresContext,
|
|
|
|
nsIFrame* aFrame,
|
|
|
|
nsILayoutHistoryState* aState,
|
|
|
|
nsIStatefulFrame::SpecialStateID aID = nsIStatefulFrame::eNoID) = 0;
|
2001-05-30 15:26:21 +04:00
|
|
|
NS_IMETHOD GenerateStateKey(nsIContent* aContent,
|
|
|
|
nsIStatefulFrame::SpecialStateID aID,
|
2002-03-31 14:14:01 +04:00
|
|
|
nsACString& aString) = 0;
|
2001-05-30 15:26:21 +04:00
|
|
|
|
1999-09-21 11:48:57 +04:00
|
|
|
|
1999-10-21 09:11:43 +04:00
|
|
|
/**
|
|
|
|
* Gets a property value for a given frame.
|
|
|
|
*
|
|
|
|
* @param aFrame the frame with the property
|
|
|
|
* @param aPropertyName property name as an atom
|
|
|
|
* @param aOptions optional flags
|
|
|
|
* NS_IFRAME_MGR_REMOVE_PROP removes the property
|
|
|
|
* @param aPropertyValue the property value or 0 if the property is not set
|
|
|
|
* @return NS_OK if the property is set,
|
|
|
|
* NS_IFRAME_MGR_PROP_NOT_THERE if the property is not set
|
|
|
|
*/
|
1999-10-16 04:55:48 +04:00
|
|
|
NS_IMETHOD GetFrameProperty(nsIFrame* aFrame,
|
|
|
|
nsIAtom* aPropertyName,
|
1999-10-19 08:52:33 +04:00
|
|
|
PRUint32 aOptions,
|
1999-10-16 04:55:48 +04:00
|
|
|
void** aPropertyValue) = 0;
|
|
|
|
|
1999-10-21 09:11:43 +04:00
|
|
|
/**
|
|
|
|
* Sets the property value for a given frame.
|
|
|
|
*
|
|
|
|
* A frame may only have one property value at a time for a given property
|
|
|
|
* name. The existing property value (if there is one) is overwritten, and the
|
|
|
|
* old value destroyed
|
|
|
|
*
|
|
|
|
* @param aFrame the frame to set the property on
|
|
|
|
* @param aPropertyName property name as an atom
|
|
|
|
* @param aPropertyValue the property value
|
|
|
|
* @param aPropertyDtorFunc when setting a property you can specify the
|
|
|
|
* dtor function (can be NULL) that will be used
|
|
|
|
* to destroy the property value. There can be only
|
|
|
|
* one dtor function for a given property name
|
|
|
|
* @return NS_OK if successful,
|
|
|
|
* NS_IFRAME_MGR_PROP_OVERWRITTEN if there is an existing property
|
|
|
|
* value that was overwritten,
|
|
|
|
* NS_ERROR_INVALID_ARG if the dtor function does not match the
|
|
|
|
* existing dtor function
|
|
|
|
*/
|
2002-12-04 03:58:52 +03:00
|
|
|
NS_IMETHOD SetFrameProperty(nsIFrame* aFrame,
|
|
|
|
nsIAtom* aPropertyName,
|
|
|
|
void* aPropertyValue,
|
|
|
|
NSFramePropertyDtorFunc aPropertyDtorFunc) = 0;
|
1999-10-21 09:11:43 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Removes a property and destroys its property value by calling the dtor
|
|
|
|
* function associated with the property name.
|
|
|
|
*
|
|
|
|
* When a frame is destroyed any remaining properties are automatically removed
|
|
|
|
*
|
|
|
|
* @param aFrame the frame to set the property on
|
|
|
|
* @param aPropertyName property name as an atom
|
|
|
|
* @return NS_OK if the property is successfully removed,
|
|
|
|
* NS_IFRAME_MGR_PROP_NOT_THERE if the property is not set
|
|
|
|
*/
|
1999-10-16 04:55:48 +04:00
|
|
|
NS_IMETHOD RemoveFrameProperty(nsIFrame* aFrame,
|
|
|
|
nsIAtom* aPropertyName) = 0;
|
|
|
|
|
1999-09-21 11:48:57 +04:00
|
|
|
#ifdef NS_DEBUG
|
|
|
|
/**
|
|
|
|
* DEBUG ONLY method to verify integrity of style tree versus frame tree
|
|
|
|
*/
|
2000-01-22 04:16:50 +03:00
|
|
|
NS_IMETHOD DebugVerifyStyleTree(nsIPresContext* aPresContext, nsIFrame* aFrame) = 0;
|
1999-09-21 11:48:57 +04:00
|
|
|
#endif
|
1999-08-04 07:39:34 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Create a frame manager. Upon success, call Init() before attempting to
|
|
|
|
* use it.
|
|
|
|
*/
|
2003-03-05 18:08:41 +03:00
|
|
|
nsresult
|
|
|
|
NS_NewFrameManager(nsIFrameManager** aInstancePtrResult);
|
1999-08-04 07:39:34 +04:00
|
|
|
|
|
|
|
#endif /* nsIFrameManager_h___ */
|