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 Frame
94
NS_NewAttributeContent(nsNodeInfoManager *aNodeInfoManager,
95
PRInt32 aNameSpaceID, nsIAtom* aAttrName,
96
nsIContent** aResult);
98
// Create a basic area frame but the GetFrameForPoint is overridden to always
99
// return the option frame
100
// By default, area frames will extend
101
// their height to cover any children that "stick out".
103
NS_NewSelectsAreaFrame(nsIPresShell* aPresShell, nsStyleContext* aContext, PRUint32 aFlags);
105
// Create a basic area frame.
107
NS_NewAreaFrame(nsIPresShell* aPresShell, nsStyleContext* aContext, PRUint32 aFlags);
109
// These AreaFrame's shrink wrap around their contents
111
NS_NewTableCellInnerFrame(nsIPresShell* aPresShell, nsStyleContext* aContext) {
112
return NS_NewBlockFrame(aPresShell, aContext);
115
// This type of AreaFrame is the document root, a margin root, and the
116
// initial containing block for absolutely positioned elements
118
NS_NewDocumentElementFrame(nsIPresShell* aPresShell, nsStyleContext* aContext) {
119
return NS_NewAreaFrame(aPresShell, aContext, NS_BLOCK_SPACE_MGR|NS_BLOCK_MARGIN_ROOT);
122
// This type of AreaFrame is a margin root, but does not shrink wrap
124
NS_NewAbsoluteItemWrapperFrame(nsIPresShell* aPresShell, nsStyleContext* aContext) {
125
return NS_NewAreaFrame(aPresShell, aContext, NS_BLOCK_SPACE_MGR|NS_BLOCK_MARGIN_ROOT);
128
// This type of AreaFrame shrink wraps
130
NS_NewFloatingItemWrapperFrame(nsIPresShell* aPresShell, nsStyleContext* aContext) {
131
return NS_NewAreaFrame(aPresShell, aContext,
132
NS_BLOCK_SPACE_MGR|NS_BLOCK_MARGIN_ROOT);
135
// This type of AreaFrame doesn't use its own space manager and
136
// doesn't shrink wrap.
138
NS_NewRelativeItemWrapperFrame(nsIPresShell* aPresShell, nsStyleContext* aContext, PRUint32 aFlags) {
139
return NS_NewAreaFrame(aPresShell, aContext, aFlags);
143
NS_NewBRFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
146
NS_NewCommentFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
148
// <frame> and <iframe>
150
NS_NewSubDocumentFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
153
NS_NewHTMLFramesetFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
156
NS_NewViewportFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
158
NS_NewCanvasFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
160
NS_NewImageFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
162
NS_NewInlineFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
164
NS_NewPositionedInlineFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
166
NS_NewObjectFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
168
NS_NewSpacerFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
170
NS_NewTextFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
172
NS_NewContinuingTextFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
174
NS_NewEmptyFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
176
NS_NewWBRFrame(nsIPresShell* aPresShell, nsStyleContext* aContext) {
177
return NS_NewEmptyFrame(aPresShell, aContext);
181
NS_NewColumnSetFrame(nsIPresShell* aPresShell, nsStyleContext* aContext, PRUint32 aStateFlags);
184
NS_NewSimplePageSequenceFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
186
NS_NewPageFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
188
NS_NewPageContentFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
190
NS_NewPageBreakFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
192
NS_NewFirstLetterFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
194
NS_NewFirstLineFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
198
NS_NewGfxButtonControlFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
200
NS_NewNativeButtonControlFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
202
NS_NewImageControlFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
204
NS_NewHTMLButtonControlFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
206
NS_NewGfxCheckboxControlFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
208
NS_NewNativeCheckboxControlFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
210
NS_NewFieldSetFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
212
NS_NewFileControlFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
214
NS_NewLegendFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
216
NS_NewNativeTextControlFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
218
NS_NewTextControlFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
220
NS_NewGfxAutoTextControlFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
222
NS_NewGfxRadioControlFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
224
NS_NewNativeRadioControlFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
226
NS_NewNativeSelectControlFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
228
NS_NewListControlFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
230
NS_NewComboboxControlFrame(nsIPresShell* aPresShell, nsStyleContext* aContext, PRUint32 aFlags);
232
NS_NewIsIndexFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
234
// Table frame factories
236
NS_NewTableOuterFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
238
NS_NewTableFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
240
NS_NewTableCaptionFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
242
NS_NewTableColFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
244
NS_NewTableColGroupFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
246
NS_NewTableRowFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
248
NS_NewTableRowGroupFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
250
NS_NewTableCellFrame(nsIPresShell* aPresShell, nsStyleContext* aContext, PRBool aIsBorderCollapse);
253
NS_NewHTMLContentSink(nsIHTMLContentSink** aInstancePtrResult,
254
nsIDocument* aDoc, nsIURI* aURL,
255
nsISupports* aContainer, // e.g. docshell
256
nsIChannel* aChannel);
258
NS_NewHTMLFragmentContentSink(nsIFragmentContentSink** aInstancePtrResult);
260
NS_NewHTMLFragmentContentSink2(nsIFragmentContentSink** aInstancePtrResult);
262
// This strips all but a whitelist of elements and attributes defined
263
// in nsContentSink.h
265
NS_NewHTMLParanoidFragmentSink(nsIFragmentContentSink** aInstancePtrResult);
267
NS_HTMLParanoidFragmentSinkShutdown();
268
#endif /* nsHTMLParts_h___ */