Merge m-c to fx-team.
[gecko.git] / layout / generic / nsHTMLParts.h
blob7df6fc10a65e696ea2fb557615a491aaf13b58fd
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 /* factory functions for rendering object classes */
8 #ifndef nsHTMLParts_h___
9 #define nsHTMLParts_h___
11 #include "nscore.h"
12 #include "nsISupports.h"
13 #include "nsIFrame.h"
14 class nsIAtom;
15 class nsNodeInfoManager;
16 class nsIContent;
17 class nsIContentIterator;
18 class nsIDocument;
19 class nsIFrame;
20 class nsIHTMLContentSink;
21 class nsIFragmentContentSink;
22 class nsStyleContext;
23 class nsIURI;
24 class nsString;
25 class nsIPresShell;
26 class nsIChannel;
27 class nsTableColFrame;
29 /**
30 * Additional frame-state bits used by nsBlockFrame
31 * See the meanings at http://www.mozilla.org/newlayout/doc/block-and-line.html
33 * NS_BLOCK_CLIP_PAGINATED_OVERFLOW is only set in paginated prescontexts, on
34 * blocks which were forced to not have scrollframes but still need to clip
35 * the display of their kids.
37 * NS_BLOCK_HAS_FIRST_LETTER_STYLE means that the block has first-letter style,
38 * even if it has no actual first-letter frame among its descendants.
40 * NS_BLOCK_HAS_FIRST_LETTER_CHILD means that there is an inflow first-letter
41 * frame among the block's descendants. If there is a floating first-letter
42 * frame, or the block has first-letter style but has no first letter, this
43 * bit is not set. This bit is set on the first continuation only.
45 * NS_BLOCK_FRAME_HAS_OUTSIDE_BULLET and NS_BLOCK_FRAME_HAS_INSIDE_BULLET
46 * means the block has an associated bullet frame, they are mutually exclusive.
49 #define NS_BLOCK_MARGIN_ROOT NS_FRAME_STATE_BIT(22)
50 #define NS_BLOCK_FLOAT_MGR NS_FRAME_STATE_BIT(23)
51 #define NS_BLOCK_CLIP_PAGINATED_OVERFLOW NS_FRAME_STATE_BIT(28)
52 #define NS_BLOCK_HAS_FIRST_LETTER_STYLE NS_FRAME_STATE_BIT(29)
53 #define NS_BLOCK_FRAME_HAS_OUTSIDE_BULLET NS_FRAME_STATE_BIT(30)
54 #define NS_BLOCK_HAS_FIRST_LETTER_CHILD NS_FRAME_STATE_BIT(31)
55 #define NS_BLOCK_FRAME_HAS_INSIDE_BULLET NS_FRAME_STATE_BIT(63)
56 // These are all the block specific frame bits, they are copied from
57 // the prev-in-flow to a newly created next-in-flow, except for the
58 // NS_BLOCK_FLAGS_NON_INHERITED_MASK bits below.
59 #define NS_BLOCK_FLAGS_MASK (NS_BLOCK_MARGIN_ROOT | \
60 NS_BLOCK_FLOAT_MGR | \
61 NS_BLOCK_CLIP_PAGINATED_OVERFLOW | \
62 NS_BLOCK_HAS_FIRST_LETTER_STYLE | \
63 NS_BLOCK_FRAME_HAS_OUTSIDE_BULLET | \
64 NS_BLOCK_HAS_FIRST_LETTER_CHILD | \
65 NS_BLOCK_FRAME_HAS_INSIDE_BULLET)
67 // This is the subset of NS_BLOCK_FLAGS_MASK that is NOT inherited
68 // by default. They should only be set on the first-in-flow.
69 // See nsBlockFrame::Init.
70 #define NS_BLOCK_FLAGS_NON_INHERITED_MASK \
71 (NS_BLOCK_FRAME_HAS_OUTSIDE_BULLET | \
72 NS_BLOCK_HAS_FIRST_LETTER_CHILD | \
73 NS_BLOCK_FRAME_HAS_INSIDE_BULLET)
75 // Factory methods for creating html layout objects
77 // Create a frame that supports "display: block" layout behavior
78 nsIFrame*
79 NS_NewBlockFrame(nsIPresShell* aPresShell, nsStyleContext* aContext, uint32_t aFlags = 0);
81 // Special Generated Content Node. It contains text taken from an
82 // attribute of its *grandparent* content node.
83 nsresult
84 NS_NewAttributeContent(nsNodeInfoManager *aNodeInfoManager,
85 int32_t aNameSpaceID, nsIAtom* aAttrName,
86 nsIContent** aResult);
88 // Create a basic area frame but the GetFrameForPoint is overridden to always
89 // return the option frame
90 // By default, area frames will extend
91 // their height to cover any children that "stick out".
92 nsIFrame*
93 NS_NewSelectsAreaFrame(nsIPresShell* aPresShell, nsStyleContext* aContext, uint32_t aFlags);
95 // Create a block formatting context blockframe
96 inline nsIFrame* NS_NewBlockFormattingContext(nsIPresShell* aPresShell,
97 nsStyleContext* aStyleContext)
99 return NS_NewBlockFrame(aPresShell, aStyleContext,
100 NS_BLOCK_FLOAT_MGR | NS_BLOCK_MARGIN_ROOT);
103 nsIFrame*
104 NS_NewBRFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
106 nsIFrame*
107 NS_NewCommentFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
109 // <frame> and <iframe>
110 nsIFrame*
111 NS_NewSubDocumentFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
112 // <frameset>
113 nsIFrame*
114 NS_NewHTMLFramesetFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
116 nsIFrame*
117 NS_NewViewportFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
118 nsIFrame*
119 NS_NewCanvasFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
120 nsIFrame*
121 NS_NewImageFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
122 nsIFrame*
123 NS_NewInlineFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
124 nsIFrame*
125 NS_NewObjectFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
126 nsIFrame*
127 NS_NewTextFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
128 nsIFrame*
129 NS_NewContinuingTextFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
130 nsIFrame*
131 NS_NewEmptyFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
132 inline nsIFrame*
133 NS_NewWBRFrame(nsIPresShell* aPresShell, nsStyleContext* aContext) {
134 return NS_NewEmptyFrame(aPresShell, aContext);
137 nsIFrame*
138 NS_NewColumnSetFrame(nsIPresShell* aPresShell, nsStyleContext* aContext, uint32_t aStateFlags);
140 nsIFrame*
141 NS_NewSimplePageSequenceFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
142 nsIFrame*
143 NS_NewPageFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
144 nsIFrame*
145 NS_NewPageContentFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
146 nsIFrame*
147 NS_NewPageBreakFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
148 nsIFrame*
149 NS_NewFirstLetterFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
150 nsIFrame*
151 NS_NewFirstLineFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
153 // forms
154 nsIFrame*
155 NS_NewGfxButtonControlFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
156 nsIFrame*
157 NS_NewNativeButtonControlFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
158 nsIFrame*
159 NS_NewImageControlFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
160 nsIFrame*
161 NS_NewHTMLButtonControlFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
162 nsIFrame*
163 NS_NewGfxCheckboxControlFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
164 nsIFrame*
165 NS_NewNativeCheckboxControlFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
166 nsIFrame*
167 NS_NewFieldSetFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
168 nsIFrame*
169 NS_NewFileControlFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
170 nsIFrame*
171 NS_NewColorControlFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
172 nsIFrame*
173 NS_NewLegendFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
174 nsIFrame*
175 NS_NewNativeTextControlFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
176 nsIFrame*
177 NS_NewTextControlFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
178 nsIFrame*
179 NS_NewGfxAutoTextControlFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
180 nsIFrame*
181 NS_NewGfxRadioControlFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
182 nsIFrame*
183 NS_NewNativeRadioControlFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
184 nsIFrame*
185 NS_NewNativeSelectControlFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
186 nsIFrame*
187 NS_NewListControlFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
188 nsIFrame*
189 NS_NewComboboxControlFrame(nsIPresShell* aPresShell, nsStyleContext* aContext, uint32_t aFlags);
190 nsIFrame*
191 NS_NewProgressFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
192 nsIFrame*
193 NS_NewMeterFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
194 nsIFrame*
195 NS_NewRangeFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
197 // Table frame factories
198 nsIFrame*
199 NS_NewTableOuterFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
200 nsIFrame*
201 NS_NewTableFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
202 nsIFrame*
203 NS_NewTableCaptionFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
204 nsTableColFrame*
205 NS_NewTableColFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
206 nsIFrame*
207 NS_NewTableColGroupFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
208 nsIFrame*
209 NS_NewTableRowFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
210 nsIFrame*
211 NS_NewTableRowGroupFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
212 nsIFrame*
213 NS_NewTableCellFrame(nsIPresShell* aPresShell, nsStyleContext* aContext, bool aIsBorderCollapse);
215 nsresult
216 NS_NewHTMLContentSink(nsIHTMLContentSink** aInstancePtrResult,
217 nsIDocument* aDoc, nsIURI* aURL,
218 nsISupports* aContainer, // e.g. docshell
219 nsIChannel* aChannel);
220 nsresult
221 NS_NewHTMLFragmentContentSink(nsIFragmentContentSink** aInstancePtrResult);
222 nsresult
223 NS_NewHTMLFragmentContentSink2(nsIFragmentContentSink** aInstancePtrResult);
225 #endif /* nsHTMLParts_h___ */