2007-03-22 10:30:00 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
// vim:cindent:ts=2:et:sw=2:
|
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
|
|
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
|
|
|
*
|
|
|
|
* 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/
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* The Original Code is Mozilla Communicator client code.
|
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is
|
|
|
|
* Netscape Communications Corporation.
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 1998
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s):
|
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
|
|
|
* 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"),
|
|
|
|
* 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
|
|
|
|
* use your version of this file under the terms of the MPL, indicate your
|
|
|
|
* 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
|
|
|
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
|
|
|
|
|
|
|
/*
|
2007-12-12 13:49:14 -08:00
|
|
|
* rendering object for CSS display:block, inline-block, and list-item
|
|
|
|
* boxes, also used for various anonymous boxes
|
2007-03-22 10:30:00 -07:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef nsBlockFrame_h___
|
|
|
|
#define nsBlockFrame_h___
|
|
|
|
|
|
|
|
#include "nsHTMLContainerFrame.h"
|
|
|
|
#include "nsHTMLParts.h"
|
|
|
|
#include "nsAbsoluteContainingBlock.h"
|
|
|
|
#include "nsLineBox.h"
|
|
|
|
#include "nsCSSPseudoElements.h"
|
|
|
|
#include "nsStyleSet.h"
|
2009-05-20 04:21:34 -07:00
|
|
|
#include "nsFloatManager.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
enum LineReflowStatus {
|
|
|
|
// The line was completely reflowed and fit in available width, and we should
|
|
|
|
// try to pull up content from the next line if possible.
|
|
|
|
LINE_REFLOW_OK,
|
|
|
|
// The line was completely reflowed and fit in available width, but we should
|
|
|
|
// not try to pull up content from the next line.
|
|
|
|
LINE_REFLOW_STOP,
|
|
|
|
// We need to reflow the line again at its current vertical position. The
|
|
|
|
// new reflow should not try to pull up any frames from the next line.
|
|
|
|
LINE_REFLOW_REDO_NO_PULL,
|
2009-05-20 04:21:34 -07:00
|
|
|
// We need to reflow the line again using the floats from its height
|
|
|
|
// this reflow, since its height made it hit floats that were not
|
|
|
|
// adjacent to its top.
|
|
|
|
LINE_REFLOW_REDO_MORE_FLOATS,
|
2007-03-22 10:30:00 -07:00
|
|
|
// We need to reflow the line again at a lower vertical postion where there
|
|
|
|
// may be more horizontal space due to different float configuration.
|
|
|
|
LINE_REFLOW_REDO_NEXT_BAND,
|
|
|
|
// The line did not fit in the available vertical space. Try pushing it to
|
|
|
|
// the next page or column if it's not the first line on the current page/column.
|
|
|
|
LINE_REFLOW_TRUNCATED
|
|
|
|
};
|
|
|
|
|
|
|
|
class nsBlockReflowState;
|
2007-08-22 02:08:13 -07:00
|
|
|
class nsBlockInFlowLineIterator;
|
2007-03-22 10:30:00 -07:00
|
|
|
class nsBulletFrame;
|
|
|
|
class nsLineBox;
|
|
|
|
class nsFirstLineFrame;
|
|
|
|
class nsIntervalSet;
|
|
|
|
/**
|
|
|
|
* Child list name indices
|
|
|
|
* @see #GetAdditionalChildListName()
|
|
|
|
*/
|
2007-07-25 21:03:29 -07:00
|
|
|
#define NS_BLOCK_LIST_COUNT (NS_CONTAINER_LIST_COUNT_INCL_OC + 4)
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Some invariants:
|
|
|
|
* -- The overflow out-of-flows list contains the out-of-
|
|
|
|
* flow frames whose placeholders are in the overflow list.
|
|
|
|
* -- A given piece of content has at most one placeholder
|
|
|
|
* frame in a block's normal child list.
|
2009-08-31 11:25:36 -07:00
|
|
|
* -- While a block is being reflowed, it may have a floatContinuationProperty
|
|
|
|
* frame property that points to an nsFrameList in its
|
|
|
|
* nsBlockReflowState. This list contains continuations for
|
|
|
|
* floats whose prev-in-flow is in the block's regular float
|
2007-03-22 10:30:00 -07:00
|
|
|
* list. The list is always empty/non-existent after the
|
|
|
|
* block has been reflowed.
|
|
|
|
* -- In all these frame lists, if there are two frames for
|
|
|
|
* the same content appearing in the list, then the frames
|
|
|
|
* appear with the prev-in-flow before the next-in-flow.
|
|
|
|
* -- While reflowing a block, its overflow line list
|
|
|
|
* will usually be empty but in some cases will have lines
|
|
|
|
* (while we reflow the block at its shrink-wrap width).
|
|
|
|
* In this case any new overflowing content must be
|
|
|
|
* prepended to the overflow lines.
|
|
|
|
*/
|
|
|
|
|
|
|
|
// see nsHTMLParts.h for the public block state bits
|
2007-10-11 04:41:04 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Something in the block has changed that requires Bidi resolution to be
|
|
|
|
* performed on the block. This flag must be either set on all blocks in a
|
|
|
|
* continuation chain or none of them.
|
|
|
|
*/
|
2007-09-03 00:00:10 -07:00
|
|
|
#define NS_BLOCK_NEEDS_BIDI_RESOLUTION 0x00100000
|
2007-03-22 10:30:00 -07:00
|
|
|
#define NS_BLOCK_HAS_LINE_CURSOR 0x01000000
|
|
|
|
#define NS_BLOCK_HAS_OVERFLOW_LINES 0x02000000
|
|
|
|
#define NS_BLOCK_HAS_OVERFLOW_OUT_OF_FLOWS 0x04000000
|
|
|
|
|
|
|
|
// Set on any block that has descendant frames in the normal
|
|
|
|
// flow with 'clear' set to something other than 'none'
|
|
|
|
// (including <BR CLEAR="..."> frames)
|
2009-08-31 11:25:36 -07:00
|
|
|
#define NS_BLOCK_HAS_CLEAR_CHILDREN 0x08000000
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
#define nsBlockFrameSuper nsHTMLContainerFrame
|
|
|
|
|
|
|
|
/*
|
|
|
|
* 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 nsGkAtoms::absoluteList
|
|
|
|
*/
|
|
|
|
class nsBlockFrame : public nsBlockFrameSuper
|
|
|
|
{
|
|
|
|
public:
|
2009-09-12 09:49:24 -07:00
|
|
|
NS_DECL_QUERYFRAME_TARGET(nsBlockFrame)
|
|
|
|
NS_DECL_FRAMEARENA_HELPERS
|
2009-01-12 11:20:59 -08:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
typedef nsLineList::iterator line_iterator;
|
|
|
|
typedef nsLineList::const_iterator const_line_iterator;
|
|
|
|
typedef nsLineList::reverse_iterator reverse_line_iterator;
|
|
|
|
typedef nsLineList::const_reverse_iterator const_reverse_line_iterator;
|
|
|
|
|
|
|
|
line_iterator begin_lines() { return mLines.begin(); }
|
|
|
|
line_iterator end_lines() { return mLines.end(); }
|
|
|
|
const_line_iterator begin_lines() const { return mLines.begin(); }
|
|
|
|
const_line_iterator end_lines() const { return mLines.end(); }
|
|
|
|
reverse_line_iterator rbegin_lines() { return mLines.rbegin(); }
|
|
|
|
reverse_line_iterator rend_lines() { return mLines.rend(); }
|
|
|
|
const_reverse_line_iterator rbegin_lines() const { return mLines.rbegin(); }
|
|
|
|
const_reverse_line_iterator rend_lines() const { return mLines.rend(); }
|
|
|
|
|
|
|
|
friend nsIFrame* NS_NewBlockFrame(nsIPresShell* aPresShell, nsStyleContext* aContext, PRUint32 aFlags);
|
|
|
|
|
2009-01-12 11:20:59 -08:00
|
|
|
// nsQueryFrame
|
|
|
|
NS_DECL_QUERYFRAME
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// nsIFrame
|
|
|
|
NS_IMETHOD Init(nsIContent* aContent,
|
|
|
|
nsIFrame* aParent,
|
|
|
|
nsIFrame* aPrevInFlow);
|
|
|
|
NS_IMETHOD SetInitialChildList(nsIAtom* aListName,
|
2009-07-28 05:53:20 -07:00
|
|
|
nsFrameList& aChildList);
|
2007-03-22 10:30:00 -07:00
|
|
|
NS_IMETHOD AppendFrames(nsIAtom* aListName,
|
2009-07-30 10:23:32 -07:00
|
|
|
nsFrameList& aFrameList);
|
2007-03-22 10:30:00 -07:00
|
|
|
NS_IMETHOD InsertFrames(nsIAtom* aListName,
|
|
|
|
nsIFrame* aPrevFrame,
|
2009-07-30 10:23:32 -07:00
|
|
|
nsFrameList& aFrameList);
|
2007-03-22 10:30:00 -07:00
|
|
|
NS_IMETHOD RemoveFrame(nsIAtom* aListName,
|
|
|
|
nsIFrame* aOldFrame);
|
2009-07-28 05:51:09 -07:00
|
|
|
virtual nsFrameList GetChildList(nsIAtom* aListName) const;
|
2007-03-22 10:30:00 -07:00
|
|
|
virtual nscoord GetBaseline() const;
|
|
|
|
virtual nsIAtom* GetAdditionalChildListName(PRInt32 aIndex) const;
|
2009-12-23 21:21:15 -08:00
|
|
|
virtual void DestroyFrom(nsIFrame* aDestructRoot);
|
2007-03-22 10:30:00 -07:00
|
|
|
virtual nsSplittableType GetSplittableType() const;
|
|
|
|
virtual PRBool IsContainingBlock() const;
|
|
|
|
virtual PRBool IsFloatContainingBlock() const;
|
|
|
|
NS_IMETHOD BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
const nsDisplayListSet& aLists);
|
|
|
|
virtual void InvalidateInternal(const nsRect& aDamageRect,
|
|
|
|
nscoord aX, nscoord aY, nsIFrame* aForChild,
|
2008-09-18 02:47:21 -07:00
|
|
|
PRUint32 aFlags);
|
2007-03-22 10:30:00 -07:00
|
|
|
virtual nsIAtom* GetType() const;
|
2007-07-25 21:03:29 -07:00
|
|
|
virtual PRBool IsFrameOfType(PRUint32 aFlags) const
|
|
|
|
{
|
|
|
|
return nsContainerFrame::IsFrameOfType(aFlags &
|
2008-01-28 23:40:05 -08:00
|
|
|
~(nsIFrame::eCanContainOverflowContainers |
|
|
|
|
nsIFrame::eBlockFrame));
|
2007-07-25 21:03:29 -07:00
|
|
|
}
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
#ifdef DEBUG
|
|
|
|
NS_IMETHOD List(FILE* out, PRInt32 aIndent) const;
|
|
|
|
NS_IMETHOD_(nsFrameState) GetDebugStateBits() const;
|
|
|
|
NS_IMETHOD GetFrameName(nsAString& aResult) const;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef ACCESSIBILITY
|
|
|
|
NS_IMETHOD GetAccessible(nsIAccessible** aAccessible);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// line cursor methods to speed up searching for the line(s)
|
|
|
|
// containing a point. The basic idea is that we set the cursor
|
|
|
|
// property if the lines' combinedArea.ys and combinedArea.yMosts
|
|
|
|
// are non-decreasing (considering only non-empty combinedAreas;
|
|
|
|
// empty combinedAreas never participate in event handling or
|
|
|
|
// painting), and the block has sufficient number of lines. The
|
|
|
|
// cursor property points to a "recently used" line. If we get a
|
|
|
|
// series of requests that work on lines
|
|
|
|
// "near" the cursor, then we can find those nearby lines quickly by
|
|
|
|
// starting our search at the cursor.
|
|
|
|
|
|
|
|
// Clear out line cursor because we're disturbing the lines (i.e., Reflow)
|
|
|
|
void ClearLineCursor();
|
|
|
|
// Get the first line that might contain y-coord 'y', or nsnull if you must search
|
|
|
|
// all lines. If nonnull is returned then we guarantee that the lines'
|
|
|
|
// combinedArea.ys and combinedArea.yMosts are non-decreasing.
|
|
|
|
// The actual line returned might not contain 'y', but if not, it is guaranteed
|
|
|
|
// to be before any line which does contain 'y'.
|
|
|
|
nsLineBox* GetFirstLineContaining(nscoord y);
|
|
|
|
// Set the line cursor to our first line. Only call this if you
|
|
|
|
// guarantee that the lines' combinedArea.ys and combinedArea.yMosts
|
|
|
|
// are non-decreasing.
|
|
|
|
void SetupLineCursor();
|
|
|
|
|
|
|
|
virtual void ChildIsDirty(nsIFrame* aChild);
|
|
|
|
virtual PRBool IsVisibleInSelection(nsISelection* aSelection);
|
|
|
|
|
|
|
|
virtual PRBool IsEmpty();
|
|
|
|
virtual PRBool CachedIsEmpty();
|
|
|
|
virtual PRBool IsSelfEmpty();
|
|
|
|
|
2009-09-11 03:46:36 -07:00
|
|
|
// Given that we have a bullet, does it actually draw something, i.e.,
|
|
|
|
// do we have either a 'list-style-type' or 'list-style-image' that is
|
|
|
|
// not 'none'?
|
|
|
|
PRBool BulletIsEmpty() const;
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
virtual void MarkIntrinsicWidthsDirty();
|
|
|
|
virtual nscoord GetMinWidth(nsIRenderingContext *aRenderingContext);
|
|
|
|
virtual nscoord GetPrefWidth(nsIRenderingContext *aRenderingContext);
|
|
|
|
|
2007-10-12 01:30:54 -07:00
|
|
|
virtual nsRect ComputeTightBounds(gfxContext* aContext) const;
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
NS_IMETHOD Reflow(nsPresContext* aPresContext,
|
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
|
|
|
nsReflowStatus& aStatus);
|
|
|
|
|
|
|
|
NS_IMETHOD AttributeChanged(PRInt32 aNameSpaceID,
|
|
|
|
nsIAtom* aAttribute,
|
|
|
|
PRInt32 aModType);
|
|
|
|
|
2007-07-25 21:03:29 -07:00
|
|
|
virtual nsresult StealFrame(nsPresContext* aPresContext,
|
|
|
|
nsIFrame* aChild,
|
2009-08-31 11:25:36 -07:00
|
|
|
PRBool aForceNormal = PR_FALSE);
|
2007-07-25 21:03:29 -07:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
virtual void DeleteNextInFlowChild(nsPresContext* aPresContext,
|
2008-12-02 17:27:19 -08:00
|
|
|
nsIFrame* aNextInFlow,
|
|
|
|
PRBool aDeletingEmptyFrames);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Determines whether the collapsed margin carried out of the last
|
|
|
|
* line includes the margin-top of a line with clearance (in which
|
|
|
|
* case we must avoid collapsing that margin with our bottom margin)
|
|
|
|
*/
|
|
|
|
PRBool CheckForCollapsedBottomMarginFromClearanceLine();
|
|
|
|
|
|
|
|
/** 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.
|
|
|
|
*/
|
|
|
|
nsIFrame* GetTopBlockChild(nsPresContext *aPresContext);
|
|
|
|
|
|
|
|
static nsresult GetCurrentLine(nsBlockReflowState *aState, nsLineBox **aOutCurrentLine);
|
|
|
|
|
|
|
|
static PRBool BlockIsMarginRoot(nsIFrame* aBlock);
|
2009-01-04 16:39:54 -08:00
|
|
|
static PRBool BlockNeedsFloatManager(nsIFrame* aBlock);
|
2008-01-28 23:40:05 -08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns whether aFrame is a block frame that will wrap its contents
|
|
|
|
* around floats intruding on it from the outside. (aFrame need not
|
|
|
|
* be a block frame, but if it's not, the result will be false.)
|
|
|
|
*/
|
|
|
|
static PRBool BlockCanIntersectFloats(nsIFrame* aFrame);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the width that needs to be cleared past floats for blocks
|
2008-05-03 16:33:36 -07:00
|
|
|
* that cannot intersect floats. aState must already have
|
|
|
|
* GetAvailableSpace called on it for the vertical position that we
|
|
|
|
* care about (which need not be its current mY)
|
2008-01-28 23:40:05 -08:00
|
|
|
*/
|
2008-04-14 18:05:17 -07:00
|
|
|
struct ReplacedElementWidthToClear {
|
|
|
|
nscoord marginLeft, borderBoxWidth, marginRight;
|
|
|
|
nscoord MarginBoxWidth() const
|
|
|
|
{ return marginLeft + borderBoxWidth + marginRight; }
|
|
|
|
};
|
|
|
|
static ReplacedElementWidthToClear
|
2009-04-08 13:52:37 -07:00
|
|
|
WidthToClearPastFloats(nsBlockReflowState& aState,
|
|
|
|
const nsRect& aFloatAvailableSpace,
|
|
|
|
nsIFrame* aFrame);
|
2008-01-28 23:40:05 -08:00
|
|
|
|
2009-08-31 11:25:36 -07:00
|
|
|
/**
|
|
|
|
* Creates a contination for aFloat and adds it to the list of overflow floats.
|
|
|
|
* Also updates aState.mReflowStatus to include the float's incompleteness.
|
|
|
|
* Must only be called while this block frame is in reflow.
|
|
|
|
* aFloatStatus must be the float's true, unmodified reflow status.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
nsresult SplitFloat(nsBlockReflowState& aState,
|
|
|
|
nsIFrame* aFloat,
|
|
|
|
nsReflowStatus aFloatStatus);
|
|
|
|
|
2007-10-19 10:41:29 -07:00
|
|
|
/**
|
|
|
|
* Walks up the frame tree, starting with aCandidate, and returns the first
|
|
|
|
* block frame that it encounters.
|
|
|
|
*/
|
|
|
|
static nsBlockFrame* GetNearestAncestorBlock(nsIFrame* aCandidate);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
protected:
|
|
|
|
nsBlockFrame(nsStyleContext* aContext)
|
|
|
|
: nsHTMLContainerFrame(aContext)
|
|
|
|
, mMinWidth(NS_INTRINSIC_WIDTH_UNKNOWN)
|
|
|
|
, mPrefWidth(NS_INTRINSIC_WIDTH_UNKNOWN)
|
2007-08-02 15:44:36 -07:00
|
|
|
, mAbsoluteContainer(nsGkAtoms::absoluteList)
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
#ifdef DEBUG
|
|
|
|
InitDebugFlags();
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
virtual ~nsBlockFrame();
|
|
|
|
|
2007-04-15 17:42:54 -07:00
|
|
|
#ifdef DEBUG
|
2007-03-22 10:30:00 -07:00
|
|
|
already_AddRefed<nsStyleContext> GetFirstLetterStyle(nsPresContext* aPresContext)
|
|
|
|
{
|
|
|
|
return aPresContext->StyleSet()->
|
2009-12-10 23:37:40 -08:00
|
|
|
ProbePseudoElementStyle(mContent,
|
|
|
|
nsCSSPseudoElements::ePseudo_firstLetter,
|
|
|
|
mStyleContext);
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
2007-04-15 17:42:54 -07:00
|
|
|
#endif
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Overides member function of nsHTMLContainerFrame. Needed to handle the
|
|
|
|
* lines in a nsBlockFrame properly.
|
|
|
|
*/
|
2008-06-12 15:02:32 -07:00
|
|
|
virtual void PaintTextDecorationLine(gfxContext* aCtx,
|
2008-03-12 19:36:58 -07:00
|
|
|
const nsPoint& aPt,
|
2007-03-22 10:30:00 -07:00
|
|
|
nsLineBox* aLine,
|
|
|
|
nscolor aColor,
|
2008-03-12 19:36:58 -07:00
|
|
|
gfxFloat aOffset,
|
|
|
|
gfxFloat aAscent,
|
|
|
|
gfxFloat aSize,
|
2007-08-06 01:15:00 -07:00
|
|
|
const PRUint8 aDecoration);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2009-09-18 11:18:35 -07:00
|
|
|
virtual void AdjustForTextIndent(const nsLineBox* aLine,
|
|
|
|
nscoord& start,
|
|
|
|
nscoord& width);
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
void TryAllLines(nsLineList::iterator* aIterator,
|
2007-10-07 10:32:07 -07:00
|
|
|
nsLineList::iterator* aStartIterator,
|
2007-03-22 10:30:00 -07:00
|
|
|
nsLineList::iterator* aEndIterator,
|
|
|
|
PRBool* aInOverflowLines);
|
|
|
|
|
|
|
|
void SetFlags(PRUint32 aFlags) {
|
|
|
|
mState &= ~NS_BLOCK_FLAGS_MASK;
|
|
|
|
mState |= aFlags;
|
|
|
|
}
|
|
|
|
|
|
|
|
PRBool HaveOutsideBullet() const {
|
|
|
|
#if defined(DEBUG) && !defined(DEBUG_rods)
|
|
|
|
if(mState & NS_BLOCK_FRAME_HAS_OUTSIDE_BULLET) {
|
|
|
|
NS_ASSERTION(mBullet,"NS_BLOCK_FRAME_HAS_OUTSIDE_BULLET flag set and no mBullet");
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
return 0 != (mState & NS_BLOCK_FRAME_HAS_OUTSIDE_BULLET);
|
|
|
|
}
|
|
|
|
|
|
|
|
/** move the frames contained by aLine by aDY
|
|
|
|
* if aLine is a block, its child floats are added to the state manager
|
|
|
|
*/
|
|
|
|
void SlideLine(nsBlockReflowState& aState,
|
|
|
|
nsLineBox* aLine, nscoord aDY);
|
|
|
|
|
|
|
|
virtual PRIntn GetSkipSides() const;
|
|
|
|
|
|
|
|
virtual void ComputeFinalSize(const nsHTMLReflowState& aReflowState,
|
|
|
|
nsBlockReflowState& aState,
|
2008-12-29 00:18:40 -08:00
|
|
|
nsHTMLReflowMetrics& aMetrics,
|
|
|
|
nscoord* aBottomEdgeOfChildren);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
void ComputeCombinedArea(const nsHTMLReflowState& aReflowState,
|
2008-12-29 00:18:40 -08:00
|
|
|
nsHTMLReflowMetrics& aMetrics,
|
|
|
|
nscoord aBottomEdgeOfChildren);
|
2007-03-22 10:30:00 -07: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.
|
2009-09-29 12:47:05 -07:00
|
|
|
* This function will clear aFrameList.
|
2007-03-22 10:30:00 -07:00
|
|
|
*/
|
2009-09-29 12:47:05 -07:00
|
|
|
virtual nsresult AddFrames(nsFrameList& aFrameList, nsIFrame* aPrevSibling);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
#ifdef IBMBIDI
|
2007-05-28 07:40:56 -07:00
|
|
|
/**
|
|
|
|
* Perform Bidi resolution on this frame
|
|
|
|
*/
|
|
|
|
nsresult ResolveBidi();
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
/**
|
|
|
|
* Test whether the frame is a form control in a visual Bidi page.
|
|
|
|
* This is necessary for backwards-compatibility, because most visual
|
|
|
|
* pages use logical order for form controls so that they will
|
|
|
|
* display correctly on native widgets in OSs with Bidi support
|
|
|
|
* @param aPresContext the pres context
|
|
|
|
* @return whether the frame is a BIDI form control
|
|
|
|
*/
|
|
|
|
PRBool IsVisualFormControl(nsPresContext* aPresContext);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
public:
|
2008-12-02 17:27:19 -08:00
|
|
|
/**
|
|
|
|
* Does all the real work for removing aDeletedFrame
|
|
|
|
* -- finds the line containing aDeletedFrame
|
|
|
|
* -- removes all aDeletedFrame next-in-flows (or all continuations,
|
|
|
|
* if REMOVE_FIXED_CONTINUATIONS is given)
|
|
|
|
* -- marks lines dirty as needed
|
|
|
|
* -- marks textruns dirty (unless FRAMES_ARE_EMPTY is given, in which
|
|
|
|
* case textruns do not need to be dirtied)
|
2009-08-31 11:25:35 -07:00
|
|
|
* -- destroys all removed frames
|
2008-12-02 17:27:19 -08:00
|
|
|
*/
|
|
|
|
enum {
|
|
|
|
REMOVE_FIXED_CONTINUATIONS = 0x02,
|
|
|
|
FRAMES_ARE_EMPTY = 0x04
|
|
|
|
};
|
|
|
|
nsresult DoRemoveFrame(nsIFrame* aDeletedFrame, PRUint32 aFlags);
|
2007-04-20 17:42:58 -07:00
|
|
|
|
|
|
|
void ReparentFloats(nsIFrame* aFirstFrame,
|
|
|
|
nsBlockFrame* aOldParent, PRBool aFromOverflow,
|
|
|
|
PRBool aReparentSiblings);
|
|
|
|
|
2009-08-31 11:25:36 -07:00
|
|
|
/** Load all of aFrame's floats into the float manager iff aFrame is not a
|
|
|
|
* block formatting context. Handles all necessary float manager translations;
|
|
|
|
* assumes float manager is in aFrame's parent's coord system.
|
|
|
|
* Safe to call on non-blocks (does nothing).
|
|
|
|
*/
|
|
|
|
static void RecoverFloatsFor(nsIFrame* aFrame,
|
|
|
|
nsFloatManager& aFloatManager);
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
protected:
|
|
|
|
|
|
|
|
/** 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.
|
|
|
|
*/
|
|
|
|
PRBool DrainOverflowLines(nsBlockReflowState& aState);
|
|
|
|
|
2009-08-31 11:25:36 -07:00
|
|
|
/** grab float continuations from this block's prevInFlow, and splice
|
|
|
|
* them into this block's mFloats list.
|
|
|
|
*/
|
|
|
|
void DrainFloatContinuations(nsBlockReflowState& aState);
|
|
|
|
|
|
|
|
/** Load all our floats into the float manager (without reflowing them).
|
|
|
|
* Assumes float manager is in our own coordinate system.
|
|
|
|
*/
|
|
|
|
void RecoverFloats(nsFloatManager& aFloatManager);
|
|
|
|
|
|
|
|
/** Reflow float continuations
|
|
|
|
*/
|
|
|
|
nsresult ReflowFloatContinuations(nsBlockReflowState& aState,
|
|
|
|
nsRect& aBounds,
|
|
|
|
nsReflowStatus& aStatus);
|
|
|
|
|
2009-08-31 11:25:36 -07:00
|
|
|
/** Find any trailing BR clear from the last line of the block (or its PIFs)
|
|
|
|
*/
|
|
|
|
PRUint8 FindTrailingClear();
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
/**
|
|
|
|
* Remove a float from our float list and also the float cache
|
|
|
|
* for the line its placeholder is on.
|
|
|
|
*/
|
|
|
|
line_iterator RemoveFloat(nsIFrame* aFloat);
|
|
|
|
|
2009-09-18 04:09:36 -07:00
|
|
|
void CollectFloats(nsIFrame* aFrame, nsFrameList& aList,
|
2007-04-20 17:42:58 -07:00
|
|
|
PRBool aFromOverflow, PRBool aCollectFromSiblings);
|
2007-03-22 10:30:00 -07:00
|
|
|
// Remove a float, abs, rel positioned frame from the appropriate block's list
|
|
|
|
static void DoRemoveOutOfFlowFrame(nsIFrame* aFrame);
|
|
|
|
|
|
|
|
/** set up the conditions necessary for an resize reflow
|
|
|
|
* the primary task is to mark the minimumly sufficient lines dirty.
|
|
|
|
*/
|
|
|
|
nsresult PrepareResizeReflow(nsBlockReflowState& aState);
|
|
|
|
|
|
|
|
/** reflow all lines that have been marked dirty */
|
|
|
|
nsresult ReflowDirtyLines(nsBlockReflowState& aState);
|
|
|
|
|
2009-04-21 16:53:52 -07:00
|
|
|
/** Mark a given line dirty due to reflow being interrupted on or before it */
|
|
|
|
void MarkLineDirtyForInterrupt(nsLineBox* aLine);
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
//----------------------------------------
|
|
|
|
// Methods for line reflow
|
|
|
|
/**
|
|
|
|
* 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
|
|
|
|
*/
|
|
|
|
nsresult ReflowLine(nsBlockReflowState& aState,
|
|
|
|
line_iterator aLine,
|
|
|
|
PRBool* aKeepReflowGoing);
|
|
|
|
|
2009-05-20 04:21:34 -07:00
|
|
|
// Return false if it needs another reflow because of reduced space
|
|
|
|
// between floats that are next to it (but not next to its top), and
|
|
|
|
// return true otherwise.
|
|
|
|
PRBool PlaceLine(nsBlockReflowState& aState,
|
|
|
|
nsLineLayout& aLineLayout,
|
|
|
|
line_iterator aLine,
|
|
|
|
nsFloatManager::SavedState* aFloatStateBeforeLine,
|
|
|
|
nsRect& aFloatAvailableSpace, /* in-out */
|
2009-06-16 08:00:20 -07:00
|
|
|
nscoord& aAvailableSpaceHeight, /* in-out */
|
2009-05-20 04:21:34 -07:00
|
|
|
PRBool* aKeepReflowGoing);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Mark |aLine| dirty, and, if necessary because of possible
|
2007-11-08 22:55:32 -08:00
|
|
|
* pull-up, mark the previous line dirty as well. Also invalidates textruns
|
|
|
|
* on those lines because the text in the lines might have changed due to
|
|
|
|
* addition/removal of frames.
|
2008-10-12 12:26:06 -07:00
|
|
|
* @param aLine the line to mark dirty
|
|
|
|
* @param aLineList the line list containing that line, null means the line
|
|
|
|
* is in 'mLines' of this frame.
|
2007-03-22 10:30:00 -07:00
|
|
|
*/
|
2008-10-12 12:26:06 -07:00
|
|
|
nsresult MarkLineDirty(line_iterator aLine,
|
|
|
|
const nsLineList* aLineList = nsnull);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// XXX where to go
|
|
|
|
PRBool ShouldJustifyLine(nsBlockReflowState& aState,
|
|
|
|
line_iterator aLine);
|
|
|
|
|
|
|
|
void DeleteLine(nsBlockReflowState& aState,
|
|
|
|
nsLineList::iterator aLine,
|
|
|
|
nsLineList::iterator aLineEnd);
|
|
|
|
|
|
|
|
//----------------------------------------
|
|
|
|
// Methods for individual frame reflow
|
|
|
|
|
|
|
|
PRBool ShouldApplyTopMargin(nsBlockReflowState& aState,
|
|
|
|
nsLineBox* aLine);
|
|
|
|
|
|
|
|
nsresult ReflowBlockFrame(nsBlockReflowState& aState,
|
|
|
|
line_iterator aLine,
|
|
|
|
PRBool* aKeepGoing);
|
|
|
|
|
|
|
|
nsresult ReflowInlineFrames(nsBlockReflowState& aState,
|
|
|
|
line_iterator aLine,
|
|
|
|
PRBool* aKeepLineGoing);
|
|
|
|
|
|
|
|
nsresult DoReflowInlineFrames(nsBlockReflowState& aState,
|
|
|
|
nsLineLayout& aLineLayout,
|
|
|
|
line_iterator aLine,
|
2009-05-20 04:21:34 -07:00
|
|
|
nsFlowAreaRect& aFloatAvailableSpace,
|
2009-06-16 08:00:20 -07:00
|
|
|
nscoord& aAvailableSpaceHeight,
|
2009-05-20 04:21:34 -07:00
|
|
|
nsFloatManager::SavedState*
|
|
|
|
aFloatStateBeforeLine,
|
2007-03-22 10:30:00 -07:00
|
|
|
PRBool* aKeepReflowGoing,
|
|
|
|
LineReflowStatus* aLineReflowStatus,
|
|
|
|
PRBool aAllowPullUp);
|
|
|
|
|
|
|
|
nsresult ReflowInlineFrame(nsBlockReflowState& aState,
|
|
|
|
nsLineLayout& aLineLayout,
|
|
|
|
line_iterator aLine,
|
|
|
|
nsIFrame* aFrame,
|
|
|
|
LineReflowStatus* aLineReflowStatus);
|
|
|
|
|
2008-06-10 16:53:22 -07:00
|
|
|
// Compute the available width for a float.
|
2009-04-08 13:52:36 -07:00
|
|
|
nsRect AdjustFloatAvailableSpace(nsBlockReflowState& aState,
|
|
|
|
const nsRect& aFloatAvailableSpace,
|
|
|
|
nsIFrame* aFloatFrame);
|
2008-06-10 16:53:22 -07:00
|
|
|
// Computes the border-box width of the float
|
|
|
|
nscoord ComputeFloatWidth(nsBlockReflowState& aState,
|
2009-04-08 13:52:36 -07:00
|
|
|
const nsRect& aFloatAvailableSpace,
|
2009-08-31 11:25:35 -07:00
|
|
|
nsIFrame* aFloat);
|
2007-03-22 10:30:00 -07:00
|
|
|
// An incomplete aReflowStatus indicates the float should be split
|
|
|
|
// but only if the available height is constrained.
|
|
|
|
nsresult ReflowFloat(nsBlockReflowState& aState,
|
2009-04-08 13:52:36 -07:00
|
|
|
const nsRect& aFloatAvailableSpace,
|
2009-08-31 11:25:35 -07:00
|
|
|
nsIFrame* aFloat,
|
2007-06-16 13:27:46 -07:00
|
|
|
nsMargin& aFloatMargin,
|
2007-03-22 10:30:00 -07:00
|
|
|
nsReflowStatus& aReflowStatus);
|
|
|
|
|
|
|
|
//----------------------------------------
|
|
|
|
// Methods for pushing/pulling lines/frames
|
|
|
|
|
2009-09-18 04:09:35 -07:00
|
|
|
/**
|
|
|
|
* Create a next-in-flow, if necessary, for aFrame. If a new frame is
|
|
|
|
* created, place it in aLine if aLine is not null.
|
|
|
|
* @param aState the block reflow state
|
|
|
|
* @param aLine where to put a new frame
|
|
|
|
* @param aFrame the frame
|
|
|
|
* @param aMadeNewFrame PR_TRUE if a new frame was created, PR_FALSE if not
|
|
|
|
* @return NS_OK if a next-in-flow already exists or is successfully created
|
|
|
|
*/
|
2007-03-22 10:30:00 -07:00
|
|
|
virtual nsresult CreateContinuationFor(nsBlockReflowState& aState,
|
|
|
|
nsLineBox* aLine,
|
|
|
|
nsIFrame* aFrame,
|
|
|
|
PRBool& aMadeNewFrame);
|
|
|
|
|
|
|
|
// Push aLine which contains a positioned element that was truncated. Clean up any
|
|
|
|
// placeholders on the same line that were continued. Set aKeepReflowGoing to false.
|
|
|
|
void PushTruncatedPlaceholderLine(nsBlockReflowState& aState,
|
|
|
|
line_iterator aLine,
|
|
|
|
PRBool& aKeepReflowGoing);
|
|
|
|
|
|
|
|
nsresult SplitLine(nsBlockReflowState& aState,
|
|
|
|
nsLineLayout& aLineLayout,
|
|
|
|
line_iterator aLine,
|
|
|
|
nsIFrame* aFrame,
|
|
|
|
LineReflowStatus* aLineReflowStatus);
|
|
|
|
|
2010-01-11 06:08:23 -08:00
|
|
|
/**
|
|
|
|
* Pull a frame from the next available location (one of our lines or
|
|
|
|
* one of our next-in-flows lines).
|
|
|
|
* @return the pulled frame or nsnull
|
|
|
|
*/
|
|
|
|
nsIFrame* PullFrame(nsBlockReflowState& aState,
|
|
|
|
line_iterator aLine);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Try to pull a frame out of a line pointed at by aFromLine.
|
|
|
|
*
|
|
|
|
* Note: pulling a frame from a line that is a place-holder frame
|
|
|
|
* doesn't automatically remove the corresponding float from the
|
|
|
|
* line's float array. This happens indirectly: either the line gets
|
|
|
|
* emptied (and destroyed) or the line gets reflowed (because we mark
|
|
|
|
* it dirty) and the code at the top of ReflowLine empties the
|
|
|
|
* array. So eventually, it will be removed, just not right away.
|
|
|
|
*
|
|
|
|
* @return the pulled frame or nsnull
|
|
|
|
*/
|
|
|
|
nsIFrame* PullFrameFrom(nsBlockReflowState& aState,
|
|
|
|
nsLineBox* aLine,
|
|
|
|
nsBlockFrame* aFromContainer,
|
|
|
|
PRBool aFromOverflowLine,
|
|
|
|
nsLineList::iterator aFromLine);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
void PushLines(nsBlockReflowState& aState,
|
|
|
|
nsLineList::iterator aLineBefore);
|
|
|
|
|
|
|
|
void PropagateFloatDamage(nsBlockReflowState& aState,
|
|
|
|
nsLineBox* aLine,
|
|
|
|
nscoord aDeltaY);
|
|
|
|
|
|
|
|
void CheckFloats(nsBlockReflowState& aState);
|
|
|
|
|
|
|
|
//----------------------------------------
|
|
|
|
// List handling kludge
|
|
|
|
|
2007-05-06 12:16:51 -07:00
|
|
|
// If this returns PR_TRUE, the block it's called on should get the
|
|
|
|
// NS_FRAME_HAS_DIRTY_CHILDREN bit set on it by the caller; either directly
|
|
|
|
// if it's already in reflow, or via calling FrameNeedsReflow() to schedule a
|
|
|
|
// reflow.
|
|
|
|
PRBool RenumberLists(nsPresContext* aPresContext);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2008-02-23 23:31:29 -08:00
|
|
|
static PRBool RenumberListsInBlock(nsPresContext* aPresContext,
|
|
|
|
nsBlockFrame* aBlockFrame,
|
|
|
|
PRInt32* aOrdinal,
|
|
|
|
PRInt32 aDepth);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2008-02-23 23:31:29 -08:00
|
|
|
static PRBool RenumberListsFor(nsPresContext* aPresContext, nsIFrame* aKid, PRInt32* aOrdinal, PRInt32 aDepth);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
static PRBool FrameStartsCounterScope(nsIFrame* aFrame);
|
|
|
|
|
|
|
|
void ReflowBullet(nsBlockReflowState& aState,
|
2008-02-10 13:49:24 -08:00
|
|
|
nsHTMLReflowMetrics& aMetrics,
|
|
|
|
nscoord aLineTop);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
//----------------------------------------
|
|
|
|
|
2008-10-30 12:17:59 -07:00
|
|
|
virtual nsILineIterator* GetLineIterator();
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
public:
|
|
|
|
nsLineList* GetOverflowLines() const;
|
|
|
|
protected:
|
|
|
|
nsLineList* RemoveOverflowLines();
|
|
|
|
nsresult SetOverflowLines(nsLineList* aOverflowLines);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This class is useful for efficiently modifying the out of flow
|
|
|
|
* overflow list. It gives the client direct writable access to
|
|
|
|
* the frame list temporarily but ensures that property is only
|
|
|
|
* written back if absolutely necessary.
|
|
|
|
*/
|
|
|
|
struct nsAutoOOFFrameList {
|
|
|
|
nsFrameList mList;
|
|
|
|
|
2009-09-18 04:09:36 -07:00
|
|
|
nsAutoOOFFrameList(nsBlockFrame* aBlock)
|
2009-09-23 19:39:21 -07:00
|
|
|
: mPropValue(aBlock->GetOverflowOutOfFlows())
|
|
|
|
, mBlock(aBlock) {
|
|
|
|
if (mPropValue) {
|
|
|
|
mList = *mPropValue;
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
}
|
2009-09-23 19:39:21 -07:00
|
|
|
~nsAutoOOFFrameList() {
|
|
|
|
mBlock->SetOverflowOutOfFlows(mList, mPropValue);
|
|
|
|
}
|
2007-03-22 10:30:00 -07:00
|
|
|
protected:
|
2009-09-23 19:39:21 -07:00
|
|
|
nsFrameList* const mPropValue;
|
2009-09-18 04:09:36 -07:00
|
|
|
nsBlockFrame* const mBlock;
|
2007-03-22 10:30:00 -07:00
|
|
|
};
|
|
|
|
friend struct nsAutoOOFFrameList;
|
|
|
|
|
2009-09-23 19:39:21 -07:00
|
|
|
nsFrameList* GetOverflowOutOfFlows() const;
|
|
|
|
void SetOverflowOutOfFlows(const nsFrameList& aList, nsFrameList* aPropValue);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
#ifdef NS_DEBUG
|
|
|
|
void VerifyLines(PRBool aFinalCheckOK);
|
|
|
|
void VerifyOverflowSituation();
|
|
|
|
PRInt32 GetDepth() const;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
nscoord mMinWidth, mPrefWidth;
|
|
|
|
|
|
|
|
nsLineList mLines;
|
|
|
|
|
|
|
|
// List of all floats in this block
|
|
|
|
nsFrameList mFloats;
|
|
|
|
|
|
|
|
// XXX_fix_me: subclass one more time!
|
|
|
|
// For list-item frames, this is the bullet frame.
|
|
|
|
nsBulletFrame* mBullet;
|
|
|
|
|
|
|
|
friend class nsBlockReflowState;
|
2007-08-22 02:08:13 -07:00
|
|
|
friend class nsBlockInFlowLineIterator;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
private:
|
|
|
|
nsAbsoluteContainingBlock mAbsoluteContainer;
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
|
|
|
public:
|
|
|
|
static PRBool gLamePaintMetrics;
|
|
|
|
static PRBool gLameReflowMetrics;
|
|
|
|
static PRBool gNoisy;
|
|
|
|
static PRBool gNoisyDamageRepair;
|
|
|
|
static PRBool gNoisyIntrinsic;
|
|
|
|
static PRBool gNoisyReflow;
|
|
|
|
static PRBool gReallyNoisyReflow;
|
2009-01-04 16:39:54 -08:00
|
|
|
static PRBool gNoisyFloatManager;
|
2007-03-22 10:30:00 -07:00
|
|
|
static PRBool gVerifyLines;
|
|
|
|
static PRBool gDisableResizeOpt;
|
|
|
|
|
|
|
|
static PRInt32 gNoiseIndent;
|
|
|
|
|
|
|
|
static const char* kReflowCommandType[];
|
|
|
|
|
|
|
|
protected:
|
|
|
|
static void InitDebugFlags();
|
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
|
|
|
class AutoNoisyIndenter {
|
|
|
|
public:
|
|
|
|
AutoNoisyIndenter(PRBool aDoIndent) : mIndented(aDoIndent) {
|
|
|
|
if (mIndented) {
|
|
|
|
nsBlockFrame::gNoiseIndent++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
~AutoNoisyIndenter() {
|
|
|
|
if (mIndented) {
|
|
|
|
nsBlockFrame::gNoiseIndent--;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
private:
|
|
|
|
PRBool mIndented;
|
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
2007-08-22 02:08:13 -07:00
|
|
|
/**
|
|
|
|
* Iterates over all lines in the prev-in-flows/next-in-flows of this block.
|
|
|
|
*/
|
|
|
|
class nsBlockInFlowLineIterator {
|
|
|
|
public:
|
|
|
|
typedef nsBlockFrame::line_iterator line_iterator;
|
2008-01-29 15:39:39 -08:00
|
|
|
nsBlockInFlowLineIterator(nsBlockFrame* aFrame, line_iterator aLine, PRBool aInOverflow);
|
2008-02-27 01:53:48 -08:00
|
|
|
/**
|
|
|
|
* Set up the iterator to point to the first line found starting from
|
|
|
|
* aFrame. Sets aFoundValidLine to false if there is no such line.
|
|
|
|
*/
|
2008-02-23 23:31:29 -08:00
|
|
|
nsBlockInFlowLineIterator(nsBlockFrame* aFrame, PRBool* aFoundValidLine);
|
2008-02-27 01:53:48 -08:00
|
|
|
/**
|
|
|
|
* Set up the iterator to point to the line that contains aFindFrame (either
|
|
|
|
* directly or indirectly). If aFrame is out of flow, or contained in an
|
|
|
|
* out-of-flow, finds the line containing the out-of-flow's placeholder. If
|
|
|
|
* the frame is not found, sets aFoundValidLine to false.
|
|
|
|
*/
|
|
|
|
nsBlockInFlowLineIterator(nsBlockFrame* aFrame, nsIFrame* aFindFrame,
|
|
|
|
PRBool* aFoundValidLine);
|
|
|
|
|
2007-08-22 02:08:13 -07:00
|
|
|
line_iterator GetLine() { return mLine; }
|
2008-01-29 15:39:39 -08:00
|
|
|
PRBool IsLastLineInList();
|
2007-08-22 02:08:13 -07:00
|
|
|
nsBlockFrame* GetContainer() { return mFrame; }
|
|
|
|
PRBool GetInOverflow() { return mInOverflowLines != nsnull; }
|
2008-04-11 22:32:49 -07:00
|
|
|
|
2008-10-12 12:26:06 -07:00
|
|
|
/**
|
|
|
|
* Returns the current line list we're iterating, null means
|
|
|
|
* we're iterating |mLines| of the container.
|
|
|
|
*/
|
|
|
|
nsLineList* GetLineList() { return mInOverflowLines; }
|
2008-04-11 22:32:49 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the end-iterator of whatever line list we're in.
|
|
|
|
*/
|
|
|
|
line_iterator End();
|
|
|
|
|
2007-08-22 02:08:13 -07:00
|
|
|
/**
|
|
|
|
* Returns false if there are no more lines. After this has returned false,
|
|
|
|
* don't call any methods on this object again.
|
|
|
|
*/
|
|
|
|
PRBool Next();
|
|
|
|
/**
|
|
|
|
* Returns false if there are no more lines. After this has returned false,
|
|
|
|
* don't call any methods on this object again.
|
|
|
|
*/
|
|
|
|
PRBool Prev();
|
|
|
|
|
|
|
|
private:
|
|
|
|
nsBlockFrame* mFrame;
|
|
|
|
line_iterator mLine;
|
|
|
|
nsLineList* mInOverflowLines;
|
2008-02-23 23:31:29 -08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Moves iterator to next valid line reachable from the current block.
|
|
|
|
* Returns false if there are no valid lines.
|
|
|
|
*/
|
|
|
|
PRBool FindValidLine();
|
2007-08-22 02:08:13 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* nsBlockFrame_h___ */
|