2001-09-29 00:14:13 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
2004-04-18 18:30:37 +04:00
|
|
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
1998-10-01 01:01:11 +04:00
|
|
|
*
|
2004-04-18 18:30:37 +04:00
|
|
|
* The contents of this file are subject to the Mozilla 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/MPL/
|
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.
|
|
|
|
*
|
2004-04-18 18:30:37 +04:00
|
|
|
* The Initial Developer of the Original Code is
|
2001-09-29 00:14:13 +04:00
|
|
|
* 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
|
2004-04-18 18:30:37 +04:00
|
|
|
* either of 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"),
|
2001-09-29 00:14:13 +04:00
|
|
|
* 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
|
2004-04-18 18:30:37 +04:00
|
|
|
* use your version of this file under the terms of the MPL, indicate your
|
2001-09-29 00:14:13 +04:00
|
|
|
* 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
|
2004-04-18 18:30:37 +04:00
|
|
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
2001-09-29 00:14:13 +04:00
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
2006-03-29 22:29:03 +04:00
|
|
|
|
|
|
|
/* base class of all rendering objects */
|
|
|
|
|
1998-10-01 01:01:11 +04:00
|
|
|
#ifndef nsFrame_h___
|
|
|
|
#define nsFrame_h___
|
|
|
|
|
2004-09-28 22:37:50 +04:00
|
|
|
#include "nsBox.h"
|
1998-10-01 01:01:11 +04:00
|
|
|
#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-12-05 02:49:50 +03:00
|
|
|
#include "nsIPresShell.h"
|
2006-04-26 06:01:07 +04:00
|
|
|
#include "nsFrameSelection.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 \
|
2009-08-21 01:52:48 +04:00
|
|
|
if (NS_FRAME_LOG_TEST(nsFrame::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 \
|
2009-08-21 01:52:48 +04:00
|
|
|
if (NS_FRAME_LOG_TEST(nsFrame::GetLogModuleInfo(),_bit)) { \
|
1998-10-01 01:01:11 +04:00
|
|
|
TraceMsg _args; \
|
|
|
|
} \
|
|
|
|
PR_END_MACRO
|
|
|
|
|
|
|
|
#define NS_FRAME_TRACE(_bit,_args) \
|
|
|
|
PR_BEGIN_MACRO \
|
2009-08-21 01:52:48 +04:00
|
|
|
if (NS_FRAME_LOG_TEST(nsFrame::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
|
|
|
|
|
2009-09-12 20:49:24 +04:00
|
|
|
// Frame allocation boilerplate macros. Every subclass of nsFrame
|
|
|
|
// must define its own operator new and GetAllocatedSize. If they do
|
|
|
|
// not, the per-frame recycler lists in nsPresArena will not work
|
|
|
|
// correctly, with potentially catastrophic consequences (not enough
|
|
|
|
// memory is allocated for a frame object).
|
|
|
|
|
|
|
|
#define NS_DECL_FRAMEARENA_HELPERS \
|
|
|
|
NS_MUST_OVERRIDE void* operator new(size_t, nsIPresShell*); \
|
2009-09-16 02:00:04 +04:00
|
|
|
virtual NS_MUST_OVERRIDE nsQueryFrame::FrameIID GetFrameId();
|
2009-09-12 20:49:24 +04:00
|
|
|
|
|
|
|
#define NS_IMPL_FRAMEARENA_HELPERS(class) \
|
|
|
|
void* class::operator new(size_t sz, nsIPresShell* aShell) \
|
2009-09-16 02:00:04 +04:00
|
|
|
{ return aShell->AllocateFrame(nsQueryFrame::class##_id, sz); } \
|
|
|
|
nsQueryFrame::FrameIID class::GetFrameId() \
|
|
|
|
{ return nsQueryFrame::class##_id; }
|
2009-09-12 20:49:24 +04:00
|
|
|
|
1998-10-01 01:01:11 +04:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
2004-09-28 22:37:50 +04:00
|
|
|
struct nsBoxLayoutMetrics;
|
|
|
|
|
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.
|
|
|
|
*/
|
2004-09-28 22:37:50 +04:00
|
|
|
class nsFrame : public nsBox
|
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.
|
|
|
|
*/
|
2009-08-18 07:21:06 +04:00
|
|
|
friend nsIFrame* NS_NewEmptyFrame(nsIPresShell* aShell,
|
|
|
|
nsStyleContext* aContext);
|
1999-12-05 02:49:50 +03:00
|
|
|
|
1999-12-05 05:24:02 +03:00
|
|
|
private:
|
2009-08-18 07:21:06 +04:00
|
|
|
// Left undefined; nsFrame objects are never allocated from the heap.
|
|
|
|
void* operator new(size_t sz) CPP_THROW_NEW;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
// Overridden to prevent the global delete from being called, since
|
|
|
|
// the memory came out of an arena instead of the heap.
|
|
|
|
//
|
|
|
|
// Ideally this would be private and undefined, like the normal
|
|
|
|
// operator new. Unfortunately, the C++ standard requires an
|
|
|
|
// overridden operator delete to be accessible to any subclass that
|
|
|
|
// defines a virtual destructor, so we can only make it protected;
|
|
|
|
// worse, some C++ compilers will synthesize calls to this function
|
|
|
|
// from the "deleting destructors" that they emit in case of
|
|
|
|
// delete-expressions, so it can't even be undefined.
|
|
|
|
void operator delete(void* aPtr, size_t sz);
|
1999-12-05 02:49:50 +03:00
|
|
|
|
|
|
|
public:
|
1999-02-26 20:05:20 +03:00
|
|
|
|
2009-01-12 22:20:59 +03:00
|
|
|
// nsQueryFrame
|
|
|
|
NS_DECL_QUERYFRAME
|
2009-09-12 20:49:24 +04:00
|
|
|
NS_DECL_FRAMEARENA_HELPERS
|
1998-10-01 01:01:11 +04:00
|
|
|
|
|
|
|
// nsIFrame
|
2006-03-09 21:55:21 +03:00
|
|
|
NS_IMETHOD Init(nsIContent* aContent,
|
1999-01-14 08:16:23 +03:00
|
|
|
nsIFrame* aParent,
|
1999-02-25 06:27:57 +03:00
|
|
|
nsIFrame* asPrevInFlow);
|
2009-07-28 16:53:20 +04:00
|
|
|
NS_IMETHOD SetInitialChildList(nsIAtom* aListName,
|
|
|
|
nsFrameList& aChildList);
|
2005-02-07 04:58:25 +03:00
|
|
|
NS_IMETHOD AppendFrames(nsIAtom* aListName,
|
2009-07-30 21:23:32 +04:00
|
|
|
nsFrameList& aFrameList);
|
2005-02-07 04:58:25 +03:00
|
|
|
NS_IMETHOD InsertFrames(nsIAtom* aListName,
|
1999-01-15 04:29:15 +03:00
|
|
|
nsIFrame* aPrevFrame,
|
2009-07-30 21:23:32 +04:00
|
|
|
nsFrameList& aFrameList);
|
2005-02-07 04:58:25 +03:00
|
|
|
NS_IMETHOD RemoveFrame(nsIAtom* aListName,
|
1999-01-15 04:29:15 +03:00
|
|
|
nsIFrame* aOldFrame);
|
2009-12-24 08:21:15 +03:00
|
|
|
virtual void DestroyFrom(nsIFrame* aDestructRoot);
|
2003-02-22 03:32:13 +03:00
|
|
|
virtual nsStyleContext* GetAdditionalStyleContext(PRInt32 aIndex) const;
|
|
|
|
virtual void SetAdditionalStyleContext(PRInt32 aIndex,
|
|
|
|
nsStyleContext* aStyleContext);
|
2010-08-31 04:46:26 +04:00
|
|
|
virtual void SetParent(nsIFrame* aParent);
|
2007-01-23 07:06:56 +03:00
|
|
|
virtual nscoord GetBaseline() const;
|
2004-01-09 17:20:53 +03:00
|
|
|
virtual nsIAtom* GetAdditionalChildListName(PRInt32 aIndex) const;
|
2009-07-28 16:51:09 +04:00
|
|
|
virtual nsFrameList GetChildList(nsIAtom* aListName) const;
|
2004-08-01 03:15:21 +04:00
|
|
|
NS_IMETHOD HandleEvent(nsPresContext* aPresContext,
|
1998-10-01 01:01:11 +04:00
|
|
|
nsGUIEvent* aEvent,
|
1999-11-24 09:03:41 +03:00
|
|
|
nsEventStatus* aEventStatus);
|
2004-08-01 03:15:21 +04:00
|
|
|
NS_IMETHOD GetContentForEvent(nsPresContext* aPresContext,
|
2000-02-11 04:24:59 +03:00
|
|
|
nsEvent* aEvent,
|
|
|
|
nsIContent** aContent);
|
2004-12-31 00:56:11 +03:00
|
|
|
NS_IMETHOD GetCursor(const nsPoint& aPoint,
|
|
|
|
nsIFrame::Cursor& aCursor);
|
1999-02-12 03:02:31 +03:00
|
|
|
|
2007-08-17 07:43:00 +04:00
|
|
|
NS_IMETHOD GetPointFromOffset(PRInt32 inOffset,
|
1999-02-12 03:02:31 +03:00
|
|
|
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);
|
|
|
|
|
2004-08-01 03:15:21 +04:00
|
|
|
static nsresult GetNextPrevLineFromeBlockFrame(nsPresContext* aPresContext,
|
1999-10-26 08:44:41 +04:00
|
|
|
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
|
|
|
);
|
2006-06-16 05:54:31 +04:00
|
|
|
|
2009-08-05 05:38:10 +04:00
|
|
|
NS_IMETHOD CharacterDataChanged(CharacterDataChangeInfo* aInfo);
|
2005-09-07 20:49:21 +04:00
|
|
|
NS_IMETHOD AttributeChanged(PRInt32 aNameSpaceID,
|
1998-10-01 01:01:11 +04:00
|
|
|
nsIAtom* aAttribute,
|
2003-07-12 01:16:12 +04:00
|
|
|
PRInt32 aModType);
|
2006-12-20 06:52:34 +03:00
|
|
|
virtual nsSplittableType GetSplittableType() const;
|
2006-02-22 00:33:47 +03:00
|
|
|
virtual nsIFrame* GetPrevContinuation() const;
|
|
|
|
NS_IMETHOD SetPrevContinuation(nsIFrame*);
|
|
|
|
virtual nsIFrame* GetNextContinuation() const;
|
|
|
|
NS_IMETHOD SetNextContinuation(nsIFrame*);
|
|
|
|
virtual nsIFrame* GetPrevInFlowVirtual() const;
|
1998-10-01 01:01:11 +04:00
|
|
|
NS_IMETHOD SetPrevInFlow(nsIFrame*);
|
2006-02-22 00:33:47 +03:00
|
|
|
virtual nsIFrame* GetNextInFlowVirtual() const;
|
1998-10-01 01:01:11 +04:00
|
|
|
NS_IMETHOD SetNextInFlow(nsIFrame*);
|
2004-12-26 22:48:54 +03:00
|
|
|
NS_IMETHOD GetOffsetFromView(nsPoint& aOffset, nsIView** aView) const;
|
2003-10-31 23:19:18 +03:00
|
|
|
virtual nsIAtom* GetType() const;
|
2004-03-12 07:40:17 +03:00
|
|
|
virtual PRBool IsContainingBlock() const;
|
2000-08-09 03:38:00 +04:00
|
|
|
|
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;
|
|
|
|
|
2004-08-01 03:15:21 +04:00
|
|
|
NS_IMETHOD GetSelectionController(nsPresContext *aPresContext, nsISelectionController **aSelCon);
|
2006-09-12 00:43:01 +04:00
|
|
|
|
|
|
|
virtual PRBool PeekOffsetNoAmount(PRBool aForward, PRInt32* aOffset);
|
|
|
|
virtual PRBool PeekOffsetCharacter(PRBool aForward, PRInt32* aOffset);
|
|
|
|
virtual PRBool PeekOffsetWord(PRBool aForward, PRBool aWordSelectEatSpace, PRBool aIsKeyboardSelect,
|
2007-08-30 07:10:19 +04:00
|
|
|
PRInt32* aOffset, PeekWordState *aState);
|
|
|
|
/**
|
|
|
|
* Check whether we should break at a boundary between punctuation and
|
2008-03-03 11:37:34 +03:00
|
|
|
* non-punctuation. Only call it at a punctuation boundary
|
|
|
|
* (i.e. exactly one of the previous and next characters are punctuation).
|
|
|
|
* @param aForward true if we're moving forward in content order
|
|
|
|
* @param aPunctAfter true if the next character is punctuation
|
|
|
|
* @param aWhitespaceAfter true if the next character is whitespace
|
2007-08-30 07:10:19 +04:00
|
|
|
*/
|
2008-03-03 11:37:34 +03:00
|
|
|
PRBool BreakWordBetweenPunctuation(const PeekWordState* aState,
|
|
|
|
PRBool aForward,
|
|
|
|
PRBool aPunctAfter, PRBool aWhitespaceAfter,
|
|
|
|
PRBool aIsKeyboardSelect);
|
|
|
|
|
2004-08-01 03:15:21 +04:00
|
|
|
NS_IMETHOD CheckVisibility(nsPresContext* aContext, PRInt32 aStartIndex, PRInt32 aEndIndex, PRBool aRecurse, PRBool *aFinished, PRBool *_retval);
|
2000-07-26 15:31:12 +04:00
|
|
|
|
1999-01-22 21:58:14 +03:00
|
|
|
NS_IMETHOD GetOffsets(PRInt32 &aStart, PRInt32 &aEnd) const;
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 08:38:33 +03:00
|
|
|
virtual void ChildIsDirty(nsIFrame* aChild);
|
1999-02-18 06:25:23 +03:00
|
|
|
|
2001-08-17 07:13:07 +04:00
|
|
|
#ifdef ACCESSIBILITY
|
2010-06-28 16:02:03 +04:00
|
|
|
virtual already_AddRefed<nsAccessible> CreateAccessible();
|
2001-08-17 07:13:07 +04:00
|
|
|
#endif
|
2001-05-18 03:52:32 +04:00
|
|
|
|
2004-08-01 03:15:21 +04:00
|
|
|
NS_IMETHOD GetParentStyleContextFrame(nsPresContext* aPresContext,
|
2002-03-27 05:38:13 +03:00
|
|
|
nsIFrame** aProviderFrame,
|
|
|
|
PRBool* aIsChild);
|
2000-09-13 02:47:09 +04:00
|
|
|
|
2003-11-11 02:36:06 +03:00
|
|
|
virtual PRBool IsEmpty();
|
2004-11-15 08:01:11 +03:00
|
|
|
virtual PRBool IsSelfEmpty();
|
2001-10-25 05:08:40 +04:00
|
|
|
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 08:38:33 +03:00
|
|
|
virtual void MarkIntrinsicWidthsDirty();
|
|
|
|
virtual nscoord GetMinWidth(nsIRenderingContext *aRenderingContext);
|
|
|
|
virtual nscoord GetPrefWidth(nsIRenderingContext *aRenderingContext);
|
|
|
|
virtual void AddInlineMinWidth(nsIRenderingContext *aRenderingContext,
|
|
|
|
InlineMinWidthData *aData);
|
|
|
|
virtual void AddInlinePrefWidth(nsIRenderingContext *aRenderingContext,
|
|
|
|
InlinePrefWidthData *aData);
|
2006-12-17 17:06:42 +03:00
|
|
|
virtual IntrinsicWidthOffsetData
|
|
|
|
IntrinsicWidthOffsets(nsIRenderingContext* aRenderingContext);
|
2007-11-18 15:09:03 +03:00
|
|
|
virtual IntrinsicSize GetIntrinsicSize();
|
2007-06-12 22:27:09 +04:00
|
|
|
virtual nsSize GetIntrinsicRatio();
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 08:38:33 +03:00
|
|
|
|
|
|
|
virtual nsSize ComputeSize(nsIRenderingContext *aRenderingContext,
|
|
|
|
nsSize aCBSize, nscoord aAvailableWidth,
|
|
|
|
nsSize aMargin, nsSize aBorder, nsSize aPadding,
|
|
|
|
PRBool aShrinkWrap);
|
|
|
|
|
2007-10-12 12:30:54 +04:00
|
|
|
// Compute tight bounds assuming this frame honours its border, background
|
|
|
|
// and outline, its children's tight bounds, and nothing else.
|
|
|
|
nsRect ComputeSimpleTightBounds(gfxContext* aContext) const;
|
|
|
|
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 08:38:33 +03:00
|
|
|
/**
|
|
|
|
* A helper, used by |nsFrame::ComputeSize| (for frames that need to
|
|
|
|
* override only this part of ComputeSize), that computes the size
|
|
|
|
* that should be returned when 'width', 'height', and
|
|
|
|
* min/max-width/height are all 'auto' or equivalent.
|
|
|
|
*
|
|
|
|
* In general, frames that can accept any computed width/height should
|
|
|
|
* override only ComputeAutoSize, and frames that cannot do so need to
|
|
|
|
* override ComputeSize to enforce their width/height invariants.
|
|
|
|
*
|
|
|
|
* Implementations may optimize by returning a garbage width if
|
2008-01-27 23:24:06 +03:00
|
|
|
* GetStylePosition()->mWidth.GetUnit() != eStyleUnit_Auto, and
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 08:38:33 +03:00
|
|
|
* likewise for height, since in such cases the result is guaranteed
|
|
|
|
* to be unused.
|
|
|
|
*/
|
|
|
|
virtual nsSize ComputeAutoSize(nsIRenderingContext *aRenderingContext,
|
|
|
|
nsSize aCBSize, nscoord aAvailableWidth,
|
|
|
|
nsSize aMargin, nsSize aBorder,
|
|
|
|
nsSize aPadding, PRBool aShrinkWrap);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Utility function for ComputeAutoSize implementations. Return
|
|
|
|
* max(GetMinWidth(), min(aWidthInCB, GetPrefWidth()))
|
|
|
|
*/
|
|
|
|
nscoord ShrinkWidthToFit(nsIRenderingContext *aRenderingContext,
|
|
|
|
nscoord aWidthInCB);
|
|
|
|
|
2004-08-01 03:15:21 +04:00
|
|
|
NS_IMETHOD WillReflow(nsPresContext* aPresContext);
|
|
|
|
NS_IMETHOD Reflow(nsPresContext* aPresContext,
|
1998-10-02 08:10:00 +04:00
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
|
|
|
nsReflowStatus& aStatus);
|
2004-08-01 03:15:21 +04:00
|
|
|
NS_IMETHOD DidReflow(nsPresContext* aPresContext,
|
2001-12-07 17:51:12 +03:00
|
|
|
const nsHTMLReflowState* aReflowState,
|
|
|
|
nsDidReflowStatus aStatus);
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 08:38:33 +03:00
|
|
|
virtual PRBool CanContinueTextRun() const;
|
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...
|
2004-08-01 03:15:21 +04:00
|
|
|
NS_IMETHOD HandlePress(nsPresContext* 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
|
|
|
|
2004-08-01 03:15:21 +04:00
|
|
|
NS_IMETHOD HandleMultiplePress(nsPresContext* aPresContext,
|
1999-05-17 04:21:18 +04:00
|
|
|
nsGUIEvent * aEvent,
|
2008-10-17 23:46:33 +04:00
|
|
|
nsEventStatus* aEventStatus,
|
|
|
|
PRBool aControlHeld);
|
1999-05-17 04:21:18 +04:00
|
|
|
|
2004-08-01 03:15:21 +04:00
|
|
|
NS_IMETHOD HandleDrag(nsPresContext* 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
|
|
|
|
2004-08-01 03:15:21 +04:00
|
|
|
NS_IMETHOD HandleRelease(nsPresContext* 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
|
|
|
|
2000-05-17 02:48:28 +04:00
|
|
|
NS_IMETHOD PeekBackwardAndForward(nsSelectionAmount aAmountBack,
|
|
|
|
nsSelectionAmount aAmountForward,
|
|
|
|
PRInt32 aStartPos,
|
2004-08-01 03:15:21 +04:00
|
|
|
nsPresContext* aPresContext,
|
2008-10-17 23:46:33 +04:00
|
|
|
PRBool aJumpLines,
|
|
|
|
PRBool aMultipleSelection);
|
1999-09-30 00:04:05 +04:00
|
|
|
|
|
|
|
|
2006-02-27 08:57:37 +03:00
|
|
|
// Helper for GetContentAndOffsetsFromPoint; calculation of content offsets
|
|
|
|
// in this function assumes there is no child frame that can be targeted.
|
|
|
|
virtual ContentOffsets CalcContentOffsetsFromFramePoint(nsPoint aPoint);
|
|
|
|
|
2004-09-28 22:37:50 +04:00
|
|
|
// Box layout methods
|
2007-01-08 05:57:59 +03:00
|
|
|
virtual nsSize GetPrefSize(nsBoxLayoutState& aBoxLayoutState);
|
|
|
|
virtual nsSize GetMinSize(nsBoxLayoutState& aBoxLayoutState);
|
|
|
|
virtual nsSize GetMaxSize(nsBoxLayoutState& aBoxLayoutState);
|
2007-01-31 19:02:42 +03:00
|
|
|
virtual nscoord GetFlex(nsBoxLayoutState& aBoxLayoutState);
|
|
|
|
virtual nscoord GetBoxAscent(nsBoxLayoutState& aBoxLayoutState);
|
2004-09-28 22:37:50 +04:00
|
|
|
|
2009-08-18 07:21:06 +04:00
|
|
|
// We compute and store the HTML content's overflow area. So don't
|
|
|
|
// try to compute it in the box code.
|
|
|
|
virtual PRBool ComputesOwnOverflowArea() { return PR_TRUE; }
|
|
|
|
|
1998-10-01 01:01:11 +04:00
|
|
|
//--------------------------------------------------
|
|
|
|
// Additional methods
|
|
|
|
|
2004-01-10 08:36:32 +03:00
|
|
|
/**
|
|
|
|
* Helper method to invalidate portions of a standard container frame if the
|
2008-08-20 10:45:29 +04:00
|
|
|
* desired size indicates that the size has changed (specifically border,
|
2004-01-10 08:36:32 +03:00
|
|
|
* background and outline).
|
|
|
|
* We assume that the difference between the old frame area and the new
|
|
|
|
* frame area is invalidated by some other means.
|
|
|
|
* @param aDesiredSize the new size of the frame
|
|
|
|
*/
|
2008-08-20 10:45:29 +04:00
|
|
|
void CheckInvalidateSizeChange(nsHTMLReflowMetrics& aNewDesiredSize);
|
2004-01-10 08:36:32 +03:00
|
|
|
|
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);
|
|
|
|
|
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
|
2003-06-15 04:55:00 +04:00
|
|
|
// frames by using the frame manager's placeholder map and it also
|
|
|
|
// handles block-within-inline and generated content wrappers.)
|
2004-08-01 03:15:21 +04:00
|
|
|
nsresult DoGetParentStyleContextFrame(nsPresContext* aPresContext,
|
2002-03-27 05:38:13 +03:00
|
|
|
nsIFrame** aProviderFrame,
|
|
|
|
PRBool* aIsChild);
|
|
|
|
|
2003-09-13 20:21:41 +04:00
|
|
|
// incorporate the child overflow area into the parent overflow area
|
|
|
|
// if the child does not have a overflow use the child area
|
2004-12-27 18:05:18 +03:00
|
|
|
void ConsiderChildOverflow(nsRect& aOverflowArea,
|
|
|
|
nsIFrame* aChildFrame);
|
2003-09-13 20:21:41 +04:00
|
|
|
|
2008-01-10 23:56:49 +03:00
|
|
|
virtual const void* GetStyleDataExternal(nsStyleStructID aSID) const;
|
2003-01-09 09:49:07 +03:00
|
|
|
|
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
|
2009-07-28 16:53:20 +04:00
|
|
|
static void VerifyDirtyBitSet(const nsFrameList& aFrameList);
|
1998-10-01 01:01:11 +04:00
|
|
|
|
2003-11-19 04:20:56 +03: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);
|
|
|
|
|
2009-03-05 18:01:04 +03:00
|
|
|
static void IndentBy(FILE* out, PRInt32 aIndent) {
|
|
|
|
while (--aIndent >= 0) fputs(" ", out);
|
|
|
|
}
|
|
|
|
|
1998-11-19 20:22:29 +03:00
|
|
|
void ListTag(FILE* out) const {
|
2009-08-21 01:52:48 +04:00
|
|
|
ListTag(out, this);
|
1998-12-12 22:20:10 +03:00
|
|
|
}
|
|
|
|
|
2009-08-21 01:52:48 +04:00
|
|
|
static void ListTag(FILE* out, const nsIFrame* aFrame) {
|
1998-11-19 20:22:29 +03:00
|
|
|
nsAutoString tmp;
|
2009-08-21 01:52:48 +04:00
|
|
|
aFrame->GetFrameName(tmp);
|
2006-02-03 17:18:39 +03:00
|
|
|
fputs(NS_LossyConvertUTF16toASCII(tmp).get(), out);
|
2009-08-21 01:52:48 +04:00
|
|
|
fprintf(out, "@%p", static_cast<const void*>(aFrame));
|
1998-11-19 20:22:29 +03:00
|
|
|
}
|
|
|
|
|
2004-05-04 20:27:40 +04:00
|
|
|
static void XMLQuote(nsString& aString);
|
|
|
|
|
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.
|
|
|
|
*/
|
2009-02-10 07:36:54 +03:00
|
|
|
virtual void DumpBaseRegressionData(nsPresContext* aPresContext, FILE* out, PRInt32 aIndent);
|
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
|
2004-08-01 03:15:21 +04:00
|
|
|
static void* DisplayReflowEnter(nsPresContext* aPresContext,
|
2001-11-14 16:40:03 +03:00
|
|
|
nsIFrame* aFrame,
|
2001-10-29 04:43:59 +03:00
|
|
|
const nsHTMLReflowState& aReflowState);
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 08:38:33 +03:00
|
|
|
static void* DisplayLayoutEnter(nsIFrame* aFrame);
|
|
|
|
static void* DisplayIntrinsicWidthEnter(nsIFrame* aFrame,
|
|
|
|
const char* aType);
|
|
|
|
static void* DisplayIntrinsicSizeEnter(nsIFrame* aFrame,
|
|
|
|
const char* aType);
|
2004-08-01 03:15:21 +04:00
|
|
|
static void DisplayReflowExit(nsPresContext* aPresContext,
|
2001-11-14 16:40:03 +03:00
|
|
|
nsIFrame* aFrame,
|
2001-10-29 04:43:59 +03:00
|
|
|
nsHTMLReflowMetrics& aMetrics,
|
|
|
|
PRUint32 aStatus,
|
|
|
|
void* aFrameTreeNode);
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 08:38:33 +03:00
|
|
|
static void DisplayLayoutExit(nsIFrame* aFrame,
|
|
|
|
void* aFrameTreeNode);
|
|
|
|
static void DisplayIntrinsicWidthExit(nsIFrame* aFrame,
|
|
|
|
const char* aType,
|
|
|
|
nscoord aResult,
|
|
|
|
void* aFrameTreeNode);
|
|
|
|
static void DisplayIntrinsicSizeExit(nsIFrame* aFrame,
|
|
|
|
const char* aType,
|
|
|
|
nsSize aResult,
|
|
|
|
void* aFrameTreeNode);
|
2003-03-22 18:09:17 +03:00
|
|
|
|
|
|
|
static void DisplayReflowStartup();
|
|
|
|
static void DisplayReflowShutdown();
|
1999-11-02 01:12:45 +03:00
|
|
|
#endif
|
1998-12-05 19:03:07 +03:00
|
|
|
|
2010-07-16 01:08:06 +04:00
|
|
|
static void ShutdownLayerActivityTimer();
|
|
|
|
|
2009-07-22 04:44:51 +04:00
|
|
|
/**
|
|
|
|
* Adds display item for standard CSS background if necessary.
|
|
|
|
* Does not check IsVisibleForPainting.
|
|
|
|
* @param aForceBackground draw the background even if the frame
|
|
|
|
* background style appears to have no background --- this is useful
|
|
|
|
* for frames that might receive a propagated background via
|
|
|
|
* nsCSSRendering::FindBackground
|
|
|
|
*/
|
|
|
|
nsresult DisplayBackgroundUnconditional(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsDisplayListSet& aLists,
|
|
|
|
PRBool aForceBackground = PR_FALSE);
|
2006-01-26 05:29:17 +03:00
|
|
|
/**
|
|
|
|
* Adds display items for standard CSS borders, background and outline for
|
|
|
|
* for this frame, as necessary. Checks IsVisibleForPainting and won't
|
|
|
|
* display anything if the frame is not visible.
|
|
|
|
* @param aForceBackground draw the background even if the frame
|
|
|
|
* background style appears to have no background --- this is useful
|
|
|
|
* for frames that might receive a propagated background via
|
|
|
|
* nsCSSRendering::FindBackground
|
|
|
|
*/
|
|
|
|
nsresult DisplayBorderBackgroundOutline(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsDisplayListSet& aLists,
|
|
|
|
PRBool aForceBackground = PR_FALSE);
|
|
|
|
/**
|
|
|
|
* Add a display item for the CSS outline. Does not check visibility.
|
|
|
|
*/
|
|
|
|
nsresult DisplayOutlineUnconditional(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsDisplayListSet& aLists);
|
|
|
|
/**
|
|
|
|
* Add a display item for the CSS outline, after calling
|
|
|
|
* IsVisibleForPainting to confirm we are visible.
|
|
|
|
*/
|
|
|
|
nsresult DisplayOutline(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsDisplayListSet& aLists);
|
|
|
|
|
2007-04-16 03:14:26 +04:00
|
|
|
/**
|
|
|
|
* Adjust the given parent frame to the right style context parent frame for
|
|
|
|
* the child, given the pseudo-type of the prospective child. This handles
|
|
|
|
* things like walking out of table pseudos and so forth.
|
|
|
|
*
|
|
|
|
* @param aProspectiveParent what GetParent() on the child returns.
|
|
|
|
* Must not be null.
|
|
|
|
* @param aChildPseudo the child's pseudo type, if any.
|
|
|
|
*/
|
|
|
|
static nsIFrame*
|
|
|
|
CorrectStyleParentFrame(nsIFrame* aProspectiveParent, nsIAtom* aChildPseudo);
|
|
|
|
|
1998-10-01 01:01:11 +04:00
|
|
|
protected:
|
1998-12-05 19:03:07 +03:00
|
|
|
// Protected constructor and destructor
|
2006-03-27 01:30:36 +04:00
|
|
|
nsFrame(nsStyleContext* aContext);
|
1998-12-05 19:03:07 +03:00
|
|
|
virtual ~nsFrame();
|
|
|
|
|
2006-01-26 05:29:17 +03:00
|
|
|
/**
|
|
|
|
* To be called by |BuildDisplayLists| of this class or derived classes to add
|
|
|
|
* a translucent overlay if this frame's content is selected.
|
|
|
|
* @param aContentType an nsISelectionDisplay DISPLAY_ constant identifying
|
|
|
|
* which kind of content this is for
|
2002-12-24 01:05:47 +03:00
|
|
|
*/
|
2006-01-26 05:29:17 +03:00
|
|
|
nsresult DisplaySelectionOverlay(nsDisplayListBuilder* aBuilder,
|
2010-09-09 19:21:46 +04:00
|
|
|
nsDisplayList* aList, PRUint16 aContentType = nsISelectionDisplay::DISPLAY_FRAMES);
|
2002-12-24 01:05:47 +03:00
|
|
|
|
2004-08-01 03:15:21 +04:00
|
|
|
PRInt16 DisplaySelection(nsPresContext* aPresContext, PRBool isOkToTurnOn = PR_FALSE);
|
2000-08-09 03:38:00 +04:00
|
|
|
|
1998-10-01 01:01:11 +04:00
|
|
|
// Style post processing hook
|
2008-10-26 13:11:34 +03:00
|
|
|
virtual void DidSetStyleContext(nsStyleContext* aOldStyleContext);
|
1998-10-01 01:01:11 +04:00
|
|
|
|
2004-11-29 23:28:46 +03:00
|
|
|
public:
|
1999-10-22 04:19:18 +04:00
|
|
|
//given a frame five me the first/last leaf available
|
2004-11-29 23:28:46 +03:00
|
|
|
//XXX Robert O'Callahan wants to move these elsewhere
|
2004-08-01 03:15:21 +04:00
|
|
|
static void GetLastLeaf(nsPresContext* aPresContext, nsIFrame **aFrame);
|
|
|
|
static void GetFirstLeaf(nsPresContext* aPresContext, nsIFrame **aFrame);
|
2006-08-07 14:54:56 +04:00
|
|
|
|
2008-10-09 14:22:30 +04:00
|
|
|
// Return the line number of the aFrame, and (optionally) the containing block
|
|
|
|
// frame.
|
|
|
|
// If aScrollLock is true, don't break outside scrollframes when looking for a
|
|
|
|
// containing block frame.
|
|
|
|
static PRInt32 GetLineNumber(nsIFrame *aFrame,
|
|
|
|
PRBool aLockScroll,
|
|
|
|
nsIFrame** aContainingBlock = nsnull);
|
2006-08-07 14:54:56 +04:00
|
|
|
|
2004-11-29 23:28:46 +03:00
|
|
|
protected:
|
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)
|
2007-11-22 23:47:33 +03:00
|
|
|
NS_IMETHOD GetDataForTableSelection(const nsFrameSelection *aFrameSelection,
|
2002-03-22 18:25:08 +03:00
|
|
|
nsIPresShell *aPresShell, nsMouseEvent *aMouseEvent,
|
|
|
|
nsIContent **aParentContent, PRInt32 *aContentOffset,
|
|
|
|
PRInt32 *aTarget);
|
2000-03-17 02:45:39 +03:00
|
|
|
|
2004-12-31 00:56:11 +03:00
|
|
|
// Fills aCursor with the appropriate information from ui
|
|
|
|
static void FillCursorInformationFromStyle(const nsStyleUserInterface* ui,
|
|
|
|
nsIFrame::Cursor& aCursor);
|
2004-09-28 22:37:50 +04:00
|
|
|
NS_IMETHOD DoLayout(nsBoxLayoutState& aBoxLayoutState);
|
|
|
|
|
|
|
|
#ifdef DEBUG_LAYOUT
|
|
|
|
virtual void GetBoxName(nsAutoString& aName);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
void InitBoxMetrics(PRBool aClear);
|
|
|
|
nsBoxLayoutMetrics* BoxMetrics() const;
|
|
|
|
|
2006-05-03 21:02:37 +04:00
|
|
|
// Fire DOM event. If no aContent argument use frame's mContent.
|
|
|
|
void FireDOMEvent(const nsAString& aDOMEventName, nsIContent *aContent = nsnull);
|
|
|
|
|
2004-09-28 22:37:50 +04:00
|
|
|
private:
|
|
|
|
nsresult BoxReflow(nsBoxLayoutState& aState,
|
|
|
|
nsPresContext* aPresContext,
|
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 08:38:33 +03:00
|
|
|
nsIRenderingContext* aRenderingContext,
|
2004-09-28 22:37:50 +04:00
|
|
|
nscoord aX,
|
|
|
|
nscoord aY,
|
|
|
|
nscoord aWidth,
|
|
|
|
nscoord aHeight,
|
|
|
|
PRBool aMoveFrame = PR_TRUE);
|
|
|
|
|
|
|
|
NS_IMETHODIMP RefreshSizeCache(nsBoxLayoutState& aState);
|
|
|
|
|
2008-10-30 22:17:59 +03:00
|
|
|
virtual nsILineIterator* GetLineIterator();
|
2009-08-21 01:52:48 +04:00
|
|
|
|
|
|
|
#ifdef NS_DEBUG
|
|
|
|
public:
|
|
|
|
// Formerly the nsIFrameDebug interface
|
|
|
|
|
|
|
|
NS_IMETHOD List(FILE* out, PRInt32 aIndent) const;
|
|
|
|
/**
|
|
|
|
* lists the frames beginning from the root frame
|
|
|
|
* - calls root frame's List(...)
|
|
|
|
*/
|
|
|
|
static void RootFrameList(nsPresContext* aPresContext,
|
|
|
|
FILE* out, PRInt32 aIndent);
|
|
|
|
|
|
|
|
static void DumpFrameTree(nsIFrame* aFrame);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get a printable from of the name of the frame type.
|
|
|
|
* XXX This should be eliminated and we use GetType() instead...
|
|
|
|
*/
|
|
|
|
NS_IMETHOD GetFrameName(nsAString& aResult) const;
|
|
|
|
/**
|
|
|
|
* Return the state bits that are relevant to regression tests (that
|
|
|
|
* is, those bits which indicate a real difference when they differ
|
|
|
|
*/
|
|
|
|
NS_IMETHOD_(nsFrameState) GetDebugStateBits() const;
|
|
|
|
/**
|
|
|
|
* Called to dump out regression data that describes the layout
|
|
|
|
* of the frame and its 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(nsPresContext* aPresContext,
|
|
|
|
FILE* out, PRInt32 aIndent);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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 PRBool GetVerifyStyleTreeEnable();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the verify-style-tree enable flag.
|
|
|
|
*/
|
|
|
|
static void SetVerifyStyleTreeEnable(PRBool aEnabled);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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 PRLogModuleInfo* GetLogModuleInfo();
|
|
|
|
|
|
|
|
// Show frame borders when rendering
|
|
|
|
static void ShowFrameBorders(PRBool aEnable);
|
|
|
|
static PRBool GetShowFrameBorders();
|
|
|
|
|
|
|
|
// Show frame border of event target
|
|
|
|
static void ShowEventTargetFrameBorder(PRBool aEnable);
|
|
|
|
static PRBool GetShowEventTargetFrameBorder();
|
|
|
|
|
|
|
|
static void PrintDisplayList(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsDisplayList& aList);
|
|
|
|
|
|
|
|
#endif
|
1998-10-01 01:01:11 +04:00
|
|
|
};
|
|
|
|
|
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 {
|
2004-08-01 03:15:21 +04:00
|
|
|
DR_cookie(nsPresContext* aPresContext,
|
2001-11-14 16:40:03 +03:00
|
|
|
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
|
|
|
|
2004-08-01 03:15:21 +04:00
|
|
|
nsPresContext* mPresContext;
|
2001-10-29 04:43:59 +03:00
|
|
|
nsIFrame* mFrame;
|
|
|
|
const nsHTMLReflowState& mReflowState;
|
|
|
|
nsHTMLReflowMetrics& mMetrics;
|
|
|
|
nsReflowStatus& mStatus;
|
|
|
|
void* mValue;
|
|
|
|
};
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 08:38:33 +03:00
|
|
|
|
|
|
|
struct DR_layout_cookie {
|
|
|
|
DR_layout_cookie(nsIFrame* aFrame);
|
|
|
|
~DR_layout_cookie();
|
|
|
|
|
|
|
|
nsIFrame* mFrame;
|
|
|
|
void* mValue;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct DR_intrinsic_width_cookie {
|
|
|
|
DR_intrinsic_width_cookie(nsIFrame* aFrame, const char* aType,
|
|
|
|
nscoord& aResult);
|
|
|
|
~DR_intrinsic_width_cookie();
|
|
|
|
|
|
|
|
nsIFrame* mFrame;
|
|
|
|
const char* mType;
|
|
|
|
nscoord& mResult;
|
|
|
|
void* mValue;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct DR_intrinsic_size_cookie {
|
|
|
|
DR_intrinsic_size_cookie(nsIFrame* aFrame, const char* aType,
|
|
|
|
nsSize& aResult);
|
|
|
|
~DR_intrinsic_size_cookie();
|
|
|
|
|
|
|
|
nsIFrame* mFrame;
|
|
|
|
const char* mType;
|
|
|
|
nsSize& mResult;
|
|
|
|
void* mValue;
|
|
|
|
};
|
2010-05-02 01:40:16 +04:00
|
|
|
|
|
|
|
struct DR_init_constraints_cookie {
|
|
|
|
DR_init_constraints_cookie(nsIFrame* aFrame, nsHTMLReflowState* aState,
|
|
|
|
nscoord aCBWidth, nscoord aCBHeight,
|
|
|
|
const nsMargin* aBorder,
|
|
|
|
const nsMargin* aPadding);
|
|
|
|
~DR_init_constraints_cookie();
|
|
|
|
|
|
|
|
nsIFrame* mFrame;
|
|
|
|
nsHTMLReflowState* mState;
|
|
|
|
void* mValue;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct DR_init_offsets_cookie {
|
|
|
|
DR_init_offsets_cookie(nsIFrame* aFrame, nsCSSOffsetState* aState,
|
|
|
|
nscoord aCBWidth, const nsMargin* aBorder,
|
|
|
|
const nsMargin* aPadding);
|
|
|
|
~DR_init_offsets_cookie();
|
|
|
|
|
|
|
|
nsIFrame* mFrame;
|
|
|
|
nsCSSOffsetState* mState;
|
|
|
|
void* mValue;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct DR_init_type_cookie {
|
|
|
|
DR_init_type_cookie(nsIFrame* aFrame, nsHTMLReflowState* aState);
|
|
|
|
~DR_init_type_cookie();
|
|
|
|
|
|
|
|
nsIFrame* mFrame;
|
|
|
|
nsHTMLReflowState* mState;
|
|
|
|
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();
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 08:38:33 +03:00
|
|
|
#define DISPLAY_LAYOUT(dr_frame) \
|
|
|
|
DR_layout_cookie dr_cookie(dr_frame);
|
|
|
|
#define DISPLAY_MIN_WIDTH(dr_frame, dr_result) \
|
|
|
|
DR_intrinsic_width_cookie dr_cookie(dr_frame, "Min", dr_result)
|
|
|
|
#define DISPLAY_PREF_WIDTH(dr_frame, dr_result) \
|
|
|
|
DR_intrinsic_width_cookie dr_cookie(dr_frame, "Pref", dr_result)
|
|
|
|
#define DISPLAY_PREF_SIZE(dr_frame, dr_result) \
|
|
|
|
DR_intrinsic_size_cookie dr_cookie(dr_frame, "Pref", dr_result)
|
|
|
|
#define DISPLAY_MIN_SIZE(dr_frame, dr_result) \
|
|
|
|
DR_intrinsic_size_cookie dr_cookie(dr_frame, "Min", dr_result)
|
|
|
|
#define DISPLAY_MAX_SIZE(dr_frame, dr_result) \
|
|
|
|
DR_intrinsic_size_cookie dr_cookie(dr_frame, "Max", dr_result)
|
2010-05-02 01:40:16 +04:00
|
|
|
#define DISPLAY_INIT_CONSTRAINTS(dr_frame, dr_state, dr_cbw, dr_cbh, \
|
|
|
|
dr_bdr, dr_pad) \
|
|
|
|
DR_init_constraints_cookie dr_cookie(dr_frame, dr_state, dr_cbw, dr_cbh, \
|
|
|
|
dr_bdr, dr_pad)
|
|
|
|
#define DISPLAY_INIT_OFFSETS(dr_frame, dr_state, dr_cbw, dr_bdr, dr_pad) \
|
|
|
|
DR_init_offsets_cookie dr_cookie(dr_frame, dr_state, dr_cbw, dr_bdr, dr_pad)
|
|
|
|
#define DISPLAY_INIT_TYPE(dr_frame, dr_result) \
|
|
|
|
DR_init_type_cookie dr_cookie(dr_frame, dr_result)
|
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()
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 08:38:33 +03:00
|
|
|
#define DISPLAY_LAYOUT(dr_frame) PR_BEGIN_MACRO PR_END_MACRO
|
|
|
|
#define DISPLAY_MIN_WIDTH(dr_frame, dr_result) PR_BEGIN_MACRO PR_END_MACRO
|
|
|
|
#define DISPLAY_PREF_WIDTH(dr_frame, dr_result) PR_BEGIN_MACRO PR_END_MACRO
|
|
|
|
#define DISPLAY_PREF_SIZE(dr_frame, dr_result) PR_BEGIN_MACRO PR_END_MACRO
|
|
|
|
#define DISPLAY_MIN_SIZE(dr_frame, dr_result) PR_BEGIN_MACRO PR_END_MACRO
|
|
|
|
#define DISPLAY_MAX_SIZE(dr_frame, dr_result) PR_BEGIN_MACRO PR_END_MACRO
|
2010-05-02 01:40:16 +04:00
|
|
|
#define DISPLAY_INIT_CONSTRAINTS(dr_frame, dr_state, dr_cbw, dr_cbh, \
|
|
|
|
dr_bdr, dr_pad) \
|
|
|
|
PR_BEGIN_MACRO PR_END_MACRO
|
|
|
|
#define DISPLAY_INIT_OFFSETS(dr_frame, dr_state, dr_cbw, dr_bdr, dr_pad) \
|
|
|
|
PR_BEGIN_MACRO PR_END_MACRO
|
|
|
|
#define DISPLAY_INIT_TYPE(dr_frame, dr_result) PR_BEGIN_MACRO PR_END_MACRO
|
|
|
|
|
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___ */
|