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
|
|
|
|
|
|
|
/* base class #2 for rendering objects that have child lists */
|
|
|
|
|
1998-04-14 00:24:54 +04:00
|
|
|
#ifndef nsHTMLContainerFrame_h___
|
|
|
|
#define nsHTMLContainerFrame_h___
|
|
|
|
|
|
|
|
#include "nsContainerFrame.h"
|
2008-03-13 05:36:58 +03:00
|
|
|
#include "gfxPoint.h"
|
1998-04-14 00:24:54 +04:00
|
|
|
class nsString;
|
1998-09-29 03:24:37 +04:00
|
|
|
class nsAbsoluteFrame;
|
1998-09-15 04:19:49 +04:00
|
|
|
class nsPlaceholderFrame;
|
1998-09-29 03:24:37 +04:00
|
|
|
struct nsStyleDisplay;
|
|
|
|
struct nsStylePosition;
|
2002-04-28 11:53:41 +04:00
|
|
|
struct nsHTMLReflowMetrics;
|
|
|
|
struct nsHTMLReflowState;
|
2006-01-26 05:29:17 +03:00
|
|
|
class nsLineBox;
|
1998-04-14 00:24:54 +04:00
|
|
|
|
1999-03-21 00:56:11 +03:00
|
|
|
// Some macros for container classes to do sanity checking on
|
|
|
|
// width/height/x/y values computed during reflow.
|
|
|
|
#ifdef DEBUG
|
|
|
|
#define CRAZY_W 500000
|
1999-10-26 03:05:31 +04:00
|
|
|
|
|
|
|
// 100000 lines, approximately. Assumes p2t is 15 and 15 pixels per line
|
|
|
|
#define CRAZY_H 22500000
|
|
|
|
|
1999-03-21 00:56:11 +03: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 05:29:17 +03:00
|
|
|
class nsDisplayTextDecoration;
|
|
|
|
|
1998-04-14 00:24:54 +04:00
|
|
|
// Base class for html container frames that provides common
|
|
|
|
// functionality.
|
|
|
|
class nsHTMLContainerFrame : public nsContainerFrame {
|
|
|
|
public:
|
1999-01-16 01:53:39 +03:00
|
|
|
|
1999-02-01 20:32:19 +03: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 becomes the
|
2002-05-29 02:50:43 +04:00
|
|
|
* next-sibling of aFrame. If aPlaceholderResult is not null and
|
|
|
|
* aFrame is a float or positioned, then *aPlaceholderResult holds
|
|
|
|
* a placeholder.
|
1999-02-01 20:32:19 +03:00
|
|
|
*/
|
2004-08-01 03:15:21 +04:00
|
|
|
static nsresult CreateNextInFlow(nsPresContext* aPresContext,
|
2002-05-29 02:50:43 +04:00
|
|
|
nsIFrame* aOuterFrame,
|
|
|
|
nsIFrame* aFrame,
|
|
|
|
nsIFrame*& aNextInFlowResult);
|
1998-09-23 06:29:31 +04:00
|
|
|
|
2000-08-12 23:44:11 +04:00
|
|
|
/**
|
|
|
|
* Helper method to wrap views around frames. Used by containers
|
|
|
|
* under special circumstances (can be used by leaf frames as well)
|
|
|
|
*/
|
2003-10-17 06:38:37 +04:00
|
|
|
static nsresult CreateViewForFrame(nsIFrame* aFrame,
|
1998-09-23 06:29:31 +04:00
|
|
|
PRBool aForce);
|
|
|
|
|
2004-08-01 03:15:21 +04:00
|
|
|
static nsresult ReparentFrameView(nsPresContext* aPresContext,
|
1999-10-26 08:44:41 +04:00
|
|
|
nsIFrame* aChildFrame,
|
|
|
|
nsIFrame* aOldParentFrame,
|
|
|
|
nsIFrame* aNewParentFrame);
|
2002-04-28 11:53:41 +04:00
|
|
|
|
2004-08-01 03:15:21 +04:00
|
|
|
static nsresult ReparentFrameViewList(nsPresContext* aPresContext,
|
2000-03-12 06:09:36 +03:00
|
|
|
nsIFrame* aChildFrameList,
|
|
|
|
nsIFrame* aOldParentFrame,
|
|
|
|
nsIFrame* aNewParentFrame);
|
1999-04-11 08:22:00 +04:00
|
|
|
|
2002-12-11 07:00:18 +03:00
|
|
|
/**
|
2006-01-26 05:29:17 +03: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 07:00:18 +03:00
|
|
|
*/
|
2006-01-26 05:29:17 +03: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 07:00:18 +03:00
|
|
|
|
2006-01-26 05:29:17 +03:00
|
|
|
protected:
|
2006-03-27 01:30:36 +04:00
|
|
|
nsHTMLContainerFrame(nsStyleContext *aContext) : nsContainerFrame(aContext) {}
|
|
|
|
|
2002-12-11 07:00:18 +03:00
|
|
|
/**
|
2006-01-26 05:29:17 +03: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 07:00:18 +03:00
|
|
|
*/
|
2006-01-26 05:29:17 +03:00
|
|
|
nsresult DisplayTextDecorationsAndChildren(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
const nsDisplayListSet& aLists);
|
2002-12-11 07:00:18 +03: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.
|
|
|
|
* NOTE: This function assigns NS_STYLE_TEXT_DECORATION_NONE to
|
|
|
|
* aDecorations for text-less frames. See bug 20163 for
|
|
|
|
* details.
|
|
|
|
*/
|
2004-08-01 03:15:21 +04:00
|
|
|
void GetTextDecorations(nsPresContext* aPresContext,
|
2002-12-11 07:00:18 +03:00
|
|
|
PRBool aIsBlock,
|
|
|
|
PRUint8& aDecorations,
|
|
|
|
nscolor& aUnderColor,
|
|
|
|
nscolor& aOverColor,
|
|
|
|
nscolor& aStrikeColor);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function that does the actual drawing of the textdecoration.
|
|
|
|
* input:
|
2008-06-13 02:02:32 +04:00
|
|
|
* @param aCtx the Thebes graphics context to draw on
|
2006-01-26 05:29:17 +03:00
|
|
|
* @param aLine the line, or nsnull if this is an inline frame
|
2002-12-11 07:00:18 +03:00
|
|
|
* @param aColor the color of the text-decoration
|
|
|
|
* @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
|
2007-08-06 12:15:00 +04:00
|
|
|
* @param aDecoration which line will be painted
|
|
|
|
* i.e., NS_STYLE_TEXT_DECORATION_UNDERLINE or
|
|
|
|
* NS_STYLE_TEXT_DECORATION_OVERLINE or
|
|
|
|
* NS_STYLE_TEXT_DECORATION_LINE_THROUGH.
|
2002-12-11 07:00:18 +03:00
|
|
|
*/
|
2008-06-13 02:02:32 +04:00
|
|
|
virtual void PaintTextDecorationLine(gfxContext* aCtx,
|
2008-03-13 05:36:58 +03:00
|
|
|
const nsPoint& aPt,
|
2006-01-26 05:29:17 +03:00
|
|
|
nsLineBox* aLine,
|
|
|
|
nscolor aColor,
|
2008-03-13 05:36:58 +03:00
|
|
|
gfxFloat aOffset,
|
|
|
|
gfxFloat aAscent,
|
|
|
|
gfxFloat aSize,
|
2007-08-06 12:15:00 +04:00
|
|
|
const PRUint8 aDecoration);
|
|
|
|
|
2006-01-26 05:29:17 +03:00
|
|
|
friend class nsDisplayTextDecoration;
|
2008-06-13 02:02:32 +04:00
|
|
|
friend class nsDisplayTextShadow;
|
1998-04-14 00:24:54 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* nsHTMLContainerFrame_h___ */
|