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
4 : *
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/
9 : *
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
13 : * License.
14 : *
15 : * The Original Code is mozilla.org code.
16 : *
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.
21 : *
22 : * Contributor(s):
23 : *
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.
35 : *
36 : * ***** END LICENSE BLOCK ***** */
37 :
38 : /* factory functions for rendering object classes */
39 :
40 : #ifndef nsHTMLParts_h___
41 : #define nsHTMLParts_h___
42 :
43 : #include "nscore.h"
44 : #include "nsISupports.h"
45 : #include "nsIFrame.h"
46 : class nsIAtom;
47 : class nsNodeInfoManager;
48 : class nsIContent;
49 : class nsIContentIterator;
50 : class nsIDocument;
51 : class nsIFrame;
52 : class nsIHTMLContentSink;
53 : class nsIFragmentContentSink;
54 : class nsStyleContext;
55 : class nsIURI;
56 : class nsString;
57 : class nsIPresShell;
58 : class nsIChannel;
59 : class nsTableColFrame;
60 :
61 : /**
62 : * Additional frame-state bits used by nsBlockFrame
63 : * See the meanings at http://www.mozilla.org/newlayout/doc/block-and-line.html
64 : *
65 : * NS_BLOCK_CLIP_PAGINATED_OVERFLOW is only set in paginated prescontexts, on
66 : * blocks which were forced to not have scrollframes but still need to clip
67 : * the display of their kids.
68 : *
69 : * NS_BLOCK_HAS_FIRST_LETTER_STYLE means that the block has first-letter style,
70 : * even if it has no actual first-letter frame among its descendants.
71 : *
72 : * NS_BLOCK_HAS_FIRST_LETTER_CHILD means that there is an inflow first-letter
73 : * frame among the block's descendants. If there is a floating first-letter
74 : * frame, or the block has first-letter style but has no first letter, this
75 : * bit is not set. This bit is set on the first continuation only.
76 : *
77 : * NS_BLOCK_FRAME_HAS_OUTSIDE_BULLET and NS_BLOCK_FRAME_HAS_INSIDE_BULLET
78 : * means the block has an associated bullet frame, they are mutually exclusive.
79 : *
80 : */
81 : #define NS_BLOCK_MARGIN_ROOT NS_FRAME_STATE_BIT(22)
82 : #define NS_BLOCK_FLOAT_MGR NS_FRAME_STATE_BIT(23)
83 : #define NS_BLOCK_CLIP_PAGINATED_OVERFLOW NS_FRAME_STATE_BIT(28)
84 : #define NS_BLOCK_HAS_FIRST_LETTER_STYLE NS_FRAME_STATE_BIT(29)
85 : #define NS_BLOCK_FRAME_HAS_OUTSIDE_BULLET NS_FRAME_STATE_BIT(30)
86 : #define NS_BLOCK_HAS_FIRST_LETTER_CHILD NS_FRAME_STATE_BIT(31)
87 : #define NS_BLOCK_FRAME_HAS_INSIDE_BULLET NS_FRAME_STATE_BIT(63)
88 : // These are all the block specific frame bits, they are copied from
89 : // the prev-in-flow to a newly created next-in-flow, except for the
90 : // NS_BLOCK_FLAGS_NON_INHERITED_MASK bits below.
91 : #define NS_BLOCK_FLAGS_MASK (NS_BLOCK_MARGIN_ROOT | \
92 : NS_BLOCK_FLOAT_MGR | \
93 : NS_BLOCK_CLIP_PAGINATED_OVERFLOW | \
94 : NS_BLOCK_HAS_FIRST_LETTER_STYLE | \
95 : NS_BLOCK_FRAME_HAS_OUTSIDE_BULLET | \
96 : NS_BLOCK_HAS_FIRST_LETTER_CHILD | \
97 : NS_BLOCK_FRAME_HAS_INSIDE_BULLET)
98 :
99 : // This is the subset of NS_BLOCK_FLAGS_MASK that is NOT inherited
100 : // by default. They should only be set on the first-in-flow.
101 : // See nsBlockFrame::Init.
102 : #define NS_BLOCK_FLAGS_NON_INHERITED_MASK \
103 : (NS_BLOCK_FRAME_HAS_OUTSIDE_BULLET | \
104 : NS_BLOCK_HAS_FIRST_LETTER_CHILD | \
105 : NS_BLOCK_FRAME_HAS_INSIDE_BULLET)
106 :
107 : // Factory methods for creating html layout objects
108 :
109 : // Create a frame that supports "display: block" layout behavior
110 : nsIFrame*
111 : NS_NewBlockFrame(nsIPresShell* aPresShell, nsStyleContext* aContext, PRUint32 aFlags = 0);
112 :
113 : // Special Generated Content Node. It contains text taken from an
114 : // attribute of its *grandparent* content node.
115 : nsresult
116 : NS_NewAttributeContent(nsNodeInfoManager *aNodeInfoManager,
117 : PRInt32 aNameSpaceID, nsIAtom* aAttrName,
118 : nsIContent** aResult);
119 :
120 : // Create a basic area frame but the GetFrameForPoint is overridden to always
121 : // return the option frame
122 : // By default, area frames will extend
123 : // their height to cover any children that "stick out".
124 : nsIFrame*
125 : NS_NewSelectsAreaFrame(nsIPresShell* aPresShell, nsStyleContext* aContext, PRUint32 aFlags);
126 :
127 : // Create a block formatting context blockframe
128 0 : inline nsIFrame* NS_NewBlockFormattingContext(nsIPresShell* aPresShell,
129 : nsStyleContext* aStyleContext)
130 : {
131 : return NS_NewBlockFrame(aPresShell, aStyleContext,
132 0 : NS_BLOCK_FLOAT_MGR | NS_BLOCK_MARGIN_ROOT);
133 : }
134 :
135 : nsIFrame*
136 : NS_NewBRFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
137 :
138 : nsIFrame*
139 : NS_NewCommentFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
140 :
141 : // <frame> and <iframe>
142 : nsIFrame*
143 : NS_NewSubDocumentFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
144 : // <frameset>
145 : nsIFrame*
146 : NS_NewHTMLFramesetFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
147 :
148 : nsIFrame*
149 : NS_NewViewportFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
150 : nsIFrame*
151 : NS_NewCanvasFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
152 : nsIFrame*
153 : NS_NewImageFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
154 : nsIFrame*
155 : NS_NewInlineFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
156 : nsIFrame*
157 : NS_NewObjectFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
158 : nsIFrame*
159 : NS_NewTextFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
160 : nsIFrame*
161 : NS_NewContinuingTextFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
162 : nsIFrame*
163 : NS_NewEmptyFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
164 : inline nsIFrame*
165 0 : NS_NewWBRFrame(nsIPresShell* aPresShell, nsStyleContext* aContext) {
166 0 : return NS_NewEmptyFrame(aPresShell, aContext);
167 : }
168 :
169 : nsIFrame*
170 : NS_NewColumnSetFrame(nsIPresShell* aPresShell, nsStyleContext* aContext, PRUint32 aStateFlags);
171 :
172 : nsIFrame*
173 : NS_NewSimplePageSequenceFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
174 : nsIFrame*
175 : NS_NewPageFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
176 : nsIFrame*
177 : NS_NewPageContentFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
178 : nsIFrame*
179 : NS_NewPageBreakFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
180 : nsIFrame*
181 : NS_NewFirstLetterFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
182 : nsIFrame*
183 : NS_NewFirstLineFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
184 :
185 : // forms
186 : nsIFrame*
187 : NS_NewGfxButtonControlFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
188 : nsIFrame*
189 : NS_NewNativeButtonControlFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
190 : nsIFrame*
191 : NS_NewImageControlFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
192 : nsIFrame*
193 : NS_NewHTMLButtonControlFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
194 : nsIFrame*
195 : NS_NewGfxCheckboxControlFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
196 : nsIFrame*
197 : NS_NewNativeCheckboxControlFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
198 : nsIFrame*
199 : NS_NewFieldSetFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
200 : nsIFrame*
201 : NS_NewFileControlFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
202 : nsIFrame*
203 : NS_NewLegendFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
204 : nsIFrame*
205 : NS_NewNativeTextControlFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
206 : nsIFrame*
207 : NS_NewTextControlFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
208 : nsIFrame*
209 : NS_NewGfxAutoTextControlFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
210 : nsIFrame*
211 : NS_NewGfxRadioControlFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
212 : nsIFrame*
213 : NS_NewNativeRadioControlFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
214 : nsIFrame*
215 : NS_NewNativeSelectControlFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
216 : nsIFrame*
217 : NS_NewListControlFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
218 : nsIFrame*
219 : NS_NewComboboxControlFrame(nsIPresShell* aPresShell, nsStyleContext* aContext, PRUint32 aFlags);
220 : nsIFrame*
221 : NS_NewProgressFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
222 :
223 : // Table frame factories
224 : nsIFrame*
225 : NS_NewTableOuterFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
226 : nsIFrame*
227 : NS_NewTableFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
228 : nsIFrame*
229 : NS_NewTableCaptionFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
230 : nsTableColFrame*
231 : NS_NewTableColFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
232 : nsIFrame*
233 : NS_NewTableColGroupFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
234 : nsIFrame*
235 : NS_NewTableRowFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
236 : nsIFrame*
237 : NS_NewTableRowGroupFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
238 : nsIFrame*
239 : NS_NewTableCellFrame(nsIPresShell* aPresShell, nsStyleContext* aContext, bool aIsBorderCollapse);
240 :
241 : nsresult
242 : NS_NewHTMLContentSink(nsIHTMLContentSink** aInstancePtrResult,
243 : nsIDocument* aDoc, nsIURI* aURL,
244 : nsISupports* aContainer, // e.g. docshell
245 : nsIChannel* aChannel);
246 : nsresult
247 : NS_NewHTMLFragmentContentSink(nsIFragmentContentSink** aInstancePtrResult);
248 : nsresult
249 : NS_NewHTMLFragmentContentSink2(nsIFragmentContentSink** aInstancePtrResult);
250 :
251 : #endif /* nsHTMLParts_h___ */
|