|
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/. */ |
|
5 |
|
6 /* factory functions for rendering object classes */ |
|
7 |
|
8 #ifndef nsHTMLParts_h___ |
|
9 #define nsHTMLParts_h___ |
|
10 |
|
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; |
|
28 |
|
29 // These are all the block specific frame bits, they are copied from |
|
30 // the prev-in-flow to a newly created next-in-flow, except for the |
|
31 // NS_BLOCK_FLAGS_NON_INHERITED_MASK bits below. |
|
32 #define NS_BLOCK_FLAGS_MASK (NS_BLOCK_MARGIN_ROOT | \ |
|
33 NS_BLOCK_FLOAT_MGR | \ |
|
34 NS_BLOCK_CLIP_PAGINATED_OVERFLOW | \ |
|
35 NS_BLOCK_HAS_FIRST_LETTER_STYLE | \ |
|
36 NS_BLOCK_FRAME_HAS_OUTSIDE_BULLET | \ |
|
37 NS_BLOCK_HAS_FIRST_LETTER_CHILD | \ |
|
38 NS_BLOCK_FRAME_HAS_INSIDE_BULLET) |
|
39 |
|
40 // This is the subset of NS_BLOCK_FLAGS_MASK that is NOT inherited |
|
41 // by default. They should only be set on the first-in-flow. |
|
42 // See nsBlockFrame::Init. |
|
43 #define NS_BLOCK_FLAGS_NON_INHERITED_MASK \ |
|
44 (NS_BLOCK_FRAME_HAS_OUTSIDE_BULLET | \ |
|
45 NS_BLOCK_HAS_FIRST_LETTER_CHILD | \ |
|
46 NS_BLOCK_FRAME_HAS_INSIDE_BULLET) |
|
47 |
|
48 // Factory methods for creating html layout objects |
|
49 |
|
50 // Create a frame that supports "display: block" layout behavior |
|
51 nsIFrame* |
|
52 NS_NewBlockFrame(nsIPresShell* aPresShell, nsStyleContext* aContext, nsFrameState aFlags = nsFrameState(0)); |
|
53 |
|
54 // Special Generated Content Node. It contains text taken from an |
|
55 // attribute of its *grandparent* content node. |
|
56 nsresult |
|
57 NS_NewAttributeContent(nsNodeInfoManager *aNodeInfoManager, |
|
58 int32_t aNameSpaceID, nsIAtom* aAttrName, |
|
59 nsIContent** aResult); |
|
60 |
|
61 // Create a basic area frame but the GetFrameForPoint is overridden to always |
|
62 // return the option frame |
|
63 // By default, area frames will extend |
|
64 // their height to cover any children that "stick out". |
|
65 nsIFrame* |
|
66 NS_NewSelectsAreaFrame(nsIPresShell* aPresShell, nsStyleContext* aContext, nsFrameState aFlags); |
|
67 |
|
68 // Create a block formatting context blockframe |
|
69 inline nsIFrame* NS_NewBlockFormattingContext(nsIPresShell* aPresShell, |
|
70 nsStyleContext* aStyleContext) |
|
71 { |
|
72 return NS_NewBlockFrame(aPresShell, aStyleContext, |
|
73 NS_BLOCK_FLOAT_MGR | NS_BLOCK_MARGIN_ROOT); |
|
74 } |
|
75 |
|
76 nsIFrame* |
|
77 NS_NewBRFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); |
|
78 |
|
79 nsIFrame* |
|
80 NS_NewCommentFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); |
|
81 |
|
82 // <frame> and <iframe> |
|
83 nsIFrame* |
|
84 NS_NewSubDocumentFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); |
|
85 // <frameset> |
|
86 nsIFrame* |
|
87 NS_NewHTMLFramesetFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); |
|
88 |
|
89 nsIFrame* |
|
90 NS_NewViewportFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); |
|
91 nsIFrame* |
|
92 NS_NewCanvasFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); |
|
93 nsIFrame* |
|
94 NS_NewImageFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); |
|
95 nsIFrame* |
|
96 NS_NewInlineFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); |
|
97 nsIFrame* |
|
98 NS_NewObjectFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); |
|
99 nsIFrame* |
|
100 NS_NewTextFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); |
|
101 nsIFrame* |
|
102 NS_NewContinuingTextFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); |
|
103 nsIFrame* |
|
104 NS_NewEmptyFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); |
|
105 inline nsIFrame* |
|
106 NS_NewWBRFrame(nsIPresShell* aPresShell, nsStyleContext* aContext) { |
|
107 return NS_NewEmptyFrame(aPresShell, aContext); |
|
108 } |
|
109 |
|
110 nsIFrame* |
|
111 NS_NewColumnSetFrame(nsIPresShell* aPresShell, nsStyleContext* aContext, nsFrameState aStateFlags); |
|
112 |
|
113 nsIFrame* |
|
114 NS_NewSimplePageSequenceFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); |
|
115 nsIFrame* |
|
116 NS_NewPageFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); |
|
117 nsIFrame* |
|
118 NS_NewPageContentFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); |
|
119 nsIFrame* |
|
120 NS_NewPageBreakFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); |
|
121 nsIFrame* |
|
122 NS_NewFirstLetterFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); |
|
123 nsIFrame* |
|
124 NS_NewFirstLineFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); |
|
125 |
|
126 // forms |
|
127 nsIFrame* |
|
128 NS_NewGfxButtonControlFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); |
|
129 nsIFrame* |
|
130 NS_NewNativeButtonControlFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); |
|
131 nsIFrame* |
|
132 NS_NewImageControlFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); |
|
133 nsIFrame* |
|
134 NS_NewHTMLButtonControlFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); |
|
135 nsIFrame* |
|
136 NS_NewGfxCheckboxControlFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); |
|
137 nsIFrame* |
|
138 NS_NewNativeCheckboxControlFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); |
|
139 nsIFrame* |
|
140 NS_NewFieldSetFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); |
|
141 nsIFrame* |
|
142 NS_NewFileControlFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); |
|
143 nsIFrame* |
|
144 NS_NewColorControlFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); |
|
145 nsIFrame* |
|
146 NS_NewLegendFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); |
|
147 nsIFrame* |
|
148 NS_NewNativeTextControlFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); |
|
149 nsIFrame* |
|
150 NS_NewTextControlFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); |
|
151 nsIFrame* |
|
152 NS_NewGfxAutoTextControlFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); |
|
153 nsIFrame* |
|
154 NS_NewGfxRadioControlFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); |
|
155 nsIFrame* |
|
156 NS_NewNativeRadioControlFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); |
|
157 nsIFrame* |
|
158 NS_NewNativeSelectControlFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); |
|
159 nsIFrame* |
|
160 NS_NewListControlFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); |
|
161 nsIFrame* |
|
162 NS_NewComboboxControlFrame(nsIPresShell* aPresShell, nsStyleContext* aContext, nsFrameState aFlags); |
|
163 nsIFrame* |
|
164 NS_NewProgressFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); |
|
165 nsIFrame* |
|
166 NS_NewMeterFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); |
|
167 nsIFrame* |
|
168 NS_NewRangeFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); |
|
169 nsIFrame* |
|
170 NS_NewNumberControlFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); |
|
171 |
|
172 // Table frame factories |
|
173 nsIFrame* |
|
174 NS_NewTableOuterFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); |
|
175 nsIFrame* |
|
176 NS_NewTableFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); |
|
177 nsIFrame* |
|
178 NS_NewTableCaptionFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); |
|
179 nsTableColFrame* |
|
180 NS_NewTableColFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); |
|
181 nsIFrame* |
|
182 NS_NewTableColGroupFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); |
|
183 nsIFrame* |
|
184 NS_NewTableRowFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); |
|
185 nsIFrame* |
|
186 NS_NewTableRowGroupFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); |
|
187 nsIFrame* |
|
188 NS_NewTableCellFrame(nsIPresShell* aPresShell, nsStyleContext* aContext, bool aIsBorderCollapse); |
|
189 |
|
190 nsresult |
|
191 NS_NewHTMLContentSink(nsIHTMLContentSink** aInstancePtrResult, |
|
192 nsIDocument* aDoc, nsIURI* aURL, |
|
193 nsISupports* aContainer, // e.g. docshell |
|
194 nsIChannel* aChannel); |
|
195 nsresult |
|
196 NS_NewHTMLFragmentContentSink(nsIFragmentContentSink** aInstancePtrResult); |
|
197 nsresult |
|
198 NS_NewHTMLFragmentContentSink2(nsIFragmentContentSink** aInstancePtrResult); |
|
199 |
|
200 #endif /* nsHTMLParts_h___ */ |