1998-04-13 20:24:54 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
*
|
|
|
|
* The contents of this file are subject to the Netscape Public License
|
|
|
|
* Version 1.0 (the "NPL"); you may not use this file except in
|
|
|
|
* compliance with the NPL. You may obtain a copy of the NPL at
|
|
|
|
* http://www.mozilla.org/NPL/
|
|
|
|
*
|
|
|
|
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* NPL.
|
|
|
|
*
|
|
|
|
* The Initial Developer of this code under the NPL is Netscape
|
|
|
|
* Communications Corporation. Portions created by Netscape are
|
|
|
|
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
|
|
|
* Reserved.
|
|
|
|
*/
|
|
|
|
#ifndef nsContainerFrame_h___
|
|
|
|
#define nsContainerFrame_h___
|
|
|
|
|
|
|
|
#include "nsSplittableFrame.h"
|
1999-01-15 22:53:39 +00:00
|
|
|
#include "nsFrameList.h"
|
1998-04-13 20:24:54 +00:00
|
|
|
|
|
|
|
/**
|
1998-09-24 04:57:30 +00:00
|
|
|
* Implementation of a container frame.
|
1998-04-13 20:24:54 +00:00
|
|
|
*/
|
|
|
|
class nsContainerFrame : public nsSplittableFrame
|
|
|
|
{
|
|
|
|
public:
|
1999-01-15 22:53:39 +00:00
|
|
|
// nsIFrame overrides
|
1998-11-10 06:05:32 +00:00
|
|
|
NS_IMETHOD SetInitialChildList(nsIPresContext& aPresContext,
|
|
|
|
nsIAtom* aListName,
|
|
|
|
nsIFrame* aChildList);
|
1999-02-10 02:25:01 +00:00
|
|
|
NS_IMETHOD FirstChild(nsIAtom* aListName, nsIFrame** aFirstChild) const;
|
1998-11-10 06:05:32 +00:00
|
|
|
NS_IMETHOD DeleteFrame(nsIPresContext& aPresContext);
|
1998-04-17 01:41:24 +00:00
|
|
|
NS_IMETHOD Paint(nsIPresContext& aPresContext,
|
|
|
|
nsIRenderingContext& aRenderingContext,
|
1998-12-18 15:54:23 +00:00
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
nsFramePaintLayer aWhichLayer);
|
1998-11-18 05:25:26 +00:00
|
|
|
NS_IMETHOD GetFrameForPoint(const nsPoint& aPoint,
|
|
|
|
nsIFrame** aFrame);
|
1999-01-15 22:53:39 +00:00
|
|
|
NS_IMETHOD ReResolveStyleContext(nsIPresContext* aPresContext,
|
1999-03-25 06:43:38 +00:00
|
|
|
nsIStyleContext* aParentContext,
|
|
|
|
PRInt32 aParentChange,
|
|
|
|
nsStyleChangeList* aChangeList,
|
|
|
|
PRInt32* aLocalChange);
|
1999-01-16 00:00:50 +00:00
|
|
|
NS_IMETHOD List(FILE* out, PRInt32 aIndent) const;
|
1998-04-13 20:24:54 +00:00
|
|
|
|
1999-01-15 22:53:39 +00:00
|
|
|
// nsIHTMLReflow overrides
|
|
|
|
NS_IMETHOD DidReflow(nsIPresContext& aPresContext,
|
|
|
|
nsDidReflowStatus aStatus);
|
1998-11-03 20:23:15 +00:00
|
|
|
|
1999-01-15 22:53:39 +00:00
|
|
|
// nsContainerFrame methods
|
|
|
|
virtual void DeleteChildsNextInFlow(nsIPresContext& aPresContext,
|
|
|
|
nsIFrame* aChild);
|
1998-04-13 20:24:54 +00:00
|
|
|
|
1999-01-15 22:53:39 +00:00
|
|
|
static PRInt32 LengthOf(nsIFrame* aFrameList) {
|
|
|
|
nsFrameList tmp(aFrameList);
|
|
|
|
return tmp.GetLength();
|
|
|
|
}
|
1998-09-19 03:24:26 +00:00
|
|
|
|
1999-01-15 22:53:39 +00:00
|
|
|
#if XXX
|
|
|
|
static nsIFrame* FrameAt(nsIFrame* aFrameList, PRInt32 aIndex) {
|
|
|
|
nsFrameList tmp(aFrameList);
|
|
|
|
return tmp.FrameAt(aIndex);
|
|
|
|
}
|
|
|
|
#endif
|
1998-09-23 02:23:33 +00:00
|
|
|
|
1998-04-13 20:24:54 +00:00
|
|
|
protected:
|
1999-01-15 22:53:39 +00:00
|
|
|
nsContainerFrame();
|
|
|
|
~nsContainerFrame();
|
1998-06-05 21:06:24 +00:00
|
|
|
|
1998-11-19 18:09:03 +00:00
|
|
|
nsresult GetFrameForPointUsing(const nsPoint& aPoint,
|
|
|
|
nsIAtom* aList,
|
|
|
|
nsIFrame** aFrame);
|
|
|
|
|
1998-12-18 15:54:23 +00:00
|
|
|
virtual void PaintChildren(nsIPresContext& aPresContext,
|
|
|
|
nsIRenderingContext& aRenderingContext,
|
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
nsFramePaintLayer aWhichLayer);
|
1998-04-13 20:24:54 +00:00
|
|
|
|
1998-10-30 22:11:06 +00:00
|
|
|
virtual void PaintChild(nsIPresContext& aPresContext,
|
|
|
|
nsIRenderingContext& aRenderingContext,
|
|
|
|
const nsRect& aDirtyRect,
|
1998-12-18 15:54:23 +00:00
|
|
|
nsIFrame* aFrame,
|
|
|
|
nsFramePaintLayer aWhichLayer);
|
1998-10-30 22:11:06 +00:00
|
|
|
|
1998-04-13 20:24:54 +00:00
|
|
|
/**
|
1998-10-06 00:27:22 +00:00
|
|
|
* Queries the child frame for the nsIHTMLReflow interface and if it's
|
|
|
|
* supported invokes the WillReflow() and Reflow() member functions. If
|
|
|
|
* the reflow succeeds and the child frame is complete, deletes any
|
|
|
|
* next-in-flows using DeleteChildsNextInFlow()
|
1998-04-13 20:24:54 +00:00
|
|
|
*/
|
1998-10-06 00:27:22 +00:00
|
|
|
nsresult ReflowChild(nsIFrame* aKidFrame,
|
|
|
|
nsIPresContext& aPresContext,
|
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
|
|
|
nsReflowStatus& aStatus);
|
1998-04-13 20:24:54 +00:00
|
|
|
|
1999-01-15 22:53:39 +00:00
|
|
|
/**
|
|
|
|
* Moves any frames on both the prev-in-flow's overflow list and the
|
|
|
|
* receiver's overflow to the receiver's child list.
|
|
|
|
*
|
|
|
|
* Resets the overlist pointers to nsnull, and updates the receiver's child
|
|
|
|
* count and content mapping.
|
|
|
|
*
|
|
|
|
* @return PR_TRUE if any frames were moved and PR_FALSE otherwise
|
|
|
|
*/
|
1998-04-13 20:24:54 +00:00
|
|
|
PRBool MoveOverflowToChildList();
|
|
|
|
|
1999-01-15 22:53:39 +00:00
|
|
|
/**
|
|
|
|
* Push aFromChild and its next siblings to the next-in-flow. Change
|
|
|
|
* the geometric parent of each frame that's pushed. If there is no
|
|
|
|
* next-in-flow the frames are placed on the overflow list (and the
|
|
|
|
* geometric parent is left unchanged).
|
|
|
|
*
|
|
|
|
* Updates the next-in-flow's child count. Does <b>not</b> update the
|
|
|
|
* pusher's child count.
|
|
|
|
*
|
|
|
|
* @param aFromChild the first child frame to push. It is disconnected from
|
|
|
|
* aPrevSibling
|
|
|
|
* @param aPrevSibling aFromChild's previous sibling. Must not be null.
|
|
|
|
* It's an error to push a parent's first child frame
|
|
|
|
*/
|
1998-09-24 04:18:58 +00:00
|
|
|
void PushChildren(nsIFrame* aFromChild, nsIFrame* aPrevSibling);
|
1998-04-13 20:24:54 +00:00
|
|
|
|
|
|
|
/**
|
1999-01-15 22:53:39 +00:00
|
|
|
* Append child list starting at aChild to this frame's child list.
|
1998-04-13 20:24:54 +00:00
|
|
|
*
|
|
|
|
* @param aChild the beginning of the child list
|
1999-01-15 22:53:39 +00:00
|
|
|
* @param aSetParent if true each child's parent is set to this frame.
|
1998-04-13 20:24:54 +00:00
|
|
|
*/
|
1999-01-15 22:53:39 +00:00
|
|
|
void AppendChildren(nsIFrame* aChild, PRBool aSetParent) {
|
|
|
|
mFrames.AppendFrames(aSetParent ? this : nsnull, aChild);
|
|
|
|
}
|
1998-04-13 20:24:54 +00:00
|
|
|
|
1999-01-15 22:53:39 +00:00
|
|
|
/**
|
|
|
|
*/
|
|
|
|
nsresult AddFrame(const nsHTMLReflowState& aReflowState,
|
|
|
|
nsIFrame * aAddedFrame);
|
|
|
|
|
|
|
|
/**
|
|
|
|
*/
|
1999-02-04 16:27:18 +00:00
|
|
|
nsresult RemoveAFrame(nsIFrame* aRemovedFrame);
|
1998-05-02 00:54:12 +00:00
|
|
|
|
1998-04-17 01:41:24 +00:00
|
|
|
/**
|
|
|
|
* Returns PR_TRUE if aChild is a child of this frame.
|
|
|
|
*/
|
1999-01-15 22:53:39 +00:00
|
|
|
PRBool IsChild(const nsIFrame* aChild) const {
|
|
|
|
return mFrames.ContainsFrame(aChild);
|
|
|
|
}
|
1998-04-13 20:24:54 +00:00
|
|
|
|
1999-01-15 22:53:39 +00:00
|
|
|
nsFrameList mFrames;
|
|
|
|
nsFrameList mOverflowFrames;
|
1998-04-13 20:24:54 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* nsContainerFrame_h___ */
|