Back to index

lightning-sunbird  0.9+nobinonly
nsHTMLParts.h
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
00002 /* ***** BEGIN LICENSE BLOCK *****
00003  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00004  *
00005  * The contents of this file are subject to the Mozilla Public License Version
00006  * 1.1 (the "License"); you may not use this file except in compliance with
00007  * the License. You may obtain a copy of the License at
00008  * http://www.mozilla.org/MPL/
00009  *
00010  * Software distributed under the License is distributed on an "AS IS" basis,
00011  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00012  * for the specific language governing rights and limitations under the
00013  * License.
00014  *
00015  * The Original Code is mozilla.org code.
00016  *
00017  * The Initial Developer of the Original Code is
00018  * Netscape Communications Corporation.
00019  * Portions created by the Initial Developer are Copyright (C) 1998
00020  * the Initial Developer. All Rights Reserved.
00021  *
00022  * Contributor(s):
00023  *
00024  * Alternatively, the contents of this file may be used under the terms of
00025  * either of the GNU General Public License Version 2 or later (the "GPL"),
00026  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00027  * in which case the provisions of the GPL or the LGPL are applicable instead
00028  * of those above. If you wish to allow use of your version of this file only
00029  * under the terms of either the GPL or the LGPL, and not to allow others to
00030  * use your version of this file under the terms of the MPL, indicate your
00031  * decision by deleting the provisions above and replace them with the notice
00032  * and other provisions required by the GPL or the LGPL. If you do not delete
00033  * the provisions above, a recipient may use your version of this file under
00034  * the terms of any one of the MPL, the GPL or the LGPL.
00035  *
00036  * ***** END LICENSE BLOCK ***** */
00037 #ifndef nsHTMLParts_h___
00038 #define nsHTMLParts_h___
00039 
00040 #include "nscore.h"
00041 #include "nsISupports.h"
00042 #include "nsReflowType.h"
00043 class nsHTMLReflowCommand;
00044 class nsIAtom;
00045 class nsNodeInfoManager;
00046 class nsIContent;
00047 class nsIContentIterator;
00048 class nsIDocument;
00049 class nsIFrame;
00050 class nsIHTMLContentSink;
00051 class nsIFragmentContentSink;
00052 class nsPresContext;
00053 class nsITextContent;
00054 class nsIURI;
00055 class nsString;
00056 class nsIPresShell;
00057 class nsIChannel;
00058 
00063 #define NS_BLOCK_SHRINK_WRAP                0x00100000
00064 #define NS_BLOCK_NO_AUTO_MARGINS            0x00200000
00065 #define NS_BLOCK_MARGIN_ROOT                0x00400000
00066 #define NS_BLOCK_SPACE_MGR                  0x00800000
00067 #define NS_BLOCK_HAS_FIRST_LETTER_STYLE     0x20000000
00068 #define NS_BLOCK_FRAME_HAS_OUTSIDE_BULLET   0x40000000
00069 // These are the bits that get inherited from a block frame to its
00070 // next-in-flows and are not private to blocks
00071 #define NS_BLOCK_FLAGS_MASK                 0xF0F00000
00072 
00073 // Factory method for creating a content iterator for generated
00074 // content
00075 nsresult
00076 NS_NewFrameContentIterator(nsPresContext*      aPresContext,
00077                            nsIFrame*            aFrame,
00078                            nsIContentIterator** aIterator);
00079 
00080 // Factory methods for creating html layout objects
00081 
00082 // These are variations on AreaFrame with slightly different layout
00083 // policies.
00084 
00085 // Create a frame that supports "display: block" layout behavior
00086 nsresult
00087 NS_NewBlockFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame,
00088                  PRUint32 aFlags = 0);
00089 
00090 // Special Generated Content Frame
00091 nsresult
00092 NS_NewAttributeContent(nsNodeInfoManager *aNodeInfoManager,
00093                        PRInt32 aNameSpaceID, nsIAtom* aAttrName,
00094                        nsIContent** aResult);
00095 
00096 // Create a basic area frame but the GetFrameForPoint is overridden to always
00097 // return the option frame 
00098 // By default, area frames will extend
00099 // their height to cover any children that "stick out".
00100 nsresult
00101 NS_NewSelectsAreaFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame,
00102                        PRUint32 aFlags);
00103 
00104 // Create a basic area frame.
00105 nsresult
00106 NS_NewAreaFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame,
00107                 PRUint32 aFlags);
00108 
00109 // These AreaFrame's shrink wrap around their contents
00110 inline nsresult
00111 NS_NewTableCellInnerFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame) {
00112   return NS_NewBlockFrame(aPresShell, aNewFrame,
00113                           NS_BLOCK_SPACE_MGR|NS_BLOCK_MARGIN_ROOT);
00114 }
00115 
00116 // This type of AreaFrame is the document root, a margin root, and the
00117 // initial containing block for absolutely positioned elements
00118 inline nsresult
00119 NS_NewDocumentElementFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame) {
00120   return NS_NewAreaFrame(aPresShell, aNewFrame, NS_BLOCK_SPACE_MGR|NS_BLOCK_MARGIN_ROOT);
00121 }
00122 
00123 // This type of AreaFrame is a margin root, but does not shrink wrap
00124 inline nsresult
00125 NS_NewAbsoluteItemWrapperFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame) {
00126   return NS_NewAreaFrame(aPresShell, aNewFrame, NS_BLOCK_SPACE_MGR|NS_BLOCK_MARGIN_ROOT);
00127 }
00128 
00129 // This type of AreaFrame shrink wraps
00130 inline nsresult
00131 NS_NewFloatingItemWrapperFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame) {
00132   return NS_NewAreaFrame(aPresShell, aNewFrame, NS_BLOCK_SPACE_MGR|NS_BLOCK_SHRINK_WRAP|NS_BLOCK_MARGIN_ROOT);
00133 }
00134 
00135 // This type of AreaFrame doesn't use its own space manager and
00136 // doesn't shrink wrap.
00137 inline nsresult
00138 NS_NewRelativeItemWrapperFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame) {
00139   return NS_NewAreaFrame(aPresShell, aNewFrame, 0);
00140 }
00141 
00142 nsresult
00143 NS_NewBRFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame);
00144 
00145 nsresult
00146 NS_NewCommentFrame(nsIPresShell* aPresShell, nsIFrame** aFrameResult);
00147 
00148 // <frame> and <iframe> 
00149 nsresult
00150 NS_NewSubDocumentFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame);
00151 // <frameset>
00152 nsresult
00153 NS_NewHTMLFramesetFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame);
00154 
00155 nsresult
00156 NS_NewViewportFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame);
00157 nsresult
00158 NS_NewCanvasFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame);
00159 nsresult
00160 NS_NewImageFrame(nsIPresShell* aPresShell, nsIFrame** aFrameResult);
00161 nsresult
00162 NS_NewInlineFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame);
00163 nsresult
00164 NS_NewPositionedInlineFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame);
00165 nsresult
00166 NS_NewObjectFrame(nsIPresShell* aPresShell, nsIFrame** aFrameResult);
00167 nsresult
00168 NS_NewSpacerFrame(nsIPresShell* aPresShell, nsIFrame** aResult);
00169 nsresult
00170 NS_NewTextFrame(nsIPresShell* aPresShell, nsIFrame** aResult);
00171 nsresult
00172 NS_NewContinuingTextFrame(nsIPresShell* aPresShell, nsIFrame** aResult);
00173 nsresult
00174 NS_NewEmptyFrame(nsIPresShell* aPresShell, nsIFrame** aResult);
00175 inline nsresult
00176 NS_NewWBRFrame(nsIPresShell* aPresShell, nsIFrame** aResult) {
00177   return NS_NewEmptyFrame(aPresShell, aResult);
00178 }
00179 
00180 nsresult
00181 NS_NewColumnSetFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame, PRUint32 aStateFlags );
00182 
00183 nsresult
00184 NS_NewSimplePageSequenceFrame(nsIPresShell* aPresShell, nsIFrame** aResult);
00185 nsresult
00186 NS_NewPageFrame(nsIPresShell* aPresShell, nsIFrame** aResult);
00187 nsresult
00188 NS_NewPageContentFrame(nsIPresShell* aPresShell, nsIFrame** aResult);
00189 nsresult
00190 NS_NewPageBreakFrame(nsIPresShell* aPresShell, nsIFrame** aResult);
00191 nsresult
00192 NS_NewFirstLetterFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame);
00193 nsresult
00194 NS_NewFirstLineFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame);
00195 
00196 // forms
00197 nsresult
00198 NS_NewGfxButtonControlFrame(nsIPresShell* aPresShell, nsIFrame** aResult);
00199 nsresult
00200 NS_NewNativeButtonControlFrame(nsIPresShell* aPresShell, nsIFrame** aResult);
00201 nsresult
00202 NS_NewImageControlFrame(nsIPresShell* aPresShell, nsIFrame** aResult);
00203 nsresult
00204 NS_NewHTMLButtonControlFrame(nsIPresShell* aPresShell, nsIFrame** aResult);
00205 nsresult
00206 NS_NewGfxCheckboxControlFrame(nsIPresShell* aPresShell, nsIFrame** aResult);
00207 nsresult
00208 NS_NewNativeCheckboxControlFrame(nsIPresShell* aPresShell, nsIFrame** aResult);
00209 nsresult
00210 NS_NewFieldSetFrame(nsIPresShell* aPresShell, nsIFrame** aResult, PRUint32 aFlags);
00211 nsresult
00212 NS_NewFileControlFrame(nsIPresShell* aPresShell, nsIFrame** aResult);
00213 nsresult
00214 NS_NewLegendFrame(nsIPresShell* aPresShell, nsIFrame** aResult);
00215 nsresult
00216 NS_NewNativeTextControlFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame);
00217 nsresult
00218 NS_NewTextControlFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame);
00219 nsresult
00220 NS_NewGfxAutoTextControlFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame);
00221 nsresult
00222 NS_NewGfxRadioControlFrame(nsIPresShell* aPresShell, nsIFrame** aResult);
00223 nsresult
00224 NS_NewNativeRadioControlFrame(nsIPresShell* aPresShell, nsIFrame** aResult);
00225 nsresult
00226 NS_NewNativeSelectControlFrame(nsIPresShell* aPresShell, nsIFrame** aResult);
00227 nsresult
00228 NS_NewListControlFrame(nsIPresShell* aPresShell, nsIFrame** aResult);
00229 nsresult
00230 NS_NewComboboxControlFrame(nsIPresShell* aPresShell, nsIFrame** aResult, PRUint32 aFlags);
00231 nsresult
00232 NS_NewIsIndexFrame(nsIPresShell* aPresShell, nsIFrame** aResult);
00233 
00234 // Table frame factories
00235 nsresult
00236 NS_NewTableOuterFrame(nsIPresShell* aPresShell, nsIFrame** aResult);
00237 nsresult
00238 NS_NewTableFrame(nsIPresShell* aPresShell, nsIFrame** aResult);
00239 nsresult
00240 NS_NewTableCaptionFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame);
00241 
00242 nsresult
00243 NS_NewTableColFrame(nsIPresShell* aPresShell, nsIFrame** aResult);
00244 nsresult
00245 NS_NewTableColGroupFrame(nsIPresShell* aPresShell, nsIFrame** aResult);
00246 nsresult
00247 NS_NewTableRowFrame(nsIPresShell* aPresShell, nsIFrame** aResult);
00248 nsresult
00249 NS_NewTableRowGroupFrame(nsIPresShell* aPresShell, nsIFrame** aResult);
00250 nsresult
00251 NS_NewTableCellFrame(nsIPresShell* aPresShell, PRBool aIsBorderCollapse, nsIFrame** aResult);
00252 
00253 nsresult
00254 NS_NewHTMLContentSink(nsIHTMLContentSink** aInstancePtrResult,
00255                       nsIDocument* aDoc, nsIURI* aURL,
00256                       nsISupports* aContainer, // e.g. docshell
00257                       nsIChannel* aChannel);
00258 nsresult
00259 NS_NewHTMLFragmentContentSink(nsIFragmentContentSink** aInstancePtrResult);
00260 nsresult
00261 NS_NewHTMLFragmentContentSink2(nsIFragmentContentSink** aInstancePtrResult);
00262 
00263 // This strips all but a whitelist of elements and attributes defined
00264 // in nsContentSink.h
00265 nsresult
00266 NS_NewHTMLParanoidFragmentSink(nsIFragmentContentSink** aInstancePtrResult);
00267 void
00268 NS_HTMLParanoidFragmentSinkShutdown();
00269 #endif /* nsHTMLParts_h___ */