/layout/base/public/nsIFrame.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: NPL 1.1/GPL 2.0/LGPL 2.1
00004  *
00005  * The contents of this file are subject to the Netscape Public License
00006  * Version 1.1 (the "License"); you may not use this file except in
00007  * compliance with the License. You may obtain a copy of the License at
00008  * http://www.mozilla.org/NPL/
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 the GNU General Public License Version 2 or later (the "GPL"), or 
00026  * 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 NPL, 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 NPL, the GPL or the LGPL.
00035  *
00036  * ***** END LICENSE BLOCK ***** */
00037 
00038 #ifndef nsIFrame_h___
00039 #define nsIFrame_h___
00040 
00041 /* nsIFrame is in the process of being deCOMtaminated, i.e., this file is eventually
00042    going to be eliminated, and all callers will use nsFrame instead.  At the moment
00043    we're midway through this process, so you will see inlined functions and member
00044    variables in this file.  -dwh */
00045 
00046 #include <stdio.h>
00047 #include "nsISupports.h"
00048 #include "nsEvent.h"
00049 #include "nsStyleStruct.h"
00050 #include "nsStyleContext.h"
00051 #include "nsIContent.h"
00052 
00070 struct nsHTMLReflowState;
00071 class nsHTMLReflowCommand;
00072 struct nsHTMLReflowMetrics;
00073 
00074 class nsIAtom;
00075 class nsIPresContext;
00076 class nsIPresShell;
00077 class nsIRenderingContext;
00078 class nsIView;
00079 class nsIWidget;
00080 class nsIDOMRange;
00081 class nsISelectionController;
00082 #ifdef ACCESSIBILITY
00083 class nsIAccessible;
00084 #endif
00085 
00086 struct nsPeekOffsetStruct;
00087 struct nsPoint;
00088 struct nsRect;
00089 struct nsSize;
00090 struct nsMargin;
00091 
00092 // Calback function used to destroy the value associated with a property.
00093 typedef void 
00094 (*NSFramePropertyDtorFunc)(nsIPresContext* aPresContext,
00095                            nsIFrame*       aFrame,
00096                            nsIAtom*        aPropertyName,
00097                            void*           aPropertyValue);
00098 
00099 // IID for the nsIFrame interface 
00100 // a6cf9050-15b3-11d2-932e-00805f8add32
00101 #define NS_IFRAME_IID \
00102  { 0xa6cf9050, 0x15b3, 0x11d2,{0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}}
00103 
00117 typedef PRUint32 nsSplittableType;
00118 
00119 #define NS_FRAME_NOT_SPLITTABLE             0   // Note: not a bit!
00120 #define NS_FRAME_SPLITTABLE                 0x1
00121 #define NS_FRAME_SPLITTABLE_NON_RECTANGULAR 0x3
00122 
00123 #define NS_FRAME_IS_SPLITTABLE(type)\
00124   (0 != ((type) & NS_FRAME_SPLITTABLE))
00125 
00126 #define NS_FRAME_IS_NOT_SPLITTABLE(type)\
00127   (0 == ((type) & NS_FRAME_SPLITTABLE))
00128 
00129 //----------------------------------------------------------------------
00130 
00135 typedef PRUint32 nsFrameState;
00136 
00137 #define NS_FRAME_IN_REFLOW                            0x00000001
00138 
00139 // This bit is set when a frame is created. After it has been reflowed
00140 // once (during the DidReflow with a finished state) the bit is
00141 // cleared.
00142 #define NS_FRAME_FIRST_REFLOW                         0x00000002
00143 
00144 // If this bit is is set, then the view position and size should be
00145 // kept in sync with the frame position and size. If the bit is not
00146 // set then it's the responsibility of the frame itself (or whoever
00147 // created the view) to position and size its associated view
00148 #define NS_FRAME_SYNC_FRAME_AND_VIEW                  0x00000004
00149 
00150 // If this bit is set, then there is a child frame in the frame that
00151 // extends outside this frame's bounding box. The implication is that
00152 // the frame's rect does not completely cover its children and
00153 // therefore operations like rendering and hit testing (for example)
00154 // must operate differently.
00155 #define NS_FRAME_OUTSIDE_CHILDREN                     0x00000008
00156 
00157 // If this bit is set, then a reference to the frame is being held
00158 // elsewhere.  The frame may want to send a notification when it is
00159 // destroyed to allow these references to be cleared.
00160 #define NS_FRAME_EXTERNAL_REFERENCE                   0x00000010
00161 
00162 // If this bit is set, then the frame is a replaced element. For example,
00163 // a frame displaying an image
00164 #define NS_FRAME_REPLACED_ELEMENT                     0x00000020
00165 
00166 // If this bit is set, then the frame corresponds to generated content
00167 #define NS_FRAME_GENERATED_CONTENT                    0x00000040
00168 
00169 // If this bit is set, then the frame has requested one or more image
00170 // loads via the nsIPresContext.StartLoadImage API at some time during
00171 // its lifetime.
00172 #define NS_FRAME_HAS_LOADED_IMAGES                    0x00000080
00173 
00174 // If this bit is set, then the frame has been moved out of the flow,
00175 // e.g., it is absolutely positioned or floated
00176 #define NS_FRAME_OUT_OF_FLOW                          0x00000100
00177 
00178 // If this bit is set, then the frame reflects content that may be selected
00179 #define NS_FRAME_SELECTED_CONTENT                     0x00000200
00180 
00181 // If this bit is set, then the frame is dirty and needs to be reflowed.
00182 // This bit is set when the frame is first created
00183 #define NS_FRAME_IS_DIRTY                             0x00000400
00184 
00185 // If this bit is set then the frame is unflowable.
00186 #define NS_FRAME_IS_UNFLOWABLE                        0x00000800
00187 
00188 // If this bit is set, the frame has dirty children.
00189 #define NS_FRAME_HAS_DIRTY_CHILDREN                   0x00001000
00190 
00191 // If this bit is set, the frame has an associated view
00192 #define NS_FRAME_HAS_VIEW                             0x00002000
00193 
00194 // If this bit is set, the frame was created from anonymous content.
00195 #define NS_FRAME_INDEPENDENT_SELECTION                0x00004000
00196 
00197 // If this bit is set, the frame is "special" (lame term, I know),
00198 // which means that it is part of the mangled frame hierarchy that
00199 // results when an inline has been split because of a nested block.
00200 #define NS_FRAME_IS_SPECIAL                           0x00008000
00201 
00202 // If this bit is set, the frame doesn't allow ignorable whitespace as
00203 // children. For example, the whitespace between <table>\n<tr>\n<td>
00204 // will be excluded during the construction of children. 
00205 // The bit is set when the frame is first created and remain
00206 // unchanged during the life-time of the frame.
00207 #define NS_FRAME_EXCLUDE_IGNORABLE_WHITESPACE         0x00010000
00208 
00209 #ifdef IBMBIDI
00210 // If this bit is set, the frame itself is a bidi continuation,
00211 // or is incomplete (its next sibling is a bidi continuation)
00212 #define NS_FRAME_IS_BIDI                              0x00020000
00213 #endif
00214 
00215 // If this bit is set the frame has descendant with a view
00216 #define NS_FRAME_HAS_CHILD_WITH_VIEW                  0x00040000
00217 
00218 // If this bit is set, then reflow may be dispatched from the current
00219 // frame instead of the root frame.
00220 #define NS_FRAME_REFLOW_ROOT                          0x00080000
00221 
00222 // The lower 20 bits of the frame state word are reserved by this API.
00223 #define NS_FRAME_RESERVED                             0x000FFFFF
00224 
00225 // The upper 12 bits of the frame state word are reserved for frame
00226 // implementations.
00227 #define NS_FRAME_IMPL_RESERVED                        0xFFF00000
00228 
00229 //----------------------------------------------------------------------
00230 
00231 enum nsFramePaintLayer {
00232   eFramePaintLayer_Underlay = 0,
00233   eFramePaintLayer_Content = 1,
00234   eFramePaintLayer_Overlay = 2
00235 };
00236 
00237 enum nsSelectionAmount {
00238   eSelectCharacter = 0,
00239   eSelectWord      = 1,
00240   eSelectLine      = 2,  //previous drawn line in flow.
00241   eSelectBeginLine = 3,
00242   eSelectEndLine   = 4,
00243   eSelectNoAmount  = 5,   //just bounce back current offset.
00244   eSelectDir       = 6,   //select next/previous frame based on direction
00245   eSelectParagraph = 7    //select a "paragraph"
00246 };
00247 
00248 enum nsDirection {
00249   eDirNext    = 0,
00250   eDirPrevious= 1
00251 };
00252 
00253 enum nsSpread {
00254   eSpreadNone   = 0,
00255   eSpreadAcross = 1,
00256   eSpreadDown   = 2
00257 };
00258 
00259 // Carried out margin flags
00260 #define NS_CARRIED_TOP_MARGIN_IS_AUTO    0x1
00261 #define NS_CARRIED_BOTTOM_MARGIN_IS_AUTO 0x2
00262 
00263 //----------------------------------------------------------------------
00264 
00265 // For HTML reflow we rename with the different paint layers are
00266 // actually used for.
00267 #define NS_FRAME_PAINT_LAYER_BACKGROUND eFramePaintLayer_Underlay
00268 #define NS_FRAME_PAINT_LAYER_FLOATERS   eFramePaintLayer_Content
00269 #define NS_FRAME_PAINT_LAYER_FOREGROUND eFramePaintLayer_Overlay
00270 #define NS_FRAME_PAINT_LAYER_DEBUG      eFramePaintLayer_Overlay
00271 
00291 typedef PRUint32 nsReflowStatus;
00292 
00293 #define NS_FRAME_COMPLETE          0            // Note: not a bit!
00294 #define NS_FRAME_NOT_COMPLETE      0x1
00295 #define NS_FRAME_REFLOW_NEXTINFLOW 0x2
00296 
00297 #define NS_FRAME_IS_COMPLETE(status) \
00298   (0 == ((status) & NS_FRAME_NOT_COMPLETE))
00299 
00300 #define NS_FRAME_IS_NOT_COMPLETE(status) \
00301   (0 != ((status) & NS_FRAME_NOT_COMPLETE))
00302 
00303 // This macro tests to see if an nsReflowStatus is an error value
00304 // or just a regular return value
00305 #define NS_IS_REFLOW_ERROR(_status) (PRInt32(_status) < 0)
00306 
00311 // This bit is set, when a break is requested. This bit is orthogonal
00312 // to the nsIFrame::nsReflowStatus completion bits.
00313 #define NS_INLINE_BREAK              0x0100
00314 
00315 // When a break is requested, this bit when set indicates that the
00316 // break should occur after the frame just reflowed; when the bit is
00317 // clear the break should occur before the frame just reflowed.
00318 #define NS_INLINE_BREAK_BEFORE       0x0000
00319 #define NS_INLINE_BREAK_AFTER        0x0200
00320 
00321 // The type of break requested can be found in these bits.
00322 #define NS_INLINE_BREAK_TYPE_MASK    0xF000
00323 
00324 //----------------------------------------
00325 // Macros that use those bits
00326 
00327 #define NS_INLINE_IS_BREAK(_status) \
00328   (0 != ((_status) & NS_INLINE_BREAK))
00329 
00330 #define NS_INLINE_IS_BREAK_AFTER(_status) \
00331   (0 != ((_status) & NS_INLINE_BREAK_AFTER))
00332 
00333 #define NS_INLINE_IS_BREAK_BEFORE(_status) \
00334   (NS_INLINE_BREAK == ((_status) & (NS_INLINE_BREAK|NS_INLINE_BREAK_AFTER)))
00335 
00336 #define NS_INLINE_GET_BREAK_TYPE(_status) (((_status) >> 12) & 0xF)
00337 
00338 #define NS_INLINE_MAKE_BREAK_TYPE(_type)  ((_type) << 12)
00339 
00340 // Construct a line-break-before status. Note that there is no
00341 // completion status for a line-break before because we *know* that
00342 // the frame will be reflowed later and hence it's current completion
00343 // status doesn't matter.
00344 #define NS_INLINE_LINE_BREAK_BEFORE()                                   \
00345   (NS_INLINE_BREAK | NS_INLINE_BREAK_BEFORE |                           \
00346    NS_INLINE_MAKE_BREAK_TYPE(NS_STYLE_CLEAR_LINE))
00347 
00348 // Take a completion status and add to it the desire to have a
00349 // line-break after. For this macro we do need the completion status
00350 // because the user of the status will need to know whether to
00351 // continue the frame or not.
00352 #define NS_INLINE_LINE_BREAK_AFTER(_completionStatus)                   \
00353   ((_completionStatus) | NS_INLINE_BREAK | NS_INLINE_BREAK_AFTER |      \
00354    NS_INLINE_MAKE_BREAK_TYPE(NS_STYLE_CLEAR_LINE))
00355 
00356 // The frame (not counting a continuation) did not fit in the available height and 
00357 // wasn't at the top of a page. If it was at the top of a page, then it is not 
00358 // possible to reflow it again with more height, so we don't set it in that case.
00359 #define NS_FRAME_TRUNCATED  0x0010
00360 #define NS_FRAME_IS_TRUNCATED(status) \
00361   (0 != ((status) & NS_FRAME_TRUNCATED))
00362 #define NS_FRAME_SET_TRUNCATION(status, aReflowState, aMetrics) \
00363   if (!aReflowState.mFlags.mIsTopOfPage &&                      \
00364       aReflowState.availableHeight < aMetrics.height)           \
00365     status |= NS_FRAME_TRUNCATED;                               \
00366   else                                                          \
00367     status &= ~NS_FRAME_TRUNCATED;
00368 
00369 //----------------------------------------------------------------------
00370 
00374 typedef PRBool nsDidReflowStatus;
00375 
00376 #define NS_FRAME_REFLOW_NOT_FINISHED PR_FALSE
00377 #define NS_FRAME_REFLOW_FINISHED     PR_TRUE
00378 
00379 //----------------------------------------------------------------------
00380 
00402 class nsIFrame : public nsISupports
00403 {
00404 public:
00405   NS_DEFINE_STATIC_IID_ACCESSOR(NS_IFRAME_IID)
00406 
00407   nsIPresContext* GetPresContext() const {
00408     return GetStyleContext()->GetRuleNode()->GetPresContext();
00409   }
00410 
00429   NS_IMETHOD  Init(nsIPresContext*  aPresContext,
00430                    nsIContent*      aContent,
00431                    nsIFrame*        aParent,
00432                    nsStyleContext*  aContext,
00433                    nsIFrame*        aPrevInFlow) = 0;
00434 
00439   NS_IMETHOD  Destroy(nsIPresContext* aPresContext) = 0;
00440 
00441   /*
00442    * Notify the frame that it has been removed as the primary frame for its content
00443    */
00444   virtual void RemovedAsPrimaryFrame(nsIPresContext* aPresContext) {}
00445 
00464   NS_IMETHOD  SetInitialChildList(nsIPresContext* aPresContext,
00465                                   nsIAtom*        aListName,
00466                                   nsIFrame*       aChildList) = 0;
00467 
00482   NS_IMETHOD AppendFrames(nsIPresContext* aPresContext,
00483                           nsIPresShell&   aPresShell,
00484                           nsIAtom*        aListName,
00485                           nsIFrame*       aFrameList) = 0;
00486 
00502   NS_IMETHOD InsertFrames(nsIPresContext* aPresContext,
00503                           nsIPresShell&   aPresShell,
00504                           nsIAtom*        aListName,
00505                           nsIFrame*       aPrevFrame,
00506                           nsIFrame*       aFrameList) = 0;
00507 
00524   NS_IMETHOD RemoveFrame(nsIPresContext* aPresContext,
00525                          nsIPresShell&   aPresShell,
00526                          nsIAtom*        aListName,
00527                          nsIFrame*       aOldFrame) = 0;
00528 
00546   NS_IMETHOD ReplaceFrame(nsIPresContext* aPresContext,
00547                           nsIPresShell&   aPresShell,
00548                           nsIAtom*        aListName,
00549                           nsIFrame*       aOldFrame,
00550                           nsIFrame*       aNewFrame) = 0;
00551 
00555   nsIContent* GetContent() const { return mContent; }
00556 
00561   NS_IMETHOD GetOffsets(PRInt32 &start, PRInt32 &end) const = 0;
00562 
00567   virtual void AdjustOffsetsForBidi(PRInt32 aStart, PRInt32 aEnd) {}
00568 
00573   nsStyleContext* GetStyleContext() const { return mStyleContext; }
00574   void SetStyleContext(nsIPresContext* aPresContext, nsStyleContext* aContext)
00575   { 
00576     if (aContext != mStyleContext) {
00577       if (mStyleContext)
00578         mStyleContext->Release();
00579       mStyleContext = aContext;
00580       if (aContext) {
00581         aContext->AddRef();
00582         DidSetStyleContext(aPresContext);
00583       }
00584     }
00585   }
00586 
00587   // Style post processing hook
00588   NS_IMETHOD DidSetStyleContext(nsIPresContext* aPresContext) = 0;
00589 
00598   virtual const nsStyleStruct* GetStyleDataExternal(nsStyleStructID aSID) const = 0;
00599 
00600   const nsStyleStruct* GetStyleData(nsStyleStructID aSID) const {
00601 #ifdef _IMPL_NS_LAYOUT
00602     NS_ASSERTION(mStyleContext, "No style context found!");
00603     return mStyleContext->GetStyleData(aSID);
00604 #else
00605     return GetStyleDataExternal(aSID);
00606 #endif
00607   }
00608 
00617   #define STYLE_STRUCT(name_, checkdata_cb_, ctor_args_)                      \
00618     const nsStyle##name_ * GetStyle##name_() const {                          \
00619       return NS_STATIC_CAST(const nsStyle##name_*,                            \
00620                             GetStyleData(eStyleStruct_##name_));              \
00621     }
00622   #include "nsStyleStructList.h"
00623   #undef STYLE_STRUCT
00624 
00625   // Utility function: more convenient than 2 calls to GetStyleData to get border and padding
00626   
00627   NS_IMETHOD  CalcBorderPadding(nsMargin& aBorderPadding) const = 0;
00628 
00639   virtual nsStyleContext* GetAdditionalStyleContext(PRInt32 aIndex) const = 0;
00640 
00641   virtual void SetAdditionalStyleContext(PRInt32 aIndex,
00642                                          nsStyleContext* aStyleContext) = 0;
00643 
00647   nsIFrame* GetParent() const { return mParent; }
00648   NS_IMETHOD SetParent(const nsIFrame* aParent) { mParent = (nsIFrame*)aParent; return NS_OK; }
00649 
00658   nsRect GetRect() const { return mRect; }
00659   nsPoint GetPosition() const { return nsPoint(mRect.x, mRect.y); }
00660   nsSize GetSize() const { return nsSize(mRect.width, mRect.height); }
00661   void SetRect(const nsRect& aRect) { mRect = aRect; }
00662   void SetPosition(const nsPoint& aPt) { mRect.MoveTo(aPt); }
00663   void SetSize(const nsSize& aSize) { mRect.SizeTo(aSize); }
00664 
00675   NS_IMETHOD  GetAdditionalChildListName(PRInt32   aIndex,
00676                                          nsIAtom** aListName) const = 0;
00677 
00686   NS_IMETHOD  FirstChild(nsIPresContext* aPresContext,
00687                          nsIAtom*        aListName,
00688                          nsIFrame**      aFirstChild) const = 0;
00689 
00693   nsIFrame* GetNextSibling() const { return mNextSibling; }
00694   void SetNextSibling(nsIFrame* aNextSibling) { mNextSibling = aNextSibling; }
00695 
00701   NS_IMETHOD  Paint(nsIPresContext*      aPresContext,
00702                     nsIRenderingContext& aRenderingContext,
00703                     const nsRect&        aDirtyRect,
00704                     nsFramePaintLayer    aWhichLayer,
00705                     PRUint32             aFlags = 0) = 0;
00706 
00707   /* 
00708    * Does the frame paint its background? If not, then all or part of it will be
00709    * painted by ancestors.
00710    */
00711   virtual PRBool CanPaintBackground() { return PR_TRUE; }
00712 
00728   NS_IMETHOD  HandleEvent(nsIPresContext* aPresContext,
00729                           nsGUIEvent*     aEvent,
00730                           nsEventStatus*  aEventStatus) = 0;
00731 
00732   NS_IMETHOD  GetContentForEvent(nsIPresContext* aPresContext,
00733                                  nsEvent* aEvent,
00734                                  nsIContent** aContent) = 0;
00735 
00736   NS_IMETHOD GetContentAndOffsetsFromPoint(nsIPresContext* aCX,
00737                                            const nsPoint&  aPoint,
00738                                            nsIContent **   aNewContent,
00739                                            PRInt32&        aContentOffset,
00740                                            PRInt32&        aContentOffsetEnd,
00741                                            PRBool&         aBeginFrameContent) = 0;
00742 
00743 
00747   NS_IMETHOD  GetCursor(nsIPresContext* aPresContext,
00748                         nsPoint&        aPoint,
00749                         PRInt32&        aCursor) = 0;
00750 
00758   NS_IMETHOD  GetFrameForPoint(nsIPresContext* aPresContext,
00759                                const nsPoint& aPoint, 
00760                                nsFramePaintLayer aWhichLayer,
00761                                nsIFrame**     aFrame) = 0;
00762   
00763   
00769   NS_IMETHOD  GetPointFromOffset(nsIPresContext*          inPresContext,
00770                                  nsIRenderingContext*     inRendContext,
00771                                  PRInt32                  inOffset,
00772                                  nsPoint*                 outPoint) = 0;
00773   
00782   NS_IMETHOD  GetChildFrameContainingOffset(PRInt32       inContentOffset,
00783                                  PRBool                   inHint,//false stick left
00784                                  PRInt32*                 outFrameContentOffset,
00785                                  nsIFrame*                *outChildFrame) = 0;
00786 
00791   nsFrameState GetStateBits() const { return mState; }
00792 
00796   void AddStateBits(nsFrameState aBits) { mState |= aBits; }
00797   void RemoveStateBits(nsFrameState aBits) { mState &= ~aBits; }
00798 
00808   NS_IMETHOD  ContentChanged(nsIPresContext* aPresContext,
00809                              nsIContent*     aChild,
00810                              nsISupports*    aSubContent) = 0;
00811 
00822   NS_IMETHOD  AttributeChanged(nsIPresContext* aPresContext,
00823                                nsIContent*     aChild,
00824                                PRInt32         aNameSpaceID,
00825                                nsIAtom*        aAttribute,
00826                                PRInt32         aModType) = 0;
00827 
00831   NS_IMETHOD  IsSplittable(nsSplittableType& aIsSplittable) const = 0;
00832 
00836   NS_IMETHOD  GetPrevInFlow(nsIFrame** aPrevInFlow) const = 0;
00837   NS_IMETHOD  SetPrevInFlow(nsIFrame*) = 0;
00838   NS_IMETHOD  GetNextInFlow(nsIFrame** aNextInFlow) const = 0;
00839   NS_IMETHOD  SetNextInFlow(nsIFrame*) = 0;
00840 
00844   virtual nsIFrame* GetFirstInFlow() const {
00845     return NS_CONST_CAST(nsIFrame*, this);
00846   }
00847 
00851   virtual nsIFrame* GetLastInFlow() const {
00852     return NS_CONST_CAST(nsIFrame*, this);
00853   }
00854 
00864   NS_IMETHOD  WillReflow(nsIPresContext* aPresContext) = 0;
00865 
00906   NS_IMETHOD Reflow(nsIPresContext*          aPresContext,
00907                     nsHTMLReflowMetrics&     aReflowMetrics,
00908                     const nsHTMLReflowState& aReflowState,
00909                     nsReflowStatus&          aStatus) = 0;
00910 
00926   NS_IMETHOD  DidReflow(nsIPresContext*           aPresContext,
00927                         const nsHTMLReflowState*  aReflowState,
00928                         nsDidReflowStatus         aStatus) = 0;
00929 
00930   // XXX Maybe these three should be a separate interface?
00931 
00943   NS_IMETHOD CanContinueTextRun(PRBool& aContinueTextRun) const = 0;
00944 
00945   // Justification helper method used to distribute extra space in a
00946   // line to leaf frames. aUsedSpace is filled in with the amount of
00947   // space actually used.
00948   NS_IMETHOD AdjustFrameSize(nscoord aExtraSpace, nscoord& aUsedSpace) = 0;
00949 
00950   // Justification helper method that is used to remove trailing
00951   // whitespace before justification.
00952   NS_IMETHOD TrimTrailingWhiteSpace(nsIPresContext* aPresContext,
00953                                     nsIRenderingContext& aRC,
00954                                     nscoord& aDeltaWidth) = 0;
00955 
00961   PRBool HasView() const { return mState & NS_FRAME_HAS_VIEW; }
00962   nsIView* GetView() const;
00963   virtual nsIView* GetViewExternal() const;
00964   nsresult SetView(nsIView* aView);
00965 
00969   nsIView* GetClosestView() const;
00970 
00974   nsIFrame* GetAncestorWithView() const;
00975   virtual nsIFrame* GetAncestorWithViewExternal() const;
00976 
00981   NS_IMETHOD  GetOffsetFromView(nsIPresContext* aPresContext,
00982                                 nsPoint&        aOffset,
00983                                 nsIView**       aView) const = 0;
00984 
00993   NS_IMETHOD  GetOriginToViewOffset(nsIPresContext* aPresContext,
00994                                     nsPoint&        aOffset,
00995                                     nsIView**       aView) const = 0;
00996 
01001   virtual PRBool AreAncestorViewsVisible() const;
01002 
01009   virtual nsIWidget* GetWindow() const;
01010 
01016   NS_IMETHOD  GetFrameType(nsIAtom** aType) const = 0;
01017   
01021   NS_IMETHOD  IsPercentageBase(PRBool& aBase) const = 0;
01022 
01033   NS_IMETHOD  SetSelected(nsIPresContext* aPresContext,
01034                           nsIDOMRange*    aRange,
01035                           PRBool          aSelected,
01036                           nsSpread        aSpread) = 0;
01037 
01038   NS_IMETHOD  GetSelected(PRBool *aSelected) const = 0;
01039 
01049   NS_IMETHOD  IsSelectable(PRBool* aIsSelectable, PRUint8* aSelectStyle) const = 0;
01050 
01056   NS_IMETHOD  GetSelectionController(nsIPresContext *aPresContext, nsISelectionController **aSelCon) = 0;
01057 
01067   NS_IMETHOD CaptureMouse(nsIPresContext* aPresContext, PRBool aGrabMouseEvents) = 0;
01068 
01076   NS_IMETHOD  PeekOffset(nsIPresContext* aPresContext, nsPeekOffsetStruct *aPos) = 0;
01077 
01089   NS_IMETHOD CheckVisibility(nsIPresContext* aContext, PRInt32 aStartIndex, PRInt32 aEndIndex, PRBool aRecurse, PRBool *aFinished, PRBool *_retval)=0;
01090 
01097   NS_IMETHOD ReflowDirtyChild(nsIPresShell* aPresShell, nsIFrame* aChild) = 0;
01098 
01106 #ifdef ACCESSIBILITY
01107   NS_IMETHOD GetAccessible(nsIAccessible** aAccessible) = 0;
01108 #endif
01109 
01127   NS_IMETHOD GetParentStyleContextFrame(nsIPresContext* aPresContext,
01128                                         nsIFrame**      aProviderFrame,
01129                                         PRBool*         aIsChild) = 0;
01130 
01140   NS_IMETHOD IsVisibleForPainting(nsIPresContext *     aPresContext, 
01141                                   nsIRenderingContext& aRenderingContext,
01142                                   PRBool               aCheckVis,
01143                                   PRBool*              aIsVisible) = 0;
01144 
01155   NS_IMETHOD IsEmpty(nsCompatibility aCompatMode,
01156                      PRBool aIsPre,
01157                      PRBool* aResult) = 0;
01158 
01165   PRBool IsGeneratedContentFrame() {
01166     return (mState & NS_FRAME_GENERATED_CONTENT) != 0;
01167   }
01168 
01177   PRBool IsPseudoFrame(nsIContent* aParentContent) {
01178     return mContent == aParentContent;
01179   }
01180 
01181 
01182   
01183   virtual void* GetProperty(nsIPresContext* aPresContext,
01184                             nsIAtom*        aPropertyName,
01185                             PRBool          aRemoveProperty) const = 0;
01186 
01187   virtual nsresult SetProperty(nsIPresContext*         aPresContext,
01188                                nsIAtom*                aPropertyName,
01189                                void*                   aPropertyValue,
01190                                NSFramePropertyDtorFunc aPropDtorFunc) = 0;
01191 #ifdef IBMBIDI
01192 
01196   NS_IMETHOD GetBidiProperty(nsIPresContext* aPresContext,
01197                              nsIAtom*        aPropertyName,
01198                              void**          aPropertyValue,
01199                              size_t          aSize ) const = 0;
01200   NS_IMETHOD SetBidiProperty(nsIPresContext* aPresContext,
01201                              nsIAtom*        aPropertyName,
01202                              void*           aPropertyValue) = 0;
01203 #endif // IBMBIDI
01204 
01211   virtual nsRect* GetOverflowAreaProperty(nsIPresContext* aPresContext,
01212                                           PRBool          aCreateIfNecessary = PR_FALSE) = 0;
01213 
01219   virtual PRBool SupportsVisibilityHidden() { return PR_TRUE; }
01220 
01221   // DEPRECATED COMPATIBILITY METHODS
01222   nsresult GetContent(nsIContent** aContent) const {  *aContent = mContent; NS_IF_ADDREF(*aContent); return NS_OK; }
01223   nsresult GetParent(nsIFrame** aParent) const { *aParent = mParent; return NS_OK; }
01224   nsresult GetRect(nsRect& aRect) const {
01225     aRect = mRect;
01226     return NS_OK;
01227   }
01228   nsresult GetOrigin(nsPoint& aPoint) const {
01229     aPoint.x = mRect.x;
01230     aPoint.y = mRect.y;
01231     return NS_OK;
01232   }
01233   nsresult GetSize(nsSize& aSize) const {
01234     aSize.width = mRect.width;
01235     aSize.height = mRect.height;
01236     return NS_OK;
01237   }
01238   nsresult SetRect(nsIPresContext* aPresContext,
01239                const nsRect&   aRect) {
01240     MoveTo(aPresContext, aRect.x, aRect.y);
01241     SizeTo(aPresContext, aRect.width, aRect.height);
01242     return NS_OK;
01243   }
01244   nsresult MoveTo(nsIPresContext* aPresContext,
01245                   nscoord         aX,
01246                   nscoord         aY) {
01247     mRect.x = aX;
01248     mRect.y = aY;
01249     return NS_OK;
01250   }
01251   nsresult SizeTo(nsIPresContext* aPresContext,
01252                   nscoord         aWidth,
01253                   nscoord         aHeight) {
01254     mRect.width = aWidth;
01255     mRect.height = aHeight;
01256     return NS_OK;
01257   }
01258   nsresult GetNextSibling(nsIFrame** aNextSibling) const {
01259     *aNextSibling = mNextSibling;
01260     return NS_OK;
01261   }
01262   nsresult GetFrameState(nsFrameState* aResult) {
01263     *aResult = mState;
01264     return NS_OK;
01265   }
01266   nsresult SetFrameState(nsFrameState aState) {
01267     mState = aState;
01268     return NS_OK;
01269   }
01270   nsIView* GetView(nsIPresContext* aPresContext) const { return GetView(); }
01271   nsIView* GetViewExternal(nsIPresContext* aPresContext) const { return GetViewExternal(); }
01272   nsresult SetView(nsIPresContext* aPresContext, nsIView* aView) { return SetView(aView); }
01273   nsIView* GetClosestView(nsIPresContext* aPresContext) const { return GetClosestView(); }
01274   nsresult GetParentWithView(nsIPresContext* aPresContext, nsIFrame** aParent) const {
01275     *aParent = GetAncestorWithViewExternal();
01276     return NS_OK;
01277   }
01278   PRBool AreAncestorViewsVisible(nsIPresContext* aPresContext) const {
01279     return AreAncestorViewsVisible();
01280   }
01281 
01282 protected:
01283   // Members
01284   nsRect           mRect;
01285   nsIContent*      mContent;
01286   nsStyleContext*  mStyleContext;
01287   nsIFrame*        mParent;
01288   nsIFrame*        mNextSibling;  // singly-linked list of frames
01289   nsFrameState     mState;
01290 
01291 private:
01292   NS_IMETHOD_(nsrefcnt) AddRef(void) = 0;
01293   NS_IMETHOD_(nsrefcnt) Release(void) = 0;
01294 };
01295 
01296 #endif /* nsIFrame_h___ */

Generated on Wed Sep 10 22:25:23 2003 for Mozilla SVG Project Rendering Backend by doxygen1.3