gecko-dev/layout/base/public/nsIFrameManager.h

181 lines
7.7 KiB
C
Raw Normal View History

1999-08-04 03:39:34 +00:00
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef nsIFrameManager_h___
#define nsIFrameManager_h___
#include "nslayout.h"
#include "nsISupports.h"
class nsIAtom;
class nsIContent;
class nsIFrame;
class nsIPresContext;
class nsIPresShell;
class nsIStyleSet;
1999-09-03 23:35:41 +00:00
class nsIStyleContext;
class nsILayoutHistoryState;
class nsStyleChangeList;
1999-08-04 03:39:34 +00:00
#define NS_IFRAMEMANAGER_IID \
{ 0xa6cf9107, 0x15b3, 0x11d2, \
{0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32} }
// Calback function used to destroy the value associated with a
// given property. used by RemoveFrameProperty()
typedef void
(*FMPropertyDtorFunc)(nsIFrame* aFrame,
nsIAtom* aPropertyName,
void* aPropertyValue);
1999-08-04 03:39:34 +00: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
NS_IMETHOD Init(nsIPresShell* aPresShell, nsIStyleSet* aStyleSet) = 0;
1999-08-04 03:39:34 +00: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;
1999-08-04 03:39:34 +00:00
// Primary frame functions
NS_IMETHOD GetPrimaryFrameFor(nsIContent* aContent, nsIFrame** aPrimaryFrame) = 0;
1999-08-04 03:39:34 +00: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;
// 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 03:39:34 +00:00
// Functions for manipulating the frame model
NS_IMETHOD AppendFrames(nsIPresContext& aPresContext,
nsIPresShell& aPresShell,
nsIFrame* aParentFrame,
nsIAtom* aListName,
nsIFrame* aFrameList) = 0;
NS_IMETHOD InsertFrames(nsIPresContext& aPresContext,
nsIPresShell& aPresShell,
nsIFrame* aParentFrame,
nsIAtom* aListName,
nsIFrame* aPrevFrame,
nsIFrame* aFrameList) = 0;
NS_IMETHOD RemoveFrame(nsIPresContext& aPresContext,
nsIPresShell& aPresShell,
nsIFrame* aParentFrame,
nsIAtom* aListName,
nsIFrame* aOldFrame) = 0;
NS_IMETHOD ReplaceFrame(nsIPresContext& aPresContext,
nsIPresShell& aPresShell,
nsIFrame* aParentFrame,
nsIAtom* aListName,
nsIFrame* aOldFrame,
nsIFrame* aNewFrame) = 0;
// 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-09-03 23:35:41 +00:00
// reparent the style contexts of this frame sub tree to live under the
// new given parent style context
NS_IMETHOD ReParentStyleContext(nsIPresContext& aPresContext,
nsIFrame* aFrame,
nsIStyleContext* aNewParentContext) = 0;
// Re-resolve style contexts for frame tree
NS_IMETHOD ComputeStyleChangeFor(nsIPresContext& aPresContext,
nsIFrame* aFrame,
PRInt32 aAttrNameSpaceID,
nsIAtom* aAttribute,
nsStyleChangeList& aChangeList,
PRInt32 aMinChange,
PRInt32& aTopLevelChange) = 0;
/**
* 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.
*/
NS_IMETHOD CaptureFrameState(nsIFrame* aFrame, nsILayoutHistoryState* aState) = 0;
NS_IMETHOD RestoreFrameState(nsIFrame* aFrame, nsILayoutHistoryState* aState) = 0;
// Gets and sets properties on a given frame
NS_IMETHOD GetFrameProperty(nsIFrame* aFrame,
nsIAtom* aPropertyName,
void** aPropertyValue) = 0;
// Sets the property value. A frame may only have one property value
// at a time for a given property name.
// When setting a property you may 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 atom, and the set call
// will fail with error NS_ERROR_INVALID_ARG if the dtor function does
// not match the existing dtor function
NS_IMETHOD SetFrameProperty(nsIFrame* aFrame,
nsIAtom* aPropertyName,
void* aPropertyValue,
FMPropertyDtorFunc aPropDtorFunc) = 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
NS_IMETHOD RemoveFrameProperty(nsIFrame* aFrame,
nsIAtom* aPropertyName) = 0;
#ifdef NS_DEBUG
/**
* DEBUG ONLY method to verify integrity of style tree versus frame tree
*/
NS_IMETHOD DebugVerifyStyleTree(nsIFrame* aFrame) = 0;
#endif
1999-08-04 03:39:34 +00: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___ */