gecko-dev/layout/generic/nsIStatefulFrame.h
Benjamin Smedberg 3498a5f86e Bug 396185 - Make nsIFrame derivatives and helper abstract classes use a different dynamic-cast system than nsISupports:
* we know all types frames may be cast to at compile time, so instead of extensible GUID IIDs, use a big enum (see nsQueryFrame::FrameIID)
* eliminate all vestiges of refcounting, since frames aren't refcounted

Some frames (SVG frames in particular) still implement nsISupports-derived interfaces, for example nsISVGValue. There is a FrameIID for nsISVGValue that lets you go from a frame to the XPCOM interface, but you can't query back.

r+sr=roc

nsITextControlFrame didn't have an IID the first time around, but this wasn't a compile error because nsITextControlFrame::kFrameIID inherited from nsIFormControlFrame::kFrameIID. I've added a static analysis pass to verify the correct behavior, since I can't figure out a way to make the compiler do it.

--HG--
extra : rebase_source : 4894a2ca0278e2ab92f27459db77165f8348cf41
2009-01-12 14:20:59 -05:00

35 lines
1.0 KiB
C++

/*
* interface for rendering objects whose state is saved in
* session-history (back-forward navigation)
*/
#ifndef _nsIStatefulFrame_h
#define _nsIStatefulFrame_h
#include "nsQueryFrame.h"
class nsPresContext;
class nsPresState;
class nsIStatefulFrame
{
public:
NS_DECLARE_FRAME_ACCESSOR(nsIStatefulFrame)
// If you create a special type stateful frame (e.g. scroll) that needs
// to be captured outside of the standard pass through the frames, you'll need
// a special ID by which to refer to that type.
enum SpecialStateID {eNoID=0, eDocumentScrollState};
// Save the state for this frame. Some implementations may choose to return
// different states depending on the value of aStateID. If this method
// succeeds, the caller is responsible for deleting the resulting state when
// done with it.
NS_IMETHOD SaveState(SpecialStateID aStateID, nsPresState** aState) = 0;
// Restore the state for this frame from aState
NS_IMETHOD RestoreState(nsPresState* aState) = 0;
};
#endif /* _nsIStatefulFrame_h */