1998-04-14 00:24:54 +04: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 nsIFrame_h___
|
|
|
|
#define nsIFrame_h___
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include "nslayout.h"
|
|
|
|
#include "nsISupports.h"
|
|
|
|
#include "nsSize.h"
|
|
|
|
#include "nsGUIEvent.h"
|
1998-05-21 06:34:13 +04:00
|
|
|
#include "nsStyleStruct.h"
|
1998-04-14 00:24:54 +04:00
|
|
|
|
1998-09-18 23:53:27 +04:00
|
|
|
class nsIAtom;
|
1998-04-14 00:24:54 +04:00
|
|
|
class nsIContent;
|
1998-06-06 01:06:24 +04:00
|
|
|
class nsIFrame;
|
1998-04-14 00:24:54 +04:00
|
|
|
class nsIPresContext;
|
|
|
|
class nsIPresShell;
|
|
|
|
class nsIRenderingContext;
|
1999-08-31 07:09:40 +04:00
|
|
|
class nsISizeOfHandler;
|
1998-04-14 00:24:54 +04:00
|
|
|
class nsISpaceManager;
|
|
|
|
class nsIStyleContext;
|
|
|
|
class nsIView;
|
|
|
|
class nsIWidget;
|
1998-06-09 08:51:44 +04:00
|
|
|
class nsIReflowCommand;
|
1998-09-03 01:59:54 +04:00
|
|
|
class nsAutoString;
|
|
|
|
class nsString;
|
1999-01-26 02:28:23 +03:00
|
|
|
class nsIFocusTracker;
|
1999-03-25 09:32:56 +03:00
|
|
|
class nsStyleChangeList;
|
1998-04-14 00:24:54 +04:00
|
|
|
|
1999-09-10 22:29:37 +04:00
|
|
|
struct nsPeekOffsetStruct;
|
1998-04-14 00:24:54 +04:00
|
|
|
struct nsPoint;
|
|
|
|
struct nsRect;
|
1998-04-17 05:41:24 +04:00
|
|
|
struct nsStyleStruct;
|
1999-04-26 08:02:04 +04:00
|
|
|
class nsIDOMRange;
|
1999-06-11 01:08:17 +04:00
|
|
|
class nsICaret;
|
1998-05-20 20:22:15 +04:00
|
|
|
struct PRLogModuleInfo;
|
|
|
|
|
1998-07-09 21:06:12 +04:00
|
|
|
// IID for the nsIFrame interface
|
|
|
|
// a6cf9050-15b3-11d2-932e-00805f8add32
|
|
|
|
#define NS_IFRAME_IID \
|
|
|
|
{ 0xa6cf9050, 0x15b3, 0x11d2,{0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}}
|
1998-04-14 00:24:54 +04:00
|
|
|
|
1998-05-22 08:54:11 +04:00
|
|
|
/**
|
|
|
|
* Indication of how the frame can be split. This is used when doing runaround
|
|
|
|
* of floaters, and when pulling up child frames from a next-in-flow.
|
|
|
|
*
|
|
|
|
* The choices are splittable, not splittable at all, and splittable in
|
|
|
|
* a non-rectangular fashion. This last type only applies to block-level
|
|
|
|
* elements, and indicates whether splitting can be used when doing runaround.
|
|
|
|
* If you can split across page boundaries, but you expect each continuing
|
|
|
|
* frame to be the same width then return frSplittable and not
|
|
|
|
* frSplittableNonRectangular.
|
|
|
|
*
|
|
|
|
* @see #IsSplittable()
|
|
|
|
*/
|
|
|
|
typedef PRUint32 nsSplittableType;
|
|
|
|
|
|
|
|
#define NS_FRAME_NOT_SPLITTABLE 0 // Note: not a bit!
|
|
|
|
#define NS_FRAME_SPLITTABLE 0x1
|
|
|
|
#define NS_FRAME_SPLITTABLE_NON_RECTANGULAR 0x3
|
|
|
|
|
|
|
|
#define NS_FRAME_IS_SPLITTABLE(type)\
|
|
|
|
(0 != ((type) & NS_FRAME_SPLITTABLE))
|
|
|
|
|
|
|
|
#define NS_FRAME_IS_NOT_SPLITTABLE(type)\
|
|
|
|
(0 == ((type) & NS_FRAME_SPLITTABLE))
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
1998-05-14 04:47:05 +04:00
|
|
|
/**
|
|
|
|
* Frame state bits. Any bits not listed here are reserved for future
|
|
|
|
* extensions, but must be stored by the frames.
|
|
|
|
*/
|
|
|
|
typedef PRUint32 nsFrameState;
|
|
|
|
|
1998-11-26 21:08:27 +03:00
|
|
|
#define NS_FRAME_IN_REFLOW 0x00000001
|
1998-05-29 06:09:18 +04:00
|
|
|
|
|
|
|
// This bit is set when a frame is created. After it has been reflowed
|
|
|
|
// once (during the DidReflow with a finished state) the bit is
|
|
|
|
// cleared.
|
|
|
|
#define NS_FRAME_FIRST_REFLOW 0x00000002
|
1998-05-12 08:17:56 +04:00
|
|
|
|
1999-02-13 08:58:28 +03:00
|
|
|
// If this bit is is set, then the view position and size should be
|
1998-10-17 00:09:32 +04:00
|
|
|
// kept in sync with the frame position and size. If the bit is not
|
|
|
|
// set then it's the responsibility of the frame itself (or whoever
|
|
|
|
// created the view) to position and size its associated view
|
|
|
|
#define NS_FRAME_SYNC_FRAME_AND_VIEW 0x00000004
|
|
|
|
|
1999-02-13 08:58:28 +03:00
|
|
|
// If this bit is set, then there is a child frame in the frame that
|
1998-10-31 01:04:56 +03:00
|
|
|
// extends outside this frame's bounding box. The implication is that
|
|
|
|
// the frames rect does not completely cover its children and
|
|
|
|
// therefore operations like rendering and hit testing (for example)
|
|
|
|
// must operate differently.
|
|
|
|
#define NS_FRAME_OUTSIDE_CHILDREN 0x00000008
|
|
|
|
|
1999-02-13 08:58:28 +03:00
|
|
|
// If this bit is set, then a reference to the frame is being held
|
1998-11-19 03:43:36 +03:00
|
|
|
// elsewhere. The frame may want to send a notification when it is
|
|
|
|
// destroyed to allow these references to be cleared.
|
|
|
|
#define NS_FRAME_EXTERNAL_REFERENCE 0x00000010
|
|
|
|
|
1999-02-13 08:58:28 +03:00
|
|
|
// If this bit is set, then the frame is a replaced element. For example,
|
|
|
|
// a frame displaying an image
|
|
|
|
#define NS_FRAME_REPLACED_ELEMENT 0x00000020
|
|
|
|
|
1999-04-05 07:44:07 +04:00
|
|
|
// If this bit is set, then the frame corresponds to generated content
|
|
|
|
#define NS_FRAME_GENERATED_CONTENT 0x00000040
|
|
|
|
|
1999-04-14 01:48:35 +04:00
|
|
|
// If this bit is set, then the frame has requested one or more image
|
|
|
|
// loads via the nsIPresContext.StartLoadImage API at some time during
|
|
|
|
// its lifetime.
|
|
|
|
#define NS_FRAME_HAS_LOADED_IMAGES 0x00000080
|
|
|
|
|
1999-04-25 21:20:53 +04:00
|
|
|
// If this bit is set, then the frame is has been moved out of the flow,
|
|
|
|
// e.g., it is absolutely positioned or floated
|
|
|
|
#define NS_FRAME_OUT_OF_FLOW 0x00000100
|
|
|
|
|
1999-04-26 08:02:04 +04:00
|
|
|
// If this bit is set, then the frame reflects content that may be selected
|
|
|
|
#define NS_FRAME_SELECTED_CONTENT 0x00000200
|
|
|
|
|
1999-07-24 06:33:07 +04:00
|
|
|
// If this bit is set, then the frame is dirty and needs to be reflowed.
|
|
|
|
// This bit is set when the frame is first created
|
1999-07-22 03:47:01 +04:00
|
|
|
#define NS_FRAME_IS_DIRTY 0x00000400
|
|
|
|
|
1999-08-28 01:39:26 +04:00
|
|
|
// If this bit is set then the frame is unflowable.
|
|
|
|
#define NS_FRAME_IS_UNFLOWABLE 0x00000800
|
|
|
|
|
1999-01-09 03:11:40 +03:00
|
|
|
// The low 16 bits of the frame state word are reserved by this API.
|
|
|
|
#define NS_FRAME_RESERVED 0x0000FFFF
|
|
|
|
|
|
|
|
// The upper 16 bits of the frame state word are reserved for frame
|
|
|
|
// implementations.
|
|
|
|
#define NS_FRAME_IMPL_RESERVED 0xFFFF0000
|
|
|
|
|
1998-05-14 04:47:05 +04:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
1998-12-18 18:54:23 +03:00
|
|
|
enum nsFramePaintLayer {
|
|
|
|
eFramePaintLayer_Underlay = 0,
|
|
|
|
eFramePaintLayer_Content = 1,
|
1998-12-21 19:40:46 +03:00
|
|
|
eFramePaintLayer_Overlay = 2
|
1998-12-18 18:54:23 +03:00
|
|
|
};
|
|
|
|
|
1999-02-02 03:23:40 +03:00
|
|
|
enum nsSelectionAmount {
|
1999-02-10 21:55:25 +03:00
|
|
|
eSelectCharacter = 0,
|
|
|
|
eSelectWord = 1,
|
|
|
|
eSelectLine = 2, //previous drawn line in flow.
|
1999-09-08 03:40:17 +04:00
|
|
|
eSelectBeginLine = 3,
|
|
|
|
eSelectEndLine = 4,
|
1999-09-26 03:33:02 +04:00
|
|
|
eSelectNoAmount = 5, //just bounce back current offset.
|
|
|
|
eSelectDir = 6 //select next/previous frame based on direction
|
1999-02-02 03:23:40 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
enum nsDirection {
|
1999-02-10 21:55:25 +03:00
|
|
|
eDirNext = 0,
|
|
|
|
eDirPrevious= 1
|
1999-02-02 03:23:40 +03:00
|
|
|
};
|
|
|
|
|
1999-05-20 04:52:00 +04:00
|
|
|
enum nsSpread {
|
|
|
|
eSpreadNone = 0,
|
|
|
|
eSpreadAcross = 1,
|
|
|
|
eSpreadDown = 2
|
|
|
|
};
|
|
|
|
|
1998-12-18 18:54:23 +03:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
1998-04-14 00:24:54 +04:00
|
|
|
/**
|
|
|
|
* A frame in the layout model. This interface is supported by all frame
|
|
|
|
* objects.
|
|
|
|
*
|
1998-11-09 22:40:27 +03:00
|
|
|
* Frames can have multiple child lists: the default unnamed child list
|
|
|
|
* (referred to as the <i>principal</i> child list, and additional named
|
|
|
|
* child lists. There is an ordering of frames within a child list, but
|
|
|
|
* there is no order defined between frames in different child lists of
|
|
|
|
* the same parent frame.
|
1998-09-10 23:32:14 +04:00
|
|
|
*
|
1999-07-22 06:24:52 +04:00
|
|
|
* Frames are NOT reference counted. Use the Destroy() member function
|
|
|
|
* to destroy a frame. The lifetime of the frame hierarchy is bounded by the
|
1998-11-09 22:40:27 +03:00
|
|
|
* lifetime of the presentation shell which owns the frames.
|
1998-04-14 00:24:54 +04:00
|
|
|
*/
|
1998-09-24 05:50:16 +04:00
|
|
|
class nsIFrame : public nsISupports
|
1998-04-14 00:24:54 +04:00
|
|
|
{
|
|
|
|
public:
|
1998-12-03 09:31:43 +03:00
|
|
|
/**
|
1998-12-04 09:13:18 +03:00
|
|
|
* Called to initialize the frame. This is called immediately after creating
|
|
|
|
* the frame.
|
|
|
|
*
|
1999-02-25 06:27:57 +03:00
|
|
|
* If the frame is a continuing frame, then aPrevInFlow indicates the previous
|
|
|
|
* frame (the frame that was split). You should connect the continuing frame to
|
|
|
|
* its prev-in-flow, e.g. by using the AppendToFlow() function
|
|
|
|
*
|
|
|
|
* If you want a view associated with your frame, you should create the view
|
1998-12-04 09:13:18 +03:00
|
|
|
* now.
|
1998-12-03 09:31:43 +03:00
|
|
|
*
|
|
|
|
* @param aContent the content object associated with the frame
|
1998-12-29 06:38:16 +03:00
|
|
|
* @param aGeometricParent the geometric parent frame
|
|
|
|
* @param aContentParent the content parent frame
|
1998-12-03 09:31:43 +03:00
|
|
|
* @param aContext the style context associated with the frame
|
1999-02-25 06:27:57 +03:00
|
|
|
* @param aPrevInFlow the prev-in-flow frame
|
|
|
|
* @see #AppendToFlow()
|
1998-12-03 09:31:43 +03:00
|
|
|
*/
|
|
|
|
NS_IMETHOD Init(nsIPresContext& aPresContext,
|
|
|
|
nsIContent* aContent,
|
1999-01-14 08:16:23 +03:00
|
|
|
nsIFrame* aParent,
|
1999-02-25 06:27:57 +03:00
|
|
|
nsIStyleContext* aContext,
|
|
|
|
nsIFrame* aPrevInFlow) = 0;
|
1998-12-03 09:31:43 +03:00
|
|
|
|
1999-07-22 06:24:52 +04:00
|
|
|
/**
|
|
|
|
* Destroys this frame and each of its child frames (recursively calls
|
|
|
|
* Destroy() for each child)
|
|
|
|
*/
|
|
|
|
NS_IMETHOD Destroy(nsIPresContext& aPresContext) = 0;
|
|
|
|
|
1998-09-10 23:32:14 +04:00
|
|
|
/**
|
1998-11-10 09:05:32 +03:00
|
|
|
* Called to set the initial list of frames. This happens after the frame
|
1998-12-03 09:31:43 +03:00
|
|
|
* has been initialized.
|
1998-09-10 23:32:14 +04:00
|
|
|
*
|
1998-11-10 09:05:32 +03:00
|
|
|
* This is only called once for a given child list, and won't be called
|
|
|
|
* at all for child lists with no initial list of frames.
|
1998-09-10 23:32:14 +04:00
|
|
|
*
|
1998-11-10 09:05:32 +03:00
|
|
|
* @param aListName the name of the child list. A NULL pointer for the atom
|
|
|
|
* name means the unnamed principal child list
|
1999-07-24 06:33:07 +04:00
|
|
|
* @param aChildList list of child frames. Each of the frames has its
|
1999-07-27 18:15:42 +04:00
|
|
|
* NS_FRAME_IS_DIRTY bit set
|
1998-11-10 09:05:32 +03:00
|
|
|
* @return NS_ERROR_INVALID_ARG if there is no child list with the specified
|
|
|
|
* name,
|
|
|
|
* NS_ERROR_UNEXPECTED if the frame is an atomic frame or if the
|
|
|
|
* initial list of frames has already been set for that child list,
|
|
|
|
* NS_OK otherwise
|
1998-12-03 09:31:43 +03:00
|
|
|
* @see #Init()
|
1998-09-10 23:32:14 +04:00
|
|
|
*/
|
1998-11-10 09:05:32 +03:00
|
|
|
NS_IMETHOD SetInitialChildList(nsIPresContext& aPresContext,
|
|
|
|
nsIAtom* aListName,
|
|
|
|
nsIFrame* aChildList) = 0;
|
1998-09-10 23:32:14 +04:00
|
|
|
|
1999-01-15 04:28:28 +03:00
|
|
|
/**
|
|
|
|
* This method is responsible for appending frames to the frame
|
1999-07-22 08:32:31 +04:00
|
|
|
* list. The implementation should append the frames to the specified
|
1999-07-22 06:24:52 +04:00
|
|
|
* child list and then generate a reflow command.
|
1999-01-15 04:28:28 +03:00
|
|
|
*
|
|
|
|
* @param aListName the name of the child list. A NULL pointer for the atom
|
|
|
|
* name means the unnamed principal child list
|
1999-07-24 06:33:07 +04:00
|
|
|
* @param aFrameList list of child frames to append. Each of the frames has
|
1999-07-27 18:15:42 +04:00
|
|
|
* its NS_FRAME_IS_DIRTY bit set
|
1999-01-15 04:28:28 +03:00
|
|
|
* @return NS_ERROR_INVALID_ARG if there is no child list with the specified
|
|
|
|
* name,
|
1999-07-27 18:15:42 +04:00
|
|
|
* NS_ERROR_UNEXPECTED if the frame is an atomic frame,
|
1999-01-15 04:28:28 +03:00
|
|
|
* NS_OK otherwise
|
|
|
|
*/
|
|
|
|
NS_IMETHOD AppendFrames(nsIPresContext& aPresContext,
|
|
|
|
nsIPresShell& aPresShell,
|
|
|
|
nsIAtom* aListName,
|
|
|
|
nsIFrame* aFrameList) = 0;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This method is responsible for inserting frames into the frame
|
1999-07-22 08:32:31 +04:00
|
|
|
* list. The implementation should insert the new frames into the specified
|
1999-07-22 06:24:52 +04:00
|
|
|
* child list and then generate a reflow command.
|
1999-01-15 04:28:28 +03:00
|
|
|
*
|
|
|
|
* @param aListName the name of the child list. A NULL pointer for the atom
|
|
|
|
* name means the unnamed principal child list
|
|
|
|
* @param aPrevFrame the frame to insert frames <b>after</b>
|
1999-07-24 06:33:07 +04:00
|
|
|
* @param aFrameList list of child frames to insert <b>after</b> aPrevFrame.
|
1999-07-27 18:15:42 +04:00
|
|
|
* Each of the frames has its NS_FRAME_IS_DIRTY bit set
|
1999-01-15 04:28:28 +03:00
|
|
|
* @return NS_ERROR_INVALID_ARG if there is no child list with the specified
|
|
|
|
* name,
|
1999-07-27 18:15:42 +04:00
|
|
|
* NS_ERROR_UNEXPECTED if the frame is an atomic frame,
|
1999-01-15 04:28:28 +03:00
|
|
|
* NS_OK otherwise
|
|
|
|
*/
|
|
|
|
NS_IMETHOD InsertFrames(nsIPresContext& aPresContext,
|
|
|
|
nsIPresShell& aPresShell,
|
|
|
|
nsIAtom* aListName,
|
|
|
|
nsIFrame* aPrevFrame,
|
|
|
|
nsIFrame* aFrameList) = 0;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This method is responsible for removing a frame in the frame
|
|
|
|
* list. The implementation should do something with the removed frame
|
|
|
|
* and then generate a reflow command. The implementation is responsible
|
|
|
|
* for destroying aOldFrame (the caller mustn't destroy aOldFrame).
|
|
|
|
*
|
|
|
|
* @param aListName the name of the child list. A NULL pointer for the atom
|
|
|
|
* name means the unnamed principal child list
|
|
|
|
* @param aOldFrame the frame to remove
|
|
|
|
* @return NS_ERROR_INVALID_ARG if there is no child list with the specified
|
|
|
|
* name,
|
1999-07-27 18:15:42 +04:00
|
|
|
* NS_ERROR_FAILURE if the child frame is not in the specified
|
|
|
|
* child list,
|
|
|
|
* NS_ERROR_UNEXPECTED if the frame is an atomic frame,
|
1999-01-15 04:28:28 +03:00
|
|
|
* NS_OK otherwise
|
|
|
|
*/
|
|
|
|
NS_IMETHOD RemoveFrame(nsIPresContext& aPresContext,
|
|
|
|
nsIPresShell& aPresShell,
|
|
|
|
nsIAtom* aListName,
|
|
|
|
nsIFrame* aOldFrame) = 0;
|
1999-07-22 08:32:31 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* This method is responsible for replacing the old frame with the
|
|
|
|
* new frame. The old frame should be destroyed and the new frame inserted
|
|
|
|
* in its place in the specified child list.
|
|
|
|
*
|
|
|
|
* @param aListName the name of the child list. A NULL pointer for the atom
|
|
|
|
* name means the unnamed principal child list
|
|
|
|
* @param aOldFrame the frame to remove
|
1999-07-24 06:33:07 +04:00
|
|
|
* @param aNewFrame the frame to replace it with. The new frame has its
|
1999-07-27 18:15:42 +04:00
|
|
|
* NS_FRAME_IS_DIRTY bit set
|
1999-07-22 08:32:31 +04:00
|
|
|
* @return NS_ERROR_INVALID_ARG if there is no child list with the specified
|
|
|
|
* name,
|
1999-07-27 18:15:42 +04:00
|
|
|
* NS_ERROR_FAILURE if the old child frame is not in the specified
|
|
|
|
* child list,
|
|
|
|
* NS_ERROR_UNEXPECTED if the frame is an atomic frame,
|
1999-07-22 08:32:31 +04:00
|
|
|
* NS_OK otherwise
|
|
|
|
*/
|
|
|
|
NS_IMETHOD ReplaceFrame(nsIPresContext& aPresContext,
|
|
|
|
nsIPresShell& aPresShell,
|
|
|
|
nsIAtom* aListName,
|
|
|
|
nsIFrame* aOldFrame,
|
|
|
|
nsIFrame* aNewFrame) = 0;
|
1998-04-14 00:24:54 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the content object associated with this frame. Adds a reference to
|
|
|
|
* the content object so the caller must do a release.
|
|
|
|
*
|
|
|
|
* @see nsISupports#Release()
|
|
|
|
*/
|
1999-02-10 03:42:56 +03:00
|
|
|
NS_IMETHOD GetContent(nsIContent** aContent) const = 0;
|
1998-04-14 00:24:54 +04:00
|
|
|
|
1999-01-22 21:58:14 +03:00
|
|
|
/**
|
|
|
|
* Get the offsets of the frame. most will be 0,0
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
NS_IMETHOD GetOffsets(PRInt32 &start, PRInt32 &end) const = 0;
|
|
|
|
|
1998-04-14 00:24:54 +04:00
|
|
|
/**
|
|
|
|
* Get the style context associated with this frame. Note that GetStyleContext()
|
|
|
|
* adds a reference to the style context so the caller must do a release.
|
|
|
|
*
|
1998-04-17 05:41:24 +04:00
|
|
|
* @see nsISupports#Release()
|
1998-04-14 00:24:54 +04:00
|
|
|
*/
|
1999-02-10 03:42:56 +03:00
|
|
|
NS_IMETHOD GetStyleContext(nsIStyleContext** aStyleContext) const = 0;
|
1999-02-10 04:36:30 +03:00
|
|
|
NS_IMETHOD SetStyleContext(nsIPresContext* aPresContext,
|
1998-05-02 00:43:02 +04:00
|
|
|
nsIStyleContext* aContext) = 0;
|
1998-04-14 00:24:54 +04:00
|
|
|
|
|
|
|
/**
|
1998-10-08 22:21:32 +04:00
|
|
|
* Get the style data associated with this frame.
|
1998-04-14 00:24:54 +04:00
|
|
|
*/
|
1999-02-10 04:36:30 +03:00
|
|
|
NS_IMETHOD GetStyleData(nsStyleStructID aSID,
|
|
|
|
const nsStyleStruct*& aStyleStruct) const = 0;
|
1998-04-14 00:24:54 +04:00
|
|
|
|
1999-09-04 03:35:14 +04:00
|
|
|
/**
|
|
|
|
* These methods are to access any additional style contexts that
|
|
|
|
* the frame may be holding. These are contexts that are children
|
|
|
|
* of the frame's primary context and are NOT used as style contexts
|
|
|
|
* for any child frames. These contexts also MUST NOT have any child
|
|
|
|
* contexts whatsoever. If you need to insert style contexts into the
|
|
|
|
* style tree, then you should create pseudo element frames to own them
|
1999-09-21 11:48:34 +04:00
|
|
|
* The indicies must be consecutive and implementations MUST return an
|
|
|
|
* NS_ERROR_INVALID_ARG if asked for an index that is out of range.
|
1999-09-04 03:35:14 +04:00
|
|
|
*/
|
|
|
|
NS_IMETHOD GetAdditionalStyleContext(PRInt32 aIndex,
|
|
|
|
nsIStyleContext** aStyleContext) const = 0;
|
|
|
|
NS_IMETHOD SetAdditionalStyleContext(PRInt32 aIndex,
|
|
|
|
nsIStyleContext* aStyleContext) = 0;
|
|
|
|
|
1998-04-14 00:24:54 +04:00
|
|
|
/**
|
1999-01-14 08:16:23 +03:00
|
|
|
* Accessor functions for geometric parent
|
1998-04-14 00:24:54 +04:00
|
|
|
*/
|
1999-02-10 04:36:30 +03:00
|
|
|
NS_IMETHOD GetParent(nsIFrame** aParent) const = 0;
|
1999-01-14 08:16:23 +03:00
|
|
|
NS_IMETHOD SetParent(const nsIFrame* aParent) = 0;
|
1998-04-14 00:24:54 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Bounding rect of the frame. The values are in twips, and the origin is
|
|
|
|
* relative to the upper-left of the geometric parent. The size includes the
|
|
|
|
* content area, borders, and padding.
|
|
|
|
*/
|
1998-04-17 05:41:24 +04:00
|
|
|
NS_IMETHOD GetRect(nsRect& aRect) const = 0;
|
|
|
|
NS_IMETHOD GetOrigin(nsPoint& aPoint) const = 0;
|
|
|
|
NS_IMETHOD GetSize(nsSize& aSize) const = 0;
|
|
|
|
NS_IMETHOD SetRect(const nsRect& aRect) = 0;
|
|
|
|
NS_IMETHOD MoveTo(nscoord aX, nscoord aY) = 0;
|
|
|
|
NS_IMETHOD SizeTo(nscoord aWidth, nscoord aHeight) = 0;
|
|
|
|
|
1998-11-09 22:59:33 +03:00
|
|
|
/**
|
|
|
|
* Used to iterate the list of additional child list names. Returns the atom
|
|
|
|
* name for the additional child list at the specified 0-based index, or a
|
|
|
|
* NULL pointer if there are no more named child lists.
|
|
|
|
*
|
|
|
|
* Note that the list is only the additional named child lists and does not
|
|
|
|
* include the unnamed principal child list.
|
|
|
|
*
|
|
|
|
* @return NS_ERROR_INVALID_ARG if the index is < 0 and NS_OK otherwise
|
|
|
|
*/
|
|
|
|
NS_IMETHOD GetAdditionalChildListName(PRInt32 aIndex,
|
1999-02-10 05:25:01 +03:00
|
|
|
nsIAtom** aListName) const = 0;
|
1998-11-09 22:59:33 +03:00
|
|
|
|
1998-04-17 05:41:24 +04:00
|
|
|
/**
|
1998-11-09 22:40:27 +03:00
|
|
|
* Get the first child frame from the specified child list.
|
1998-10-09 01:03:59 +04:00
|
|
|
*
|
1998-11-09 22:40:27 +03:00
|
|
|
* @param aListName the name of the child list. A NULL pointer for the atom
|
|
|
|
* name means the unnamed principal child list
|
|
|
|
* @return NS_ERROR_INVALID_ARG if there is no child list with the specified name
|
|
|
|
* @see #GetAdditionalListName()
|
|
|
|
*/
|
1999-02-10 05:25:01 +03:00
|
|
|
NS_IMETHOD FirstChild(nsIAtom* aListName, nsIFrame** aFirstChild) const = 0;
|
1998-11-09 22:40:27 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Child frames are linked together in a singly-linked
|
1998-04-17 05:41:24 +04:00
|
|
|
*/
|
1999-02-10 09:13:38 +03:00
|
|
|
NS_IMETHOD GetNextSibling(nsIFrame** aNextSibling) const = 0;
|
1998-10-09 01:03:59 +04:00
|
|
|
NS_IMETHOD SetNextSibling(nsIFrame* aNextSibling) = 0;
|
1998-04-14 00:24:54 +04:00
|
|
|
|
|
|
|
/**
|
1998-12-18 18:54:23 +03:00
|
|
|
* Paint is responsible for painting the a frame. The aWhichLayer
|
|
|
|
* argument indicates which layer of painting should be done during
|
|
|
|
* the call.
|
1998-04-14 00:24:54 +04:00
|
|
|
*/
|
1998-04-17 05:41:24 +04:00
|
|
|
NS_IMETHOD Paint(nsIPresContext& aPresContext,
|
|
|
|
nsIRenderingContext& aRenderingContext,
|
1998-12-18 18:54:23 +03:00
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
nsFramePaintLayer aWhichLayer) = 0;
|
1998-04-14 00:24:54 +04:00
|
|
|
|
|
|
|
/**
|
1998-10-08 22:21:32 +04:00
|
|
|
* Event handling of GUI events.
|
|
|
|
*
|
|
|
|
* @param aEvent event structure describing the type of event and rge widget
|
|
|
|
* where the event originated
|
|
|
|
* @param aEventStatus a return value indicating whether the event was handled
|
|
|
|
* and whether default processing should be done
|
|
|
|
*
|
|
|
|
* XXX From a frame's perspective it's unclear what the effect of the event status
|
|
|
|
* is. Does it cause the event to continue propagating through the frame hierarchy
|
|
|
|
* or is it just returned to the widgets?
|
|
|
|
*
|
|
|
|
* @see nsGUIEvent
|
|
|
|
* @see nsEventStatus
|
1998-04-14 00:24:54 +04:00
|
|
|
*/
|
1998-04-17 05:41:24 +04:00
|
|
|
NS_IMETHOD HandleEvent(nsIPresContext& aPresContext,
|
|
|
|
nsGUIEvent* aEvent,
|
|
|
|
nsEventStatus& aEventStatus) = 0;
|
1998-04-14 00:24:54 +04:00
|
|
|
|
1999-09-30 00:04:05 +04:00
|
|
|
NS_IMETHOD GetContentAndOffsetsFromPoint(nsIPresContext& aCX,
|
|
|
|
const nsPoint& aPoint,
|
|
|
|
nsIContent ** aNewContent,
|
|
|
|
PRInt32& aContentOffset,
|
1999-10-13 05:16:09 +04:00
|
|
|
PRInt32& aContentOffsetEnd,
|
|
|
|
PRBool& aBeginFrameContent) = 0;
|
1999-09-30 00:04:05 +04:00
|
|
|
|
1998-08-28 20:02:33 +04:00
|
|
|
|
1998-04-14 00:24:54 +04:00
|
|
|
/**
|
1998-11-18 08:25:26 +03:00
|
|
|
* Get the cursor for a given frame.
|
1998-04-14 00:24:54 +04:00
|
|
|
*/
|
1998-11-18 08:25:26 +03:00
|
|
|
NS_IMETHOD GetCursor(nsIPresContext& aPresContext,
|
|
|
|
nsPoint& aPoint,
|
|
|
|
PRInt32& aCursor) = 0;
|
|
|
|
|
|
|
|
NS_IMETHOD GetFrameForPoint(const nsPoint& aPoint,
|
|
|
|
nsIFrame** aFrame) = 0;
|
|
|
|
|
1999-02-12 03:02:31 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get a point (in the frame's coordinate space) given an offset into
|
|
|
|
* the content. This point should be on the baseline of text with
|
|
|
|
* the correct horizontal offset
|
|
|
|
*/
|
|
|
|
NS_IMETHOD GetPointFromOffset(nsIPresContext* inPresContext,
|
|
|
|
nsIRenderingContext* inRendContext,
|
|
|
|
PRInt32 inOffset,
|
|
|
|
nsPoint* outPoint) = 0;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the child frame of this frame which contains the given
|
|
|
|
* content offset. outChildFrame may be this frame, or nsnull on return.
|
|
|
|
* outContentOffset returns the content offset relative to the start
|
1999-09-11 04:18:02 +04:00
|
|
|
* of the returned node. You can also pass a hint which tells the method
|
|
|
|
* to stick to the end of the first found frame or the beginning of the
|
|
|
|
* next in case the offset falls on a boundary.
|
1999-02-12 03:02:31 +03:00
|
|
|
*/
|
|
|
|
NS_IMETHOD GetChildFrameContainingOffset(PRInt32 inContentOffset,
|
1999-09-11 04:18:02 +04:00
|
|
|
PRBool inHint,//false stick left
|
1999-02-12 03:02:31 +03:00
|
|
|
PRInt32* outFrameContentOffset,
|
|
|
|
nsIFrame* *outChildFrame) = 0;
|
|
|
|
|
1998-11-18 08:25:26 +03:00
|
|
|
/**
|
1998-05-14 04:47:05 +04:00
|
|
|
* Get the current frame-state value for this frame. aResult is
|
|
|
|
* filled in with the state bits. The return value has no
|
|
|
|
* meaning.
|
|
|
|
*/
|
1999-02-10 07:17:06 +03:00
|
|
|
NS_IMETHOD GetFrameState(nsFrameState* aResult) = 0;
|
1998-05-14 04:47:05 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the current frame-state value for this frame. The return
|
|
|
|
* value has no meaning.
|
|
|
|
*/
|
|
|
|
NS_IMETHOD SetFrameState(nsFrameState aNewState) = 0;
|
|
|
|
|
1998-05-08 08:45:37 +04:00
|
|
|
/**
|
|
|
|
* This call is invoked when content is changed in the content tree.
|
|
|
|
* The first frame that maps that content is asked to deal with the
|
1998-05-11 22:38:10 +04:00
|
|
|
* change by generating an incremental reflow command.
|
1998-05-08 08:45:37 +04:00
|
|
|
*
|
|
|
|
* @param aIndexInParent the index in the content container where
|
|
|
|
* the new content was deleted.
|
|
|
|
*/
|
1998-09-30 03:41:59 +04:00
|
|
|
NS_IMETHOD ContentChanged(nsIPresContext* aPresContext,
|
1998-05-08 08:45:37 +04:00
|
|
|
nsIContent* aChild,
|
|
|
|
nsISupports* aSubContent) = 0;
|
|
|
|
|
1998-09-18 23:53:27 +04:00
|
|
|
/**
|
|
|
|
* This call is invoked when the value of a content objects's attribute
|
1998-09-30 03:41:59 +04:00
|
|
|
* is changed.
|
|
|
|
* The first frame that maps that content is asked to deal
|
1999-09-10 09:50:02 +04:00
|
|
|
* with the change by doing whatever is appropriate.
|
1998-09-18 23:53:27 +04:00
|
|
|
*
|
|
|
|
* @param aChild the content object
|
|
|
|
* @param aAttribute the attribute whose value changed
|
1999-09-10 09:50:02 +04:00
|
|
|
* @param aHint the level of change that has already been dealt with
|
1998-09-18 23:53:27 +04:00
|
|
|
*/
|
1998-09-30 03:41:59 +04:00
|
|
|
NS_IMETHOD AttributeChanged(nsIPresContext* aPresContext,
|
1998-09-18 23:53:27 +04:00
|
|
|
nsIContent* aChild,
|
1999-10-16 03:16:45 +04:00
|
|
|
PRInt32 aNameSpaceID,
|
1998-09-30 03:41:59 +04:00
|
|
|
nsIAtom* aAttribute,
|
|
|
|
PRInt32 aHint) = 0;
|
1998-09-18 23:53:27 +04:00
|
|
|
|
1999-09-10 09:50:02 +04:00
|
|
|
/**
|
|
|
|
* This call is invoked when the value of a content object's state
|
|
|
|
* is changed.
|
|
|
|
* The first frame that maps that content is asked to deal
|
|
|
|
* with the change by doing whatever is appropriate.
|
|
|
|
*
|
|
|
|
* @param aChild the content object
|
|
|
|
* @param aHint the level of change that has already been dealt with
|
|
|
|
*/
|
|
|
|
NS_IMETHOD ContentStateChanged(nsIPresContext* aPresContext,
|
|
|
|
nsIContent* aChild,
|
|
|
|
PRInt32 aHint) = 0;
|
|
|
|
|
1998-04-18 03:08:20 +04:00
|
|
|
/**
|
|
|
|
* Return how your frame can be split.
|
|
|
|
*/
|
1998-05-22 08:54:11 +04:00
|
|
|
NS_IMETHOD IsSplittable(nsSplittableType& aIsSplittable) const = 0;
|
1998-04-18 03:08:20 +04:00
|
|
|
|
1998-04-14 00:24:54 +04:00
|
|
|
/**
|
1999-02-25 08:31:15 +03:00
|
|
|
* Flow member functions
|
1998-04-14 00:24:54 +04:00
|
|
|
*/
|
1999-02-24 07:48:08 +03:00
|
|
|
NS_IMETHOD GetPrevInFlow(nsIFrame** aPrevInFlow) const = 0;
|
1998-04-17 05:41:24 +04:00
|
|
|
NS_IMETHOD SetPrevInFlow(nsIFrame*) = 0;
|
1999-02-24 07:48:08 +03:00
|
|
|
NS_IMETHOD GetNextInFlow(nsIFrame** aNextInFlow) const = 0;
|
1998-04-17 05:41:24 +04:00
|
|
|
NS_IMETHOD SetNextInFlow(nsIFrame*) = 0;
|
|
|
|
|
1998-04-14 00:24:54 +04:00
|
|
|
/**
|
|
|
|
* Accessor functions to get/set the associated view object
|
|
|
|
*/
|
1999-02-10 08:38:18 +03:00
|
|
|
NS_IMETHOD GetView(nsIView** aView) const = 0; // may be null
|
1998-04-17 05:41:24 +04:00
|
|
|
NS_IMETHOD SetView(nsIView* aView) = 0;
|
1998-04-14 00:24:54 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Find the first geometric parent that has a view
|
|
|
|
*/
|
1999-02-10 08:38:18 +03:00
|
|
|
NS_IMETHOD GetParentWithView(nsIFrame** aParent) const = 0;
|
1998-04-14 00:24:54 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the offset from this frame to the closest geometric parent that
|
|
|
|
* has a view. Also returns the containing view or null in case of error
|
|
|
|
*/
|
1999-02-10 08:38:18 +03:00
|
|
|
NS_IMETHOD GetOffsetFromView(nsPoint& aOffset, nsIView** aView) const = 0;
|
1998-04-14 00:24:54 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the window that contains this frame. If this frame has a
|
|
|
|
* view and the view has a window, then this frames window is
|
|
|
|
* returned, otherwise this frame's geometric parent is checked
|
|
|
|
* recursively upwards.
|
|
|
|
*/
|
1999-02-10 08:38:18 +03:00
|
|
|
NS_IMETHOD GetWindow(nsIWidget**) const = 0;
|
1998-04-14 00:24:54 +04:00
|
|
|
|
1999-02-09 08:44:13 +03:00
|
|
|
/**
|
|
|
|
* Get the "type" of the frame. May return a NULL atom pointer
|
|
|
|
*
|
|
|
|
* @see nsLayoutAtoms
|
|
|
|
*/
|
1999-02-10 07:17:06 +03:00
|
|
|
NS_IMETHOD GetFrameType(nsIAtom** aType) const = 0;
|
1999-02-09 08:44:13 +03:00
|
|
|
|
1998-05-14 02:38:09 +04:00
|
|
|
/**
|
|
|
|
* Is this frame a "containing block"?
|
|
|
|
*/
|
|
|
|
NS_IMETHOD IsPercentageBase(PRBool& aBase) const = 0;
|
|
|
|
|
1998-09-06 00:57:57 +04:00
|
|
|
/**
|
|
|
|
* called when the frame has been scrolled to a new
|
|
|
|
* position. only called for frames with views.
|
|
|
|
*/
|
1999-08-31 07:09:40 +04:00
|
|
|
NS_IMETHOD Scrolled(nsIView *aView) = 0;
|
1998-09-06 00:57:57 +04:00
|
|
|
|
1998-04-14 00:24:54 +04:00
|
|
|
// Debugging
|
1999-01-16 03:00:50 +03:00
|
|
|
NS_IMETHOD List(FILE* out, PRInt32 aIndent) const = 0;
|
1998-11-19 20:22:29 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get a printable from of the name of the frame type.
|
|
|
|
*/
|
|
|
|
NS_IMETHOD GetFrameName(nsString& aResult) const = 0;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Called to dump out regression data that describes the layout
|
|
|
|
* of the frame and it's children, and so on. The format of the
|
|
|
|
* data is dictated to be XML (using a specific DTD); the
|
|
|
|
* specific kind of data dumped is up to the frame itself, with
|
|
|
|
* the caveat that some base types are defined.
|
|
|
|
* For more information, see XXX.
|
|
|
|
*/
|
|
|
|
NS_IMETHOD DumpRegressionData(FILE* out, PRInt32 aIndent) = 0;
|
|
|
|
|
1999-08-31 07:09:40 +04:00
|
|
|
/**
|
|
|
|
* Get the size of the frame object. The size value should include
|
|
|
|
* all subordinate data referenced by the frame that is not
|
|
|
|
* accounted for by child frames. However, this value should not
|
|
|
|
* include the content objects, style contexts, views or other data
|
|
|
|
* that lies logically outside the frame system.
|
|
|
|
*
|
|
|
|
* If the implementation so chooses, instead of returning the total
|
|
|
|
* subordinate data it may instead use the sizeof handler to store
|
|
|
|
* away subordinate data under its own key so that the subordinate
|
|
|
|
* data may be tabulated independently of the frame itself.
|
|
|
|
*
|
|
|
|
* The caller is responsible for recursing over all child-lists that
|
|
|
|
* the frame supports.
|
|
|
|
*/
|
|
|
|
NS_IMETHOD SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const = 0;
|
|
|
|
|
1998-04-17 05:41:24 +04:00
|
|
|
NS_IMETHOD VerifyTree() const = 0;
|
1998-11-19 20:22:29 +03:00
|
|
|
|
1999-02-02 03:23:40 +03:00
|
|
|
/** Selection related calls
|
|
|
|
*/
|
|
|
|
/**
|
|
|
|
* Called to set the selection of the frame based on frame offsets. you can FORCE the frame
|
|
|
|
* to redraw event if aSelected == the frame selection with the last parameter.
|
1999-03-12 03:17:14 +03:00
|
|
|
* data in struct may be changed when passed in.
|
1999-04-26 08:02:04 +04:00
|
|
|
* @param aRange is the range that will dictate if the frames need to be redrawn null means the whole content needs to be redrawn
|
|
|
|
* @param aSelected is it selected
|
1999-05-20 04:52:00 +04:00
|
|
|
* @param aSpread should is spread selection to flow elements around it? or go down to its children?
|
1999-01-26 02:28:23 +03:00
|
|
|
*/
|
1999-05-20 04:52:00 +04:00
|
|
|
NS_IMETHOD SetSelected(nsIDOMRange *aRange,PRBool aSelected, nsSpread aSpread) = 0;
|
1999-01-22 21:58:14 +03:00
|
|
|
|
1999-04-26 08:02:04 +04:00
|
|
|
NS_IMETHOD GetSelected(PRBool *aSelected) const = 0;
|
1998-12-14 21:34:14 +03:00
|
|
|
|
1999-05-08 01:12:59 +04:00
|
|
|
/** EndSelection related calls
|
|
|
|
*/
|
|
|
|
|
1999-02-02 03:23:40 +03:00
|
|
|
/**
|
|
|
|
* called to find the previous/next character, word, or line returns the actual
|
|
|
|
* nsIFrame and the frame offset. THIS DOES NOT CHANGE SELECTION STATE
|
|
|
|
* uses frame's begin selection state to start. if no selection on this frame will
|
|
|
|
* return NS_ERROR_FAILURE
|
1999-09-10 22:29:37 +04:00
|
|
|
* @param aPOS is defined in nsIFrameSelection
|
|
|
|
*/
|
|
|
|
NS_IMETHOD PeekOffset(nsPeekOffsetStruct *aPos) = 0;
|
1999-02-02 03:23:40 +03:00
|
|
|
|
1998-05-20 20:22:15 +04:00
|
|
|
/**
|
|
|
|
* See if tree verification is enabled. To enable tree verification add
|
|
|
|
* "frameverifytree:1" to your NSPR_LOG_MODULES environment variable
|
|
|
|
* (any non-zero debug level will work). Or, call SetVerifyTreeEnable
|
|
|
|
* with PR_TRUE.
|
|
|
|
*/
|
|
|
|
static NS_LAYOUT PRBool GetVerifyTreeEnable();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the verify-tree enable flag.
|
|
|
|
*/
|
|
|
|
static NS_LAYOUT void SetVerifyTreeEnable(PRBool aEnabled);
|
|
|
|
|
1999-09-21 11:48:34 +04:00
|
|
|
/**
|
|
|
|
* See if style tree verification is enabled. To enable style tree
|
|
|
|
* verification add "styleverifytree:1" to your NSPR_LOG_MODULES
|
|
|
|
* environment variable (any non-zero debug level will work). Or,
|
|
|
|
* call SetVerifyStyleTreeEnable with PR_TRUE.
|
|
|
|
*/
|
|
|
|
static NS_LAYOUT PRBool GetVerifyStyleTreeEnable();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the verify-style-tree enable flag.
|
|
|
|
*/
|
|
|
|
static NS_LAYOUT void SetVerifyStyleTreeEnable(PRBool aEnabled);
|
|
|
|
|
1998-05-20 20:22:15 +04:00
|
|
|
/**
|
|
|
|
* The frame class and related classes share an nspr log module
|
|
|
|
* for logging frame activity.
|
|
|
|
*
|
|
|
|
* Note: the log module is created during library initialization which
|
|
|
|
* means that you cannot perform logging before then.
|
|
|
|
*/
|
|
|
|
static NS_LAYOUT PRLogModuleInfo* GetLogModuleInfo();
|
|
|
|
|
1998-04-14 00:24:54 +04:00
|
|
|
// Show frame borders when rendering
|
|
|
|
static NS_LAYOUT void ShowFrameBorders(PRBool aEnable);
|
|
|
|
static NS_LAYOUT PRBool GetShowFrameBorders();
|
1998-05-20 20:22:15 +04:00
|
|
|
|
1998-09-24 05:50:16 +04:00
|
|
|
private:
|
|
|
|
NS_IMETHOD_(nsrefcnt) AddRef(void) = 0;
|
|
|
|
NS_IMETHOD_(nsrefcnt) Release(void) = 0;
|
1998-04-14 00:24:54 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* nsIFrame_h___ */
|