2001-09-28 20:14:13 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
2004-04-18 14:30:37 +00:00
|
|
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
1998-04-13 20:24:54 +00:00
|
|
|
*
|
2004-04-18 14:30:37 +00: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-13 20:24:54 +00:00
|
|
|
*
|
2001-09-28 20:14:13 +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-04-13 20:24:54 +00:00
|
|
|
*
|
1999-11-06 03:40:37 +00:00
|
|
|
* The Original Code is mozilla.org code.
|
|
|
|
*
|
2004-04-18 14:30:37 +00:00
|
|
|
* The Initial Developer of the Original Code is
|
2001-09-28 20:14:13 +00:00
|
|
|
* Netscape Communications Corporation.
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 1998
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
1999-11-06 03:40:37 +00:00
|
|
|
*
|
2001-09-28 20:14:13 +00:00
|
|
|
* Contributor(s):
|
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
2004-04-18 14:30:37 +00: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-28 20:14:13 +00: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 14:30:37 +00:00
|
|
|
* use your version of this file under the terms of the MPL, indicate your
|
2001-09-28 20:14:13 +00: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 14:30:37 +00:00
|
|
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
2001-09-28 20:14:13 +00:00
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
2006-03-29 18:29:03 +00:00
|
|
|
|
|
|
|
/* base class #2 for rendering objects that have child lists */
|
|
|
|
|
1998-04-13 20:24:54 +00:00
|
|
|
#ifndef nsHTMLContainerFrame_h___
|
|
|
|
#define nsHTMLContainerFrame_h___
|
|
|
|
|
|
|
|
#include "nsContainerFrame.h"
|
2011-06-22 18:11:48 +00:00
|
|
|
#include "nsDisplayList.h"
|
2008-03-13 02:36:58 +00:00
|
|
|
#include "gfxPoint.h"
|
2009-12-12 21:27:18 +00:00
|
|
|
|
1998-04-13 20:24:54 +00:00
|
|
|
class nsString;
|
1998-09-28 23:24:37 +00:00
|
|
|
class nsAbsoluteFrame;
|
1998-09-15 00:19:49 +00:00
|
|
|
class nsPlaceholderFrame;
|
1998-09-28 23:24:37 +00:00
|
|
|
struct nsStyleDisplay;
|
|
|
|
struct nsStylePosition;
|
2002-04-28 07:53:41 +00:00
|
|
|
struct nsHTMLReflowMetrics;
|
|
|
|
struct nsHTMLReflowState;
|
2006-01-26 02:29:17 +00:00
|
|
|
class nsLineBox;
|
1998-04-13 20:24:54 +00:00
|
|
|
|
1999-03-20 21:56:11 +00:00
|
|
|
// Some macros for container classes to do sanity checking on
|
|
|
|
// width/height/x/y values computed during reflow.
|
2011-04-17 01:22:41 +00:00
|
|
|
// NOTE: AppUnitsPerCSSPixel value hardwired here to remove the
|
2011-04-17 01:22:44 +00:00
|
|
|
// dependency on nsDeviceContext.h. It doesn't matter if it's a
|
2011-04-17 01:22:41 +00:00
|
|
|
// little off.
|
1999-03-20 21:56:11 +00:00
|
|
|
#ifdef DEBUG
|
2011-04-17 01:22:41 +00:00
|
|
|
#define CRAZY_W (1000000*60)
|
2009-12-12 21:27:18 +00:00
|
|
|
#define CRAZY_H CRAZY_W
|
1999-10-25 23:05:31 +00:00
|
|
|
|
1999-03-20 21:56:11 +00:00
|
|
|
#define CRAZY_WIDTH(_x) (((_x) < -CRAZY_W) || ((_x) > CRAZY_W))
|
|
|
|
#define CRAZY_HEIGHT(_y) (((_y) < -CRAZY_H) || ((_y) > CRAZY_H))
|
|
|
|
#endif
|
|
|
|
|
2006-01-26 02:29:17 +00:00
|
|
|
class nsDisplayTextDecoration;
|
|
|
|
|
1998-04-13 20:24:54 +00:00
|
|
|
// Base class for html container frames that provides common
|
|
|
|
// functionality.
|
|
|
|
class nsHTMLContainerFrame : public nsContainerFrame {
|
|
|
|
public:
|
2009-09-12 16:49:24 +00:00
|
|
|
NS_DECL_FRAMEARENA_HELPERS
|
1999-01-15 22:53:39 +00:00
|
|
|
|
2009-09-18 11:09:35 +00:00
|
|
|
/**
|
|
|
|
* Helper method to create next-in-flows if necessary. If aFrame
|
|
|
|
* already has a next-in-flow then this method does
|
|
|
|
* nothing. Otherwise, a new continuation frame is created and
|
|
|
|
* linked into the flow. In addition, the new frame is inserted
|
|
|
|
* into the principal child list after aFrame.
|
|
|
|
* @note calling this method on a block frame is illegal. Use
|
|
|
|
* nsBlockFrame::CreateContinuationFor() instead.
|
|
|
|
* @param aNextInFlowResult will contain the next-in-flow
|
|
|
|
* <b>if and only if</b> one is created. If a next-in-flow already
|
|
|
|
* exists aNextInFlowResult is set to nsnull.
|
|
|
|
* @return NS_OK if a next-in-flow already exists or is successfully created.
|
|
|
|
*/
|
|
|
|
nsresult CreateNextInFlow(nsPresContext* aPresContext,
|
|
|
|
nsIFrame* aFrame,
|
|
|
|
nsIFrame*& aNextInFlowResult);
|
|
|
|
|
2002-12-11 04:00:18 +00:00
|
|
|
/**
|
2006-01-26 02:29:17 +00:00
|
|
|
* Displays the standard border, background and outline for the frame
|
|
|
|
* and calls DisplayTextDecorationsAndChildren. This is suitable for
|
|
|
|
* inline frames or frames that behave like inlines.
|
2002-12-11 04:00:18 +00:00
|
|
|
*/
|
2006-01-26 02:29:17 +00:00
|
|
|
NS_IMETHOD BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
const nsDisplayListSet& aLists);
|
|
|
|
|
|
|
|
nsresult DisplayTextDecorations(nsDisplayListBuilder* aBuilder,
|
|
|
|
nsDisplayList* aBelowTextDecorations,
|
|
|
|
nsDisplayList* aAboveTextDecorations,
|
|
|
|
nsLineBox* aLine);
|
2002-12-11 04:00:18 +00:00
|
|
|
|
2006-01-26 02:29:17 +00:00
|
|
|
protected:
|
2006-03-26 21:30:36 +00:00
|
|
|
nsHTMLContainerFrame(nsStyleContext *aContext) : nsContainerFrame(aContext) {}
|
|
|
|
|
2002-12-11 04:00:18 +00:00
|
|
|
/**
|
2006-01-26 02:29:17 +00:00
|
|
|
* Displays the below-children decorations, then the children, then
|
|
|
|
* the above-children decorations, with the decorations going in the
|
|
|
|
* Content() list. This is suitable for inline elements and elements
|
|
|
|
* that behave like inline elements (e.g. MathML containers).
|
2002-12-11 04:00:18 +00:00
|
|
|
*/
|
2006-01-26 02:29:17 +00:00
|
|
|
nsresult DisplayTextDecorationsAndChildren(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
const nsDisplayListSet& aLists);
|
2002-12-11 04:00:18 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Fetch the text decorations for this frame.
|
|
|
|
* @param aIsBlock whether |this| is a block frame or no.
|
|
|
|
* @param aDecorations mask with all decorations.
|
|
|
|
* See bug 1777 and 20163 to understand how a
|
|
|
|
* frame can end up with several decorations.
|
|
|
|
* @param aUnderColor The color of underline if the appropriate bit
|
|
|
|
* in aDecoration is set. It is undefined otherwise.
|
|
|
|
* @param aOverColor The color of overline if the appropriate bit
|
|
|
|
* in aDecoration is set. It is undefined otherwise.
|
|
|
|
* @param aStrikeColor The color of strike-through if the appropriate bit
|
|
|
|
* in aDecoration is set. It is undefined otherwise.
|
2011-03-31 12:27:03 +00:00
|
|
|
* @param aUnderStyle The style of underline if the appropriate bit
|
|
|
|
* in aDecoration is set. It is undefined otherwise.
|
|
|
|
* The style is one of
|
|
|
|
* NS_STYLE_TEXT_DECORATION_STYLE_* consts.
|
|
|
|
* @param aOverStyle The style of overline if the appropriate bit
|
|
|
|
* in aDecoration is set. It is undefined otherwise.
|
|
|
|
* The style is one of
|
|
|
|
* NS_STYLE_TEXT_DECORATION_STYLE_* consts.
|
|
|
|
* @param aStrikeStyle The style of strike-through if the appropriate bit
|
|
|
|
* in aDecoration is set. It is undefined otherwise.
|
|
|
|
* The style is one of
|
|
|
|
* NS_STYLE_TEXT_DECORATION_STYLE_* consts.
|
2011-04-23 05:16:41 +00:00
|
|
|
* NOTE: This function assigns NS_STYLE_TEXT_DECORATION_LINE_NONE to
|
2002-12-11 04:00:18 +00:00
|
|
|
* aDecorations for text-less frames. See bug 20163 for
|
|
|
|
* details.
|
2011-04-23 05:13:09 +00:00
|
|
|
* NOTE: The results of color and style for each lines were not initialized
|
|
|
|
* if the line wasn't included in aDecorations.
|
2002-12-11 04:00:18 +00:00
|
|
|
*/
|
2004-07-31 23:15:21 +00:00
|
|
|
void GetTextDecorations(nsPresContext* aPresContext,
|
2002-12-11 04:00:18 +00:00
|
|
|
PRBool aIsBlock,
|
|
|
|
PRUint8& aDecorations,
|
|
|
|
nscolor& aUnderColor,
|
|
|
|
nscolor& aOverColor,
|
2011-03-31 12:27:03 +00:00
|
|
|
nscolor& aStrikeColor,
|
|
|
|
PRUint8& aUnderStyle,
|
|
|
|
PRUint8& aOverStyle,
|
|
|
|
PRUint8& aStrikeStyle);
|
2002-12-11 04:00:18 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function that does the actual drawing of the textdecoration.
|
|
|
|
* input:
|
2008-06-12 22:02:32 +00:00
|
|
|
* @param aCtx the Thebes graphics context to draw on
|
2006-01-26 02:29:17 +00:00
|
|
|
* @param aLine the line, or nsnull if this is an inline frame
|
2002-12-11 04:00:18 +00:00
|
|
|
* @param aColor the color of the text-decoration
|
2011-03-31 12:27:03 +00:00
|
|
|
* @param aStyle the style of the text-decoration, i.e., one of
|
|
|
|
* NS_STYLE_TEXT_DECORATION_STYLE_* consts.
|
2002-12-11 04:00:18 +00:00
|
|
|
* @param aAscent ascent of the font from which the
|
|
|
|
* text-decoration was derived.
|
|
|
|
* @param aOffset distance *above* baseline where the
|
|
|
|
* text-decoration should be drawn,
|
|
|
|
* i.e. negative offsets draws *below*
|
|
|
|
* the baseline.
|
|
|
|
* @param aSize the thickness of the line
|
2011-06-22 18:11:48 +00:00
|
|
|
* @param aClipEdges clip edges from the display item
|
2011-04-23 05:16:41 +00:00
|
|
|
* @param aDecoration which line will be painted i.e.,
|
|
|
|
* NS_STYLE_TEXT_DECORATION_LINE_UNDERLINE or
|
|
|
|
* NS_STYLE_TEXT_DECORATION_LINE_OVERLINE or
|
|
|
|
* NS_STYLE_TEXT_DECORATION_LINE_LINE_THROUGH.
|
2002-12-11 04:00:18 +00:00
|
|
|
*/
|
2011-06-22 18:11:48 +00:00
|
|
|
virtual void PaintTextDecorationLine(
|
|
|
|
gfxContext* aCtx,
|
|
|
|
const nsPoint& aPt,
|
|
|
|
nsLineBox* aLine,
|
|
|
|
nscolor aColor,
|
|
|
|
PRUint8 aStyle,
|
|
|
|
gfxFloat aOffset,
|
|
|
|
gfxFloat aAscent,
|
|
|
|
gfxFloat aSize,
|
|
|
|
const nsCharClipDisplayItem::ClipEdges& aClipEdges,
|
|
|
|
const PRUint8 aDecoration);
|
2007-08-06 08:15:00 +00:00
|
|
|
|
2009-09-18 18:18:35 +00:00
|
|
|
virtual void AdjustForTextIndent(const nsLineBox* aLine,
|
|
|
|
nscoord& start,
|
|
|
|
nscoord& width);
|
|
|
|
|
2006-01-26 02:29:17 +00:00
|
|
|
friend class nsDisplayTextDecoration;
|
2008-06-12 22:02:32 +00:00
|
|
|
friend class nsDisplayTextShadow;
|
1998-04-13 20:24:54 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* nsHTMLContainerFrame_h___ */
|