1998-09-30 21:35:29 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
*
|
1999-11-06 03:40:37 +00: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-09-30 21:35:29 +00:00
|
|
|
*
|
1999-11-06 03:40:37 +00: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-09-30 21:35:29 +00:00
|
|
|
*
|
1999-11-06 03:40:37 +00:00
|
|
|
* The Original Code is mozilla.org code.
|
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is Netscape
|
1998-09-30 21:35:29 +00:00
|
|
|
* Communications Corporation. Portions created by Netscape are
|
1999-11-06 03:40:37 +00:00
|
|
|
* Copyright (C) 1998 Netscape Communications Corporation. All
|
|
|
|
* Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s):
|
2000-02-02 22:24:56 +00:00
|
|
|
* Pierre Phaneuf <pp@ludusdesign.com>
|
1998-09-30 21:35:29 +00:00
|
|
|
*/
|
|
|
|
#include "nsContainerFrame.h"
|
|
|
|
#include "nsIContent.h"
|
|
|
|
#include "nsIPresContext.h"
|
|
|
|
#include "nsIRenderingContext.h"
|
|
|
|
#include "nsISpaceManager.h"
|
|
|
|
#include "nsIStyleContext.h"
|
|
|
|
#include "nsRect.h"
|
|
|
|
#include "nsPoint.h"
|
|
|
|
#include "nsGUIEvent.h"
|
|
|
|
#include "nsStyleConsts.h"
|
|
|
|
#include "nsIView.h"
|
|
|
|
#include "nsVoidArray.h"
|
|
|
|
#include "nsISizeOfHandler.h"
|
1999-01-15 22:53:39 +00:00
|
|
|
#include "nsIReflowCommand.h"
|
1998-10-01 04:46:11 +00:00
|
|
|
#include "nsHTMLIIDs.h"
|
1999-04-13 00:15:13 +00:00
|
|
|
#include "nsHTMLContainerFrame.h"
|
1999-10-21 05:11:43 +00:00
|
|
|
#include "nsIFrameManager.h"
|
|
|
|
#include "nsIPresShell.h"
|
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
#include "nsLayoutAtoms.h"
|
1999-11-19 15:33:29 +00:00
|
|
|
#include "nsIViewManager.h"
|
1998-09-30 21:35:29 +00:00
|
|
|
|
|
|
|
#ifdef NS_DEBUG
|
|
|
|
#undef NOISY
|
|
|
|
#else
|
|
|
|
#undef NOISY
|
|
|
|
#endif
|
|
|
|
|
1999-01-15 22:53:39 +00:00
|
|
|
nsContainerFrame::nsContainerFrame()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
nsContainerFrame::~nsContainerFrame()
|
1998-09-30 21:35:29 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
1999-11-24 06:03:41 +00:00
|
|
|
nsContainerFrame::SetInitialChildList(nsIPresContext* aPresContext,
|
1998-11-10 06:05:32 +00:00
|
|
|
nsIAtom* aListName,
|
|
|
|
nsIFrame* aChildList)
|
1998-09-30 21:35:29 +00:00
|
|
|
{
|
1999-08-25 21:49:18 +00:00
|
|
|
// NS_PRECONDITION(mFrames.IsEmpty(), "already initialized");
|
1998-09-30 21:35:29 +00:00
|
|
|
|
1999-01-15 22:53:39 +00:00
|
|
|
nsresult result;
|
1999-07-24 21:41:15 +00:00
|
|
|
if (!mFrames.IsEmpty()) {
|
|
|
|
// We already have child frames which means we've already been
|
|
|
|
// initialized
|
1998-11-10 06:05:32 +00:00
|
|
|
result = NS_ERROR_UNEXPECTED;
|
1999-07-24 21:41:15 +00:00
|
|
|
} else if (aListName) {
|
|
|
|
// All we know about is the unnamed principal child list
|
1998-11-10 06:05:32 +00:00
|
|
|
result = NS_ERROR_INVALID_ARG;
|
|
|
|
} else {
|
1999-07-24 21:41:15 +00:00
|
|
|
#ifdef NS_DEBUG
|
|
|
|
nsFrame::VerifyDirtyBitSet(aChildList);
|
|
|
|
#endif
|
1999-01-15 22:53:39 +00:00
|
|
|
mFrames.SetFrames(aChildList);
|
1998-11-10 06:05:32 +00:00
|
|
|
result = NS_OK;
|
|
|
|
}
|
|
|
|
return result;
|
1998-09-30 21:35:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
1999-11-24 06:03:41 +00:00
|
|
|
nsContainerFrame::Destroy(nsIPresContext* aPresContext)
|
1998-09-30 21:35:29 +00:00
|
|
|
{
|
1998-11-14 19:25:34 +00:00
|
|
|
// Prevent event dispatch during destruction
|
1999-01-15 22:53:39 +00:00
|
|
|
nsIView* view;
|
1999-11-24 06:03:41 +00:00
|
|
|
GetView(aPresContext, &view);
|
1998-10-30 23:38:03 +00:00
|
|
|
if (nsnull != view) {
|
|
|
|
view->SetClientData(nsnull);
|
1998-09-30 21:35:29 +00:00
|
|
|
}
|
|
|
|
|
1998-11-14 19:25:34 +00:00
|
|
|
// Delete the primary child list
|
1999-07-22 04:00:57 +00:00
|
|
|
mFrames.DestroyFrames(aPresContext);
|
1998-11-14 19:25:34 +00:00
|
|
|
|
1999-07-22 02:24:52 +00:00
|
|
|
// Base class will destroy the frame
|
|
|
|
return nsFrame::Destroy(aPresContext);
|
1998-11-14 19:25:34 +00:00
|
|
|
}
|
|
|
|
|
1998-09-30 21:35:29 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Child frame enumeration
|
|
|
|
|
1998-11-14 19:25:34 +00:00
|
|
|
NS_IMETHODIMP
|
2000-01-22 01:16:50 +00:00
|
|
|
nsContainerFrame::FirstChild(nsIPresContext* aPresContext,
|
|
|
|
nsIAtom* aListName,
|
|
|
|
nsIFrame** aFirstChild) const
|
1998-09-30 21:35:29 +00:00
|
|
|
{
|
1999-02-10 02:25:01 +00:00
|
|
|
NS_PRECONDITION(nsnull != aFirstChild, "null OUT parameter pointer");
|
2000-01-22 01:16:50 +00:00
|
|
|
// We only know about the unnamed principal child list and the overflow
|
|
|
|
// list
|
1998-11-09 19:40:27 +00:00
|
|
|
if (nsnull == aListName) {
|
1999-02-10 02:25:01 +00:00
|
|
|
*aFirstChild = mFrames.FirstChild();
|
1998-11-09 19:40:27 +00:00
|
|
|
return NS_OK;
|
2000-01-22 01:16:50 +00:00
|
|
|
} else if (nsLayoutAtoms::overflowList == aListName) {
|
|
|
|
*aFirstChild = GetOverflowFrames(aPresContext, PR_FALSE);
|
|
|
|
return NS_OK;
|
1998-11-09 19:40:27 +00:00
|
|
|
} else {
|
1999-02-10 02:25:01 +00:00
|
|
|
*aFirstChild = nsnull;
|
1998-11-09 19:40:27 +00:00
|
|
|
return NS_ERROR_INVALID_ARG;
|
|
|
|
}
|
1998-09-30 21:35:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
1999-01-15 22:53:39 +00:00
|
|
|
// Painting/Events
|
1998-09-30 21:35:29 +00:00
|
|
|
|
1998-10-30 22:11:06 +00:00
|
|
|
NS_IMETHODIMP
|
1999-11-24 06:03:41 +00:00
|
|
|
nsContainerFrame::Paint(nsIPresContext* aPresContext,
|
1998-10-30 22:11:06 +00:00
|
|
|
nsIRenderingContext& aRenderingContext,
|
1998-12-18 15:54:23 +00:00
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
nsFramePaintLayer aWhichLayer)
|
1998-09-30 21:35:29 +00:00
|
|
|
{
|
1998-12-18 15:54:23 +00:00
|
|
|
PaintChildren(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer);
|
1998-09-30 21:35:29 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
1998-10-30 22:11:06 +00:00
|
|
|
// Paint the children of a container, assuming nothing about the
|
|
|
|
// childrens spatial arrangement. Given relative positioning, negative
|
|
|
|
// margins, etc, that's probably a good thing.
|
|
|
|
//
|
|
|
|
// Note: aDirtyRect is in our coordinate system (and of course, child
|
|
|
|
// rect's are also in our coordinate system)
|
|
|
|
void
|
1999-11-24 06:03:41 +00:00
|
|
|
nsContainerFrame::PaintChildren(nsIPresContext* aPresContext,
|
1998-10-30 22:11:06 +00:00
|
|
|
nsIRenderingContext& aRenderingContext,
|
1998-12-18 15:54:23 +00:00
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
nsFramePaintLayer aWhichLayer)
|
1998-09-30 21:35:29 +00:00
|
|
|
{
|
1998-10-30 22:11:06 +00:00
|
|
|
const nsStyleDisplay* disp = (const nsStyleDisplay*)
|
|
|
|
mStyleContext->GetStyleData(eStyleStruct_Display);
|
|
|
|
|
1999-01-15 22:53:39 +00:00
|
|
|
nsIFrame* kid = mFrames.FirstChild();
|
1998-11-19 03:52:29 +00:00
|
|
|
while (nsnull != kid) {
|
1998-12-18 15:54:23 +00:00
|
|
|
PaintChild(aPresContext, aRenderingContext, aDirtyRect, kid, aWhichLayer);
|
1999-02-10 06:13:38 +00:00
|
|
|
kid->GetNextSibling(&kid);
|
1998-11-19 03:52:29 +00:00
|
|
|
}
|
1998-10-30 22:11:06 +00:00
|
|
|
}
|
1998-10-06 21:00:58 +00:00
|
|
|
|
1998-10-30 22:11:06 +00:00
|
|
|
// Paint one child frame
|
|
|
|
void
|
1999-11-24 06:03:41 +00:00
|
|
|
nsContainerFrame::PaintChild(nsIPresContext* aPresContext,
|
1998-10-30 22:11:06 +00:00
|
|
|
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
|
|
|
{
|
|
|
|
nsIView *pView;
|
1999-11-24 06:03:41 +00:00
|
|
|
aFrame->GetView(aPresContext, &pView);
|
1998-10-30 22:11:06 +00:00
|
|
|
if (nsnull == pView) {
|
|
|
|
nsRect kidRect;
|
|
|
|
aFrame->GetRect(kidRect);
|
|
|
|
nsFrameState state;
|
1999-02-10 04:17:06 +00:00
|
|
|
aFrame->GetFrameState(&state);
|
1998-09-30 21:35:29 +00:00
|
|
|
|
1998-10-30 22:11:06 +00:00
|
|
|
// Compute the constrained damage area; set the overlap flag to
|
|
|
|
// PR_TRUE if any portion of the child frame intersects the
|
|
|
|
// dirty rect.
|
|
|
|
nsRect damageArea;
|
|
|
|
PRBool overlap;
|
|
|
|
if (NS_FRAME_OUTSIDE_CHILDREN & state) {
|
|
|
|
// If the child frame has children that leak out of our box
|
|
|
|
// then we don't constrain the damageArea to just the childs
|
|
|
|
// bounding rect.
|
|
|
|
damageArea = aDirtyRect;
|
|
|
|
overlap = PR_TRUE;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
// Compute the intersection of the dirty rect and the childs
|
|
|
|
// rect (both are in our coordinate space). This limits the
|
|
|
|
// damageArea to just the portion that intersects the childs
|
|
|
|
// rect.
|
|
|
|
overlap = damageArea.IntersectRect(aDirtyRect, kidRect);
|
1998-10-09 22:58:25 +00:00
|
|
|
#ifdef NS_DEBUG
|
|
|
|
if (!overlap && (0 == kidRect.width) && (0 == kidRect.height)) {
|
|
|
|
overlap = PR_TRUE;
|
|
|
|
}
|
|
|
|
#endif
|
1998-10-30 22:11:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (overlap) {
|
|
|
|
// Translate damage area into the kids coordinate
|
|
|
|
// system. Translate rendering context into the kids
|
|
|
|
// coordinate system.
|
|
|
|
damageArea.x -= kidRect.x;
|
|
|
|
damageArea.y -= kidRect.y;
|
|
|
|
aRenderingContext.Translate(kidRect.x, kidRect.y);
|
|
|
|
|
|
|
|
// Paint the kid
|
1998-12-18 15:54:23 +00:00
|
|
|
aFrame->Paint(aPresContext, aRenderingContext, damageArea, aWhichLayer);
|
2000-01-16 15:13:46 +00:00
|
|
|
// don't use PushState and PopState, because they're slow
|
|
|
|
aRenderingContext.Translate(-kidRect.x, -kidRect.y);
|
1998-10-30 22:11:06 +00:00
|
|
|
|
1998-09-30 21:35:29 +00:00
|
|
|
#ifdef NS_DEBUG
|
1998-10-30 22:11:06 +00:00
|
|
|
// Draw a border around the child
|
1999-11-01 22:12:45 +00:00
|
|
|
if (nsIFrameDebug::GetShowFrameBorders() && !kidRect.IsEmpty()) {
|
1998-10-30 22:11:06 +00:00
|
|
|
aRenderingContext.SetColor(NS_RGB(255,0,0));
|
|
|
|
aRenderingContext.DrawRect(kidRect);
|
1998-09-30 21:35:29 +00:00
|
|
|
}
|
1998-10-30 22:11:06 +00:00
|
|
|
#endif
|
1998-09-30 21:35:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1998-11-18 05:25:26 +00:00
|
|
|
NS_IMETHODIMP
|
1999-10-26 04:44:41 +00:00
|
|
|
nsContainerFrame::GetFrameForPoint(nsIPresContext* aPresContext,
|
|
|
|
const nsPoint& aPoint,
|
2000-03-22 02:43:08 +00:00
|
|
|
nsFramePaintLayer aWhichLayer,
|
1998-11-18 05:25:26 +00:00
|
|
|
nsIFrame** aFrame)
|
1998-11-19 18:09:03 +00:00
|
|
|
{
|
2000-03-22 02:43:08 +00:00
|
|
|
return GetFrameForPointUsing(aPresContext, aPoint, nsnull, aWhichLayer, (aWhichLayer == NS_FRAME_PAINT_LAYER_FOREGROUND), aFrame);
|
1998-11-19 18:09:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
1999-10-26 04:44:41 +00:00
|
|
|
nsContainerFrame::GetFrameForPointUsing(nsIPresContext* aPresContext,
|
|
|
|
const nsPoint& aPoint,
|
1998-11-19 18:09:03 +00:00
|
|
|
nsIAtom* aList,
|
2000-03-22 02:43:08 +00:00
|
|
|
nsFramePaintLayer aWhichLayer,
|
|
|
|
PRBool aConsiderSelf,
|
1998-11-19 18:09:03 +00:00
|
|
|
nsIFrame** aFrame)
|
1998-09-30 21:35:29 +00:00
|
|
|
{
|
2000-03-22 02:43:08 +00:00
|
|
|
nsIFrame *kid, *hit;
|
1998-11-18 05:25:26 +00:00
|
|
|
nsPoint tmp;
|
|
|
|
|
2000-03-22 02:43:08 +00:00
|
|
|
PRBool inThisFrame = mRect.Contains(aPoint);
|
|
|
|
|
|
|
|
if (! ((mState & NS_FRAME_OUTSIDE_CHILDREN) || inThisFrame ) ) {
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
1999-11-23 22:05:05 +00:00
|
|
|
|
2000-01-22 01:16:50 +00:00
|
|
|
FirstChild(aPresContext, aList, &kid);
|
2000-03-22 02:43:08 +00:00
|
|
|
*aFrame = nsnull;
|
|
|
|
tmp.MoveTo(aPoint.x - mRect.x, aPoint.y - mRect.y);
|
1998-09-30 21:35:29 +00:00
|
|
|
while (nsnull != kid) {
|
2000-03-22 02:43:08 +00:00
|
|
|
nsresult rv = kid->GetFrameForPoint(aPresContext, tmp, aWhichLayer, &hit);
|
|
|
|
|
|
|
|
if (NS_SUCCEEDED(rv) && hit) {
|
|
|
|
*aFrame = hit;
|
1998-09-30 21:35:29 +00:00
|
|
|
}
|
1999-02-10 06:13:38 +00:00
|
|
|
kid->GetNextSibling(&kid);
|
1998-09-30 21:35:29 +00:00
|
|
|
}
|
|
|
|
|
2000-03-22 02:43:08 +00:00
|
|
|
if (*aFrame) {
|
|
|
|
return NS_OK;
|
1998-09-30 21:35:29 +00:00
|
|
|
}
|
1999-11-23 22:05:05 +00:00
|
|
|
|
2000-03-22 02:43:08 +00:00
|
|
|
if ( inThisFrame && aConsiderSelf ) {
|
|
|
|
const nsStyleDisplay* disp = (const nsStyleDisplay*)
|
|
|
|
mStyleContext->GetStyleData(eStyleStruct_Display);
|
|
|
|
if (disp->IsVisible()) {
|
|
|
|
*aFrame = this;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
1999-11-23 22:05:05 +00:00
|
|
|
}
|
|
|
|
|
1999-05-07 00:08:02 +00:00
|
|
|
return NS_ERROR_FAILURE;
|
1998-09-30 21:35:29 +00:00
|
|
|
}
|
|
|
|
|
1999-07-22 04:32:31 +00:00
|
|
|
NS_IMETHODIMP
|
1999-11-24 06:03:41 +00:00
|
|
|
nsContainerFrame::ReplaceFrame(nsIPresContext* aPresContext,
|
1999-07-22 04:32:31 +00:00
|
|
|
nsIPresShell& aPresShell,
|
|
|
|
nsIAtom* aListName,
|
|
|
|
nsIFrame* aOldFrame,
|
|
|
|
nsIFrame* aNewFrame)
|
|
|
|
{
|
|
|
|
nsIFrame* prevFrame;
|
|
|
|
nsIFrame* firstChild;
|
|
|
|
nsresult rv;
|
|
|
|
|
|
|
|
// Get the old frame's previous sibling frame
|
2000-01-22 01:16:50 +00:00
|
|
|
FirstChild(aPresContext, aListName, &firstChild);
|
1999-07-22 04:32:31 +00:00
|
|
|
nsFrameList frames(firstChild);
|
|
|
|
NS_ASSERTION(frames.ContainsFrame(aOldFrame), "frame is not a valid child frame");
|
|
|
|
prevFrame = frames.GetPrevSiblingFor(aOldFrame);
|
|
|
|
|
|
|
|
// Default implementation treats it like two separate operations
|
|
|
|
rv = RemoveFrame(aPresContext, aPresShell, aListName, aOldFrame);
|
|
|
|
if (NS_SUCCEEDED(rv)) {
|
|
|
|
rv = InsertFrames(aPresContext, aPresShell, aListName, prevFrame, aNewFrame);
|
|
|
|
}
|
|
|
|
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
2000-01-12 08:28:24 +00:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsContainerFrame::ReflowDirtyChild(nsIPresShell* aPresShell, nsIFrame* aChild)
|
|
|
|
{
|
2000-01-12 21:52:58 +00:00
|
|
|
// The container frame always generates a reflow command
|
|
|
|
// targeted at its child
|
|
|
|
if (!(mState & NS_FRAME_HAS_DIRTY_CHILDREN)) {
|
|
|
|
mState |= NS_FRAME_HAS_DIRTY_CHILDREN;
|
|
|
|
|
|
|
|
nsFrame::CreateAndPostReflowCommand(aPresShell, aChild,
|
|
|
|
nsIReflowCommand::ReflowDirty, nsnull, nsnull, nsnull);
|
2000-01-12 08:28:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
1998-09-30 21:35:29 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Helper member functions
|
|
|
|
|
1999-11-20 06:03:16 +00:00
|
|
|
static PRBool
|
|
|
|
TranslatePointTo(nsPoint& aPoint, nsIView* aChildView, nsIView* aParentView)
|
|
|
|
{
|
|
|
|
do {
|
|
|
|
nsRect bounds;
|
|
|
|
|
|
|
|
aChildView->GetBounds(bounds);
|
|
|
|
aPoint.x += bounds.x;
|
|
|
|
aPoint.y += bounds.y;
|
|
|
|
aChildView->GetParent(aChildView);
|
|
|
|
} while (aChildView && (aChildView != aParentView));
|
|
|
|
|
|
|
|
return aChildView == aParentView;
|
|
|
|
}
|
|
|
|
|
1999-11-19 15:33:29 +00:00
|
|
|
void
|
|
|
|
nsContainerFrame::PositionFrameView(nsIPresContext* aPresContext,
|
|
|
|
nsIFrame* aKidFrame,
|
|
|
|
nsIView* aView)
|
|
|
|
{
|
|
|
|
if (aView) {
|
|
|
|
// Position view relative to its parent, not relative to aKidFrame's
|
|
|
|
// frame which may not have a view
|
1999-11-20 06:03:16 +00:00
|
|
|
nsIView* containingView;
|
|
|
|
nsPoint origin;
|
|
|
|
nsIView* parentView;
|
|
|
|
nsIViewManager *vm;
|
1999-11-19 15:33:29 +00:00
|
|
|
|
|
|
|
aView->GetParent(parentView);
|
|
|
|
aKidFrame->GetOffsetFromView(aPresContext, origin, &containingView);
|
1999-11-20 06:03:16 +00:00
|
|
|
aView->GetViewManager(vm);
|
|
|
|
|
2000-05-17 04:45:44 +00:00
|
|
|
if (containingView != parentView)
|
|
|
|
{
|
|
|
|
// it is possible for parent view not to have a frame attached to it
|
|
|
|
// kind of an anonymous view. This happens with native scrollbars and
|
|
|
|
// the clip view. To fix this we need to go up and parentView chain
|
|
|
|
// until we find a view with client data. This is total HACK to fix
|
|
|
|
// the HACK below. COMBO box code should NOT be in the container code!!!
|
|
|
|
// And the case it looks from does not just happen for combo boxes. Native
|
|
|
|
// scrollframes get in this situation too!!
|
|
|
|
while(parentView) {
|
|
|
|
void *data = 0;
|
|
|
|
parentView->GetClientData(data);
|
|
|
|
if (data)
|
|
|
|
break;
|
|
|
|
|
|
|
|
nsRect bounds;
|
|
|
|
parentView->GetBounds(bounds);
|
|
|
|
origin.x += bounds.x;
|
|
|
|
origin.y += bounds.y;
|
|
|
|
parentView->GetParent(parentView);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (containingView != parentView)
|
|
|
|
{
|
|
|
|
// Huh, the view's parent view isn't the same as the containing view.
|
|
|
|
// This happens for combo box drop-down frames.
|
|
|
|
//
|
|
|
|
// We have the origin in the coordinate space of the containing view,
|
|
|
|
// but we need it in the coordinate space of the parent view so do a
|
|
|
|
// view translation
|
|
|
|
NS_VERIFY(TranslatePointTo(origin, containingView, parentView), "translation failed");
|
|
|
|
vm->MoveViewTo(aView, origin.x, origin.y);
|
|
|
|
}
|
1999-11-19 15:33:29 +00:00
|
|
|
}
|
1999-11-20 06:03:16 +00:00
|
|
|
|
2000-05-17 04:45:44 +00:00
|
|
|
vm->MoveViewTo(aView, origin.x, origin.y);
|
|
|
|
|
1999-11-20 06:03:16 +00:00
|
|
|
NS_RELEASE(vm);
|
1999-11-19 15:33:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
nsContainerFrame::SyncFrameViewAfterReflow(nsIPresContext* aPresContext,
|
|
|
|
nsIFrame* aFrame,
|
|
|
|
nsIView* aView,
|
1999-11-30 04:48:34 +00:00
|
|
|
const nsRect* aCombinedArea,
|
1999-11-19 15:33:29 +00:00
|
|
|
PRUint32 aFlags)
|
|
|
|
{
|
|
|
|
if (aView) {
|
|
|
|
nsIViewManager *vm;
|
|
|
|
nsFrameState kidState;
|
|
|
|
nsSize frameSize;
|
|
|
|
|
|
|
|
aView->GetViewManager(vm);
|
|
|
|
aFrame->GetFrameState(&kidState);
|
|
|
|
aFrame->GetSize(frameSize);
|
|
|
|
|
|
|
|
// Make sure the view is sized and positioned correctly
|
|
|
|
if (0 == (aFlags & NS_FRAME_NO_MOVE_VIEW)) {
|
|
|
|
nsIView* containingView;
|
|
|
|
nsPoint origin;
|
|
|
|
nsIView* parentView;
|
|
|
|
|
|
|
|
aView->GetParent(parentView);
|
|
|
|
aFrame->GetOffsetFromView(aPresContext, origin, &containingView);
|
|
|
|
|
2000-05-17 04:45:44 +00:00
|
|
|
|
|
|
|
if (containingView != parentView)
|
|
|
|
{
|
|
|
|
// it is possible for parent view not to have a frame attached to it
|
|
|
|
// kind of an anonymous view. This happens with native scrollbars and
|
|
|
|
// the clip view. To fix this we need to go up and parentView chain
|
|
|
|
// until we find a view with client data. This is total HACK to fix
|
|
|
|
// the HACK below. COMBO box code should NOT be in the container code!!!
|
|
|
|
// And the case it looks from does not just happen for combo boxes. Native
|
|
|
|
// scrollframes get in this situation too!!
|
|
|
|
while(parentView) {
|
|
|
|
void *data = 0;
|
|
|
|
parentView->GetClientData(data);
|
|
|
|
if (data)
|
|
|
|
break;
|
1999-11-20 06:03:16 +00:00
|
|
|
|
2000-05-17 04:45:44 +00:00
|
|
|
nsRect bounds;
|
|
|
|
parentView->GetBounds(bounds);
|
|
|
|
origin.x += bounds.x;
|
|
|
|
origin.y += bounds.y;
|
|
|
|
parentView->GetParent(parentView);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (containingView != parentView)
|
|
|
|
{
|
|
|
|
// Huh, the view's parent view isn't the same as the containing view.
|
|
|
|
// This happens for combo box drop-down frames.
|
|
|
|
//
|
|
|
|
// We have the origin in the coordinate space of the containing view,
|
|
|
|
// but we need it in the coordinate space of the parent view so do a
|
|
|
|
// view translation
|
|
|
|
NS_VERIFY(TranslatePointTo(origin, containingView, parentView), "translation failed");
|
|
|
|
vm->MoveViewTo(aView, origin.x, origin.y);
|
|
|
|
}
|
1999-11-19 15:33:29 +00:00
|
|
|
}
|
2000-05-17 04:45:44 +00:00
|
|
|
|
|
|
|
vm->MoveViewTo(aView, origin.x, origin.y);
|
|
|
|
|
1999-11-19 15:33:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (0 == (aFlags & NS_FRAME_NO_SIZE_VIEW)) {
|
|
|
|
// If the frame has child frames that stick outside the content
|
|
|
|
// area, then size the view large enough to include those child
|
|
|
|
// frames
|
|
|
|
if ((kidState & NS_FRAME_OUTSIDE_CHILDREN) && aCombinedArea) {
|
|
|
|
vm->ResizeView(aView, aCombinedArea->XMost(), aCombinedArea->YMost());
|
|
|
|
|
|
|
|
} else {
|
|
|
|
vm->ResizeView(aView, frameSize.width, frameSize.height);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
const nsStyleColor* color;
|
|
|
|
const nsStyleDisplay* display;
|
|
|
|
aFrame->GetStyleData(eStyleStruct_Color, (const nsStyleStruct*&)color);
|
|
|
|
aFrame->GetStyleData(eStyleStruct_Display, (const nsStyleStruct*&)display);
|
|
|
|
|
|
|
|
// Set the view's opacity
|
|
|
|
vm->SetViewOpacity(aView, color->mOpacity);
|
|
|
|
|
|
|
|
// See if the view should be hidden or visible
|
|
|
|
PRBool viewIsVisible = PR_TRUE;
|
|
|
|
PRBool viewHasTransparentContent = (color->mBackgroundFlags &
|
|
|
|
NS_STYLE_BG_COLOR_TRANSPARENT) == NS_STYLE_BG_COLOR_TRANSPARENT;
|
|
|
|
|
|
|
|
if (NS_STYLE_VISIBILITY_COLLAPSE == display->mVisible) {
|
|
|
|
viewIsVisible = PR_FALSE;
|
|
|
|
}
|
|
|
|
else if (NS_STYLE_VISIBILITY_HIDDEN == display->mVisible) {
|
|
|
|
// If it has a widget, hide the view because the widget can't deal with it
|
|
|
|
nsIWidget* widget = nsnull;
|
|
|
|
aView->GetWidget(widget);
|
|
|
|
if (widget) {
|
|
|
|
viewIsVisible = PR_FALSE;
|
|
|
|
NS_RELEASE(widget);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
// If it's a scroll frame, then hide the view. This means that
|
|
|
|
// child elements can't override their parent's visibility, but
|
|
|
|
// it's not practical to leave it visible in all cases because
|
|
|
|
// the scrollbars will be showing
|
|
|
|
nsIAtom* frameType;
|
|
|
|
aFrame->GetFrameType(&frameType);
|
|
|
|
|
|
|
|
if (frameType == nsLayoutAtoms::scrollFrame) {
|
|
|
|
viewIsVisible = PR_FALSE;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
// If we're a container element, then leave the view visible, but
|
|
|
|
// mark it as having transparent content. The reason we need to
|
|
|
|
// do this is that child elements can override their parent's
|
|
|
|
// hidden visibility and be visible anyway
|
|
|
|
nsIFrame* firstChild;
|
|
|
|
|
2000-01-22 01:16:50 +00:00
|
|
|
aFrame->FirstChild(aPresContext, nsnull, &firstChild);
|
1999-11-19 15:33:29 +00:00
|
|
|
if (firstChild) {
|
|
|
|
// Not a left frame, so the view needs to be visible, but marked
|
|
|
|
// as having transparent content
|
|
|
|
viewHasTransparentContent = PR_TRUE;
|
|
|
|
} else {
|
|
|
|
// Leaf frame so go ahead and hide the view
|
|
|
|
viewIsVisible = PR_FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
NS_IF_RELEASE(frameType);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// If the frame has visible content that overflows the content area, then we
|
|
|
|
// need the view marked as having transparent content
|
|
|
|
if (NS_STYLE_OVERFLOW_VISIBLE == display->mOverflow) {
|
|
|
|
if (kidState & NS_FRAME_OUTSIDE_CHILDREN) {
|
|
|
|
viewHasTransparentContent = PR_TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Make sure visibility is correct
|
2000-05-18 00:37:27 +00:00
|
|
|
if (0 == (aFlags & NS_FRAME_NO_VISIBILITY)) {
|
|
|
|
vm->SetViewVisibility(aView, viewIsVisible ? nsViewVisibility_kShow :
|
|
|
|
nsViewVisibility_kHide);
|
|
|
|
}
|
1999-11-19 15:33:29 +00:00
|
|
|
|
|
|
|
// Make sure content transparency is correct
|
|
|
|
if (viewIsVisible) {
|
|
|
|
vm->SetViewContentTransparency(aView, viewHasTransparentContent);
|
|
|
|
}
|
|
|
|
|
1999-12-08 04:49:20 +00:00
|
|
|
// Make sure z-index is correct
|
|
|
|
PRInt32 zIndex = 0;
|
|
|
|
PRBool autoZIndex = PR_FALSE;
|
|
|
|
const nsStylePosition* position;
|
|
|
|
|
|
|
|
aFrame->GetStyleData(eStyleStruct_Position, (const nsStyleStruct*&)position);
|
|
|
|
if (position->mZIndex.GetUnit() == eStyleUnit_Integer) {
|
|
|
|
zIndex = position->mZIndex.GetIntValue();
|
|
|
|
|
|
|
|
} else if (position->mZIndex.GetUnit() == eStyleUnit_Auto) {
|
|
|
|
autoZIndex = PR_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
vm->SetViewZIndex(aView, zIndex);
|
|
|
|
vm->SetViewAutoZIndex(aView, autoZIndex);
|
|
|
|
|
2000-04-25 04:43:11 +00:00
|
|
|
// There are two types of clipping:
|
|
|
|
// - 'clip' which only applies to absolutely positioned elements, and is
|
|
|
|
// relative to the element's border edge. 'clip' applies to the entire
|
|
|
|
// element
|
|
|
|
// - 'overflow-clip' which only applies to block-level elements and replaced
|
|
|
|
// elements that have 'overflow' set to 'hidden'. 'overflow-clip' is relative
|
|
|
|
// to the content area and applies to content only (not border or background).
|
|
|
|
// Note that out-of-flow frames like floated or absolutely positioned frames
|
|
|
|
// are block-level, but we can't rely on the 'display' value being set correctly
|
|
|
|
// in the style context...
|
|
|
|
PRBool hasClip, hasOverflowClip;
|
|
|
|
PRBool isBlockLevel = display->IsBlockLevel() || (0 != (kidState & NS_FRAME_OUT_OF_FLOW));
|
|
|
|
hasClip = position->IsAbsolutelyPositioned() && (display->mClipFlags & NS_STYLE_CLIP_RECT);
|
|
|
|
hasOverflowClip = isBlockLevel && (display->mOverflow == NS_STYLE_OVERFLOW_HIDDEN);
|
|
|
|
if (hasClip || hasOverflowClip) {
|
|
|
|
nsRect clipRect, overflowClipRect;
|
|
|
|
|
|
|
|
if (hasClip) {
|
|
|
|
// Start with the 'auto' values and then factor in user specified values
|
|
|
|
clipRect.SetRect(0, 0, frameSize.width, frameSize.height);
|
|
|
|
|
|
|
|
if (display->mClipFlags & NS_STYLE_CLIP_RECT) {
|
|
|
|
if (0 == (NS_STYLE_CLIP_TOP_AUTO & display->mClipFlags)) {
|
|
|
|
clipRect.y = display->mClip.y;
|
|
|
|
}
|
|
|
|
if (0 == (NS_STYLE_CLIP_LEFT_AUTO & display->mClipFlags)) {
|
|
|
|
clipRect.x = display->mClip.x;
|
|
|
|
}
|
|
|
|
if (0 == (NS_STYLE_CLIP_RIGHT_AUTO & display->mClipFlags)) {
|
2000-06-22 05:28:36 +00:00
|
|
|
clipRect.width = display->mClip.width;
|
2000-04-25 04:43:11 +00:00
|
|
|
}
|
|
|
|
if (0 == (NS_STYLE_CLIP_BOTTOM_AUTO & display->mClipFlags)) {
|
2000-06-22 05:28:36 +00:00
|
|
|
clipRect.height = display->mClip.height;
|
2000-04-25 04:43:11 +00:00
|
|
|
}
|
2000-04-24 22:29:06 +00:00
|
|
|
}
|
2000-04-25 04:43:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (hasOverflowClip) {
|
2001-02-07 09:57:26 +00:00
|
|
|
const nsStyleBorder* borderStyle;
|
|
|
|
const nsStylePadding* paddingStyle;
|
2000-04-25 04:43:11 +00:00
|
|
|
nsMargin border, padding;
|
|
|
|
|
2001-02-07 09:57:26 +00:00
|
|
|
aFrame->GetStyleData(eStyleStruct_Border, (const nsStyleStruct*&)borderStyle);
|
|
|
|
aFrame->GetStyleData(eStyleStruct_Padding, (const nsStyleStruct*&)paddingStyle);
|
2000-04-25 04:43:11 +00:00
|
|
|
|
|
|
|
// XXX We don't support the 'overflow-clip' property yet so just use the
|
|
|
|
// content area (which is the default value) as the clip shape
|
|
|
|
overflowClipRect.SetRect(0, 0, frameSize.width, frameSize.height);
|
2001-02-07 09:57:26 +00:00
|
|
|
borderStyle->GetBorder(border);
|
2000-04-25 04:43:11 +00:00
|
|
|
overflowClipRect.Deflate(border);
|
|
|
|
// XXX We need to handle percentage padding
|
2001-02-07 09:57:26 +00:00
|
|
|
if (paddingStyle->GetPadding(padding)) {
|
2000-04-25 04:43:11 +00:00
|
|
|
overflowClipRect.Deflate(padding);
|
2000-04-24 22:29:06 +00:00
|
|
|
}
|
2000-04-25 04:43:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// If both 'clip' and 'overflow-clip' apply then use the intersection
|
|
|
|
// of the two
|
|
|
|
if (hasClip && hasOverflowClip) {
|
|
|
|
clipRect.IntersectRect(clipRect, overflowClipRect);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Set clipping of child views.
|
|
|
|
if (hasClip) {
|
|
|
|
aView->SetChildClip(clipRect.x, clipRect.y, clipRect.XMost(), clipRect.YMost());
|
1999-11-19 15:33:29 +00:00
|
|
|
} else {
|
2000-04-25 04:43:11 +00:00
|
|
|
aView->SetChildClip(overflowClipRect.x, overflowClipRect.y,
|
|
|
|
overflowClipRect.XMost(), overflowClipRect.YMost());
|
1999-11-19 15:33:29 +00:00
|
|
|
}
|
2000-04-25 04:43:11 +00:00
|
|
|
PRUint32 vflags;
|
|
|
|
aView->GetViewFlags(&vflags);
|
|
|
|
aView->SetViewFlags(vflags | NS_VIEW_PUBLIC_FLAG_CLIPCHILDREN);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
// Remove clipping of child views.
|
|
|
|
PRUint32 vflags;
|
|
|
|
aView->GetViewFlags(&vflags);
|
|
|
|
aView->SetViewFlags(vflags & ~NS_VIEW_PUBLIC_FLAG_CLIPCHILDREN);
|
1999-11-19 15:33:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_RELEASE(vm);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1998-09-30 21:35:29 +00:00
|
|
|
/**
|
1999-11-19 15:33:29 +00:00
|
|
|
* Invokes the WillReflow() function, positions the frame and its view (if
|
|
|
|
* requested), and then calls Reflow(). If the reflow succeeds and the child
|
|
|
|
* frame is complete, deletes any next-in-flows using DeleteChildsNextInFlow()
|
1998-09-30 21:35:29 +00:00
|
|
|
*/
|
1998-10-06 00:27:22 +00:00
|
|
|
nsresult
|
|
|
|
nsContainerFrame::ReflowChild(nsIFrame* aKidFrame,
|
1999-11-24 06:03:41 +00:00
|
|
|
nsIPresContext* aPresContext,
|
1998-10-06 00:27:22 +00:00
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
1999-11-19 15:33:29 +00:00
|
|
|
nscoord aX,
|
|
|
|
nscoord aY,
|
|
|
|
PRUint32 aFlags,
|
1998-10-06 00:27:22 +00:00
|
|
|
nsReflowStatus& aStatus)
|
1998-09-30 21:35:29 +00:00
|
|
|
{
|
|
|
|
NS_PRECONDITION(aReflowState.frame == aKidFrame, "bad reflow state");
|
|
|
|
|
1999-10-30 02:52:11 +00:00
|
|
|
nsresult result;
|
1998-09-30 21:35:29 +00:00
|
|
|
|
1999-03-08 19:25:18 +00:00
|
|
|
#ifdef DEBUG
|
1999-07-14 17:27:48 +00:00
|
|
|
nsSize* saveMaxElementSize = aDesiredSize.maxElementSize;
|
|
|
|
#ifdef REALLY_NOISY_MAX_ELEMENT_SIZE
|
1999-03-08 19:25:18 +00:00
|
|
|
if (nsnull != aDesiredSize.maxElementSize) {
|
|
|
|
aDesiredSize.maxElementSize->width = nscoord(0xdeadbeef);
|
|
|
|
aDesiredSize.maxElementSize->height = nscoord(0xdeadbeef);
|
|
|
|
}
|
1999-07-14 17:27:48 +00:00
|
|
|
#endif
|
1999-03-08 19:25:18 +00:00
|
|
|
#endif
|
|
|
|
|
1999-11-19 15:33:29 +00:00
|
|
|
// Send the WillReflow() notification, and position the child frame
|
|
|
|
// and its view if requested
|
1999-10-30 02:52:11 +00:00
|
|
|
aKidFrame->WillReflow(aPresContext);
|
1999-11-19 15:33:29 +00:00
|
|
|
|
|
|
|
if (0 == (aFlags & NS_FRAME_NO_MOVE_FRAME)) {
|
1999-11-24 06:03:41 +00:00
|
|
|
aKidFrame->MoveTo(aPresContext, aX, aY);
|
1999-11-19 15:33:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (0 == (aFlags & NS_FRAME_NO_MOVE_VIEW)) {
|
|
|
|
nsIView* view;
|
1999-11-24 06:03:41 +00:00
|
|
|
aKidFrame->GetView(aPresContext, &view);
|
1999-11-19 15:33:29 +00:00
|
|
|
if (view) {
|
1999-11-24 06:03:41 +00:00
|
|
|
PositionFrameView(aPresContext, aKidFrame, view);
|
1999-11-19 15:33:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Reflow the child frame
|
1999-10-30 02:52:11 +00:00
|
|
|
result = aKidFrame->Reflow(aPresContext, aDesiredSize, aReflowState,
|
|
|
|
aStatus);
|
1998-10-06 00:27:22 +00:00
|
|
|
|
1999-03-08 19:25:18 +00:00
|
|
|
#ifdef DEBUG
|
1999-07-14 17:27:48 +00:00
|
|
|
if (saveMaxElementSize != aDesiredSize.maxElementSize) {
|
2000-10-28 22:17:53 +00:00
|
|
|
printf("nsContainerFrame: ");
|
1999-07-14 17:27:48 +00:00
|
|
|
nsFrame::ListTag(stdout, aKidFrame);
|
2000-10-28 22:17:53 +00:00
|
|
|
printf(" changed the maxElementSize *pointer* (baaaad boy!)\n");
|
1999-07-14 17:27:48 +00:00
|
|
|
}
|
|
|
|
#ifdef REALLY_NOISY_MAX_ELEMENT_SIZE
|
1999-03-08 19:25:18 +00:00
|
|
|
if ((nsnull != aDesiredSize.maxElementSize) &&
|
|
|
|
((nscoord(0xdeadbeef) == aDesiredSize.maxElementSize->width) ||
|
|
|
|
(nscoord(0xdeadbeef) == aDesiredSize.maxElementSize->height))) {
|
2000-10-28 22:17:53 +00:00
|
|
|
printf("nsContainerFrame: ");
|
1999-03-08 19:25:18 +00:00
|
|
|
nsFrame::ListTag(stdout, aKidFrame);
|
2000-10-28 22:17:53 +00:00
|
|
|
printf(" didn't set max-element-size!\n");
|
1999-03-08 19:25:18 +00:00
|
|
|
aDesiredSize.maxElementSize->width = 0;
|
|
|
|
aDesiredSize.maxElementSize->height = 0;
|
|
|
|
}
|
1999-07-14 17:27:48 +00:00
|
|
|
#endif
|
1999-03-08 19:25:18 +00:00
|
|
|
#endif
|
|
|
|
|
1998-10-06 00:27:22 +00:00
|
|
|
// If the reflow was successful and the child frame is complete, delete any
|
|
|
|
// next-in-flows
|
|
|
|
if (NS_SUCCEEDED(result) && NS_FRAME_IS_COMPLETE(aStatus)) {
|
1998-09-30 21:35:29 +00:00
|
|
|
nsIFrame* kidNextInFlow;
|
1999-02-24 04:48:08 +00:00
|
|
|
aKidFrame->GetNextInFlow(&kidNextInFlow);
|
1998-09-30 21:35:29 +00:00
|
|
|
if (nsnull != kidNextInFlow) {
|
|
|
|
// Remove all of the childs next-in-flows. Make sure that we ask
|
|
|
|
// the right parent to do the removal (it's possible that the
|
|
|
|
// parent is not this because we are executing pullup code)
|
|
|
|
nsIFrame* parent;
|
1999-02-10 01:36:30 +00:00
|
|
|
aKidFrame->GetParent(&parent);
|
1999-01-15 22:53:39 +00:00
|
|
|
((nsContainerFrame*)parent)->DeleteChildsNextInFlow(aPresContext,
|
|
|
|
aKidFrame);
|
1998-09-30 21:35:29 +00:00
|
|
|
}
|
|
|
|
}
|
1998-10-06 00:27:22 +00:00
|
|
|
return result;
|
1998-09-30 21:35:29 +00:00
|
|
|
}
|
|
|
|
|
1999-11-19 15:33:29 +00:00
|
|
|
void
|
|
|
|
nsContainerFrame::PositionChildViews(nsIPresContext* aPresContext,
|
|
|
|
nsIFrame* aFrame)
|
|
|
|
{
|
|
|
|
nsIAtom* childListName = nsnull;
|
|
|
|
PRInt32 childListIndex = 0;
|
|
|
|
|
|
|
|
do {
|
|
|
|
// Recursively walk aFrame's child frames
|
|
|
|
nsIFrame* childFrame;
|
2000-01-22 01:16:50 +00:00
|
|
|
aFrame->FirstChild(aPresContext, childListName, &childFrame);
|
1999-11-19 15:33:29 +00:00
|
|
|
while (childFrame) {
|
|
|
|
nsIView* view;
|
|
|
|
|
|
|
|
// See if the child frame has a view
|
|
|
|
childFrame->GetView(aPresContext, &view);
|
|
|
|
|
|
|
|
if (view) {
|
|
|
|
// Position the view. Because any child views are relative to their
|
|
|
|
// parent, there's no need to recurse
|
|
|
|
PositionFrameView(aPresContext, childFrame, view);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
// Recursively examine its child frames
|
|
|
|
PositionChildViews(aPresContext, childFrame);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Get the next sibling child frame
|
|
|
|
childFrame->GetNextSibling(&childFrame);
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IF_RELEASE(childListName);
|
|
|
|
aFrame->GetAdditionalChildListName(childListIndex++, &childListName);
|
|
|
|
} while (childListName);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The second half of frame reflow. Does the following:
|
|
|
|
* - sets the frame's bounds
|
|
|
|
* - sizes and positions (if requested) the frame's view. If the frame's final
|
|
|
|
* position differs from the current position and the frame itself does not
|
|
|
|
* have a view, then any child frames with views are positioned so they stay
|
|
|
|
* in sync
|
|
|
|
* - sets the view's visibility, opacity, content transparency, and clip
|
|
|
|
* - invoked the DidReflow() function
|
|
|
|
*
|
|
|
|
* Flags:
|
|
|
|
* NS_FRAME_NO_MOVE_FRAME - don't move the frame. aX and aY are ignored in this
|
|
|
|
* case. Also implies NS_FRAME_NO_MOVE_VIEW
|
|
|
|
* NS_FRAME_NO_MOVE_VIEW - don't position the frame's view. Set this if you
|
|
|
|
* don't want to automatically sync the frame and view
|
|
|
|
* NS_FRAME_NO_SIZE_VIEW - don't size the frame's view
|
|
|
|
* NS_FRAME_NO_MOVE_CHILD_VIEWS - don't move child views. This is for the case
|
|
|
|
* where the frame's new position differs from its current position and the
|
|
|
|
* frame itself doesn't have a view, so moving the frame would cause any child
|
|
|
|
* views to be out of sync
|
|
|
|
*/
|
|
|
|
nsresult
|
|
|
|
nsContainerFrame::FinishReflowChild(nsIFrame* aKidFrame,
|
1999-11-24 06:03:41 +00:00
|
|
|
nsIPresContext* aPresContext,
|
1999-11-19 15:33:29 +00:00
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
nscoord aX,
|
|
|
|
nscoord aY,
|
|
|
|
PRUint32 aFlags)
|
|
|
|
{
|
|
|
|
nsPoint curOrigin;
|
|
|
|
nsRect bounds(aX, aY, aDesiredSize.width, aDesiredSize.height);
|
|
|
|
|
|
|
|
aKidFrame->GetOrigin(curOrigin);
|
1999-11-24 06:03:41 +00:00
|
|
|
aKidFrame->SetRect(aPresContext, bounds);
|
1999-11-19 15:33:29 +00:00
|
|
|
|
|
|
|
nsIView* view;
|
1999-11-24 06:03:41 +00:00
|
|
|
aKidFrame->GetView(aPresContext, &view);
|
1999-11-19 15:33:29 +00:00
|
|
|
if (view) {
|
|
|
|
// Make sure the frame's view is properly sized and positioned and has
|
|
|
|
// things like opacity correct
|
1999-11-24 06:03:41 +00:00
|
|
|
SyncFrameViewAfterReflow(aPresContext, aKidFrame, view,
|
1999-12-06 15:49:53 +00:00
|
|
|
&aDesiredSize.mOverflowArea,
|
1999-11-19 15:33:29 +00:00
|
|
|
aFlags);
|
|
|
|
|
|
|
|
} else if (0 == (aFlags & NS_FRAME_NO_MOVE_CHILD_VIEWS)) {
|
|
|
|
// If the frame has moved, then we need to make sure any child views are
|
|
|
|
// correctly positioned
|
|
|
|
if ((curOrigin.x != aX) || (curOrigin.y != aY)) {
|
1999-11-24 06:03:41 +00:00
|
|
|
PositionChildViews(aPresContext, aKidFrame);
|
1999-11-19 15:33:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return aKidFrame->DidReflow(aPresContext, NS_FRAME_REFLOW_FINISHED);
|
|
|
|
}
|
|
|
|
|
1998-09-30 21:35:29 +00:00
|
|
|
/**
|
|
|
|
* Remove and delete aChild's next-in-flow(s). Updates the sibling and flow
|
|
|
|
* pointers
|
|
|
|
*
|
|
|
|
* @param aChild child this child's next-in-flow
|
|
|
|
* @return PR_TRUE if successful and PR_FALSE otherwise
|
|
|
|
*/
|
1999-01-15 22:53:39 +00:00
|
|
|
void
|
1999-11-24 06:03:41 +00:00
|
|
|
nsContainerFrame::DeleteChildsNextInFlow(nsIPresContext* aPresContext,
|
1999-01-15 22:53:39 +00:00
|
|
|
nsIFrame* aChild)
|
1998-09-30 21:35:29 +00:00
|
|
|
{
|
1999-04-12 23:46:02 +00:00
|
|
|
NS_PRECONDITION(mFrames.ContainsFrame(aChild), "bad geometric parent");
|
1998-09-30 21:35:29 +00:00
|
|
|
|
|
|
|
nsIFrame* nextInFlow;
|
|
|
|
nsContainerFrame* parent;
|
|
|
|
|
1999-02-24 04:48:08 +00:00
|
|
|
aChild->GetNextInFlow(&nextInFlow);
|
1998-09-30 21:35:29 +00:00
|
|
|
NS_PRECONDITION(nsnull != nextInFlow, "null next-in-flow");
|
1999-02-10 01:36:30 +00:00
|
|
|
nextInFlow->GetParent((nsIFrame**)&parent);
|
1998-09-30 21:35:29 +00:00
|
|
|
|
|
|
|
// If the next-in-flow has a next-in-flow then delete it, too (and
|
|
|
|
// delete it first).
|
|
|
|
nsIFrame* nextNextInFlow;
|
|
|
|
|
1999-02-24 04:48:08 +00:00
|
|
|
nextInFlow->GetNextInFlow(&nextNextInFlow);
|
1998-09-30 21:35:29 +00:00
|
|
|
if (nsnull != nextNextInFlow) {
|
|
|
|
parent->DeleteChildsNextInFlow(aPresContext, nextInFlow);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Disconnect the next-in-flow from the flow list
|
1999-10-22 14:53:52 +00:00
|
|
|
nsSplittableFrame::BreakFromPrevFlow(nextInFlow);
|
1998-09-30 21:35:29 +00:00
|
|
|
|
|
|
|
// Take the next-in-flow out of the parent's child list
|
1999-02-21 18:59:00 +00:00
|
|
|
PRBool result = parent->mFrames.RemoveFrame(nextInFlow);
|
2000-03-20 23:11:39 +00:00
|
|
|
if (!result) {
|
|
|
|
// We didn't find the child in the parent's principal child list.
|
|
|
|
// Maybe it's on the overflow list?
|
|
|
|
nsFrameList overflowFrames(parent->GetOverflowFrames(aPresContext, PR_TRUE));
|
|
|
|
|
|
|
|
if (overflowFrames.IsEmpty() || !overflowFrames.RemoveFrame(nextInFlow)) {
|
|
|
|
NS_ASSERTION(result, "failed to remove frame");
|
|
|
|
}
|
|
|
|
|
|
|
|
// Set the overflow property again
|
|
|
|
if (overflowFrames.NotEmpty()) {
|
|
|
|
parent->SetOverflowFrames(aPresContext, overflowFrames.FirstChild());
|
|
|
|
}
|
|
|
|
}
|
1998-09-30 21:35:29 +00:00
|
|
|
|
1998-10-06 00:27:22 +00:00
|
|
|
// Delete the next-in-flow frame
|
1999-07-22 02:24:52 +00:00
|
|
|
nextInFlow->Destroy(aPresContext);
|
1998-09-30 21:35:29 +00:00
|
|
|
|
|
|
|
#ifdef NS_DEBUG
|
1999-02-24 04:48:08 +00:00
|
|
|
aChild->GetNextInFlow(&nextInFlow);
|
1998-09-30 21:35:29 +00:00
|
|
|
NS_POSTCONDITION(nsnull == nextInFlow, "non null next-in-flow");
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
1999-10-21 05:11:43 +00:00
|
|
|
nsIFrame*
|
|
|
|
nsContainerFrame::GetOverflowFrames(nsIPresContext* aPresContext,
|
2000-01-22 01:16:50 +00:00
|
|
|
PRBool aRemoveProperty) const
|
1999-10-21 05:11:43 +00:00
|
|
|
{
|
|
|
|
nsCOMPtr<nsIPresShell> presShell;
|
|
|
|
aPresContext->GetShell(getter_AddRefs(presShell));
|
1999-10-22 02:06:22 +00:00
|
|
|
|
1999-10-21 05:11:43 +00:00
|
|
|
if (presShell) {
|
1999-10-22 02:06:22 +00:00
|
|
|
nsCOMPtr<nsIFrameManager> frameManager;
|
1999-10-21 05:11:43 +00:00
|
|
|
presShell->GetFrameManager(getter_AddRefs(frameManager));
|
|
|
|
|
|
|
|
if (frameManager) {
|
|
|
|
PRUint32 options = 0;
|
|
|
|
void* value;
|
|
|
|
|
|
|
|
if (aRemoveProperty) {
|
|
|
|
options |= NS_IFRAME_MGR_REMOVE_PROP;
|
|
|
|
}
|
2000-01-22 01:16:50 +00:00
|
|
|
frameManager->GetFrameProperty((nsIFrame*)this, nsLayoutAtoms::overflowProperty,
|
1999-10-21 05:11:43 +00:00
|
|
|
options, &value);
|
|
|
|
return (nsIFrame*)value;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return nsnull;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Destructor function for the overflow frame property
|
|
|
|
static void
|
|
|
|
DestroyOverflowFrames(nsIPresContext* aPresContext,
|
|
|
|
nsIFrame* aFrame,
|
|
|
|
nsIAtom* aPropertyName,
|
|
|
|
void* aPropertyValue)
|
|
|
|
{
|
|
|
|
if (aPropertyValue) {
|
|
|
|
nsFrameList frames((nsIFrame*)aPropertyValue);
|
|
|
|
|
1999-11-24 06:03:41 +00:00
|
|
|
frames.DestroyFrames(aPresContext);
|
1999-10-21 05:11:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsContainerFrame::SetOverflowFrames(nsIPresContext* aPresContext,
|
|
|
|
nsIFrame* aOverflowFrames)
|
|
|
|
{
|
|
|
|
nsCOMPtr<nsIPresShell> presShell;
|
|
|
|
nsresult rv = NS_ERROR_FAILURE;
|
|
|
|
|
|
|
|
aPresContext->GetShell(getter_AddRefs(presShell));
|
|
|
|
if (presShell) {
|
1999-10-22 02:06:22 +00:00
|
|
|
nsCOMPtr<nsIFrameManager> frameManager;
|
1999-10-21 05:11:43 +00:00
|
|
|
presShell->GetFrameManager(getter_AddRefs(frameManager));
|
|
|
|
|
|
|
|
if (frameManager) {
|
|
|
|
rv = frameManager->SetFrameProperty(this, nsLayoutAtoms::overflowProperty,
|
|
|
|
aOverflowFrames, DestroyOverflowFrames);
|
|
|
|
|
|
|
|
// Verify that we didn't overwrite an existing overflow list
|
|
|
|
NS_ASSERTION(rv != NS_IFRAME_MGR_PROP_OVERWRITTEN,
|
|
|
|
"existing overflow list");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
1998-09-30 21:35:29 +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
|
|
|
|
*/
|
1999-01-15 22:53:39 +00:00
|
|
|
void
|
1999-10-21 05:11:43 +00:00
|
|
|
nsContainerFrame::PushChildren(nsIPresContext* aPresContext,
|
|
|
|
nsIFrame* aFromChild,
|
|
|
|
nsIFrame* aPrevSibling)
|
1998-09-30 21:35:29 +00:00
|
|
|
{
|
|
|
|
NS_PRECONDITION(nsnull != aFromChild, "null pointer");
|
|
|
|
NS_PRECONDITION(nsnull != aPrevSibling, "pushing first child");
|
|
|
|
#ifdef NS_DEBUG
|
|
|
|
nsIFrame* prevNextSibling;
|
1999-02-10 06:13:38 +00:00
|
|
|
aPrevSibling->GetNextSibling(&prevNextSibling);
|
1998-09-30 21:35:29 +00:00
|
|
|
NS_PRECONDITION(prevNextSibling == aFromChild, "bad prev sibling");
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// Disconnect aFromChild from its previous sibling
|
|
|
|
aPrevSibling->SetNextSibling(nsnull);
|
|
|
|
|
1999-01-15 22:53:39 +00:00
|
|
|
if (nsnull != mNextInFlow) {
|
1999-02-01 17:29:58 +00:00
|
|
|
// XXX This is not a very good thing to do. If it gets removed
|
|
|
|
// then remove the copy of this routine that doesn't do this from
|
|
|
|
// nsInlineFrame.
|
1999-01-15 22:53:39 +00:00
|
|
|
nsContainerFrame* nextInFlow = (nsContainerFrame*)mNextInFlow;
|
1999-04-13 00:15:13 +00:00
|
|
|
// When pushing and pulling frames we need to check for whether any
|
|
|
|
// views need to be reparented.
|
|
|
|
for (nsIFrame* f = aFromChild; f; f->GetNextSibling(&f)) {
|
1999-10-26 04:44:41 +00:00
|
|
|
nsHTMLContainerFrame::ReparentFrameView(aPresContext, f, this, mNextInFlow);
|
1999-04-13 00:15:13 +00:00
|
|
|
}
|
1999-01-15 22:53:39 +00:00
|
|
|
nextInFlow->mFrames.InsertFrames(mNextInFlow, nsnull, aFromChild);
|
|
|
|
}
|
|
|
|
else {
|
1998-09-30 21:35:29 +00:00
|
|
|
// Add the frames to our overflow list
|
1999-10-21 05:11:43 +00:00
|
|
|
SetOverflowFrames(aPresContext, aFromChild);
|
1998-09-30 21:35:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Moves any frames on the overflwo lists (the prev-in-flow's overflow list and
|
|
|
|
* the receiver's overflow list) to the child list.
|
|
|
|
*
|
|
|
|
* Updates this frame's child count and content mapping.
|
|
|
|
*
|
|
|
|
* @return PR_TRUE if any frames were moved and PR_FALSE otherwise
|
|
|
|
*/
|
1999-01-15 22:53:39 +00:00
|
|
|
PRBool
|
1999-10-21 05:11:43 +00:00
|
|
|
nsContainerFrame::MoveOverflowToChildList(nsIPresContext* aPresContext)
|
1998-09-30 21:35:29 +00:00
|
|
|
{
|
1999-01-15 22:53:39 +00:00
|
|
|
PRBool result = PR_FALSE;
|
1998-09-30 21:35:29 +00:00
|
|
|
|
|
|
|
// Check for an overflow list with our prev-in-flow
|
|
|
|
nsContainerFrame* prevInFlow = (nsContainerFrame*)mPrevInFlow;
|
|
|
|
if (nsnull != prevInFlow) {
|
1999-10-21 05:11:43 +00:00
|
|
|
nsIFrame* prevOverflowFrames = prevInFlow->GetOverflowFrames(aPresContext,
|
|
|
|
PR_TRUE);
|
|
|
|
if (prevOverflowFrames) {
|
1999-01-15 22:53:39 +00:00
|
|
|
NS_ASSERTION(mFrames.IsEmpty(), "bad overflow list");
|
1999-04-13 00:15:13 +00:00
|
|
|
// When pushing and pulling frames we need to check for whether any
|
|
|
|
// views need to be reparented.
|
1999-10-21 05:11:43 +00:00
|
|
|
for (nsIFrame* f = prevOverflowFrames; f; f->GetNextSibling(&f)) {
|
1999-10-26 04:44:41 +00:00
|
|
|
nsHTMLContainerFrame::ReparentFrameView(aPresContext, f, prevInFlow, this);
|
1999-04-13 00:15:13 +00:00
|
|
|
}
|
1999-10-21 05:11:43 +00:00
|
|
|
mFrames.InsertFrames(this, nsnull, prevOverflowFrames);
|
1998-09-30 21:35:29 +00:00
|
|
|
result = PR_TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// It's also possible that we have an overflow list for ourselves
|
1999-10-21 05:11:43 +00:00
|
|
|
nsIFrame* overflowFrames = GetOverflowFrames(aPresContext, PR_TRUE);
|
|
|
|
if (overflowFrames) {
|
1999-01-15 22:53:39 +00:00
|
|
|
NS_ASSERTION(mFrames.NotEmpty(), "overflow list w/o frames");
|
1999-10-21 05:11:43 +00:00
|
|
|
mFrames.AppendFrames(nsnull, overflowFrames);
|
1998-09-30 21:35:29 +00:00
|
|
|
result = PR_TRUE;
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Debugging
|
|
|
|
|
1999-11-01 22:12:45 +00:00
|
|
|
#ifdef NS_DEBUG
|
1998-11-19 17:22:29 +00:00
|
|
|
NS_IMETHODIMP
|
1999-10-26 04:44:41 +00:00
|
|
|
nsContainerFrame::List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) const
|
1998-09-30 21:35:29 +00:00
|
|
|
{
|
1999-01-16 00:00:50 +00:00
|
|
|
IndentBy(out, aIndent);
|
|
|
|
ListTag(out);
|
2000-07-27 05:16:08 +00:00
|
|
|
#ifdef DEBUG_waterson
|
|
|
|
fprintf(out, " [parent=%p]", mParent);
|
|
|
|
#endif
|
1999-01-16 00:00:50 +00:00
|
|
|
nsIView* view;
|
1999-10-26 04:44:41 +00:00
|
|
|
GetView(aPresContext, &view);
|
1999-01-16 00:00:50 +00:00
|
|
|
if (nsnull != view) {
|
|
|
|
fprintf(out, " [view=%p]", view);
|
|
|
|
}
|
1999-04-27 22:11:21 +00:00
|
|
|
if (nsnull != mNextSibling) {
|
|
|
|
fprintf(out, " next=%p", mNextSibling);
|
|
|
|
}
|
1999-01-16 00:00:50 +00:00
|
|
|
if (nsnull != mPrevInFlow) {
|
1999-02-01 17:29:58 +00:00
|
|
|
fprintf(out, " prev-in-flow=%p", mPrevInFlow);
|
1999-01-16 00:00:50 +00:00
|
|
|
}
|
|
|
|
if (nsnull != mNextInFlow) {
|
1999-02-01 17:29:58 +00:00
|
|
|
fprintf(out, " next-in-flow=%p", mNextInFlow);
|
1998-09-30 21:35:29 +00:00
|
|
|
}
|
1999-03-05 04:22:54 +00:00
|
|
|
fprintf(out, " {%d,%d,%d,%d}", mRect.x, mRect.y, mRect.width, mRect.height);
|
1999-01-16 00:19:10 +00:00
|
|
|
if (0 != mState) {
|
|
|
|
fprintf(out, " [state=%08x]", mState);
|
|
|
|
}
|
1999-04-27 22:11:21 +00:00
|
|
|
fprintf(out, " sc=%p", mStyleContext);
|
1999-01-16 00:19:10 +00:00
|
|
|
|
1998-09-30 21:35:29 +00:00
|
|
|
// Output the children
|
1999-01-16 00:19:10 +00:00
|
|
|
nsIAtom* listName = nsnull;
|
|
|
|
PRInt32 listIndex = 0;
|
|
|
|
PRBool outputOneList = PR_FALSE;
|
|
|
|
do {
|
|
|
|
nsIFrame* kid;
|
2000-01-22 01:16:50 +00:00
|
|
|
FirstChild(aPresContext, listName, &kid);
|
1999-01-16 00:19:10 +00:00
|
|
|
if (nsnull != kid) {
|
1999-02-01 17:29:58 +00:00
|
|
|
if (outputOneList) {
|
|
|
|
IndentBy(out, aIndent);
|
|
|
|
}
|
1999-01-16 00:19:10 +00:00
|
|
|
outputOneList = PR_TRUE;
|
|
|
|
nsAutoString tmp;
|
|
|
|
if (nsnull != listName) {
|
|
|
|
listName->ToString(tmp);
|
|
|
|
fputs(tmp, out);
|
|
|
|
}
|
|
|
|
fputs("<\n", out);
|
|
|
|
while (nsnull != kid) {
|
2000-01-22 01:16:50 +00:00
|
|
|
// Verify the child frame's parent frame pointer is correct
|
|
|
|
nsIFrame* parentFrame;
|
|
|
|
kid->GetParent(&parentFrame);
|
|
|
|
NS_ASSERTION(parentFrame == (nsIFrame*)this, "bad parent frame pointer");
|
1999-11-01 22:12:45 +00:00
|
|
|
|
2000-01-22 01:16:50 +00:00
|
|
|
// Have the child frame list
|
|
|
|
nsIFrameDebug* frameDebug;
|
2000-02-02 22:24:56 +00:00
|
|
|
if (NS_SUCCEEDED(kid->QueryInterface(NS_GET_IID(nsIFrameDebug), (void**)&frameDebug))) {
|
1999-11-01 22:12:45 +00:00
|
|
|
frameDebug->List(aPresContext, out, aIndent + 1);
|
|
|
|
}
|
1999-02-10 06:13:38 +00:00
|
|
|
kid->GetNextSibling(&kid);
|
1999-01-16 00:19:10 +00:00
|
|
|
}
|
|
|
|
IndentBy(out, aIndent);
|
|
|
|
fputs(">\n", out);
|
1998-09-30 21:35:29 +00:00
|
|
|
}
|
1999-01-16 00:19:10 +00:00
|
|
|
NS_IF_RELEASE(listName);
|
1999-02-10 02:25:01 +00:00
|
|
|
GetAdditionalChildListName(listIndex++, &listName);
|
1999-01-16 00:19:10 +00:00
|
|
|
} while(nsnull != listName);
|
|
|
|
|
|
|
|
if (!outputOneList) {
|
1999-01-16 00:00:50 +00:00
|
|
|
fputs("<>\n", out);
|
1998-09-30 21:35:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
1999-08-31 03:09:40 +00:00
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsContainerFrame::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const
|
|
|
|
{
|
1999-09-01 01:02:16 +00:00
|
|
|
if (!aResult) {
|
|
|
|
return NS_ERROR_NULL_POINTER;
|
1999-08-31 03:09:40 +00:00
|
|
|
}
|
1999-09-01 01:02:16 +00:00
|
|
|
*aResult = sizeof(*this);
|
|
|
|
return NS_OK;
|
1999-08-31 03:09:40 +00:00
|
|
|
}
|
1999-09-01 01:02:16 +00:00
|
|
|
#endif
|