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-04-14 00:24:54 +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-04-14 00:24:54 +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-04-14 00:24:54 +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):
|
|
|
|
*
|
|
|
|
* 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
|
|
|
|
|
|
|
/*
|
|
|
|
* rendering object for the point that anchors out-of-flow rendering
|
|
|
|
* objects such as floats and absolutely positioned elements
|
|
|
|
*/
|
|
|
|
|
2006-11-06 04:17:32 +03:00
|
|
|
/*
|
|
|
|
* Destruction of a placeholder and its out-of-flow must observe the
|
|
|
|
* following constraints:
|
|
|
|
*
|
|
|
|
* - The mapping from the out-of-flow to the placeholder must be
|
|
|
|
* removed from the frame manager before the placeholder is destroyed.
|
|
|
|
* - The mapping from the out-of-flow to the placeholder must be
|
|
|
|
* removed from the frame manager before the out-of-flow is destroyed.
|
|
|
|
* - The placeholder must be removed from the frame tree, or have the
|
|
|
|
* mapping from it to its out-of-flow cleared, before the out-of-flow
|
|
|
|
* is destroyed (so that the placeholder will not point to a destroyed
|
|
|
|
* frame while it's in the frame tree).
|
|
|
|
*
|
|
|
|
* Therefore the safe order of teardown is to:
|
|
|
|
*
|
|
|
|
* 1) Unregister the placeholder from the frame manager.
|
|
|
|
* 2) Destroy the placeholder
|
|
|
|
* 3) Destroy the out of flow
|
|
|
|
*
|
|
|
|
* In certain cases it may be possible to replace step (2) with:
|
|
|
|
*
|
|
|
|
* 2') Null out the mOutOfFlowFrame pointer in the placeholder
|
|
|
|
*
|
|
|
|
* and add
|
|
|
|
*
|
|
|
|
* 4) Destroy the placeholder
|
|
|
|
*
|
|
|
|
* but this is somewhat dangerous, since lots of code assumes that
|
|
|
|
* placeholders point to something useful.
|
|
|
|
*/
|
|
|
|
|
1998-04-14 00:24:54 +04:00
|
|
|
#ifndef nsPlaceholderFrame_h___
|
|
|
|
#define nsPlaceholderFrame_h___
|
|
|
|
|
2002-05-29 02:50:43 +04:00
|
|
|
#include "nsSplittableFrame.h"
|
2007-01-30 03:06:41 +03:00
|
|
|
#include "nsGkAtoms.h"
|
1998-04-14 00:24:54 +04:00
|
|
|
|
2006-03-27 01:30:36 +04:00
|
|
|
nsIFrame* NS_NewPlaceholderFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
|
2002-01-10 17:16:05 +03:00
|
|
|
|
1998-11-14 22:26:57 +03:00
|
|
|
/**
|
1999-04-23 18:34:48 +04:00
|
|
|
* Implementation of a frame that's used as a placeholder for a frame that
|
|
|
|
* has been moved out of the flow
|
1998-11-14 22:26:57 +03:00
|
|
|
*/
|
2002-05-29 02:50:43 +04:00
|
|
|
class nsPlaceholderFrame : public nsSplittableFrame {
|
1998-04-14 00:24:54 +04:00
|
|
|
public:
|
|
|
|
/**
|
|
|
|
* Create a new placeholder frame
|
|
|
|
*/
|
2006-03-27 01:30:36 +04:00
|
|
|
friend nsIFrame* NS_NewPlaceholderFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
|
|
|
|
nsPlaceholderFrame(nsStyleContext* aContext) : nsSplittableFrame(aContext) {}
|
2002-09-25 02:13:20 +04:00
|
|
|
virtual ~nsPlaceholderFrame();
|
1998-04-14 00:24:54 +04:00
|
|
|
|
1999-04-23 18:34:48 +04:00
|
|
|
// Get/Set the associated out of flow frame
|
1999-05-04 00:54:24 +04:00
|
|
|
nsIFrame* GetOutOfFlowFrame() const {return mOutOfFlowFrame;}
|
|
|
|
void SetOutOfFlowFrame(nsIFrame* aFrame) {mOutOfFlowFrame = aFrame;}
|
1998-04-14 00:24:54 +04:00
|
|
|
|
1998-10-03 08:28:05 +04:00
|
|
|
// nsIHTMLReflow overrides
|
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
|
|
|
// We need to override GetMinWidth and GetPrefWidth because XUL uses
|
|
|
|
// placeholders not within lines.
|
|
|
|
virtual nscoord GetMinWidth(nsIRenderingContext *aRenderingContext);
|
|
|
|
virtual nscoord GetPrefWidth(nsIRenderingContext *aRenderingContext);
|
|
|
|
virtual void AddInlineMinWidth(nsIRenderingContext *aRenderingContext,
|
|
|
|
InlineMinWidthData *aData);
|
|
|
|
virtual void AddInlinePrefWidth(nsIRenderingContext *aRenderingContext,
|
|
|
|
InlinePrefWidthData *aData);
|
2004-08-01 03:15:21 +04:00
|
|
|
NS_IMETHOD Reflow(nsPresContext* aPresContext,
|
1998-10-03 08:28:05 +04:00
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
|
|
|
nsReflowStatus& aStatus);
|
|
|
|
|
2006-04-10 04:16:29 +04:00
|
|
|
virtual void Destroy();
|
2006-12-20 06:52:34 +03:00
|
|
|
virtual nsSplittableType GetSplittableType() const;
|
2005-03-23 06:35:08 +03:00
|
|
|
|
1998-10-03 08:28:05 +04:00
|
|
|
// nsIFrame overrides
|
2006-09-19 08:26:20 +04:00
|
|
|
#if defined(DEBUG) || (defined(MOZ_REFLOW_PERF_DSP) && defined(MOZ_REFLOW_PERF))
|
2006-01-26 05:29:17 +03:00
|
|
|
NS_IMETHOD BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
const nsDisplayListSet& aLists);
|
2006-09-19 08:26:20 +04:00
|
|
|
#endif // DEBUG || (MOZ_REFLOW_PERF_DSP && MOZ_REFLOW_PERF)
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
2005-09-07 01:34:50 +04:00
|
|
|
NS_IMETHOD List(FILE* out, PRInt32 aIndent) const;
|
2006-09-19 08:26:20 +04:00
|
|
|
#endif // DEBUG
|
1998-07-01 01:35:07 +04:00
|
|
|
|
1999-04-23 18:34:48 +04:00
|
|
|
/**
|
|
|
|
* Get the "type" of the frame
|
|
|
|
*
|
2006-12-26 20:47:52 +03:00
|
|
|
* @see nsGkAtoms::placeholderFrame
|
1999-04-23 18:34:48 +04:00
|
|
|
*/
|
2003-10-31 23:19:18 +03:00
|
|
|
virtual nsIAtom* GetType() const;
|
1999-04-23 18:34:48 +04:00
|
|
|
|
1999-09-01 05:02:16 +04:00
|
|
|
#ifdef DEBUG
|
2001-11-14 04:33:42 +03:00
|
|
|
NS_IMETHOD GetFrameName(nsAString& aResult) const;
|
1999-09-01 05:02:16 +04:00
|
|
|
#endif
|
1998-04-14 00:24:54 +04:00
|
|
|
|
2004-11-14 23:22:58 +03:00
|
|
|
virtual PRBool IsEmpty() { return PR_TRUE; }
|
2004-11-15 08:01:11 +03:00
|
|
|
virtual PRBool IsSelfEmpty() { return PR_TRUE; }
|
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 PRBool CanContinueTextRun() const;
|
2006-10-19 05:47:47 +04:00
|
|
|
|
2005-09-23 01:59:06 +04:00
|
|
|
#ifdef ACCESSIBILITY
|
|
|
|
NS_IMETHOD GetAccessible(nsIAccessible** aAccessible)
|
|
|
|
{
|
|
|
|
nsIFrame *realFrame = GetRealFrameForPlaceholder(this);
|
|
|
|
return realFrame ? realFrame->GetAccessible(aAccessible) :
|
|
|
|
nsSplittableFrame::GetAccessible(aAccessible);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2005-04-14 19:30:35 +04:00
|
|
|
/**
|
|
|
|
* @return the out-of-flow for aFrame if aFrame is a placeholder; otherwise
|
|
|
|
* aFrame
|
|
|
|
*/
|
|
|
|
static nsIFrame* GetRealFrameFor(nsIFrame* aFrame) {
|
|
|
|
NS_PRECONDITION(aFrame, "Must have a frame to work with");
|
2006-12-26 20:47:52 +03:00
|
|
|
if (aFrame->GetType() == nsGkAtoms::placeholderFrame) {
|
2005-04-14 19:30:35 +04:00
|
|
|
return GetRealFrameForPlaceholder(aFrame);
|
|
|
|
}
|
|
|
|
return aFrame;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return the out-of-flow for aFrame, which is known to be a placeholder
|
|
|
|
*/
|
|
|
|
static nsIFrame* GetRealFrameForPlaceholder(nsIFrame* aFrame) {
|
2006-12-26 20:47:52 +03:00
|
|
|
NS_PRECONDITION(aFrame->GetType() == nsGkAtoms::placeholderFrame,
|
2005-04-14 19:30:35 +04:00
|
|
|
"Must have placeholder frame as input");
|
|
|
|
nsIFrame* outOfFlow =
|
2007-07-08 11:08:04 +04:00
|
|
|
static_cast<nsPlaceholderFrame*>(aFrame)->GetOutOfFlowFrame();
|
2005-04-14 19:30:35 +04:00
|
|
|
NS_ASSERTION(outOfFlow, "Null out-of-flow for placeholder?");
|
|
|
|
return outOfFlow;
|
|
|
|
}
|
|
|
|
|
1998-04-14 00:24:54 +04:00
|
|
|
protected:
|
1999-04-23 18:34:48 +04:00
|
|
|
nsIFrame* mOutOfFlowFrame;
|
1998-04-14 00:24:54 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* nsPlaceholderFrame_h___ */
|