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___
12 #include "nsISupports.h"
15 class nsNodeInfoManager
;
17 class nsIContentIterator
;
20 class nsIHTMLContentSink
;
21 class nsIFragmentContentSink
;
27 class nsTableColFrame
;
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
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.
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".
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
);
104 NS_NewBRFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
107 NS_NewCommentFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
109 // <frame> and <iframe>
111 NS_NewSubDocumentFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
114 NS_NewHTMLFramesetFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
117 NS_NewViewportFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
119 NS_NewCanvasFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
121 NS_NewImageFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
123 NS_NewInlineFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
125 NS_NewObjectFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
127 NS_NewTextFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
129 NS_NewContinuingTextFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
131 NS_NewEmptyFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
133 NS_NewWBRFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
) {
134 return NS_NewEmptyFrame(aPresShell
, aContext
);
138 NS_NewColumnSetFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
, uint32_t aStateFlags
);
141 NS_NewSimplePageSequenceFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
143 NS_NewPageFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
145 NS_NewPageContentFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
147 NS_NewPageBreakFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
149 NS_NewFirstLetterFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
151 NS_NewFirstLineFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
155 NS_NewGfxButtonControlFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
157 NS_NewNativeButtonControlFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
159 NS_NewImageControlFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
161 NS_NewHTMLButtonControlFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
163 NS_NewGfxCheckboxControlFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
165 NS_NewNativeCheckboxControlFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
167 NS_NewFieldSetFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
169 NS_NewFileControlFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
171 NS_NewColorControlFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
173 NS_NewLegendFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
175 NS_NewNativeTextControlFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
177 NS_NewTextControlFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
179 NS_NewGfxAutoTextControlFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
181 NS_NewGfxRadioControlFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
183 NS_NewNativeRadioControlFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
185 NS_NewNativeSelectControlFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
187 NS_NewListControlFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
189 NS_NewComboboxControlFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
, uint32_t aFlags
);
191 NS_NewProgressFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
193 NS_NewMeterFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
195 NS_NewRangeFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
197 // Table frame factories
199 NS_NewTableOuterFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
201 NS_NewTableFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
203 NS_NewTableCaptionFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
205 NS_NewTableColFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
207 NS_NewTableColGroupFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
209 NS_NewTableRowFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
211 NS_NewTableRowGroupFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
213 NS_NewTableCellFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
, bool aIsBorderCollapse
);
216 NS_NewHTMLContentSink(nsIHTMLContentSink
** aInstancePtrResult
,
217 nsIDocument
* aDoc
, nsIURI
* aURL
,
218 nsISupports
* aContainer
, // e.g. docshell
219 nsIChannel
* aChannel
);
221 NS_NewHTMLFragmentContentSink(nsIFragmentContentSink
** aInstancePtrResult
);
223 NS_NewHTMLFragmentContentSink2(nsIFragmentContentSink
** aInstancePtrResult
);
225 #endif /* nsHTMLParts_h___ */