1998-11-16 20:11:12 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
*
|
1999-11-06 06:40:37 +03: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-11-16 20:11:12 +03:00
|
|
|
*
|
1999-11-06 06:40:37 +03: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-11-16 20:11:12 +03:00
|
|
|
*
|
|
|
|
* The Original Code is Mozilla Communicator client code.
|
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is Netscape Communications
|
1999-11-06 06:40:37 +03:00
|
|
|
* Corporation. Portions created by Netscape are
|
|
|
|
* Copyright (C) 1998 Netscape Communications Corporation. All
|
|
|
|
* Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s):
|
1998-11-16 20:11:12 +03:00
|
|
|
*/
|
|
|
|
#ifndef nsBlockFrame_h___
|
|
|
|
#define nsBlockFrame_h___
|
|
|
|
|
|
|
|
#include "nsHTMLContainerFrame.h"
|
1999-11-03 03:42:12 +03:00
|
|
|
#include "nsHTMLParts.h"
|
2000-05-09 09:11:12 +04:00
|
|
|
#include "nsAbsoluteContainingBlock.h"
|
1998-11-16 20:11:12 +03:00
|
|
|
|
1998-12-05 19:02:08 +03:00
|
|
|
class nsBlockReflowState;
|
|
|
|
class nsBulletFrame;
|
|
|
|
class nsLineBox;
|
1999-04-20 04:27:43 +04:00
|
|
|
class nsFirstLineFrame;
|
2001-05-11 12:04:29 +04:00
|
|
|
class nsILineIterator;
|
1998-11-18 09:13:58 +03:00
|
|
|
/**
|
|
|
|
* Child list name indices
|
|
|
|
* @see #GetAdditionalChildListName()
|
|
|
|
*/
|
2000-05-09 09:11:12 +04:00
|
|
|
#define NS_BLOCK_FRAME_FLOATER_LIST_INDEX 0
|
|
|
|
#define NS_BLOCK_FRAME_BULLET_LIST_INDEX 1
|
|
|
|
#define NS_BLOCK_FRAME_ABSOLUTE_LIST_INDEX 2
|
|
|
|
#define NS_BLOCK_FRAME_LAST_LIST_INDEX NS_BLOCK_FRAME_ABSOLUTE_LIST_INDEX
|
1998-11-18 09:13:58 +03:00
|
|
|
|
1999-02-09 20:31:33 +03:00
|
|
|
#define nsBlockFrameSuper nsHTMLContainerFrame
|
1998-12-05 19:02:08 +03:00
|
|
|
|
1999-03-27 04:21:21 +03:00
|
|
|
#define NS_BLOCK_FRAME_CID \
|
|
|
|
{ 0xa6cf90df, 0x15b3, 0x11d2,{0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}}
|
|
|
|
|
|
|
|
extern const nsIID kBlockFrameCID;
|
|
|
|
|
2000-05-09 09:11:12 +04:00
|
|
|
/*
|
|
|
|
* Base class for block and inline frames.
|
|
|
|
* The block frame has an additional named child list:
|
|
|
|
* - "Absolute-list" which contains the absolutely positioned frames
|
|
|
|
*
|
|
|
|
* @see nsLayoutAtoms::absoluteList
|
|
|
|
*/
|
1999-02-09 20:31:33 +03:00
|
|
|
class nsBlockFrame : public nsBlockFrameSuper
|
1998-11-16 20:11:12 +03:00
|
|
|
{
|
|
|
|
public:
|
1999-12-05 02:49:50 +03:00
|
|
|
friend nsresult NS_NewBlockFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame, PRUint32 aFlags);
|
1999-02-09 20:31:33 +03:00
|
|
|
|
1998-11-16 20:11:12 +03:00
|
|
|
// nsISupports
|
|
|
|
NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr);
|
|
|
|
|
|
|
|
// nsIFrame
|
1999-11-24 09:03:41 +03:00
|
|
|
NS_IMETHOD Init(nsIPresContext* aPresContext,
|
1999-02-25 08:31:15 +03:00
|
|
|
nsIContent* aContent,
|
|
|
|
nsIFrame* aParent,
|
|
|
|
nsIStyleContext* aContext,
|
|
|
|
nsIFrame* aPrevInFlow);
|
1999-11-24 09:03:41 +03:00
|
|
|
NS_IMETHOD SetInitialChildList(nsIPresContext* aPresContext,
|
1998-11-16 20:11:12 +03:00
|
|
|
nsIAtom* aListName,
|
|
|
|
nsIFrame* aChildList);
|
1999-11-24 09:03:41 +03:00
|
|
|
NS_IMETHOD AppendFrames(nsIPresContext* aPresContext,
|
1999-02-02 20:31:09 +03:00
|
|
|
nsIPresShell& aPresShell,
|
|
|
|
nsIAtom* aListName,
|
|
|
|
nsIFrame* aFrameList);
|
1999-11-24 09:03:41 +03:00
|
|
|
NS_IMETHOD InsertFrames(nsIPresContext* aPresContext,
|
1999-02-02 20:31:09 +03:00
|
|
|
nsIPresShell& aPresShell,
|
|
|
|
nsIAtom* aListName,
|
|
|
|
nsIFrame* aPrevFrame,
|
|
|
|
nsIFrame* aFrameList);
|
1999-11-24 09:03:41 +03:00
|
|
|
NS_IMETHOD RemoveFrame(nsIPresContext* aPresContext,
|
1999-02-02 20:31:09 +03:00
|
|
|
nsIPresShell& aPresShell,
|
|
|
|
nsIAtom* aListName,
|
|
|
|
nsIFrame* aOldFrame);
|
2000-01-22 04:16:50 +03:00
|
|
|
NS_IMETHOD FirstChild(nsIPresContext* aPresContext,
|
|
|
|
nsIAtom* aListName,
|
|
|
|
nsIFrame** aFirstChild) const;
|
1999-02-09 20:31:33 +03:00
|
|
|
NS_IMETHOD GetAdditionalChildListName(PRInt32 aIndex,
|
1999-02-10 05:25:01 +03:00
|
|
|
nsIAtom** aListName) const;
|
1999-11-24 09:03:41 +03:00
|
|
|
NS_IMETHOD Destroy(nsIPresContext* aPresContext);
|
1998-11-16 20:11:12 +03:00
|
|
|
NS_IMETHOD IsSplittable(nsSplittableType& aIsSplittable) const;
|
1999-02-09 20:31:33 +03:00
|
|
|
NS_IMETHOD IsPercentageBase(PRBool& aBase) const;
|
1999-11-24 09:03:41 +03:00
|
|
|
NS_IMETHOD Paint(nsIPresContext* aPresContext,
|
1998-11-16 20:11:12 +03:00
|
|
|
nsIRenderingContext& aRenderingContext,
|
1998-12-18 18:54:23 +03:00
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
nsFramePaintLayer aWhichLayer);
|
1999-02-12 20:45:58 +03:00
|
|
|
NS_IMETHOD GetFrameType(nsIAtom** aType) const;
|
1999-09-01 05:02:16 +04:00
|
|
|
#ifdef DEBUG
|
1999-11-02 01:12:45 +03:00
|
|
|
NS_IMETHOD List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) const;
|
|
|
|
NS_IMETHOD GetFrameName(nsString& aResult) const;
|
1999-08-31 07:09:40 +04:00
|
|
|
NS_IMETHOD SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const;
|
1998-11-16 20:11:12 +03:00
|
|
|
NS_IMETHOD VerifyTree() const;
|
1999-11-02 01:12:45 +03:00
|
|
|
#endif
|
2000-03-22 05:43:08 +03:00
|
|
|
NS_IMETHOD GetFrameForPoint(nsIPresContext* aPresContext, const nsPoint& aPoint, nsFramePaintLayer aWhichLayer, nsIFrame** aFrame);
|
1999-11-24 09:03:41 +03:00
|
|
|
NS_IMETHOD HandleEvent(nsIPresContext* aPresContext,
|
1999-04-14 01:29:08 +04:00
|
|
|
nsGUIEvent* aEvent,
|
1999-11-24 09:03:41 +03:00
|
|
|
nsEventStatus* aEventStatus);
|
2000-01-12 11:28:24 +03:00
|
|
|
NS_IMETHOD ReflowDirtyChild(nsIPresShell* aPresShell, nsIFrame* aChild);
|
1998-11-16 20:11:12 +03:00
|
|
|
|
2001-03-08 05:46:44 +03:00
|
|
|
NS_IMETHOD IsVisibleForPainting(nsIPresContext * aPresContext,
|
|
|
|
nsIRenderingContext& aRenderingContext,
|
|
|
|
PRBool aCheckVis,
|
|
|
|
PRBool* aIsVisible);
|
|
|
|
|
1998-11-16 20:11:12 +03:00
|
|
|
// nsIHTMLReflow
|
1999-11-24 09:03:41 +03:00
|
|
|
NS_IMETHOD Reflow(nsIPresContext* aPresContext,
|
1998-11-16 20:11:12 +03:00
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
|
|
|
nsReflowStatus& aStatus);
|
|
|
|
|
1999-02-23 22:18:12 +03:00
|
|
|
NS_IMETHOD AttributeChanged(nsIPresContext* aPresContext,
|
|
|
|
nsIContent* aChild,
|
1999-10-16 03:16:45 +04:00
|
|
|
PRInt32 aNameSpaceID,
|
1999-02-23 22:18:12 +03:00
|
|
|
nsIAtom* aAttribute,
|
|
|
|
PRInt32 aHint);
|
|
|
|
|
1998-11-16 20:11:12 +03:00
|
|
|
#ifdef DO_SELECTION
|
1999-11-24 09:03:41 +03:00
|
|
|
NS_IMETHOD HandleEvent(nsIPresContext* aPresContext,
|
1998-11-16 20:11:12 +03:00
|
|
|
nsGUIEvent* aEvent,
|
1999-11-24 09:03:41 +03:00
|
|
|
nsEventStatus* aEventStatus);
|
1998-11-16 20:11:12 +03:00
|
|
|
|
1999-11-24 09:03:41 +03:00
|
|
|
NS_IMETHOD HandleDrag(nsIPresContext* aPresContext,
|
1998-11-16 20:11:12 +03:00
|
|
|
nsGUIEvent* aEvent,
|
1999-11-24 09:03:41 +03:00
|
|
|
nsEventStatus* aEventStatus);
|
1998-11-16 20:11:12 +03:00
|
|
|
|
1999-02-09 20:31:33 +03:00
|
|
|
nsIFrame * FindHitFrame(nsBlockFrame * aBlockFrame,
|
1998-11-16 20:11:12 +03:00
|
|
|
const nscoord aX, const nscoord aY,
|
|
|
|
const nsPoint & aPoint);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
1999-11-24 09:03:41 +03:00
|
|
|
virtual void DeleteChildsNextInFlow(nsIPresContext* aPresContext,
|
1999-01-16 01:53:39 +03:00
|
|
|
nsIFrame* aNextInFlow);
|
1998-11-16 20:11:12 +03:00
|
|
|
|
2000-03-23 02:19:10 +03:00
|
|
|
/** return the topmost block child based on y-index.
|
|
|
|
* almost always the first or second line, if there is one.
|
|
|
|
* accounts for lines that hold only compressed white space, etc.
|
|
|
|
*/
|
1999-03-27 04:21:21 +03:00
|
|
|
nsIFrame* GetTopBlockChild();
|
|
|
|
|
2000-03-23 02:19:10 +03:00
|
|
|
/** Place the floaters in the spacemanager for all lines in this block.
|
|
|
|
* recursively adds floaters in child blocks of this frame.
|
|
|
|
*/
|
1999-09-15 04:28:10 +04:00
|
|
|
nsresult UpdateSpaceManager(nsIPresContext* aPresContext,
|
|
|
|
nsISpaceManager* aSpaceManager);
|
|
|
|
|
2000-04-14 08:05:58 +04:00
|
|
|
nsLineBox* FindLineFor(nsIFrame* aFrame, nsLineBox** aPrevLineResult,
|
|
|
|
PRBool* aIsFloaterResult);
|
|
|
|
|
2000-08-24 08:26:43 +04:00
|
|
|
static nsresult GetCurrentLine(nsBlockReflowState *aState, nsLineBox **aOutCurrentLine);
|
|
|
|
|
2000-06-05 12:24:18 +04:00
|
|
|
// return our ascent (i.e., ascent of our first line)
|
|
|
|
// to support 'vertical-align: baseline' in table-cells
|
|
|
|
nscoord GetAscent() const;
|
|
|
|
|
2001-05-01 08:22:57 +04:00
|
|
|
static void CombineRects(const nsRect& r1, nsRect& r2);
|
|
|
|
|
1998-12-05 19:02:08 +03:00
|
|
|
protected:
|
1999-02-09 20:31:33 +03:00
|
|
|
nsBlockFrame();
|
|
|
|
virtual ~nsBlockFrame();
|
1998-11-16 20:11:12 +03:00
|
|
|
|
1999-04-28 02:11:05 +04:00
|
|
|
nsIStyleContext* GetFirstLetterStyle(nsIPresContext* aPresContext);
|
|
|
|
|
2001-05-11 12:04:29 +04:00
|
|
|
/**
|
|
|
|
* GetClosestLine will return the line that VERTICALLY owns the point closest to aPoint.y
|
|
|
|
* aOrigin is the offset for this block frame to its frame.
|
|
|
|
* aPoint is the point to search for.
|
|
|
|
* aClosestLine is the result.
|
|
|
|
*/
|
|
|
|
nsresult GetClosestLine(nsILineIterator *aLI,
|
|
|
|
const nsPoint &aOrigin,
|
|
|
|
const nsPoint &aPoint,
|
|
|
|
PRInt32 &aClosestLine);
|
|
|
|
|
1998-11-16 20:11:12 +03:00
|
|
|
void SetFlags(PRUint32 aFlags) {
|
1999-11-03 03:42:12 +03:00
|
|
|
mState &= ~NS_BLOCK_FLAGS_MASK;
|
|
|
|
mState |= aFlags;
|
1998-11-16 20:11:12 +03:00
|
|
|
}
|
|
|
|
|
1999-02-19 01:22:55 +03:00
|
|
|
PRBool HaveOutsideBullet() const {
|
2001-03-14 09:45:41 +03:00
|
|
|
#ifdef DEBUG
|
|
|
|
if(mState & NS_BLOCK_FRAME_HAS_OUTSIDE_BULLET) {
|
|
|
|
NS_ASSERTION(mBullet,"NS_BLOCK_FRAME_HAS_OUTSIDE_BULLET flag set and no mBullet");
|
|
|
|
}
|
|
|
|
#endif
|
1999-02-19 01:22:55 +03:00
|
|
|
return 0 != (mState & NS_BLOCK_FRAME_HAS_OUTSIDE_BULLET);
|
|
|
|
}
|
|
|
|
|
2000-06-12 02:14:33 +04:00
|
|
|
/** return PR_TRUE if the incremental reflow described by aState is 100% contained
|
|
|
|
* within the bounds of a ancestor frame, relative to this frame.
|
|
|
|
*/
|
|
|
|
PRBool IsIncrementalDamageConstrained(const nsBlockReflowState& aState) const;
|
|
|
|
|
2000-03-23 02:19:10 +03:00
|
|
|
/** move the frames contained by aLine by aDY
|
|
|
|
* if aLine is a block, it's child floaters are added to the state manager
|
|
|
|
*/
|
1999-09-16 23:56:36 +04:00
|
|
|
void SlideLine(nsBlockReflowState& aState,
|
1999-04-03 22:59:01 +04:00
|
|
|
nsLineBox* aLine, nscoord aDY);
|
1998-11-16 20:11:12 +03:00
|
|
|
|
2000-03-23 02:19:10 +03:00
|
|
|
/** grab overflow lines from this block's prevInFlow, and make them
|
|
|
|
* part of this block's mLines list.
|
|
|
|
* @return PR_TRUE if any lines were drained.
|
|
|
|
*/
|
1999-10-26 08:44:41 +04:00
|
|
|
PRBool DrainOverflowLines(nsIPresContext* aPresContext);
|
1998-11-16 20:11:12 +03:00
|
|
|
|
1998-12-05 19:02:08 +03:00
|
|
|
virtual PRIntn GetSkipSides() const;
|
1998-11-16 20:11:12 +03:00
|
|
|
|
1999-03-05 07:21:32 +03:00
|
|
|
virtual void ComputeFinalSize(const nsHTMLReflowState& aReflowState,
|
|
|
|
nsBlockReflowState& aState,
|
1998-12-05 19:02:08 +03:00
|
|
|
nsHTMLReflowMetrics& aMetrics);
|
1998-11-16 20:11:12 +03:00
|
|
|
|
2000-03-23 02:19:10 +03:00
|
|
|
/** add the frames in aFrameList to this block after aPrevSibling
|
|
|
|
* this block thinks in terms of lines, but the frame construction code
|
|
|
|
* knows nothing about lines at all. So we need to find the line that
|
|
|
|
* contains aPrevSibling and add aFrameList after aPrevSibling on that line.
|
|
|
|
* new lines are created as necessary to handle block data in aFrameList.
|
|
|
|
*/
|
1999-04-20 04:27:43 +04:00
|
|
|
nsresult AddFrames(nsIPresContext* aPresContext,
|
|
|
|
nsIFrame* aFrameList,
|
|
|
|
nsIFrame* aPrevSibling);
|
|
|
|
|
2000-03-23 02:19:10 +03:00
|
|
|
/** move the frame list rooted at aFrame into this as a child
|
|
|
|
* assumes prev/next sibling pointers will be or have been set elsewhere
|
|
|
|
* changes aFrame's parent to be this, and reparents aFrame's view and stylecontext.
|
|
|
|
*/
|
1999-08-31 07:09:40 +04:00
|
|
|
void FixParentAndView(nsIPresContext* aPresContext, nsIFrame* aFrame);
|
|
|
|
|
2000-03-23 02:19:10 +03:00
|
|
|
/** does all the real work for removing aDeletedFrame from this
|
|
|
|
* finds the line containing aFrame.
|
|
|
|
* handled continued frames
|
|
|
|
* marks lines dirty as needed
|
|
|
|
*/
|
1999-08-31 07:09:40 +04:00
|
|
|
nsresult DoRemoveFrame(nsIPresContext* aPresContext,
|
|
|
|
nsIFrame* aDeletedFrame);
|
|
|
|
|
1999-04-20 04:27:43 +04:00
|
|
|
|
2000-03-23 02:19:10 +03:00
|
|
|
/** set up the conditions necessary for an initial reflow */
|
1999-02-09 20:31:33 +03:00
|
|
|
nsresult PrepareInitialReflow(nsBlockReflowState& aState);
|
1998-11-16 20:11:12 +03:00
|
|
|
|
2000-03-23 02:19:10 +03:00
|
|
|
/** set up the conditions necessary for an styleChanged reflow */
|
1999-02-09 20:31:33 +03:00
|
|
|
nsresult PrepareStyleChangedReflow(nsBlockReflowState& aState);
|
1998-11-16 20:11:12 +03:00
|
|
|
|
2000-03-23 02:19:10 +03:00
|
|
|
/** set up the conditions necessary for an incremental reflow.
|
|
|
|
* the primary task is to mark the minimumly sufficient lines dirty.
|
|
|
|
*/
|
1999-02-09 20:31:33 +03:00
|
|
|
nsresult PrepareChildIncrementalReflow(nsBlockReflowState& aState);
|
1998-11-16 20:11:12 +03:00
|
|
|
|
2000-03-23 02:19:10 +03:00
|
|
|
/** set up the conditions necessary for an resize reflow
|
|
|
|
* the primary task is to mark the minimumly sufficient lines dirty.
|
|
|
|
*/
|
1999-02-09 20:31:33 +03:00
|
|
|
nsresult PrepareResizeReflow(nsBlockReflowState& aState);
|
1998-11-16 20:11:12 +03:00
|
|
|
|
2000-03-23 02:19:10 +03:00
|
|
|
/** reflow all lines that have been marked dirty */
|
1999-02-09 20:31:33 +03:00
|
|
|
nsresult ReflowDirtyLines(nsBlockReflowState& aState);
|
1998-11-16 20:11:12 +03:00
|
|
|
|
2000-03-23 02:19:10 +03:00
|
|
|
/** set aState to what it would be if we had done a full reflow to this point. */
|
1999-04-03 22:59:01 +04:00
|
|
|
void RecoverStateFrom(nsBlockReflowState& aState,
|
|
|
|
nsLineBox* aLine,
|
1999-07-14 19:16:56 +04:00
|
|
|
nsRect* aDamageRect);
|
1998-11-16 20:11:12 +03:00
|
|
|
|
1998-12-05 19:02:08 +03:00
|
|
|
//----------------------------------------
|
|
|
|
// Methods for line reflow
|
2000-03-23 02:19:10 +03:00
|
|
|
/**
|
|
|
|
* Reflow a line.
|
|
|
|
* @param aState the current reflow state
|
|
|
|
* @param aLine the line to reflow. can contain a single block frame
|
|
|
|
* or contain 1 or more inline frames.
|
|
|
|
* @param aKeepReflowGoing [OUT] indicates whether the caller should continue to reflow more lines
|
|
|
|
* @param aDamageDirtyArea if PR_TRUE, do extra work to mark the changed areas as damaged for painting
|
|
|
|
* this indicates that frames may have changed size, for example
|
|
|
|
*/
|
1999-02-09 20:31:33 +03:00
|
|
|
nsresult ReflowLine(nsBlockReflowState& aState,
|
|
|
|
nsLineBox* aLine,
|
1999-07-14 19:16:56 +04:00
|
|
|
PRBool* aKeepReflowGoing,
|
1999-08-01 20:50:52 +04:00
|
|
|
PRBool aDamageDirtyArea = PR_FALSE);
|
1998-11-16 20:11:12 +03:00
|
|
|
|
1998-12-05 19:02:08 +03:00
|
|
|
nsresult PlaceLine(nsBlockReflowState& aState,
|
1999-08-28 01:45:37 +04:00
|
|
|
nsLineLayout& aLineLayout,
|
1998-12-05 19:02:08 +03:00
|
|
|
nsLineBox* aLine,
|
2000-01-08 06:58:27 +03:00
|
|
|
PRBool* aKeepReflowGoing,
|
|
|
|
PRBool aUpdateMaximumWidth);
|
1998-11-16 20:11:12 +03:00
|
|
|
|
2000-01-12 11:28:24 +03:00
|
|
|
nsresult MarkLineDirty (nsLineBox* aLine,
|
|
|
|
nsLineBox* aPrevLine);
|
|
|
|
|
1998-12-05 19:02:08 +03:00
|
|
|
// XXX blech
|
|
|
|
void PostPlaceLine(nsBlockReflowState& aState,
|
|
|
|
nsLineBox* aLine,
|
|
|
|
const nsSize& aMaxElementSize);
|
1998-11-16 20:11:12 +03:00
|
|
|
|
1998-12-17 21:52:10 +03:00
|
|
|
void ComputeLineMaxElementSize(nsBlockReflowState& aState,
|
|
|
|
nsLineBox* aLine,
|
|
|
|
nsSize* aMaxElementSize);
|
|
|
|
|
1998-12-05 19:02:08 +03:00
|
|
|
// XXX where to go
|
|
|
|
PRBool ShouldJustifyLine(nsBlockReflowState& aState, nsLineBox* aLine);
|
1998-11-16 20:11:12 +03:00
|
|
|
|
1998-12-08 01:28:23 +03:00
|
|
|
void DeleteLine(nsBlockReflowState& aState, nsLineBox* aLine);
|
|
|
|
|
1998-12-05 19:02:08 +03:00
|
|
|
//----------------------------------------
|
|
|
|
// Methods for individual frame reflow
|
|
|
|
|
1999-03-27 04:21:21 +03:00
|
|
|
PRBool ShouldApplyTopMargin(nsBlockReflowState& aState,
|
|
|
|
nsLineBox* aLine);
|
1998-12-05 19:02:08 +03:00
|
|
|
|
|
|
|
nsresult ReflowBlockFrame(nsBlockReflowState& aState,
|
|
|
|
nsLineBox* aLine,
|
1999-02-12 20:45:58 +03:00
|
|
|
PRBool* aKeepGoing);
|
1998-12-05 19:02:08 +03:00
|
|
|
|
1999-03-21 04:15:12 +03:00
|
|
|
nsresult ReflowInlineFrames(nsBlockReflowState& aState,
|
|
|
|
nsLineBox* aLine,
|
2000-01-08 06:58:27 +03:00
|
|
|
PRBool* aKeepLineGoing,
|
2000-04-19 07:12:13 +04:00
|
|
|
PRBool aDamageDirtyArea,
|
2000-01-08 06:58:27 +03:00
|
|
|
PRBool aUpdateMaximumWidth = PR_FALSE);
|
1999-03-21 04:15:12 +03:00
|
|
|
|
1999-08-28 01:45:37 +04:00
|
|
|
nsresult DoReflowInlineFrames(nsBlockReflowState& aState,
|
|
|
|
nsLineLayout& aLineLayout,
|
|
|
|
nsLineBox* aLine,
|
|
|
|
PRBool* aKeepReflowGoing,
|
2000-01-08 06:58:27 +03:00
|
|
|
PRUint8* aLineReflowStatus,
|
2000-04-19 07:12:13 +04:00
|
|
|
PRBool aUpdateMaximumWidth,
|
|
|
|
PRBool aDamageDirtyArea);
|
1999-08-28 01:45:37 +04:00
|
|
|
|
|
|
|
nsresult DoReflowInlineFramesAuto(nsBlockReflowState& aState,
|
|
|
|
nsLineBox* aLine,
|
|
|
|
PRBool* aKeepReflowGoing,
|
2000-01-08 06:58:27 +03:00
|
|
|
PRUint8* aLineReflowStatus,
|
2000-04-19 07:12:13 +04:00
|
|
|
PRBool aUpdateMaximumWidth,
|
|
|
|
PRBool aDamageDirtyArea);
|
1999-08-28 01:45:37 +04:00
|
|
|
|
|
|
|
nsresult DoReflowInlineFramesMalloc(nsBlockReflowState& aState,
|
|
|
|
nsLineBox* aLine,
|
|
|
|
PRBool* aKeepReflowGoing,
|
2000-01-08 06:58:27 +03:00
|
|
|
PRUint8* aLineReflowStatus,
|
2000-04-19 07:12:13 +04:00
|
|
|
PRBool aUpdateMaximumWidth,
|
|
|
|
PRBool aDamageDirtyArea);
|
1999-08-28 01:45:37 +04:00
|
|
|
|
1998-12-05 19:02:08 +03:00
|
|
|
nsresult ReflowInlineFrame(nsBlockReflowState& aState,
|
1999-08-28 01:45:37 +04:00
|
|
|
nsLineLayout& aLineLayout,
|
1998-12-05 19:02:08 +03:00
|
|
|
nsLineBox* aLine,
|
|
|
|
nsIFrame* aFrame,
|
1999-03-21 04:15:12 +03:00
|
|
|
PRUint8* aLineReflowStatus);
|
1998-11-16 20:11:12 +03:00
|
|
|
|
1999-04-01 05:37:36 +04:00
|
|
|
nsresult ReflowFloater(nsBlockReflowState& aState,
|
|
|
|
nsPlaceholderFrame* aPlaceholder,
|
|
|
|
nsRect& aCombinedRect,
|
1999-07-14 21:26:20 +04:00
|
|
|
nsMargin& aMarginResult,
|
|
|
|
nsMargin& aComputedOffsetsResult);
|
1998-11-16 20:11:12 +03:00
|
|
|
|
1998-12-05 19:02:08 +03:00
|
|
|
//----------------------------------------
|
|
|
|
// Methods for pushing/pulling lines/frames
|
|
|
|
|
|
|
|
virtual nsresult CreateContinuationFor(nsBlockReflowState& aState,
|
|
|
|
nsLineBox* aLine,
|
|
|
|
nsIFrame* aFrame,
|
|
|
|
PRBool& aMadeNewFrame);
|
|
|
|
|
|
|
|
nsresult SplitLine(nsBlockReflowState& aState,
|
1999-08-28 01:45:37 +04:00
|
|
|
nsLineLayout& aLineLayout,
|
1998-12-05 19:02:08 +03:00
|
|
|
nsLineBox* aLine,
|
|
|
|
nsIFrame* aFrame);
|
|
|
|
|
1999-02-09 20:31:33 +03:00
|
|
|
nsBlockFrame* FindFollowingBlockFrame(nsIFrame* aFrame);
|
1998-12-05 19:02:08 +03:00
|
|
|
|
|
|
|
nsresult PullFrame(nsBlockReflowState& aState,
|
|
|
|
nsLineBox* aLine,
|
2000-04-19 07:12:13 +04:00
|
|
|
PRBool aDamageDeletedLine,
|
1998-12-05 19:02:08 +03:00
|
|
|
nsIFrame*& aFrameResult);
|
|
|
|
|
|
|
|
nsresult PullFrame(nsBlockReflowState& aState,
|
|
|
|
nsLineBox* aToLine,
|
|
|
|
nsLineBox** aFromList,
|
|
|
|
PRBool aUpdateGeometricParent,
|
2000-04-19 07:12:13 +04:00
|
|
|
PRBool aDamageDeletedLines,
|
1998-12-05 19:02:08 +03:00
|
|
|
nsIFrame*& aFrameResult,
|
|
|
|
PRBool& aStopPulling);
|
|
|
|
|
|
|
|
void PushLines(nsBlockReflowState& aState);
|
|
|
|
|
|
|
|
//----------------------------------------
|
|
|
|
//XXX
|
1999-11-24 09:03:41 +03:00
|
|
|
virtual void PaintChildren(nsIPresContext* aPresContext,
|
1998-12-18 18:54:23 +03:00
|
|
|
nsIRenderingContext& aRenderingContext,
|
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
nsFramePaintLayer aWhichLayer);
|
|
|
|
|
1999-11-24 09:03:41 +03:00
|
|
|
void PaintFloaters(nsIPresContext* aPresContext,
|
1998-11-16 20:11:12 +03:00
|
|
|
nsIRenderingContext& aRenderingContext,
|
1999-03-26 03:39:04 +03:00
|
|
|
const nsRect& aDirtyRect);
|
1998-11-16 20:11:12 +03:00
|
|
|
|
2001-05-04 00:11:50 +04:00
|
|
|
void PropagateReflowDamage(nsBlockReflowState& aState,
|
1998-12-05 19:02:08 +03:00
|
|
|
nsLineBox* aLine,
|
1999-09-15 04:28:10 +04:00
|
|
|
const nsRect& aOldCombinedArea,
|
1998-12-05 19:02:08 +03:00
|
|
|
nscoord aDeltaY);
|
|
|
|
|
|
|
|
void BuildFloaterList();
|
|
|
|
|
1999-07-14 21:26:20 +04:00
|
|
|
//----------------------------------------
|
|
|
|
// List handling kludge
|
|
|
|
|
2000-01-22 04:16:50 +03:00
|
|
|
void RenumberLists(nsIPresContext* aPresContext);
|
1998-12-05 19:02:08 +03:00
|
|
|
|
2000-01-22 04:16:50 +03:00
|
|
|
PRBool RenumberListsIn(nsIPresContext* aPresContext,
|
|
|
|
nsIFrame* aContainerFrame,
|
2000-07-28 13:02:34 +04:00
|
|
|
PRInt32* aOrdinal,
|
|
|
|
PRInt32 aDepth);
|
1999-09-18 03:16:43 +04:00
|
|
|
|
2000-01-22 04:16:50 +03:00
|
|
|
PRBool RenumberListsInBlock(nsIPresContext* aPresContext,
|
|
|
|
nsBlockFrame* aContainerFrame,
|
2000-07-28 13:02:34 +04:00
|
|
|
PRInt32* aOrdinal,
|
|
|
|
PRInt32 aDepth);
|
1999-09-18 03:16:43 +04:00
|
|
|
|
2000-07-28 13:02:34 +04:00
|
|
|
PRBool RenumberListsFor(nsIPresContext* aPresContext, nsIFrame* aKid, PRInt32* aOrdinal, PRInt32 aDepth);
|
1999-07-14 21:26:20 +04:00
|
|
|
|
|
|
|
PRBool FrameStartsCounterScope(nsIFrame* aFrame);
|
|
|
|
|
1999-10-20 03:04:19 +04:00
|
|
|
nsresult UpdateBulletPosition(nsBlockReflowState& aState);
|
1999-03-05 07:21:32 +03:00
|
|
|
|
1999-02-19 01:22:55 +03:00
|
|
|
void ReflowBullet(nsBlockReflowState& aState,
|
|
|
|
nsHTMLReflowMetrics& aMetrics);
|
1998-12-05 19:02:08 +03:00
|
|
|
|
1999-07-14 21:26:20 +04:00
|
|
|
//----------------------------------------
|
|
|
|
|
1999-11-03 02:42:52 +03:00
|
|
|
nsLineBox* GetOverflowLines(nsIPresContext* aPresContext,
|
2000-01-22 04:16:50 +03:00
|
|
|
PRBool aRemoveProperty) const;
|
1999-11-03 02:42:52 +03:00
|
|
|
|
|
|
|
nsresult SetOverflowLines(nsIPresContext* aPresContext,
|
|
|
|
nsLineBox* aOverflowFrames);
|
|
|
|
|
1999-04-20 04:27:43 +04:00
|
|
|
nsIFrame* LastChild();
|
1998-12-05 19:02:08 +03:00
|
|
|
|
1999-02-09 20:31:33 +03:00
|
|
|
#ifdef NS_DEBUG
|
1999-11-03 02:42:52 +03:00
|
|
|
PRBool IsChild(nsIPresContext* aPresContext, nsIFrame* aFrame);
|
1999-04-20 04:27:43 +04:00
|
|
|
void VerifyLines(PRBool aFinalCheckOK);
|
1999-11-03 02:42:52 +03:00
|
|
|
void VerifyOverflowSituation(nsIPresContext* aPresContext);
|
1999-03-23 01:41:09 +03:00
|
|
|
PRInt32 GetDepth() const;
|
1999-02-09 20:31:33 +03:00
|
|
|
#endif
|
|
|
|
|
2000-06-05 12:24:18 +04:00
|
|
|
// Ascent of our first line to support 'vertical-align: baseline' in table-cells
|
|
|
|
nscoord mAscent;
|
|
|
|
|
1999-02-09 20:31:33 +03:00
|
|
|
nsLineBox* mLines;
|
|
|
|
|
1998-11-16 20:11:12 +03:00
|
|
|
// List of all floaters in this block
|
1999-01-16 01:53:39 +03:00
|
|
|
nsFrameList mFloaters;
|
1998-11-16 20:11:12 +03:00
|
|
|
|
1998-12-05 19:02:08 +03:00
|
|
|
// XXX_fix_me: subclass one more time!
|
|
|
|
// For list-item frames, this is the bullet frame.
|
|
|
|
nsBulletFrame* mBullet;
|
1998-11-16 20:11:12 +03:00
|
|
|
|
1999-02-09 20:31:33 +03:00
|
|
|
friend class nsBlockReflowState;
|
2000-05-09 09:11:12 +04:00
|
|
|
|
|
|
|
private:
|
|
|
|
nsAbsoluteContainingBlock mAbsoluteContainer;
|
|
|
|
|
2001-05-01 08:22:57 +04:00
|
|
|
|
|
|
|
#ifdef DEBUG
|
|
|
|
public:
|
|
|
|
static PRBool gLamePaintMetrics;
|
|
|
|
static PRBool gLameReflowMetrics;
|
|
|
|
static PRBool gNoisy;
|
|
|
|
static PRBool gNoisyDamageRepair;
|
|
|
|
static PRBool gNoisyMaxElementSize;
|
|
|
|
static PRBool gNoisyReflow;
|
|
|
|
static PRBool gReallyNoisyReflow;
|
|
|
|
static PRBool gNoisySpaceManager;
|
|
|
|
static PRBool gVerifyLines;
|
|
|
|
static PRBool gDisableResizeOpt;
|
|
|
|
|
|
|
|
static PRInt32 gNoiseIndent;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
static void InitDebugFlags();
|
|
|
|
#endif
|
1998-11-16 20:11:12 +03:00
|
|
|
};
|
|
|
|
|
2001-05-01 08:22:57 +04:00
|
|
|
// Some #ifdef'd bug fixes
|
|
|
|
#define FIX_BUG_38157
|
|
|
|
#define FIX_BUG_37657
|
|
|
|
|
1998-11-16 20:11:12 +03:00
|
|
|
#endif /* nsBlockFrame_h___ */
|
|
|
|
|