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"
46 class nsNodeInfoManager
;
48 class nsIContentIterator
;
51 class nsIHTMLContentSink
;
52 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
73 #define NS_BLOCK_NO_AUTO_MARGINS 0x00200000
74 #define NS_BLOCK_MARGIN_ROOT 0x00400000
75 #define NS_BLOCK_SPACE_MGR 0x00800000
76 #define NS_BLOCK_HAS_FIRST_LETTER_STYLE 0x20000000
77 #define NS_BLOCK_FRAME_HAS_OUTSIDE_BULLET 0x40000000
78 #define NS_BLOCK_HAS_FIRST_LETTER_CHILD 0x80000000
79 // These are the bits that get inherited from a block frame to its
80 // next-in-flows and are not private to blocks
81 #define NS_BLOCK_FLAGS_MASK 0xF0E00000
83 // Factory methods for creating html layout objects
85 // These are variations on AreaFrame with slightly different layout
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 basic area frame.
108 NS_NewAreaFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
, PRUint32 aFlags
);
110 // These AreaFrame's shrink wrap around their contents
112 NS_NewTableCellInnerFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
) {
113 return NS_NewBlockFrame(aPresShell
, aContext
);
116 // This type of AreaFrame is the document root, a margin root, and the
117 // initial containing block for absolutely positioned elements
119 NS_NewDocumentElementFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
) {
120 return NS_NewAreaFrame(aPresShell
, aContext
, NS_BLOCK_SPACE_MGR
|NS_BLOCK_MARGIN_ROOT
);
123 // This type of AreaFrame is a margin root, but does not shrink wrap
125 NS_NewAbsoluteItemWrapperFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
) {
126 return NS_NewAreaFrame(aPresShell
, aContext
, NS_BLOCK_SPACE_MGR
|NS_BLOCK_MARGIN_ROOT
);
129 // This type of AreaFrame shrink wraps
131 NS_NewFloatingItemWrapperFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
) {
132 return NS_NewAreaFrame(aPresShell
, aContext
,
133 NS_BLOCK_SPACE_MGR
|NS_BLOCK_MARGIN_ROOT
);
136 // This type of AreaFrame doesn't use its own space manager and
137 // doesn't shrink wrap.
139 NS_NewRelativeItemWrapperFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
, PRUint32 aFlags
) {
140 return NS_NewAreaFrame(aPresShell
, aContext
, aFlags
);
144 NS_NewBRFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
147 NS_NewCommentFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
149 // <frame> and <iframe>
151 NS_NewSubDocumentFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
154 NS_NewHTMLFramesetFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
157 NS_NewViewportFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
159 NS_NewCanvasFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
161 NS_NewImageFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
163 NS_NewInlineFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
165 NS_NewPositionedInlineFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
167 NS_NewObjectFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
169 NS_NewSpacerFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
171 NS_NewTextFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
173 NS_NewContinuingTextFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
175 NS_NewEmptyFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
177 NS_NewWBRFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
) {
178 return NS_NewEmptyFrame(aPresShell
, aContext
);
182 NS_NewColumnSetFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
, PRUint32 aStateFlags
);
185 NS_NewSimplePageSequenceFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
187 NS_NewPageFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
189 NS_NewPageContentFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
191 NS_NewPageBreakFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
193 NS_NewFirstLetterFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
195 NS_NewFirstLineFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
199 NS_NewGfxButtonControlFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
201 NS_NewNativeButtonControlFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
203 NS_NewImageControlFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
205 NS_NewHTMLButtonControlFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
207 NS_NewGfxCheckboxControlFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
209 NS_NewNativeCheckboxControlFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
211 NS_NewFieldSetFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
213 NS_NewFileControlFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
215 NS_NewLegendFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
217 NS_NewNativeTextControlFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
219 NS_NewTextControlFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
221 NS_NewGfxAutoTextControlFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
223 NS_NewGfxRadioControlFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
225 NS_NewNativeRadioControlFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
227 NS_NewNativeSelectControlFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
229 NS_NewListControlFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
231 NS_NewComboboxControlFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
, PRUint32 aFlags
);
233 NS_NewIsIndexFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
235 // Table frame factories
237 NS_NewTableOuterFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
239 NS_NewTableFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
241 NS_NewTableCaptionFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
243 NS_NewTableColFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
245 NS_NewTableColGroupFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
247 NS_NewTableRowFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
249 NS_NewTableRowGroupFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
251 NS_NewTableCellFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
, PRBool aIsBorderCollapse
);
254 NS_NewHTMLContentSink(nsIHTMLContentSink
** aInstancePtrResult
,
255 nsIDocument
* aDoc
, nsIURI
* aURL
,
256 nsISupports
* aContainer
, // e.g. docshell
257 nsIChannel
* aChannel
);
259 NS_NewHTMLFragmentContentSink(nsIFragmentContentSink
** aInstancePtrResult
);
261 NS_NewHTMLFragmentContentSink2(nsIFragmentContentSink
** aInstancePtrResult
);
263 // This strips all but a whitelist of elements and attributes defined
264 // in nsContentSink.h
266 NS_NewHTMLParanoidFragmentSink(nsIFragmentContentSink
** aInstancePtrResult
);
268 NS_HTMLParanoidFragmentSinkShutdown();
269 #endif /* nsHTMLParts_h___ */