1999-08-04 07:39:34 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
*
|
1999-11-06 06:40:37 +03: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
|
|
|
*
|
1999-11-06 06:40:37 +03: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.
|
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is Netscape
|
1999-08-04 07:39:34 +04:00
|
|
|
* Communications Corporation. Portions created by Netscape are
|
1999-11-06 06:40:37 +03:00
|
|
|
* Copyright (C) 1998 Netscape Communications Corporation. All
|
|
|
|
* Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s):
|
1999-08-04 07:39:34 +04:00
|
|
|
*/
|
|
|
|
#ifndef nsIFrameManager_h___
|
|
|
|
#define nsIFrameManager_h___
|
|
|
|
|
|
|
|
#include "nslayout.h"
|
|
|
|
#include "nsISupports.h"
|
2000-06-15 04:35:46 +04:00
|
|
|
#include "nsIStatefulFrame.h"
|
1999-08-04 07:39:34 +04:00
|
|
|
|
|
|
|
class nsIAtom;
|
|
|
|
class nsIContent;
|
|
|
|
class nsIFrame;
|
|
|
|
class nsIPresContext;
|
|
|
|
class nsIPresShell;
|
1999-08-06 00:17:44 +04:00
|
|
|
class nsIStyleSet;
|
1999-09-04 03:35:41 +04:00
|
|
|
class nsIStyleContext;
|
1999-08-31 18:35:50 +04:00
|
|
|
class nsILayoutHistoryState;
|
1999-09-21 11:48:57 +04:00
|
|
|
class nsStyleChangeList;
|
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
|
|
|
|
|
|
|
// Calback function used to destroy the value associated with a
|
|
|
|
// given property. used by RemoveFrameProperty()
|
|
|
|
typedef void
|
1999-10-21 09:11:43 +04:00
|
|
|
(*NSFMPropertyDtorFunc)(nsIPresContext* aPresContext,
|
|
|
|
nsIFrame* aFrame,
|
|
|
|
nsIAtom* aPropertyName,
|
|
|
|
void* aPropertyValue);
|
1999-08-04 07:39:34 +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
|
|
|
|
|
|
|
|
// nsresult error codes for frame property functions
|
|
|
|
#define NS_IFRAME_MGR_PROP_NOT_THERE \
|
|
|
|
NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_LAYOUT, 1)
|
|
|
|
|
|
|
|
#define NS_IFRAME_MGR_PROP_OVERWRITTEN \
|
|
|
|
NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_LAYOUT, 2)
|
1999-10-19 08:52:33 +04:00
|
|
|
|
1999-08-04 07:39:34 +04:00
|
|
|
/**
|
|
|
|
* Frame manager interface. The frame manager serves two purposes:
|
|
|
|
* <li>provides a serice for mapping from content to frame and from out-of-flow
|
|
|
|
* frame to placeholder frame
|
|
|
|
* <li>handles structural modifications to the frame model. If the frame model
|
|
|
|
* lock can be acquired, then the changes are processed immediately; otherwise,
|
|
|
|
* they're queued and processed later
|
|
|
|
*/
|
|
|
|
class nsIFrameManager : public nsISupports {
|
|
|
|
public:
|
|
|
|
static const nsIID& GetIID() {static nsIID iid = NS_IFRAMEMANAGER_IID; return iid;}
|
|
|
|
|
|
|
|
// 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
|
|
|
|
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
|
|
|
|
// destroyed it destroys the entire frame hierarchy
|
|
|
|
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;
|
|
|
|
NS_IMETHOD SetPlaceholderFrameFor(nsIFrame* aFrame,
|
|
|
|
nsIFrame* aPlaceholderFrame) = 0;
|
|
|
|
NS_IMETHOD ClearPlaceholderFrameMap() = 0;
|
|
|
|
|
1999-10-02 08:26:24 +04:00
|
|
|
// Mapping undisplayed content
|
|
|
|
NS_IMETHOD SetUndisplayedContent(nsIContent* aContent, nsIStyleContext* aStyleContext) = 0;
|
|
|
|
NS_IMETHOD SetUndisplayedPseudoIn(nsIStyleContext* aPseudoContext,
|
|
|
|
nsIContent* aParentContent) = 0;
|
|
|
|
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,
|
|
|
|
nsIStyleContext* aNewParentContext) = 0;
|
|
|
|
|
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,
|
|
|
|
PRInt32 aMinChange,
|
|
|
|
PRInt32& aTopLevelChange) = 0;
|
|
|
|
|
2000-05-16 06:43:33 +04:00
|
|
|
// Determine whether an attribute affects style
|
|
|
|
NS_IMETHOD AttributeAffectsStyle(nsIAtom *aAttribute, nsIContent *aContent,
|
|
|
|
PRBool &aAffects) = 0;
|
|
|
|
|
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;
|
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
|
|
|
|
*/
|
|
|
|
NS_IMETHOD SetFrameProperty(nsIFrame* aFrame,
|
|
|
|
nsIAtom* aPropertyName,
|
|
|
|
void* aPropertyValue,
|
|
|
|
NSFMPropertyDtorFunc aPropertyDtorFunc) = 0;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
extern NS_LAYOUT nsresult
|
|
|
|
NS_NewFrameManager(nsIFrameManager** aInstancePtrResult);
|
|
|
|
|
|
|
|
#endif /* nsIFrameManager_h___ */
|