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
|
1998-10-01 01:01:11 +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/
|
1998-10-01 01:01:11 +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.
|
1998-10-01 01:01:11 +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):
|
2000-02-03 01:24:56 +03:00
|
|
|
* Pierre Phaneuf <pp@ludusdesign.com>
|
2001-09-29 00:14:13 +04:00
|
|
|
*
|
|
|
|
* 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 ***** */
|
1998-10-01 01:01:11 +04:00
|
|
|
#ifndef nsFrame_h___
|
|
|
|
#define nsFrame_h___
|
|
|
|
|
|
|
|
#include "nsIFrame.h"
|
|
|
|
#include "nsRect.h"
|
1998-11-19 20:22:29 +03:00
|
|
|
#include "nsString.h"
|
1998-10-01 01:01:11 +04:00
|
|
|
#include "prlog.h"
|
1999-11-02 01:12:45 +03:00
|
|
|
#ifdef NS_DEBUG
|
|
|
|
#include "nsIFrameDebug.h"
|
|
|
|
#endif
|
1998-10-01 01:01:11 +04:00
|
|
|
|
1999-12-05 02:49:50 +03:00
|
|
|
#include "nsIPresShell.h"
|
2001-12-18 01:39:59 +03:00
|
|
|
#include "nsHTMLReflowCommand.h"
|
2000-05-31 04:07:58 +04:00
|
|
|
#include "nsIFrameSelection.h"
|
2001-07-16 06:40:48 +04:00
|
|
|
#include "nsHTMLReflowState.h"
|
2001-08-01 05:27:50 +04:00
|
|
|
#include "nsHTMLReflowMetrics.h"
|
1999-12-05 02:49:50 +03:00
|
|
|
|
1998-10-01 01:01:11 +04:00
|
|
|
/**
|
|
|
|
* nsFrame logging constants. We redefine the nspr
|
|
|
|
* PRLogModuleInfo.level field to be a bitfield. Each bit controls a
|
|
|
|
* specific type of logging. Each logging operation has associated
|
|
|
|
* inline methods defined below.
|
|
|
|
*/
|
|
|
|
#define NS_FRAME_TRACE_CALLS 0x1
|
|
|
|
#define NS_FRAME_TRACE_PUSH_PULL 0x2
|
|
|
|
#define NS_FRAME_TRACE_CHILD_REFLOW 0x4
|
|
|
|
#define NS_FRAME_TRACE_NEW_FRAMES 0x8
|
|
|
|
|
|
|
|
#define NS_FRAME_LOG_TEST(_lm,_bit) (PRIntn((_lm)->level) & (_bit))
|
|
|
|
|
|
|
|
#ifdef NS_DEBUG
|
|
|
|
#define NS_FRAME_LOG(_bit,_args) \
|
|
|
|
PR_BEGIN_MACRO \
|
1999-11-02 01:12:45 +03:00
|
|
|
if (NS_FRAME_LOG_TEST(nsIFrameDebug::GetLogModuleInfo(),_bit)) { \
|
1998-10-01 01:01:11 +04:00
|
|
|
PR_LogPrint _args; \
|
|
|
|
} \
|
|
|
|
PR_END_MACRO
|
|
|
|
#else
|
|
|
|
#define NS_FRAME_LOG(_bit,_args)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// XXX Need to rework this so that logging is free when it's off
|
|
|
|
#ifdef NS_DEBUG
|
|
|
|
#define NS_FRAME_TRACE_IN(_method) Trace(_method, PR_TRUE)
|
|
|
|
|
|
|
|
#define NS_FRAME_TRACE_OUT(_method) Trace(_method, PR_FALSE)
|
|
|
|
|
|
|
|
// XXX remove me
|
|
|
|
#define NS_FRAME_TRACE_MSG(_bit,_args) \
|
|
|
|
PR_BEGIN_MACRO \
|
1999-11-02 01:12:45 +03:00
|
|
|
if (NS_FRAME_LOG_TEST(nsIFrameDebug::GetLogModuleInfo(),_bit)) { \
|
1998-10-01 01:01:11 +04:00
|
|
|
TraceMsg _args; \
|
|
|
|
} \
|
|
|
|
PR_END_MACRO
|
|
|
|
|
|
|
|
#define NS_FRAME_TRACE(_bit,_args) \
|
|
|
|
PR_BEGIN_MACRO \
|
1999-11-02 01:12:45 +03:00
|
|
|
if (NS_FRAME_LOG_TEST(nsIFrameDebug::GetLogModuleInfo(),_bit)) { \
|
1998-10-01 01:01:11 +04:00
|
|
|
TraceMsg _args; \
|
|
|
|
} \
|
|
|
|
PR_END_MACRO
|
|
|
|
|
|
|
|
#define NS_FRAME_TRACE_REFLOW_IN(_method) Trace(_method, PR_TRUE)
|
|
|
|
|
|
|
|
#define NS_FRAME_TRACE_REFLOW_OUT(_method, _status) \
|
|
|
|
Trace(_method, PR_FALSE, _status)
|
|
|
|
|
|
|
|
#else
|
|
|
|
#define NS_FRAME_TRACE(_bits,_args)
|
|
|
|
#define NS_FRAME_TRACE_IN(_method)
|
|
|
|
#define NS_FRAME_TRACE_OUT(_method)
|
|
|
|
#define NS_FRAME_TRACE_MSG(_bits,_args)
|
|
|
|
#define NS_FRAME_TRACE_REFLOW_IN(_method)
|
|
|
|
#define NS_FRAME_TRACE_REFLOW_OUT(_method, _status)
|
|
|
|
#endif
|
|
|
|
|
2002-05-25 00:11:14 +04:00
|
|
|
// handy utilities
|
2003-03-05 18:08:41 +03:00
|
|
|
void SetFontFromStyle(nsIRenderingContext* aRC, nsStyleContext* aSC);
|
1999-06-11 01:08:17 +04:00
|
|
|
|
1998-10-01 01:01:11 +04:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
1998-10-17 00:09:32 +04:00
|
|
|
/**
|
|
|
|
* Implementation of a simple frame that's not splittable and has no
|
|
|
|
* child frames.
|
|
|
|
*
|
|
|
|
* Sets the NS_FRAME_SYNCHRONIZE_FRAME_AND_VIEW bit, so the default
|
|
|
|
* behavior is to keep the frame and view position and size in sync.
|
|
|
|
*/
|
1999-10-30 06:52:11 +04:00
|
|
|
class nsFrame : public nsIFrame
|
1999-11-02 01:12:45 +03:00
|
|
|
#ifdef NS_DEBUG
|
|
|
|
, public nsIFrameDebug
|
|
|
|
#endif
|
1998-10-01 01:01:11 +04:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
* Create a new "empty" frame that maps a given piece of content into a
|
|
|
|
* 0,0 area.
|
|
|
|
*/
|
1999-12-05 02:49:50 +03:00
|
|
|
friend nsresult NS_NewEmptyFrame(nsIPresShell* aShell, nsIFrame** aInstancePtrResult);
|
|
|
|
|
|
|
|
// Overloaded new operator. Initializes the memory to 0 and relies on an arena
|
|
|
|
// (which comes from the presShell) to perform the allocation.
|
2002-07-03 21:14:41 +04:00
|
|
|
void* operator new(size_t sz, nsIPresShell* aPresShell) CPP_THROW_NEW;
|
1999-12-05 02:49:50 +03:00
|
|
|
|
|
|
|
// Overridden to prevent the global delete from being called, since the memory
|
1999-12-05 05:24:02 +03:00
|
|
|
// came out of an nsIArena instead of the global delete operator's heap.
|
|
|
|
// XXX Would like to make this private some day, but our UNIX compilers can't
|
|
|
|
// deal with it.
|
1999-12-05 02:49:50 +03:00
|
|
|
void operator delete(void* aPtr, size_t sz);
|
1998-10-01 01:01:11 +04:00
|
|
|
|
1999-12-05 05:24:02 +03:00
|
|
|
private:
|
1999-12-05 02:49:50 +03:00
|
|
|
// The normal operator new is disallowed on nsFrames.
|
2002-07-03 00:25:30 +04:00
|
|
|
void* operator new(size_t sz) CPP_THROW_NEW { return nsnull; };
|
1999-12-05 02:49:50 +03:00
|
|
|
|
|
|
|
public:
|
1999-02-26 20:05:20 +03:00
|
|
|
|
1998-10-01 01:01:11 +04:00
|
|
|
// nsISupports
|
|
|
|
NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr);
|
|
|
|
|
|
|
|
// nsIFrame
|
1999-11-24 09:03:41 +03:00
|
|
|
NS_IMETHOD Init(nsIPresContext* aPresContext,
|
1998-12-03 09:31:43 +03:00
|
|
|
nsIContent* aContent,
|
1999-01-14 08:16:23 +03:00
|
|
|
nsIFrame* aParent,
|
2003-02-22 03:32:13 +03:00
|
|
|
nsStyleContext* aContext,
|
1999-02-25 06:27:57 +03:00
|
|
|
nsIFrame* asPrevInFlow);
|
1999-11-24 09:03:41 +03:00
|
|
|
NS_IMETHOD SetInitialChildList(nsIPresContext* aPresContext,
|
1998-11-10 09:05:32 +03:00
|
|
|
nsIAtom* aListName,
|
|
|
|
nsIFrame* aChildList);
|
1999-11-24 09:03:41 +03:00
|
|
|
NS_IMETHOD AppendFrames(nsIPresContext* aPresContext,
|
1999-01-15 04:29:15 +03:00
|
|
|
nsIPresShell& aPresShell,
|
|
|
|
nsIAtom* aListName,
|
|
|
|
nsIFrame* aFrameList);
|
1999-11-24 09:03:41 +03:00
|
|
|
NS_IMETHOD InsertFrames(nsIPresContext* aPresContext,
|
1999-01-15 04:29:15 +03:00
|
|
|
nsIPresShell& aPresShell,
|
|
|
|
nsIAtom* aListName,
|
|
|
|
nsIFrame* aPrevFrame,
|
|
|
|
nsIFrame* aFrameList);
|
1999-11-24 09:03:41 +03:00
|
|
|
NS_IMETHOD RemoveFrame(nsIPresContext* aPresContext,
|
1999-01-15 04:29:15 +03:00
|
|
|
nsIPresShell& aPresShell,
|
|
|
|
nsIAtom* aListName,
|
|
|
|
nsIFrame* aOldFrame);
|
1999-11-24 09:03:41 +03:00
|
|
|
NS_IMETHOD ReplaceFrame(nsIPresContext* aPresContext,
|
1999-07-22 08:32:31 +04:00
|
|
|
nsIPresShell& aPresShell,
|
|
|
|
nsIAtom* aListName,
|
|
|
|
nsIFrame* aOldFrame,
|
|
|
|
nsIFrame* aNewFrame);
|
1999-11-24 09:03:41 +03:00
|
|
|
NS_IMETHOD Destroy(nsIPresContext* aPresContext);
|
2001-02-07 12:57:26 +03:00
|
|
|
NS_IMETHOD CalcBorderPadding(nsMargin& aBorderPadding) const;
|
2003-02-22 03:32:13 +03:00
|
|
|
virtual nsStyleContext* GetAdditionalStyleContext(PRInt32 aIndex) const;
|
|
|
|
virtual void SetAdditionalStyleContext(PRInt32 aIndex,
|
|
|
|
nsStyleContext* aStyleContext);
|
1999-02-10 05:25:01 +03:00
|
|
|
NS_IMETHOD GetAdditionalChildListName(PRInt32 aIndex, nsIAtom** aListName) const;
|
2000-01-22 04:16:50 +03:00
|
|
|
NS_IMETHOD FirstChild(nsIPresContext* aPresContext,
|
|
|
|
nsIAtom* aListName,
|
|
|
|
nsIFrame** aFirstChild) const;
|
1999-11-24 09:03:41 +03:00
|
|
|
NS_IMETHOD Paint(nsIPresContext* aPresContext,
|
1998-10-01 01:01:11 +04:00
|
|
|
nsIRenderingContext& aRenderingContext,
|
1998-12-18 18:54:23 +03:00
|
|
|
const nsRect& aDirtyRect,
|
2001-09-19 16:35:19 +04:00
|
|
|
nsFramePaintLayer aWhichLayer,
|
|
|
|
PRUint32 aFlags = 0);
|
1999-11-24 09:03:41 +03:00
|
|
|
NS_IMETHOD HandleEvent(nsIPresContext* aPresContext,
|
1998-10-01 01:01:11 +04:00
|
|
|
nsGUIEvent* aEvent,
|
1999-11-24 09:03:41 +03:00
|
|
|
nsEventStatus* aEventStatus);
|
2000-02-11 04:24:59 +03:00
|
|
|
NS_IMETHOD GetContentForEvent(nsIPresContext* aPresContext,
|
|
|
|
nsEvent* aEvent,
|
|
|
|
nsIContent** aContent);
|
1999-11-24 09:03:41 +03:00
|
|
|
NS_IMETHOD GetCursor(nsIPresContext* aPresContext,
|
1998-11-18 08:25:26 +03:00
|
|
|
nsPoint& aPoint,
|
|
|
|
PRInt32& aCursor);
|
1999-10-26 08:44:41 +04:00
|
|
|
NS_IMETHOD GetFrameForPoint(nsIPresContext* aPresContext,
|
|
|
|
const nsPoint& aPoint,
|
2000-03-22 05:43:08 +03:00
|
|
|
nsFramePaintLayer aWhichLayer,
|
1999-10-26 08:44:41 +04:00
|
|
|
nsIFrame** aFrame);
|
1999-02-12 03:02:31 +03:00
|
|
|
|
|
|
|
NS_IMETHOD GetPointFromOffset(nsIPresContext* inPresContext,
|
|
|
|
nsIRenderingContext* inRendContext,
|
|
|
|
PRInt32 inOffset,
|
|
|
|
nsPoint* outPoint);
|
|
|
|
|
|
|
|
NS_IMETHOD GetChildFrameContainingOffset(PRInt32 inContentOffset,
|
1999-09-11 04:18:02 +04:00
|
|
|
PRBool inHint,
|
1999-02-12 03:02:31 +03:00
|
|
|
PRInt32* outFrameContentOffset,
|
|
|
|
nsIFrame* *outChildFrame);
|
|
|
|
|
1999-10-26 08:44:41 +04:00
|
|
|
static nsresult GetNextPrevLineFromeBlockFrame(nsIPresContext* aPresContext,
|
|
|
|
nsPeekOffsetStruct *aPos,
|
1999-07-15 22:19:03 +04:00
|
|
|
nsIFrame *aBlockFrame,
|
|
|
|
PRInt32 aLineStart,
|
1999-10-13 05:15:26 +04:00
|
|
|
PRInt8 aOutSideLimit
|
1999-07-15 22:19:03 +04:00
|
|
|
);
|
1998-10-01 01:01:11 +04:00
|
|
|
NS_IMETHOD ContentChanged(nsIPresContext* aPresContext,
|
|
|
|
nsIContent* aChild,
|
|
|
|
nsISupports* aSubContent);
|
|
|
|
NS_IMETHOD AttributeChanged(nsIPresContext* aPresContext,
|
|
|
|
nsIContent* aChild,
|
1999-10-16 03:16:45 +04:00
|
|
|
PRInt32 aNameSpaceID,
|
1998-10-01 01:01:11 +04:00
|
|
|
nsIAtom* aAttribute,
|
2001-08-25 06:01:08 +04:00
|
|
|
PRInt32 aModType,
|
1998-10-01 01:01:11 +04:00
|
|
|
PRInt32 aHint);
|
1999-09-10 09:52:23 +04:00
|
|
|
NS_IMETHOD ContentStateChanged(nsIPresContext* aPresContext,
|
|
|
|
nsIContent* aChild,
|
|
|
|
PRInt32 aHint);
|
1998-10-01 01:01:11 +04:00
|
|
|
NS_IMETHOD IsSplittable(nsSplittableType& aIsSplittable) const;
|
1999-02-24 07:48:08 +03:00
|
|
|
NS_IMETHOD GetPrevInFlow(nsIFrame** aPrevInFlow) const;
|
1998-10-01 01:01:11 +04:00
|
|
|
NS_IMETHOD SetPrevInFlow(nsIFrame*);
|
1999-02-24 07:48:08 +03:00
|
|
|
NS_IMETHOD GetNextInFlow(nsIFrame** aNextInFlow) const;
|
1998-10-01 01:01:11 +04:00
|
|
|
NS_IMETHOD SetNextInFlow(nsIFrame*);
|
1999-10-26 08:44:41 +04:00
|
|
|
NS_IMETHOD GetView(nsIPresContext* aPresContext, nsIView** aView) const;
|
|
|
|
NS_IMETHOD SetView(nsIPresContext* aPresContext, nsIView* aView);
|
|
|
|
NS_IMETHOD GetParentWithView(nsIPresContext* aPresContext, nsIFrame** aParent) const;
|
|
|
|
NS_IMETHOD GetOffsetFromView(nsIPresContext* aPresContext, nsPoint& aOffset, nsIView** aView) const;
|
2002-02-08 01:39:15 +03:00
|
|
|
NS_IMETHOD GetOriginToViewOffset(nsIPresContext *aPresContext, nsPoint& aOffset, nsIView **aView) const;
|
1999-10-26 08:44:41 +04:00
|
|
|
NS_IMETHOD GetWindow(nsIPresContext* aPresContext, nsIWidget**) const;
|
1999-02-10 07:17:06 +03:00
|
|
|
NS_IMETHOD GetFrameType(nsIAtom** aType) const;
|
1998-10-01 01:01:11 +04:00
|
|
|
NS_IMETHOD IsPercentageBase(PRBool& aBase) const;
|
|
|
|
NS_IMETHOD Scrolled(nsIView *aView);
|
1999-11-02 01:12:45 +03:00
|
|
|
#ifdef NS_DEBUG
|
1999-10-26 08:44:41 +04:00
|
|
|
NS_IMETHOD List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) const;
|
2001-11-14 04:33:42 +03:00
|
|
|
NS_IMETHOD GetFrameName(nsAString& aResult) const;
|
2000-12-07 18:31:40 +03:00
|
|
|
NS_IMETHOD DumpRegressionData(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent, PRBool aIncludeStyleData);
|
1998-10-01 01:01:11 +04:00
|
|
|
NS_IMETHOD VerifyTree() const;
|
1999-11-02 01:12:45 +03:00
|
|
|
#endif
|
2000-08-09 03:38:00 +04:00
|
|
|
|
1999-10-26 08:44:41 +04:00
|
|
|
NS_IMETHOD SetSelected(nsIPresContext* aPresContext, nsIDOMRange *aRange,PRBool aSelected, nsSpread aSpread);
|
1999-04-26 08:02:04 +04:00
|
|
|
NS_IMETHOD GetSelected(PRBool *aSelected) const;
|
2000-08-09 03:38:00 +04:00
|
|
|
NS_IMETHOD IsSelectable(PRBool* aIsSelectable, PRUint8* aSelectStyle) const;
|
|
|
|
|
2000-05-31 07:20:02 +04:00
|
|
|
NS_IMETHOD GetSelectionController(nsIPresContext *aPresContext, nsISelectionController **aSelCon);
|
1999-10-26 08:44:41 +04:00
|
|
|
NS_IMETHOD PeekOffset(nsIPresContext* aPresContext, nsPeekOffsetStruct *aPos) ;
|
2000-07-26 15:31:12 +04:00
|
|
|
NS_IMETHOD CheckVisibility(nsIPresContext* aContext, PRInt32 aStartIndex, PRInt32 aEndIndex, PRBool aRecurse, PRBool *aFinished, PRBool *_retval);
|
|
|
|
|
2000-05-17 02:48:28 +04:00
|
|
|
NS_IMETHOD PeekOffsetParagraph(nsIPresContext* aPresContext,
|
|
|
|
nsPeekOffsetStruct *aPos);
|
1999-01-22 21:58:14 +03:00
|
|
|
NS_IMETHOD GetOffsets(PRInt32 &aStart, PRInt32 &aEnd) const;
|
2000-01-12 11:28:24 +03:00
|
|
|
NS_IMETHOD ReflowDirtyChild(nsIPresShell* aPresShell, nsIFrame* aChild);
|
1999-02-18 06:25:23 +03:00
|
|
|
|
2001-08-17 07:13:07 +04:00
|
|
|
#ifdef ACCESSIBILITY
|
2001-05-18 03:52:32 +04:00
|
|
|
NS_IMETHOD GetAccessible(nsIAccessible** aAccessible);
|
2001-08-17 07:13:07 +04:00
|
|
|
#endif
|
2001-05-18 03:52:32 +04:00
|
|
|
|
2002-03-27 05:38:13 +03:00
|
|
|
NS_IMETHOD GetParentStyleContextFrame(nsIPresContext* aPresContext,
|
|
|
|
nsIFrame** aProviderFrame,
|
|
|
|
PRBool* aIsChild);
|
2000-09-13 02:47:09 +04:00
|
|
|
|
2001-01-27 17:09:34 +03:00
|
|
|
// Check Style Visibility and mState for Selection (when printing)
|
|
|
|
NS_IMETHOD IsVisibleForPainting(nsIPresContext * aPresContext,
|
|
|
|
nsIRenderingContext& aRenderingContext,
|
|
|
|
PRBool aCheckVis,
|
|
|
|
PRBool* aIsVisible);
|
|
|
|
|
2002-06-26 01:16:17 +04:00
|
|
|
NS_IMETHOD IsEmpty(nsCompatibility aCompatMode,
|
2001-10-25 05:08:40 +04:00
|
|
|
PRBool aIsPre,
|
|
|
|
PRBool* aResult);
|
|
|
|
|
1998-10-01 08:46:11 +04:00
|
|
|
// nsIHTMLReflow
|
1999-11-24 09:03:41 +03:00
|
|
|
NS_IMETHOD WillReflow(nsIPresContext* aPresContext);
|
|
|
|
NS_IMETHOD Reflow(nsIPresContext* aPresContext,
|
1998-10-02 08:10:00 +04:00
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
|
|
|
nsReflowStatus& aStatus);
|
2001-12-07 17:51:12 +03:00
|
|
|
NS_IMETHOD DidReflow(nsIPresContext* aPresContext,
|
|
|
|
const nsHTMLReflowState* aReflowState,
|
|
|
|
nsDidReflowStatus aStatus);
|
2000-07-29 02:29:28 +04:00
|
|
|
NS_IMETHOD CanContinueTextRun(PRBool& aContinueTextRun) const;
|
1998-10-27 19:51:21 +03:00
|
|
|
NS_IMETHOD AdjustFrameSize(nscoord aExtraSpace, nscoord& aUsedSpace);
|
1999-04-20 04:26:32 +04:00
|
|
|
NS_IMETHOD TrimTrailingWhiteSpace(nsIPresContext* aPresContext,
|
1998-10-27 19:51:21 +03:00
|
|
|
nsIRenderingContext& aRC,
|
|
|
|
nscoord& aDeltaWidth);
|
1998-10-01 08:46:11 +04:00
|
|
|
|
1998-10-08 22:21:32 +04:00
|
|
|
// Selection Methods
|
1999-02-18 06:25:23 +03:00
|
|
|
// XXX Doc me... (in nsIFrame.h puhleeze)
|
1998-10-08 22:21:32 +04:00
|
|
|
// XXX If these are selection specific, then the name should imply selection
|
|
|
|
// rather than generic event processing, e.g., SelectionHandlePress...
|
1999-11-24 09:03:41 +03:00
|
|
|
NS_IMETHOD HandlePress(nsIPresContext* aPresContext,
|
1998-10-08 22:21:32 +04:00
|
|
|
nsGUIEvent * aEvent,
|
1999-11-24 09:03:41 +03:00
|
|
|
nsEventStatus* aEventStatus);
|
1998-10-01 01:01:11 +04:00
|
|
|
|
1999-11-24 09:03:41 +03:00
|
|
|
NS_IMETHOD HandleMultiplePress(nsIPresContext* aPresContext,
|
1999-05-17 04:21:18 +04:00
|
|
|
nsGUIEvent * aEvent,
|
1999-11-24 09:03:41 +03:00
|
|
|
nsEventStatus* aEventStatus);
|
1999-05-17 04:21:18 +04:00
|
|
|
|
1999-11-24 09:03:41 +03:00
|
|
|
NS_IMETHOD HandleDrag(nsIPresContext* aPresContext,
|
1998-10-08 22:21:32 +04:00
|
|
|
nsGUIEvent * aEvent,
|
1999-11-24 09:03:41 +03:00
|
|
|
nsEventStatus* aEventStatus);
|
1998-10-01 01:01:11 +04:00
|
|
|
|
1999-11-24 09:03:41 +03:00
|
|
|
NS_IMETHOD HandleRelease(nsIPresContext* aPresContext,
|
1998-10-08 22:21:32 +04:00
|
|
|
nsGUIEvent * aEvent,
|
1999-11-24 09:03:41 +03:00
|
|
|
nsEventStatus* aEventStatus);
|
1998-10-01 01:01:11 +04:00
|
|
|
|
1999-11-24 09:03:41 +03:00
|
|
|
NS_IMETHOD GetContentAndOffsetsFromPoint(nsIPresContext* aCX,
|
1999-09-30 00:04:05 +04:00
|
|
|
const nsPoint& aPoint,
|
|
|
|
nsIContent ** aNewContent,
|
|
|
|
PRInt32& aContentOffset,
|
1999-10-13 05:15:26 +04:00
|
|
|
PRInt32& aContentOffsetEnd,
|
|
|
|
PRBool& aBeginFrameContent);
|
2000-05-17 02:48:28 +04:00
|
|
|
NS_IMETHOD PeekBackwardAndForward(nsSelectionAmount aAmountBack,
|
|
|
|
nsSelectionAmount aAmountForward,
|
|
|
|
PRInt32 aStartPos,
|
|
|
|
nsIPresContext* aPresContext,
|
|
|
|
PRBool aJumpLines);
|
1999-09-30 00:04:05 +04:00
|
|
|
|
|
|
|
|
1998-10-01 01:01:11 +04:00
|
|
|
//--------------------------------------------------
|
|
|
|
// Additional methods
|
|
|
|
|
|
|
|
// Invalidate part of the frame by asking the view manager to repaint.
|
|
|
|
// aDamageRect is in the frame's local coordinate space
|
2001-08-18 11:25:52 +04:00
|
|
|
void Invalidate(nsIPresContext* aPresContext,
|
|
|
|
const nsRect& aDamageRect,
|
|
|
|
PRBool aImmediate = PR_FALSE) const;
|
1998-10-01 01:01:11 +04:00
|
|
|
|
1998-10-09 00:35:16 +04:00
|
|
|
// Helper function to return the index in parent of the frame's content
|
|
|
|
// object. Returns -1 on error or if the frame doesn't have a content object
|
|
|
|
static PRInt32 ContentIndexInContainer(const nsIFrame* aFrame);
|
|
|
|
|
1999-08-28 01:48:06 +04:00
|
|
|
// Helper function that tests if the frame tree is too deep; if it
|
|
|
|
// is it marks the frame as "unflowable" and zeros out the metrics
|
|
|
|
// and returns PR_TRUE. Otherwise, the frame is unmarked
|
|
|
|
// "unflowable" and the metrics are not touched and PR_FALSE is
|
|
|
|
// returned.
|
|
|
|
PRBool IsFrameTreeTooDeep(const nsHTMLReflowState& aReflowState,
|
|
|
|
nsHTMLReflowMetrics& aMetrics);
|
|
|
|
|
1999-10-26 08:44:41 +04:00
|
|
|
virtual nsresult GetClosestViewForFrame(nsIPresContext* aPresContext,
|
|
|
|
nsIFrame *aFrame,
|
|
|
|
nsIView **aView);
|
1999-09-30 00:04:05 +04:00
|
|
|
|
2001-12-18 01:39:59 +03:00
|
|
|
static nsresult CreateAndPostReflowCommand(nsIPresShell* aPresShell,
|
|
|
|
nsIFrame* aTargetFrame,
|
|
|
|
nsReflowType aReflowType,
|
|
|
|
nsIFrame* aChildFrame,
|
|
|
|
nsIAtom* aAttribute,
|
|
|
|
nsIAtom* aListName);
|
2000-01-12 11:28:24 +03:00
|
|
|
|
2002-03-27 05:38:13 +03:00
|
|
|
// Do the work for getting the parent style context frame so that
|
|
|
|
// other frame's |GetParentStyleContextFrame| methods can call this
|
|
|
|
// method on *another* frame. (This function handles out-of-flow
|
|
|
|
// frames by using the frame manager's placeholder map and it handles
|
|
|
|
// block-within-inline by calling |GetIBSpecialParent|.)
|
|
|
|
nsresult DoGetParentStyleContextFrame(nsIPresContext* aPresContext,
|
|
|
|
nsIFrame** aProviderFrame,
|
|
|
|
PRBool* aIsChild);
|
|
|
|
|
|
|
|
nsresult GetIBSpecialParent(nsIPresContext* aPresContext,
|
|
|
|
nsIFrame** aSpecialParent);
|
|
|
|
|
2000-04-12 07:04:11 +04:00
|
|
|
//Mouse Capturing code used by the frames to tell the view to capture all the following events
|
2000-08-15 02:28:41 +04:00
|
|
|
NS_IMETHOD CaptureMouse(nsIPresContext* aPresContext, PRBool aGrabMouseEvents);
|
2000-04-12 07:04:11 +04:00
|
|
|
PRBool IsMouseCaptured(nsIPresContext* aPresContext);
|
2002-12-04 03:58:52 +03:00
|
|
|
|
|
|
|
virtual void* GetProperty(nsIPresContext* aPresContext,
|
|
|
|
nsIAtom* aPropertyName,
|
|
|
|
PRBool aRemoveProperty) const;
|
|
|
|
|
|
|
|
virtual nsresult SetProperty(nsIPresContext* aPresContext,
|
|
|
|
nsIAtom* aPropertyName,
|
|
|
|
void* aPropertyValue,
|
|
|
|
NSFramePropertyDtorFunc aPropDtorFunc);
|
|
|
|
|
2003-01-09 09:49:07 +03:00
|
|
|
NS_IMETHOD GetStyleDataExternal(nsStyleStructID aSID,
|
2003-01-09 11:07:27 +03:00
|
|
|
const nsStyleStruct*& aStyleStruct) const;
|
2003-01-09 09:49:07 +03:00
|
|
|
|
2001-03-09 06:29:00 +03:00
|
|
|
#ifdef IBMBIDI
|
|
|
|
NS_IMETHOD GetBidiProperty(nsIPresContext* aPresContext,
|
|
|
|
nsIAtom* aPropertyName,
|
|
|
|
void** aPropertyValue,
|
2001-06-21 16:35:48 +04:00
|
|
|
size_t aSize ) const;
|
2001-03-09 06:29:00 +03:00
|
|
|
NS_IMETHOD SetBidiProperty(nsIPresContext* aPresContext,
|
|
|
|
nsIAtom* aPropertyName,
|
2001-06-21 16:35:48 +04:00
|
|
|
void* aPropertyValue) ;
|
2001-03-09 06:29:00 +03:00
|
|
|
#endif // IBMBIDI
|
2000-04-12 07:04:11 +04:00
|
|
|
|
1998-10-01 01:01:11 +04:00
|
|
|
#ifdef NS_DEBUG
|
|
|
|
/**
|
|
|
|
* Tracing method that writes a method enter/exit routine to the
|
|
|
|
* nspr log using the nsIFrame log module. The tracing is only
|
|
|
|
* done when the NS_FRAME_TRACE_CALLS bit is set in the log module's
|
|
|
|
* level field.
|
|
|
|
*/
|
|
|
|
void Trace(const char* aMethod, PRBool aEnter);
|
|
|
|
void Trace(const char* aMethod, PRBool aEnter, nsReflowStatus aStatus);
|
|
|
|
void TraceMsg(const char* fmt, ...);
|
1999-07-24 06:37:06 +04:00
|
|
|
|
|
|
|
// Helper function that verifies that each frame in the list has the
|
|
|
|
// NS_FRAME_IS_DIRTY bit set
|
|
|
|
static void VerifyDirtyBitSet(nsIFrame* aFrameList);
|
1998-10-01 01:01:11 +04:00
|
|
|
|
1998-11-19 20:22:29 +03:00
|
|
|
void ListTag(FILE* out) const {
|
1999-11-02 01:12:45 +03:00
|
|
|
ListTag(out, (nsIFrame*)this);
|
1998-12-12 22:20:10 +03:00
|
|
|
}
|
|
|
|
|
1999-11-02 01:12:45 +03:00
|
|
|
static void ListTag(FILE* out, nsIFrame* aFrame) {
|
1998-11-19 20:22:29 +03:00
|
|
|
nsAutoString tmp;
|
1999-11-02 01:12:45 +03:00
|
|
|
nsIFrameDebug* frameDebug;
|
|
|
|
|
2000-02-03 01:24:56 +03:00
|
|
|
if (NS_SUCCEEDED(aFrame->QueryInterface(NS_GET_IID(nsIFrameDebug), (void**)&frameDebug))) {
|
1999-11-02 01:12:45 +03:00
|
|
|
frameDebug->GetFrameName(tmp);
|
|
|
|
}
|
2001-10-16 07:53:44 +04:00
|
|
|
fputs(NS_LossyConvertUCS2toASCII(tmp).get(), out);
|
2001-10-25 05:08:40 +04:00
|
|
|
fprintf(out, "@%p", NS_STATIC_CAST(void*, aFrame));
|
1998-11-19 20:22:29 +03:00
|
|
|
}
|
|
|
|
|
1998-12-05 19:03:07 +03:00
|
|
|
static void IndentBy(FILE* out, PRInt32 aIndent) {
|
|
|
|
while (--aIndent >= 0) fputs(" ", out);
|
|
|
|
}
|
1999-11-02 01:12:45 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Dump out the "base classes" regression data. This should dump
|
|
|
|
* out the interior data, not the "frame" XML container. And it
|
|
|
|
* should call the base classes same named method before doing
|
|
|
|
* anything specific in a derived class. This means that derived
|
|
|
|
* classes need not override DumpRegressionData unless they need
|
|
|
|
* some custom behavior that requires changing how the outer "frame"
|
|
|
|
* XML container is dumped.
|
|
|
|
*/
|
2000-12-07 18:31:40 +03:00
|
|
|
virtual void DumpBaseRegressionData(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent, PRBool aIncludeStyleData);
|
1999-11-02 01:12:45 +03:00
|
|
|
|
2001-11-14 04:33:42 +03:00
|
|
|
nsresult MakeFrameName(const nsAString& aKind, nsAString& aResult) const;
|
2001-10-29 04:43:59 +03:00
|
|
|
|
|
|
|
// Display Reflow Debugging
|
2001-11-14 16:40:03 +03:00
|
|
|
static void* DisplayReflowEnter(nsIPresContext* aPresContext,
|
|
|
|
nsIFrame* aFrame,
|
2001-10-29 04:43:59 +03:00
|
|
|
const nsHTMLReflowState& aReflowState);
|
2001-11-14 16:40:03 +03:00
|
|
|
static void DisplayReflowExit(nsIPresContext* aPresContext,
|
|
|
|
nsIFrame* aFrame,
|
2001-10-29 04:43:59 +03:00
|
|
|
nsHTMLReflowMetrics& aMetrics,
|
|
|
|
PRUint32 aStatus,
|
|
|
|
void* aFrameTreeNode);
|
1999-11-02 01:12:45 +03:00
|
|
|
#endif
|
1998-12-05 19:03:07 +03:00
|
|
|
|
1998-10-01 01:01:11 +04:00
|
|
|
protected:
|
1998-12-05 19:03:07 +03:00
|
|
|
// Protected constructor and destructor
|
|
|
|
nsFrame();
|
|
|
|
virtual ~nsFrame();
|
|
|
|
|
2002-12-24 01:05:47 +03:00
|
|
|
/**
|
|
|
|
* To be called by |Paint| of this class or derived classes to paint
|
|
|
|
* the background, border, and outline, when in the correct layer to
|
|
|
|
* do so.
|
|
|
|
*/
|
|
|
|
void PaintSelf(nsIPresContext* aPresContext,
|
|
|
|
nsIRenderingContext& aRenderingContext,
|
|
|
|
const nsRect& aDirtyRect,
|
2003-02-23 05:49:22 +03:00
|
|
|
PRIntn aSkipSides = 0,
|
|
|
|
PRBool aUsePrintBackgroundSettings = PR_TRUE);
|
2002-12-24 01:05:47 +03:00
|
|
|
|
2000-04-30 22:56:26 +04:00
|
|
|
PRInt16 DisplaySelection(nsIPresContext* aPresContext, PRBool isOkToTurnOn = PR_FALSE);
|
2000-08-09 03:38:00 +04:00
|
|
|
|
1999-10-22 04:19:18 +04:00
|
|
|
//this will modify aPos and return the next frame ect.
|
2000-01-22 04:16:50 +03:00
|
|
|
NS_IMETHOD GetFrameFromDirection(nsIPresContext* aPresContext, nsPeekOffsetStruct *aPos);
|
1999-10-22 04:19:18 +04:00
|
|
|
|
1998-10-01 01:01:11 +04:00
|
|
|
// Style post processing hook
|
|
|
|
NS_IMETHOD DidSetStyleContext(nsIPresContext* aPresContext);
|
|
|
|
|
2001-03-08 05:46:44 +03:00
|
|
|
// Helper routine for determining whether to print selection
|
|
|
|
nsresult GetSelectionForVisCheck(nsIPresContext * aPresContext, nsISelection** aSelection);
|
|
|
|
|
1999-10-22 04:19:18 +04:00
|
|
|
//return the line number of the aFrame
|
|
|
|
static PRInt32 GetLineNumber(nsIFrame *aFrame);
|
|
|
|
//given a frame five me the first/last leaf available
|
2000-01-22 04:16:50 +03:00
|
|
|
static void GetLastLeaf(nsIPresContext* aPresContext, nsIFrame **aFrame);
|
|
|
|
static void GetFirstLeaf(nsIPresContext* aPresContext, nsIFrame **aFrame);
|
2000-03-17 02:45:39 +03:00
|
|
|
|
|
|
|
// Test if we are selecting a table object:
|
2000-05-31 04:07:58 +04:00
|
|
|
// Most table/cell selection requires that Ctrl (Cmd on Mac) key is down
|
|
|
|
// during a mouse click or drag. Exception is using Shift+click when
|
|
|
|
// already in "table/cell selection mode" to extend a block selection
|
|
|
|
// Get the parent content node and offset of the frame
|
2000-03-17 02:45:39 +03:00
|
|
|
// of the enclosing cell or table (if not inside a cell)
|
|
|
|
// aTarget tells us what table element to select (currently only cell and table supported)
|
|
|
|
// (enums for this are defined in nsIFrame.h)
|
2002-03-22 18:25:08 +03:00
|
|
|
NS_IMETHOD GetDataForTableSelection(nsIFrameSelection *aFrameSelection,
|
|
|
|
nsIPresShell *aPresShell, nsMouseEvent *aMouseEvent,
|
|
|
|
nsIContent **aParentContent, PRInt32 *aContentOffset,
|
|
|
|
PRInt32 *aTarget);
|
2000-03-17 02:45:39 +03:00
|
|
|
|
1998-11-19 20:55:22 +03:00
|
|
|
static void XMLQuote(nsString& aString);
|
|
|
|
|
1999-06-02 03:04:13 +04:00
|
|
|
virtual PRBool ParentDisablesSelection() const;
|
|
|
|
|
2000-04-25 08:43:11 +04:00
|
|
|
// Set the overflow clip rect into the rendering-context. Used for block-level
|
|
|
|
// elements and replaced elements that have 'overflow' set to 'hidden'. This
|
|
|
|
// member function assumes that the caller has checked that the clip property
|
|
|
|
// applies to its situation.
|
|
|
|
void SetOverflowClipRect(nsIRenderingContext& aRenderingContext);
|
1999-04-10 21:32:22 +04:00
|
|
|
|
1998-12-07 06:43:02 +03:00
|
|
|
protected:
|
1998-10-01 01:01:11 +04:00
|
|
|
NS_IMETHOD_(nsrefcnt) AddRef(void);
|
|
|
|
NS_IMETHOD_(nsrefcnt) Release(void);
|
|
|
|
};
|
|
|
|
|
2001-11-14 16:40:03 +03:00
|
|
|
// Start Display Reflow Debugging
|
2001-10-29 04:43:59 +03:00
|
|
|
#ifdef DEBUG
|
|
|
|
|
|
|
|
struct DR_cookie {
|
2001-11-14 16:40:03 +03:00
|
|
|
DR_cookie(nsIPresContext* aPresContext,
|
|
|
|
nsIFrame* aFrame,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
2001-10-29 04:43:59 +03:00
|
|
|
nsHTMLReflowMetrics& aMetrics,
|
|
|
|
nsReflowStatus& aStatus);
|
|
|
|
~DR_cookie();
|
2001-11-27 04:45:46 +03:00
|
|
|
void Change() const;
|
2001-10-29 04:43:59 +03:00
|
|
|
|
2001-11-14 16:40:03 +03:00
|
|
|
nsIPresContext* mPresContext;
|
2001-10-29 04:43:59 +03:00
|
|
|
nsIFrame* mFrame;
|
|
|
|
const nsHTMLReflowState& mReflowState;
|
|
|
|
nsHTMLReflowMetrics& mMetrics;
|
|
|
|
nsReflowStatus& mStatus;
|
|
|
|
void* mValue;
|
|
|
|
};
|
|
|
|
|
2001-11-14 16:40:03 +03:00
|
|
|
#define DISPLAY_REFLOW(dr_pres_context, dr_frame, dr_rf_state, dr_rf_metrics, dr_rf_status) \
|
|
|
|
DR_cookie dr_cookie(dr_pres_context, dr_frame, dr_rf_state, dr_rf_metrics, dr_rf_status);
|
2001-11-27 04:45:46 +03:00
|
|
|
#define DISPLAY_REFLOW_CHANGE() \
|
|
|
|
dr_cookie.Change();
|
2001-10-29 04:43:59 +03:00
|
|
|
|
|
|
|
#else
|
|
|
|
|
2001-11-14 16:40:03 +03:00
|
|
|
#define DISPLAY_REFLOW(dr_pres_context, dr_frame, dr_rf_state, dr_rf_metrics, dr_rf_status)
|
2001-11-27 04:45:46 +03:00
|
|
|
#define DISPLAY_REFLOW_CHANGE()
|
2001-10-29 04:43:59 +03:00
|
|
|
|
|
|
|
#endif
|
|
|
|
// End Display Reflow Debugging
|
|
|
|
|
2002-03-12 18:21:35 +03:00
|
|
|
// similar to NS_ENSURE_TRUE but with no return value
|
|
|
|
#define ENSURE_TRUE(x) \
|
|
|
|
PR_BEGIN_MACRO \
|
|
|
|
if (!(x)) { \
|
|
|
|
NS_WARNING("ENSURE_TRUE(" #x ") failed"); \
|
|
|
|
return; \
|
|
|
|
} \
|
|
|
|
PR_END_MACRO
|
1998-10-01 01:01:11 +04:00
|
|
|
#endif /* nsFrame_h___ */
|