1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
15 * The Original Code is mozilla.org code.
17 * The Initial Developer of the Original Code is
18 * Netscape Communications Corporation.
19 * Portions created by the Initial Developer are Copyright (C) 1998
20 * the Initial Developer. All Rights Reserved.
24 * Alternatively, the contents of this file may be used under the terms of
25 * either of the GNU General Public License Version 2 or later (the "GPL"),
26 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 * in which case the provisions of the GPL or the LGPL are applicable instead
28 * of those above. If you wish to allow use of your version of this file only
29 * under the terms of either the GPL or the LGPL, and not to allow others to
30 * use your version of this file under the terms of the MPL, indicate your
31 * decision by deleting the provisions above and replace them with the notice
32 * and other provisions required by the GPL or the LGPL. If you do not delete
33 * the provisions above, a recipient may use your version of this file under
34 * the terms of any one of the MPL, the GPL or the LGPL.
36 * ***** END LICENSE BLOCK ***** */
38 /* factory functions for rendering object classes */
40 #ifndef nsHTMLParts_h___
41 #define nsHTMLParts_h___
44 #include "nsISupports.h"
47 class nsNodeInfoManager
;
49 class nsIContentIterator
;
52 class nsIHTMLContentSink
;
53 class nsIFragmentContentSink
;
59 class nsTableColFrame
;
62 * Additional frame-state bits used by nsBlockFrame
63 * See the meanings at http://www.mozilla.org/newlayout/doc/block-and-line.html
65 * NS_BLOCK_HAS_FIRST_LETTER_STYLE means that the block has first-letter style,
66 * even if it has no actual first-letter frame among its descendants.
68 * NS_BLOCK_HAS_FIRST_LETTER_CHILD means that there is an inflow first-letter
69 * frame among the block's descendants. If there is a floating first-letter
70 * frame, or the block has first-letter style but has no first letter, this
71 * bit is not set. This bit is set on the first continuation only.
73 #define NS_BLOCK_MARGIN_ROOT NS_FRAME_STATE_BIT(22)
74 #define NS_BLOCK_FLOAT_MGR NS_FRAME_STATE_BIT(23)
75 #define NS_BLOCK_HAS_FIRST_LETTER_STYLE NS_FRAME_STATE_BIT(29)
76 #define NS_BLOCK_FRAME_HAS_OUTSIDE_BULLET NS_FRAME_STATE_BIT(30)
77 #define NS_BLOCK_HAS_FIRST_LETTER_CHILD NS_FRAME_STATE_BIT(31)
78 // These are the bits that get inherited from a block frame to its
79 // next-in-flows and are not private to blocks
80 #define NS_BLOCK_FLAGS_MASK (NS_BLOCK_MARGIN_ROOT | \
81 NS_BLOCK_FLOAT_MGR | \
82 NS_BLOCK_HAS_FIRST_LETTER_STYLE | \
83 NS_BLOCK_FRAME_HAS_OUTSIDE_BULLET | \
84 NS_BLOCK_HAS_FIRST_LETTER_CHILD)
86 // Factory methods for creating html layout objects
88 // Create a frame that supports "display: block" layout behavior
90 NS_NewBlockFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
, PRUint32 aFlags
= 0);
92 // Special Generated Content Node. It contains text taken from an
93 // attribute of its *grandparent* content node.
95 NS_NewAttributeContent(nsNodeInfoManager
*aNodeInfoManager
,
96 PRInt32 aNameSpaceID
, nsIAtom
* aAttrName
,
97 nsIContent
** aResult
);
99 // Create a basic area frame but the GetFrameForPoint is overridden to always
100 // return the option frame
101 // By default, area frames will extend
102 // their height to cover any children that "stick out".
104 NS_NewSelectsAreaFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
, PRUint32 aFlags
);
106 // Create a block formatting context blockframe
107 inline nsIFrame
* NS_NewBlockFormattingContext(nsIPresShell
* aPresShell
,
108 nsStyleContext
* aStyleContext
)
110 return NS_NewBlockFrame(aPresShell
, aStyleContext
,
111 NS_BLOCK_FLOAT_MGR
| NS_BLOCK_MARGIN_ROOT
);
115 NS_NewBRFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
118 NS_NewCommentFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
120 // <frame> and <iframe>
122 NS_NewSubDocumentFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
125 NS_NewHTMLFramesetFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
128 NS_NewViewportFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
130 NS_NewCanvasFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
132 NS_NewImageFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
134 NS_NewInlineFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
136 NS_NewPositionedInlineFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
138 NS_NewObjectFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
140 NS_NewTextFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
142 NS_NewContinuingTextFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
144 NS_NewEmptyFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
146 NS_NewWBRFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
) {
147 return NS_NewEmptyFrame(aPresShell
, aContext
);
151 NS_NewColumnSetFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
, PRUint32 aStateFlags
);
154 NS_NewSimplePageSequenceFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
156 NS_NewPageFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
158 NS_NewPageContentFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
160 NS_NewPageBreakFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
162 NS_NewFirstLetterFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
164 NS_NewFirstLineFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
168 NS_NewGfxButtonControlFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
170 NS_NewNativeButtonControlFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
172 NS_NewImageControlFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
174 NS_NewHTMLButtonControlFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
176 NS_NewGfxCheckboxControlFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
178 NS_NewNativeCheckboxControlFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
180 NS_NewFieldSetFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
182 NS_NewFileControlFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
184 NS_NewLegendFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
186 NS_NewNativeTextControlFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
188 NS_NewTextControlFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
190 NS_NewGfxAutoTextControlFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
192 NS_NewGfxRadioControlFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
194 NS_NewNativeRadioControlFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
196 NS_NewNativeSelectControlFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
198 NS_NewListControlFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
200 NS_NewComboboxControlFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
, PRUint32 aFlags
);
202 NS_NewIsIndexFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
204 // Table frame factories
206 NS_NewTableOuterFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
208 NS_NewTableFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
210 NS_NewTableCaptionFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
212 NS_NewTableColFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
214 NS_NewTableColGroupFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
216 NS_NewTableRowFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
218 NS_NewTableRowGroupFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
220 NS_NewTableCellFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
, PRBool aIsBorderCollapse
);
223 NS_NewHTMLContentSink(nsIHTMLContentSink
** aInstancePtrResult
,
224 nsIDocument
* aDoc
, nsIURI
* aURL
,
225 nsISupports
* aContainer
, // e.g. docshell
226 nsIChannel
* aChannel
);
228 NS_NewHTMLFragmentContentSink(nsIFragmentContentSink
** aInstancePtrResult
);
230 NS_NewHTMLFragmentContentSink2(nsIFragmentContentSink
** aInstancePtrResult
);
232 // This strips all but a whitelist of elements and attributes defined
233 // in nsContentSink.h
235 NS_NewHTMLParanoidFragmentSink(nsIFragmentContentSink
** aInstancePtrResult
);
237 NS_NewHTMLParanoidFragmentSink2(nsIFragmentContentSink
** aInstancePtrResult
);
239 NS_HTMLParanoidFragmentSinkShutdown();
240 #endif /* nsHTMLParts_h___ */