Back to index

lightning-sunbird  0.9+nobinonly
nsPresContext.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 nsPresContext_h___
00038 #define nsPresContext_h___
00039 
00040 #include "nsISupports.h"
00041 #include "nsColor.h"
00042 #include "nsCoord.h"
00043 #include "nsAString.h"
00044 #include "nsCompatibility.h"
00045 #include "nsCOMPtr.h"
00046 #include "nsIPresShell.h"
00047 #include "nsRect.h"
00048 #include "nsIDeviceContext.h"
00049 #include "nsHashtable.h"
00050 #include "nsFont.h"
00051 #include "nsIWeakReference.h"
00052 #include "nsITheme.h"
00053 #include "nsILanguageAtomService.h"
00054 #include "nsIObserver.h"
00055 #include "nsITimer.h"
00056 #include "nsCRT.h"
00057 #include "nsIPrintSettings.h"
00058 #include "nsPropertyTable.h"
00059 #ifdef IBMBIDI
00060 class nsBidiPresUtils;
00061 #endif // IBMBIDI
00062 
00063 struct nsRect;
00064 
00065 class imgIRequest;
00066 
00067 class nsIContent;
00068 class nsIDocument;
00069 class nsIFontMetrics;
00070 class nsIFrame;
00071 class nsFrameManager;
00072 class nsIImage;
00073 class nsILinkHandler;
00074 class nsStyleContext;
00075 class nsIAtom;
00076 class nsIEventStateManager;
00077 class nsIURI;
00078 class nsILookAndFeel;
00079 class nsICSSPseudoComparator;
00080 class nsIAtom;
00081 struct nsStyleStruct;
00082 struct nsStyleBackground;
00083 
00084 #ifdef MOZ_REFLOW_PERF
00085 class nsIRenderingContext;
00086 #endif
00087 
00088 #define NS_IPRESCONTEXT_IID   \
00089 { 0x96e4bc06, 0x8e72, 0x4941, \
00090   {0xa6, 0x6c, 0x70, 0xee, 0x7d, 0x1b, 0x58, 0x21} }
00091 
00092 enum nsWidgetType {
00093   eWidgetType_Button        = 1,
00094   eWidgetType_Checkbox      = 2,
00095   eWidgetType_Radio                = 3,
00096   eWidgetType_Text                 = 4
00097 };
00098 
00099 enum nsLanguageSpecificTransformType {
00100   eLanguageSpecificTransformType_Unknown = -1,
00101   eLanguageSpecificTransformType_None = 0,
00102   eLanguageSpecificTransformType_Japanese
00103 };
00104 
00105 // supported values for cached bool types
00106 const PRUint32 kPresContext_UseDocumentColors = 0x01;
00107 const PRUint32 kPresContext_UseDocumentFonts = 0x02;
00108 const PRUint32 kPresContext_UnderlineLinks = 0x03;
00109 
00110 // supported values for cached integer pref types
00111 const PRUint32 kPresContext_MinimumFontSize = 0x01;
00112 
00113 // IDs for the default variable and fixed fonts (not to be changed, see nsFont.h)
00114 // To be used for Get/SetDefaultFont(). The other IDs in nsFont.h are also supported.
00115 const PRUint8 kPresContext_DefaultVariableFont_ID = 0x00; // kGenericFont_moz_variable
00116 const PRUint8 kPresContext_DefaultFixedFont_ID    = 0x01; // kGenericFont_moz_fixed
00117 
00118 // An interface for presentation contexts. Presentation contexts are
00119 // objects that provide an outer context for a presentation shell.
00120 
00121 // hack to make egcs / gcc 2.95.2 happy
00122 class nsPresContext_base : public nsIObserver
00123 {
00124 public:
00125   NS_DEFINE_STATIC_IID_ACCESSOR(NS_IPRESCONTEXT_IID)
00126 };
00127 
00128 class nsPresContext : public nsPresContext_base {
00129 public:
00130   NS_DECL_ISUPPORTS
00131   NS_DECL_NSIOBSERVER
00132   NS_DECL_AND_IMPL_ZEROING_OPERATOR_NEW
00133 
00134   enum nsPresContextType {
00135     eContext_Galley,       // unpaginated screen presentation
00136     eContext_PrintPreview, // paginated screen presentation
00137     eContext_Print         // paginated printer presentation
00138   };
00139 
00140   nsPresContext(nsPresContextType aType) NS_HIDDEN;
00141 
00145   NS_HIDDEN_(nsresult) Init(nsIDeviceContext* aDeviceContext);
00146 
00151   NS_HIDDEN_(void) SetShell(nsIPresShell* aShell);
00152 
00153 
00154   NS_HIDDEN_(nsPresContextType) Type() const { return mType; }
00155 
00159   nsIPresShell* PresShell() const
00160   {
00161     NS_ASSERTION(mShell, "Null pres shell");
00162     return mShell;
00163   }
00164 
00165   nsIPresShell* GetPresShell() const { return mShell; }
00166 
00167   nsIDocument* GetDocument() { return GetPresShell()->GetDocument(); } 
00168   nsIViewManager* GetViewManager() { return GetPresShell()->GetViewManager(); } 
00169 #ifdef _IMPL_NS_LAYOUT
00170   nsStyleSet* StyleSet() { return GetPresShell()->StyleSet(); }
00171 
00172   nsFrameManager* FrameManager()
00173     { return GetPresShell()->FrameManager(); } 
00174 #endif
00175 
00182   nsCompatibility CompatibilityMode() const { return mCompatibilityMode; }
00183   NS_HIDDEN_(void) SetCompatibilityMode(nsCompatibility aMode);
00184 
00188   PRUint16     ImageAnimationMode() const { return mImageAnimationMode; }
00189   virtual NS_HIDDEN_(void) SetImageAnimationModeExternal(PRUint16 aMode);
00190   NS_HIDDEN_(void) SetImageAnimationModeInternal(PRUint16 aMode);
00191 #ifdef _IMPL_NS_LAYOUT
00192   void SetImageAnimationMode(PRUint16 aMode)
00193   { SetImageAnimationModeInternal(aMode); }
00194 #else
00195   void SetImageAnimationMode(PRUint16 aMode)
00196   { SetImageAnimationModeExternal(aMode); }
00197 #endif
00198 
00203   nsILookAndFeel* LookAndFeel() { return mLookAndFeel; }
00204 
00208   nsIAtom* Medium() { return mMedium; }
00209 
00213   NS_HIDDEN_(void) ClearStyleDataAndReflow();
00214 
00215   void* AllocateFromShell(size_t aSize)
00216   {
00217     if (mShell)
00218       return mShell->AllocateFrame(aSize);
00219     return nsnull;
00220   }
00221 
00222   void FreeToShell(size_t aSize, void* aFreeChunk)
00223   {
00224     if (mShell)
00225       mShell->FreeFrame(aSize, aFreeChunk);
00226   }
00227 
00231   virtual NS_HIDDEN_(already_AddRefed<nsIFontMetrics>)
00232    GetMetricsForExternal(const nsFont& aFont);
00233   NS_HIDDEN_(already_AddRefed<nsIFontMetrics>)
00234     GetMetricsForInternal(const nsFont& aFont);
00235 #ifdef _IMPL_NS_LAYOUT
00236   already_AddRefed<nsIFontMetrics> GetMetricsFor(const nsFont& aFont)
00237   { return GetMetricsForInternal(aFont); }
00238 #else
00239   already_AddRefed<nsIFontMetrics> GetMetricsFor(const nsFont& aFont)
00240   { return GetMetricsForExternal(aFont); }
00241 #endif
00242 
00247   virtual NS_HIDDEN_(const nsFont*) GetDefaultFontExternal(PRUint8 aFontID) const;
00248   NS_HIDDEN_(const nsFont*) GetDefaultFontInternal(PRUint8 aFontID) const;
00249 #ifdef _IMPL_NS_LAYOUT
00250   const nsFont* GetDefaultFont(PRUint8 aFontID) const
00251   { return GetDefaultFontInternal(aFontID); }
00252 #else
00253   const nsFont* GetDefaultFont(PRUint8 aFontID) const
00254   { return GetDefaultFontExternal(aFontID); }
00255 #endif
00256 
00258   // *  - initially created for bugs 31816, 20760, 22963
00259   PRBool GetCachedBoolPref(PRUint32 aPrefType) const
00260   {
00261     // If called with a constant parameter, the compiler should optimize
00262     // this switch statement away.
00263     switch (aPrefType) {
00264     case kPresContext_UseDocumentFonts:
00265       return mUseDocumentFonts;
00266     case kPresContext_UseDocumentColors:
00267       return mUseDocumentColors;
00268     case kPresContext_UnderlineLinks:
00269       return mUnderlineLinks;
00270     default:
00271       NS_ERROR("Invalid arg passed to GetCachedBoolPref");
00272     }
00273 
00274     return PR_FALSE;
00275   }
00276 
00278   // *  - initially created for bugs 30910, 61883, 74186, 84398
00279   PRInt32 GetCachedIntPref(PRUint32 aPrefType) const
00280   {
00281     // If called with a constant parameter, the compiler should optimize
00282     // this switch statement away.
00283     switch (aPrefType) {
00284     case kPresContext_MinimumFontSize:
00285       return mMinimumFontSize;
00286     default:
00287       NS_ERROR("invalid arg passed to GetCachedIntPref");
00288     }
00289 
00290     return PR_FALSE;
00291   }
00292 
00296   PRInt32 FontScaler() const { return mFontScaler; }
00297 
00301   const nscolor DefaultColor() const { return mDefaultColor; }
00302   const nscolor DefaultBackgroundColor() const { return mBackgroundColor; }
00303   const nscolor DefaultLinkColor() const { return mLinkColor; }
00304   const nscolor DefaultActiveLinkColor() const { return mActiveLinkColor; }
00305   const nscolor DefaultVisitedLinkColor() const { return mVisitedLinkColor; }
00306   const nscolor FocusBackgroundColor() const { return mFocusBackgroundColor; }
00307   const nscolor FocusTextColor() const { return mFocusTextColor; }
00308 
00309   PRBool GetUseFocusColors() const { return mUseFocusColors; }
00310   PRUint8 FocusRingWidth() const { return mFocusRingWidth; }
00311   PRBool GetFocusRingOnAnything() const { return mFocusRingOnAnything; }
00312  
00313 
00321   NS_HIDDEN_(imgIRequest*) LoadImage(imgIRequest* aImage,
00322                                      nsIFrame* aTargetFrame);
00323 
00328   NS_HIDDEN_(void) StopImagesFor(nsIFrame* aTargetFrame);
00329 
00330   NS_HIDDEN_(void) SetContainer(nsISupports* aContainer);
00331 
00332   virtual NS_HIDDEN_(already_AddRefed<nsISupports>) GetContainerExternal();
00333   NS_HIDDEN_(already_AddRefed<nsISupports>) GetContainerInternal();
00334 #ifdef _IMPL_NS_LAYOUT
00335   already_AddRefed<nsISupports> GetContainer()
00336   { return GetContainerInternal(); }
00337 #else
00338   already_AddRefed<nsISupports> GetContainer()
00339   { return GetContainerExternal(); }
00340 #endif
00341 
00342   // XXX this are going to be replaced with set/get container
00343   void SetLinkHandler(nsILinkHandler* aHandler) { mLinkHandler = aHandler; }
00344   nsILinkHandler* GetLinkHandler() { return mLinkHandler; }
00345 
00352   nsRect GetVisibleArea() { return mVisibleArea; }
00353 
00358   void SetVisibleArea(const nsRect& r) { mVisibleArea = r; }
00359 
00364   PRBool IsPaginated() const { return mPaginated; }
00365 
00370   NS_HIDDEN_(void) SetPaginatedScrolling(PRBool aResult);
00371 
00376   PRBool HasPaginatedScrolling() const { return mCanPaginatedScroll; }
00377 
00387   NS_HIDDEN_(void) GetPageDim(nsRect* aActualRect, nsRect* aAdjRect);
00388 
00396   NS_HIDDEN_(void) SetPageDim(const nsRect& aRect);
00397 
00398   float PixelsToTwips() const { return mDeviceContext->DevUnitsToAppUnits(); }
00399 
00400   float TwipsToPixels() const { return mDeviceContext->AppUnitsToDevUnits(); }
00401 
00402   NS_HIDDEN_(float) TwipsToPixelsForFonts() const;
00403 
00404   //XXX this is probably not an ideal name. MMP
00409   NS_HIDDEN_(float) ScaledPixelsToTwips() const;
00410 
00411   /* Convenience method for converting one pixel value to twips */
00412   nscoord IntScaledPixelsToTwips(nscoord aPixels) const
00413   { return NSIntPixelsToTwips(aPixels, ScaledPixelsToTwips()); }
00414 
00415   /* Set whether twip scaling is used */
00416   void SetScalingOfTwips(PRBool aOn) { mDoScaledTwips = aOn; }
00417 
00418   nsIDeviceContext* DeviceContext() { return mDeviceContext; }
00419   nsIEventStateManager* EventStateManager() { return mEventManager; }
00420   nsIAtom* GetLangGroup() { return mLangGroup; }
00421 
00422   float TextZoom() { return mTextZoom; }
00423   void SetTextZoomInternal(float aZoom) {
00424     mTextZoom = aZoom;
00425     ClearStyleDataAndReflow();
00426   }
00427   virtual NS_HIDDEN_(void) SetTextZoomExternal(float aZoom);
00428 #ifdef _IMPL_NS_LAYOUT
00429   void SetTextZoom(float aZoom) { SetTextZoomInternal(aZoom); }
00430 #else
00431   void SetTextZoom(float aZoom) { SetTextZoomExternal(aZoom); }
00432 #endif
00433 
00434 
00435 
00444   nsLanguageSpecificTransformType LanguageSpecificTransformType() const
00445   {
00446     return mLanguageSpecificTransformType;
00447   }
00448 
00449   struct ScrollbarStyles {
00450     // Always one of NS_STYLE_OVERFLOW_SCROLL, NS_STYLE_OVERFLOW_HIDDEN,
00451     // or NS_STYLE_OVERFLOW_AUTO.
00452     PRUint8 mHorizontal, mVertical;
00453     ScrollbarStyles(PRUint8 h, PRUint8 v) : mHorizontal(h), mVertical(v) {}
00454     ScrollbarStyles() {}
00455   };
00456   void SetViewportOverflowOverride(PRUint8 aX, PRUint8 aY)
00457   {
00458     mViewportStyleOverflow.mHorizontal = aX;
00459     mViewportStyleOverflow.mVertical = aY;
00460   }
00461   ScrollbarStyles GetViewportOverflowOverride()
00462   {
00463     return mViewportStyleOverflow;
00464   }
00465 
00469   PRBool GetBackgroundImageDraw() const { return mDrawImageBackground; }
00470   void   SetBackgroundImageDraw(PRBool aCanDraw)
00471   {
00472     NS_ASSERTION(!(aCanDraw & ~1), "Value must be true or false");
00473     mDrawImageBackground = aCanDraw;
00474   }
00475 
00476   PRBool GetBackgroundColorDraw() const { return mDrawColorBackground; }
00477   void   SetBackgroundColorDraw(PRBool aCanDraw)
00478   {
00479     NS_ASSERTION(!(aCanDraw & ~1), "Value must be true or false");
00480     mDrawColorBackground = aCanDraw;
00481   }
00482 
00483 #ifdef IBMBIDI
00484 
00491   virtual NS_HIDDEN_(PRBool) BidiEnabledExternal() const;
00492   NS_HIDDEN_(PRBool) BidiEnabledInternal() const;
00493 #ifdef _IMPL_NS_LAYOUT
00494   PRBool BidiEnabled() const { return BidiEnabledInternal(); }
00495 #else
00496   PRBool BidiEnabled() const { return BidiEnabledExternal(); }
00497 #endif
00498 
00504   NS_HIDDEN_(void) SetBidiEnabled(PRBool aBidiEnabled) const;
00505 
00520   void SetVisualMode(PRBool aIsVisual)
00521   {
00522     NS_ASSERTION(!(aIsVisual & ~1), "Value must be true or false");
00523     mIsVisual = aIsVisual;
00524   }
00525 
00531   PRBool IsVisualMode() const { return mIsVisual; }
00532 
00533 //Mohamed
00534 
00538   NS_HIDDEN_(nsBidiPresUtils*) GetBidiUtils();
00539 
00543   NS_HIDDEN_(void) SetBidi(PRUint32 aBidiOptions,
00544                            PRBool aForceReflow = PR_FALSE);
00545 
00549   NS_HIDDEN_(PRUint32) GetBidi() const { return mBidi; }
00550 
00555   void SetIsBidiSystem(PRBool aIsBidi)
00556   {
00557     NS_ASSERTION(!(aIsBidi & ~1), "Value must be true or false");
00558     mIsBidiSystem = aIsBidi;
00559   }
00560 
00565   PRBool IsBidiSystem() const { return mIsBidiSystem; }
00566 #endif // IBMBIDI
00567 
00571   void SetIsRenderingOnlySelection(PRBool aResult)
00572   {
00573     NS_ASSERTION(!(aResult & ~1), "Value must be true or false");
00574     mIsRenderingOnlySelection = aResult;
00575   }
00576 
00577   PRBool IsRenderingOnlySelection() const { return mIsRenderingOnlySelection; }
00578 
00579   /*
00580    * Obtain a native them for rendering our widgets (both form controls and html)
00581    */
00582   NS_HIDDEN_(nsITheme*) GetTheme();
00583 
00584   /*
00585    * Notify the pres context that the theme has changed.  An internal switch
00586    * means it's one of our Mozilla themes that changed (e.g., Modern to Classic).
00587    * Otherwise, the OS is telling us that the native theme for the platform
00588    * has changed.
00589    */
00590   NS_HIDDEN_(void) ThemeChanged();
00591 
00592   /*
00593    * Notify the pres context that a system color has changed
00594    */
00595   NS_HIDDEN_(void) SysColorChanged();
00596 
00598   NS_HIDDEN_(void) SetPrintSettings(nsIPrintSettings *aPrintSettings);
00599 
00600   nsIPrintSettings* GetPrintSettings() { return mPrintSettings; }
00601 
00602   /* Accessor for table of frame properties */
00603   nsPropertyTable* PropertyTable() { return &mPropertyTable; }
00604 
00605   /* Helper function that ensures that this prescontext is shown in its
00606      docshell if it's the most recent prescontext for the docshell.  Returns
00607      whether the prescontext is now being shown.
00608 
00609      @param aUnsuppressFocus If this is false, then focus will not be
00610      unsuppressed when PR_TRUE is returned.  It's the caller's responsibility
00611      to unsuppress focus in that case.
00612   */
00613   NS_HIDDEN_(PRBool) EnsureVisible(PRBool aUnsuppressFocus);
00614   
00615 #ifdef MOZ_REFLOW_PERF
00616   NS_HIDDEN_(void) CountReflows(const char * aName,
00617                                 PRUint32 aType, nsIFrame * aFrame);
00618   NS_HIDDEN_(void) PaintCount(const char * aName,
00619                               nsIRenderingContext* aRendingContext,
00620                               nsIFrame * aFrame, PRUint32 aColor);
00621 #endif
00622 
00627   const nscoord* GetBorderWidthTable() { return mBorderWidthTable; }
00628 
00629   // Is this presentation in a chrome docshell?
00630   PRBool IsChrome();
00631 
00632 protected:
00633   NS_HIDDEN_(void) SetImgAnimations(nsIContent *aParent, PRUint16 aMode);
00634   NS_HIDDEN_(void) GetDocumentColorPreferences();
00635 
00636   NS_HIDDEN_(void) PreferenceChanged(const char* aPrefName);
00637   static NS_HIDDEN_(int) PR_CALLBACK PrefChangedCallback(const char*, void*);
00638 
00639   NS_HIDDEN_(void) UpdateAfterPreferencesChanged();
00640   static NS_HIDDEN_(void) PR_CALLBACK PrefChangedUpdateTimerCallback(nsITimer *aTimer, void *aClosure);
00641 
00642   NS_HIDDEN_(void) GetUserPreferences();
00643   NS_HIDDEN_(void) GetFontPreferences();
00644 
00645   NS_HIDDEN_(void) UpdateCharSet(const nsAFlatCString& aCharSet);
00646 
00647   // IMPORTANT: The ownership implicit in the following member variables
00648   // has been explicitly checked.  If you add any members to this class,
00649   // please make the ownership explicit (pinkerton, scc).
00650   
00651   nsPresContextType     mType;
00652   nsIPresShell*         mShell;         // [WEAK]
00653   nsIDeviceContext*     mDeviceContext; // [STRONG] could be weak, but
00654                                         // better safe than sorry.
00655                                         // Cannot reintroduce cycles
00656                                         // since there is no dependency
00657                                         // from gfx back to layout.
00658   nsIEventStateManager* mEventManager;  // [STRONG]
00659   nsILookAndFeel*       mLookAndFeel;   // [STRONG]
00660   nsIAtom*              mMedium;        // initialized by subclass ctors;
00661                                         // weak pointer to static atom
00662 
00663   nsILinkHandler*       mLinkHandler;   // [WEAK]
00664   nsIAtom*              mLangGroup;     // [STRONG]
00665 
00666   nsSupportsHashtable   mImageLoaders;
00667   nsWeakPtr             mContainer;
00668 
00669   float                 mTextZoom;      // Text zoom, defaults to 1.0
00670 
00671 #ifdef IBMBIDI
00672   nsBidiPresUtils*      mBidiUtils;
00673 #endif
00674 
00675   nsCOMPtr<nsITheme> mTheme;
00676   nsCOMPtr<nsILanguageAtomService> mLangService;
00677   nsCOMPtr<nsIPrintSettings> mPrintSettings;
00678   nsCOMPtr<nsITimer>    mPrefChangedTimer;
00679 
00680   nsPropertyTable       mPropertyTable;
00681 
00682   nsLanguageSpecificTransformType mLanguageSpecificTransformType;
00683   PRInt32               mFontScaler;
00684   nscoord               mMinimumFontSize;
00685 
00686   nsRect                mVisibleArea;
00687   nsRect                mPageDim;
00688 
00689   nscolor               mDefaultColor;
00690   nscolor               mBackgroundColor;
00691 
00692   nscolor               mLinkColor;
00693   nscolor               mActiveLinkColor;
00694   nscolor               mVisitedLinkColor;
00695 
00696   nscolor               mFocusBackgroundColor;
00697   nscolor               mFocusTextColor;
00698 
00699   ScrollbarStyles       mViewportStyleOverflow;
00700   PRUint8               mFocusRingWidth;
00701 
00702   nsCompatibility       mCompatibilityMode;
00703   PRUint16              mImageAnimationMode;
00704   PRUint16              mImageAnimationModePref;
00705 
00706   nsFont                mDefaultVariableFont;
00707   nsFont                mDefaultFixedFont;
00708   nsFont                mDefaultSerifFont;
00709   nsFont                mDefaultSansSerifFont;
00710   nsFont                mDefaultMonospaceFont;
00711   nsFont                mDefaultCursiveFont;
00712   nsFont                mDefaultFantasyFont;
00713 
00714   nscoord               mBorderWidthTable[3];
00715 
00716   unsigned              mUseDocumentFonts : 1;
00717   unsigned              mUseDocumentColors : 1;
00718   unsigned              mUnderlineLinks : 1;
00719   unsigned              mUseFocusColors : 1;
00720   unsigned              mFocusRingOnAnything : 1;
00721   unsigned              mDrawImageBackground : 1;
00722   unsigned              mDrawColorBackground : 1;
00723   unsigned              mNeverAnimate : 1;
00724   unsigned              mIsRenderingOnlySelection : 1;
00725   unsigned              mNoTheme : 1;
00726   unsigned              mPaginated : 1;
00727   unsigned              mCanPaginatedScroll : 1;
00728   unsigned              mDoScaledTwips : 1;
00729   unsigned              mEnableJapaneseTransform : 1;
00730 #ifdef IBMBIDI
00731   unsigned              mIsVisual : 1;
00732   unsigned              mIsBidiSystem : 1;
00733 
00734   PRUint32              mBidi;
00735 #endif
00736 #ifdef DEBUG
00737   PRBool                mInitialized;
00738 #endif
00739 
00740 
00741 protected:
00742 
00743   ~nsPresContext() NS_HIDDEN;
00744 
00745   // these are private, use the list in nsFont.h if you want a public list
00746   enum {
00747     eDefaultFont_Variable,
00748     eDefaultFont_Fixed,
00749     eDefaultFont_Serif,
00750     eDefaultFont_SansSerif,
00751     eDefaultFont_Monospace,
00752     eDefaultFont_Cursive,
00753     eDefaultFont_Fantasy,
00754     eDefaultFont_COUNT
00755   };
00756 
00757 };
00758 
00759 // Bit values for StartLoadImage's aImageStatus
00760 #define NS_LOAD_IMAGE_STATUS_ERROR      0x1
00761 #define NS_LOAD_IMAGE_STATUS_SIZE       0x2
00762 #define NS_LOAD_IMAGE_STATUS_BITS       0x4
00763 
00764 #ifdef MOZ_REFLOW_PERF
00765 
00766 #define DO_GLOBAL_REFLOW_COUNT(_name, _type) \
00767   aPresContext->CountReflows((_name), (_type), (nsIFrame*)this); 
00768 #else
00769 #define DO_GLOBAL_REFLOW_COUNT(_name, _type)
00770 #endif // MOZ_REFLOW_PERF
00771 
00772 #if defined(MOZ_REFLOW_PERF_DSP) && defined(MOZ_REFLOW_PERF)
00773 #define DO_GLOBAL_REFLOW_COUNT_DSP(_name, _rend) \
00774   if (NS_FRAME_PAINT_LAYER_FOREGROUND == aWhichLayer) { \
00775     aPresContext->PaintCount((_name), (_rend), (nsIFrame*)this, 0); \
00776   }
00777 #define DO_GLOBAL_REFLOW_COUNT_DSP_J(_name, _rend, _just) \
00778   if (NS_FRAME_PAINT_LAYER_FOREGROUND == aWhichLayer) { \
00779     aPresContext->PaintCount((_name), (_rend), (nsIFrame*)this, (_just)); \
00780   }
00781 #else
00782 #define DO_GLOBAL_REFLOW_COUNT_DSP(_name, _rend)
00783 #define DO_GLOBAL_REFLOW_COUNT_DSP_J(_name, _rend, _just)
00784 #endif // MOZ_REFLOW_PERF_DSP
00785 
00786 #endif /* nsPresContext_h___ */