2001-09-29 00:14:13 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
|
|
|
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
1998-04-14 00:24:54 +04:00
|
|
|
*
|
2001-09-29 00:14:13 +04:00
|
|
|
* The contents of this file are subject to the Netscape Public License
|
|
|
|
* Version 1.1 (the "License"); you may not use this file except in
|
|
|
|
* compliance with the License. You may obtain a copy of the License at
|
|
|
|
* http://www.mozilla.org/NPL/
|
1998-04-14 00:24:54 +04:00
|
|
|
*
|
2001-09-29 00:14:13 +04:00
|
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* License.
|
1998-04-14 00:24:54 +04:00
|
|
|
*
|
1999-11-06 06:40:37 +03:00
|
|
|
* The Original Code is mozilla.org code.
|
|
|
|
*
|
2001-09-29 00:14:13 +04:00
|
|
|
* The Initial Developer of the Original Code is
|
|
|
|
* Netscape Communications Corporation.
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 1998
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
1999-11-06 06:40:37 +03:00
|
|
|
*
|
2001-09-29 00:14:13 +04:00
|
|
|
* Contributor(s):
|
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
|
|
|
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
|
|
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
|
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
|
|
* of those above. If you wish to allow use of your version of this file only
|
|
|
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
|
|
* use your version of this file under the terms of the NPL, indicate your
|
|
|
|
* decision by deleting the provisions above and replace them with the notice
|
|
|
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
|
|
* the provisions above, a recipient may use your version of this file under
|
|
|
|
* the terms of any one of the NPL, the GPL or the LGPL.
|
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
1998-04-14 00:24:54 +04:00
|
|
|
#ifndef nsIPresContext_h___
|
|
|
|
#define nsIPresContext_h___
|
|
|
|
|
|
|
|
#include "nsISupports.h"
|
1998-07-16 08:34:59 +04:00
|
|
|
#include "nsColor.h"
|
2001-07-16 06:40:48 +04:00
|
|
|
#include "nsCoord.h"
|
2002-03-24 01:26:36 +03:00
|
|
|
#include "nsAString.h"
|
2001-09-29 21:50:15 +04:00
|
|
|
#include "nsIRequest.h"
|
2002-06-26 01:16:17 +04:00
|
|
|
#include "nsCompatibility.h"
|
2003-02-22 03:32:13 +03:00
|
|
|
#include "nsCOMPtr.h"
|
2003-06-19 22:16:53 +04:00
|
|
|
#include "nsIPresShell.h"
|
2004-02-01 13:09:07 +03:00
|
|
|
#include "nsRect.h"
|
2001-03-09 06:13:03 +03:00
|
|
|
#ifdef IBMBIDI
|
|
|
|
class nsBidiPresUtils;
|
|
|
|
#endif // IBMBIDI
|
1998-04-14 00:24:54 +04:00
|
|
|
|
1998-05-12 02:57:05 +04:00
|
|
|
struct nsFont;
|
2001-07-16 06:40:48 +04:00
|
|
|
struct nsRect;
|
1998-05-12 02:57:05 +04:00
|
|
|
|
2001-08-10 00:22:39 +04:00
|
|
|
class imgIRequest;
|
|
|
|
|
1998-05-12 02:57:05 +04:00
|
|
|
class nsIContent;
|
1998-09-10 23:32:14 +04:00
|
|
|
class nsIDocument;
|
1998-05-12 02:57:05 +04:00
|
|
|
class nsIDeviceContext;
|
|
|
|
class nsIFontMetrics;
|
|
|
|
class nsIFrame;
|
2003-07-12 04:48:16 +04:00
|
|
|
class nsIFrameManager;
|
1999-04-14 01:48:49 +04:00
|
|
|
class nsIImage;
|
1998-04-14 00:24:54 +04:00
|
|
|
class nsILinkHandler;
|
|
|
|
class nsIPresShell;
|
2002-12-11 08:11:02 +03:00
|
|
|
class nsIPref;
|
2003-02-22 03:32:13 +03:00
|
|
|
class nsStyleContext;
|
1998-05-19 01:03:10 +04:00
|
|
|
class nsIAtom;
|
1998-04-14 00:24:54 +04:00
|
|
|
class nsString;
|
1998-06-24 01:53:02 +04:00
|
|
|
class nsIEventStateManager;
|
1999-06-23 07:29:44 +04:00
|
|
|
class nsIURI;
|
1999-09-10 09:51:08 +04:00
|
|
|
class nsILookAndFeel;
|
2001-02-16 00:24:47 +03:00
|
|
|
class nsICSSPseudoComparator;
|
2001-07-16 06:40:48 +04:00
|
|
|
class nsILanguageAtom;
|
2001-12-18 01:51:39 +03:00
|
|
|
class nsITheme;
|
2003-01-09 09:49:07 +03:00
|
|
|
struct nsStyleStruct;
|
|
|
|
struct nsStyleBackground;
|
1998-04-14 00:24:54 +04:00
|
|
|
|
2001-03-13 04:47:22 +03:00
|
|
|
#ifdef MOZ_REFLOW_PERF
|
|
|
|
class nsIRenderingContext;
|
|
|
|
#endif
|
|
|
|
|
1998-04-14 00:24:54 +04:00
|
|
|
#define NS_IPRESCONTEXT_IID \
|
|
|
|
{ 0x0a5d12e0, 0x944e, 0x11d1, \
|
|
|
|
{0x93, 0x23, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32} }
|
|
|
|
|
1999-08-06 09:11:39 +04:00
|
|
|
enum nsWidgetType {
|
|
|
|
eWidgetType_Button = 1,
|
|
|
|
eWidgetType_Checkbox = 2,
|
|
|
|
eWidgetType_Radio = 3,
|
|
|
|
eWidgetType_Text = 4
|
|
|
|
};
|
|
|
|
|
2000-09-21 02:59:20 +04:00
|
|
|
enum nsLanguageSpecificTransformType {
|
|
|
|
eLanguageSpecificTransformType_Unknown = -1,
|
|
|
|
eLanguageSpecificTransformType_None = 0,
|
|
|
|
eLanguageSpecificTransformType_Japanese,
|
|
|
|
eLanguageSpecificTransformType_Korean
|
|
|
|
};
|
|
|
|
|
2000-10-11 12:33:01 +04:00
|
|
|
// supported values for cached bool types
|
|
|
|
const PRUint32 kPresContext_UseDocumentColors = 0x01;
|
|
|
|
const PRUint32 kPresContext_UseDocumentFonts = 0x02;
|
|
|
|
const PRUint32 kPresContext_UnderlineLinks = 0x03;
|
|
|
|
|
2001-09-27 22:34:30 +04:00
|
|
|
// supported values for cached integer pref types
|
|
|
|
const PRUint32 kPresContext_MinimumFontSize = 0x01;
|
|
|
|
|
|
|
|
// IDs for the default variable and fixed fonts (not to be changed, see nsFont.h)
|
|
|
|
// To be used for Get/SetDefaultFont(). The other IDs in nsFont.h are also supported.
|
|
|
|
const PRUint8 kPresContext_DefaultVariableFont_ID = 0x00; // kGenericFont_moz_variable
|
|
|
|
const PRUint8 kPresContext_DefaultFixedFont_ID = 0x01; // kGenericFont_moz_fixed
|
|
|
|
|
1998-04-14 00:24:54 +04:00
|
|
|
// An interface for presentation contexts. Presentation contexts are
|
|
|
|
// objects that provide an outer context for a presentation shell.
|
|
|
|
class nsIPresContext : public nsISupports {
|
|
|
|
public:
|
2002-06-26 07:38:55 +04:00
|
|
|
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IPRESCONTEXT_IID)
|
1999-04-30 12:59:11 +04:00
|
|
|
|
1998-06-25 08:24:45 +04:00
|
|
|
/**
|
|
|
|
* Initialize the presentation context from a particular device.
|
|
|
|
*/
|
2000-03-02 10:13:02 +03:00
|
|
|
NS_IMETHOD Init(nsIDeviceContext* aDeviceContext) = 0;
|
1998-11-26 21:08:44 +03:00
|
|
|
|
1998-04-14 00:24:54 +04:00
|
|
|
/**
|
|
|
|
* Set the presentation shell that this context is bound to.
|
|
|
|
* A presentation context may only be bound to a single shell.
|
|
|
|
*/
|
1998-11-26 21:08:44 +03:00
|
|
|
NS_IMETHOD SetShell(nsIPresShell* aShell) = 0;
|
1998-04-14 00:24:54 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the PresentationShell that this context is bound to.
|
|
|
|
*/
|
2003-12-21 08:36:36 +03:00
|
|
|
nsIPresShell* PresShell() const
|
|
|
|
{
|
|
|
|
NS_ASSERTION(mShell, "Null pres shell");
|
|
|
|
return mShell;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsIPresShell* GetPresShell() const { return mShell; }
|
2003-06-19 22:16:53 +04:00
|
|
|
|
|
|
|
nsIDocument* GetDocument() { return GetPresShell()->GetDocument(); }
|
|
|
|
nsIViewManager* GetViewManager() { return GetPresShell()->GetViewManager(); }
|
2004-01-28 03:18:22 +03:00
|
|
|
#ifdef _IMPL_NS_LAYOUT
|
|
|
|
nsStyleSet* StyleSet() { return GetPresShell()->StyleSet(); }
|
|
|
|
#endif
|
2003-07-12 04:48:16 +04:00
|
|
|
nsIFrameManager* GetFrameManager()
|
|
|
|
{ return GetPresShell()->GetFrameManager(); }
|
1998-04-14 00:24:54 +04:00
|
|
|
|
1998-07-31 09:54:59 +04:00
|
|
|
/**
|
|
|
|
* Access compatibility mode for this context
|
2001-06-27 06:25:47 +04:00
|
|
|
*
|
|
|
|
* All users must explicitly set the compatibility mode rather than
|
|
|
|
* relying on a default.
|
1998-07-31 09:54:59 +04:00
|
|
|
*/
|
2003-12-25 00:51:50 +03:00
|
|
|
nsCompatibility CompatibilityMode() const { return mCompatibilityMode; }
|
|
|
|
virtual void SetCompatibilityMode(nsCompatibility aMode) = 0;
|
1998-07-31 09:54:59 +04:00
|
|
|
|
2000-05-13 05:39:20 +04:00
|
|
|
/**
|
|
|
|
* Access the image animation mode for this context
|
|
|
|
*/
|
2003-12-26 07:24:11 +03:00
|
|
|
PRUint16 ImageAnimationMode() const { return mImageAnimationMode; }
|
|
|
|
virtual void SetImageAnimationMode(PRUint16 aMode) = 0;
|
2000-05-13 05:39:20 +04:00
|
|
|
|
2001-09-29 21:50:15 +04:00
|
|
|
/**
|
2004-01-21 12:35:59 +03:00
|
|
|
* Get cached look and feel service. This is faster than obtaining it
|
|
|
|
* through the service manager.
|
2001-09-29 21:50:15 +04:00
|
|
|
*/
|
2004-01-21 12:35:59 +03:00
|
|
|
nsILookAndFeel* LookAndFeel() { return mLookAndFeel; }
|
2002-11-06 15:58:05 +03:00
|
|
|
|
1998-12-02 03:28:57 +03:00
|
|
|
/**
|
|
|
|
* Get medium of presentation
|
|
|
|
*/
|
2004-01-28 03:18:22 +03:00
|
|
|
nsIAtom* Medium() { return mMedium; }
|
1998-12-02 03:28:57 +03:00
|
|
|
|
2000-04-03 01:52:17 +04:00
|
|
|
/**
|
2001-07-25 10:33:06 +04:00
|
|
|
* Clear style data from the root frame downwards, and reflow.
|
2000-04-03 01:52:17 +04:00
|
|
|
*/
|
2004-01-28 03:18:22 +03:00
|
|
|
virtual void ClearStyleDataAndReflow() = 0;
|
2001-10-30 09:02:05 +03:00
|
|
|
|
2003-02-23 20:20:15 +03:00
|
|
|
/**
|
|
|
|
* Resolve a new style context for a content node and return the URL
|
2003-10-02 02:53:56 +04:00
|
|
|
* for its XBL binding, or null if it has no binding specified in CSS.
|
2003-02-23 20:20:15 +03:00
|
|
|
*/
|
2004-01-28 03:18:22 +03:00
|
|
|
virtual nsresult GetXBLBindingURL(nsIContent* aContent,
|
|
|
|
nsIURI** aResult) = 0;
|
1998-07-31 09:54:59 +04:00
|
|
|
|
2001-06-01 02:19:43 +04:00
|
|
|
NS_IMETHOD AllocateFromShell(size_t aSize, void** aResult) = 0;
|
|
|
|
NS_IMETHOD FreeToShell(size_t aSize, void* aFreeChunk) = 0;
|
|
|
|
|
1998-04-14 00:24:54 +04:00
|
|
|
/**
|
|
|
|
* Get the font metrics for a given font.
|
|
|
|
*/
|
1999-02-12 20:45:58 +03:00
|
|
|
NS_IMETHOD GetMetricsFor(const nsFont& aFont, nsIFontMetrics** aResult) = 0;
|
1998-04-14 00:24:54 +04:00
|
|
|
|
2004-02-01 01:41:40 +03:00
|
|
|
/**
|
|
|
|
* Get the default font correponding to the given ID. This object is
|
|
|
|
* read-only, you must copy the font to modify it.
|
|
|
|
*/
|
|
|
|
virtual const nsFont* GetDefaultFont(PRUint8 aFontID) const = 0;
|
1998-07-17 09:41:41 +04:00
|
|
|
|
2000-10-11 12:33:01 +04:00
|
|
|
/** Get a cached boolean pref, by its type
|
2001-09-27 22:34:30 +04:00
|
|
|
if the type is not supported, then NS_ERROR_INVALID_ARG is returned
|
|
|
|
and the aValue argument is undefined, otherwise aValue is set
|
2000-10-11 12:33:01 +04:00
|
|
|
to the value of the boolean pref */
|
|
|
|
// * - initially created for bugs 31816, 20760, 22963
|
2001-10-31 01:58:00 +03:00
|
|
|
NS_IMETHOD GetCachedBoolPref(PRUint32 aPrefType, PRBool& aValue) = 0;
|
2001-09-27 22:34:30 +04:00
|
|
|
|
|
|
|
/** Get a cached integer pref, by its type
|
|
|
|
if the type is not supported, then NS_ERROR_INVALID_ARG is returned
|
|
|
|
and the aValue argument is undefined, otherwise aValue is set
|
|
|
|
to the value of the integer pref */
|
|
|
|
// * - initially created for bugs 30910, 61883, 74186, 84398
|
2001-10-31 01:58:00 +03:00
|
|
|
NS_IMETHOD GetCachedIntPref(PRUint32 aPrefType, PRInt32& aValue) = 0;
|
2000-10-11 12:33:01 +04:00
|
|
|
|
1998-07-25 05:11:49 +04:00
|
|
|
/**
|
|
|
|
* Access Nav's magic font scaler value
|
|
|
|
*/
|
2004-02-01 01:41:40 +03:00
|
|
|
PRInt32 FontScaler() const { return mFontScaler; }
|
1998-07-25 05:11:49 +04:00
|
|
|
|
1998-07-17 09:41:41 +04:00
|
|
|
/**
|
2000-10-11 12:33:01 +04:00
|
|
|
* Get the default colors
|
1998-07-17 09:41:41 +04:00
|
|
|
*/
|
2004-02-01 01:41:40 +03:00
|
|
|
const nscolor DefaultColor() const { return mDefaultColor; }
|
|
|
|
const nscolor DefaultBackgroundColor() const { return mBackgroundColor; }
|
|
|
|
const nscolor DefaultLinkColor() const { return mLinkColor; }
|
|
|
|
const nscolor DefaultActiveLinkColor() const { return mActiveLinkColor; }
|
|
|
|
const nscolor DefaultVisitedLinkColor() const { return mVisitedLinkColor; }
|
|
|
|
const nscolor FocusBackgroundColor() const { return mFocusBackgroundColor; }
|
|
|
|
const nscolor FocusTextColor() const { return mFocusTextColor; }
|
|
|
|
|
2001-04-10 02:17:11 +04:00
|
|
|
NS_IMETHOD GetUseFocusColors(PRBool& useFocusColors) = 0;
|
2004-02-01 01:41:40 +03:00
|
|
|
PRUint8 FocusRingWidth() const { return mFocusRingWidth; }
|
2001-04-10 02:17:11 +04:00
|
|
|
NS_IMETHOD GetFocusRingOnAnything(PRBool& focusRingOnAnything) = 0;
|
|
|
|
|
1999-06-13 02:31:57 +04:00
|
|
|
|
1998-04-14 00:24:54 +04:00
|
|
|
/**
|
1998-05-12 02:57:05 +04:00
|
|
|
* Load an image for the target frame. This call can be made
|
2001-08-10 00:22:39 +04:00
|
|
|
* repeated with only a single image ever being loaded. When the
|
1998-07-16 08:34:59 +04:00
|
|
|
* image's data is ready for rendering the target frame's Paint()
|
|
|
|
* method will be invoked (via the ViewManager) so that the
|
|
|
|
* appropriate damage repair is done.
|
1999-04-14 01:48:49 +04:00
|
|
|
*/
|
2004-02-01 13:09:07 +03:00
|
|
|
virtual nsresult LoadImage(nsIURI* aURL,
|
|
|
|
nsIFrame* aTargetFrame,
|
|
|
|
imgIRequest **aRequest) = 0;
|
1998-04-14 00:24:54 +04:00
|
|
|
|
|
|
|
/**
|
2001-08-10 00:22:39 +04:00
|
|
|
* This method is called when a frame is being destroyed to
|
|
|
|
* ensure that the image load gets disassociated from the prescontext
|
1998-04-14 00:24:54 +04:00
|
|
|
*/
|
2004-02-01 13:09:07 +03:00
|
|
|
virtual void StopImagesFor(nsIFrame* aTargetFrame) = 0;
|
1998-04-14 00:24:54 +04:00
|
|
|
|
2004-02-01 13:09:07 +03:00
|
|
|
virtual void SetContainer(nsISupports* aContainer) = 0;
|
1998-04-14 00:24:54 +04:00
|
|
|
|
2004-02-01 13:09:07 +03:00
|
|
|
virtual already_AddRefed<nsISupports> GetContainer() = 0;
|
1998-04-14 00:24:54 +04:00
|
|
|
|
1998-07-13 23:49:07 +04:00
|
|
|
// XXX this are going to be replaced with set/get container
|
2004-02-01 13:09:07 +03:00
|
|
|
void SetLinkHandler(nsILinkHandler* aHandler) { mLinkHandler = aHandler; }
|
|
|
|
nsILinkHandler* GetLinkHandler() { return mLinkHandler; }
|
1998-04-14 00:24:54 +04:00
|
|
|
|
|
|
|
/**
|
1998-07-13 23:49:07 +04:00
|
|
|
* Get the visible area associated with this presentation context.
|
|
|
|
* This is the size of the visiable area that is used for
|
|
|
|
* presenting the document. The returned value is in the standard
|
|
|
|
* nscoord units (as scaled by the device context).
|
1998-04-14 00:24:54 +04:00
|
|
|
*/
|
2004-02-01 13:09:07 +03:00
|
|
|
nsRect GetVisibleArea() { return mVisibleArea; }
|
1998-04-14 00:24:54 +04:00
|
|
|
|
|
|
|
/**
|
1998-07-13 23:49:07 +04:00
|
|
|
* Set the currently visible area. The units for r are standard
|
|
|
|
* nscoord units (as scaled by the device context).
|
1998-04-14 00:24:54 +04:00
|
|
|
*/
|
2004-02-01 13:09:07 +03:00
|
|
|
void SetVisibleArea(const nsRect& r) { mVisibleArea = r; }
|
1998-04-14 00:24:54 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Return true if this presentation context is a paginated
|
|
|
|
* context.
|
|
|
|
*/
|
1999-02-12 20:45:58 +03:00
|
|
|
NS_IMETHOD IsPaginated(PRBool* aResult) = 0;
|
1998-04-14 00:24:54 +04:00
|
|
|
|
2001-11-03 17:59:39 +03:00
|
|
|
/**
|
|
|
|
* Sets whether the presentation context can scroll for a paginated
|
|
|
|
* context.
|
|
|
|
*/
|
|
|
|
NS_IMETHOD SetPaginatedScrolling(PRBool aResult) = 0;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return true if this presentation context can scroll for paginated
|
|
|
|
* context.
|
|
|
|
*/
|
|
|
|
NS_IMETHOD GetPaginatedScrolling(PRBool* aResult) = 0;
|
|
|
|
|
1998-04-14 00:24:54 +04:00
|
|
|
/**
|
2002-05-07 01:58:10 +04:00
|
|
|
* Gets the rect for the page dimensions,
|
2001-04-12 17:04:29 +04:00
|
|
|
* this includes X,Y Offsets which are used to determine
|
|
|
|
* the inclusion of margins
|
|
|
|
* Also, indicates whether the size has been overridden
|
|
|
|
*
|
|
|
|
* @param aActualRect returns the size of the actual device/surface
|
|
|
|
* @param aRect returns the adjusted size
|
1998-04-14 00:24:54 +04:00
|
|
|
*/
|
2004-02-01 13:09:07 +03:00
|
|
|
virtual void GetPageDim(nsRect* aActualRect, nsRect* aAdjRect) = 0;
|
1998-04-14 00:24:54 +04:00
|
|
|
|
|
|
|
/**
|
2001-04-12 17:04:29 +04:00
|
|
|
* Sets the "adjusted" rect for the page Dimimensions,
|
|
|
|
* this includes X,Y Offsets which are used to determine
|
|
|
|
* the inclusion of margins
|
|
|
|
*
|
|
|
|
* @param aRect returns the adjusted size
|
1998-04-14 00:24:54 +04:00
|
|
|
*/
|
2004-02-01 13:09:07 +03:00
|
|
|
virtual void SetPageDim(nsRect* aRect) = 0;
|
1999-02-12 20:45:58 +03:00
|
|
|
|
|
|
|
NS_IMETHOD GetPixelsToTwips(float* aResult) const = 0;
|
1998-04-14 00:24:54 +04:00
|
|
|
|
1999-02-12 20:45:58 +03:00
|
|
|
NS_IMETHOD GetTwipsToPixels(float* aResult) const = 0;
|
1998-04-14 00:24:54 +04:00
|
|
|
|
2001-11-03 17:59:39 +03:00
|
|
|
NS_IMETHOD GetTwipsToPixelsForFonts(float* aResult) const = 0;
|
|
|
|
|
1998-11-14 04:52:27 +03:00
|
|
|
//XXX this is probably not an ideal name. MMP
|
|
|
|
/**
|
|
|
|
* Do pixels to twips conversion taking into account
|
|
|
|
* differing size of a "pixel" from device to device.
|
|
|
|
*/
|
1999-02-12 20:45:58 +03:00
|
|
|
NS_IMETHOD GetScaledPixelsToTwips(float* aScale) const = 0;
|
1998-11-14 04:52:27 +03:00
|
|
|
|
2004-02-03 01:17:21 +03:00
|
|
|
nsIDeviceContext* DeviceContext() { return mDeviceContext; }
|
1998-06-24 01:53:02 +04:00
|
|
|
|
|
|
|
NS_IMETHOD GetEventStateManager(nsIEventStateManager** aManager) = 0;
|
2003-06-19 22:16:53 +04:00
|
|
|
nsIEventStateManager* GetEventStateManager();
|
|
|
|
|
2004-02-01 13:09:07 +03:00
|
|
|
nsILanguageAtom* GetLanguage() { return mLanguage; }
|
2000-04-21 18:59:47 +04:00
|
|
|
|
2000-09-21 02:59:20 +04:00
|
|
|
/**
|
|
|
|
* Get the language-specific transform type for the current document.
|
|
|
|
* This tells us whether we need to perform special language-dependent
|
|
|
|
* transformations such as Unicode U+005C (backslash) to Japanese
|
|
|
|
* Yen Sign (Unicode U+00A5, JIS 0x5C).
|
|
|
|
*
|
|
|
|
* @param aType returns type, must be non-NULL
|
|
|
|
*/
|
|
|
|
NS_IMETHOD GetLanguageSpecificTransformType(
|
|
|
|
nsLanguageSpecificTransformType* aType) = 0;
|
|
|
|
|
2001-12-14 05:25:48 +03:00
|
|
|
/**
|
|
|
|
* Set and get methods for controling the background drawing
|
|
|
|
*/
|
2002-02-15 17:48:12 +03:00
|
|
|
NS_IMETHOD GetBackgroundImageDraw(PRBool &aCanDraw)=0;
|
|
|
|
NS_IMETHOD SetBackgroundImageDraw(PRBool aCanDraw)=0;
|
|
|
|
NS_IMETHOD GetBackgroundColorDraw(PRBool &aCanDraw)=0;
|
|
|
|
NS_IMETHOD SetBackgroundColorDraw(PRBool aCanDraw)=0;
|
2001-12-14 05:25:48 +03:00
|
|
|
|
2001-03-09 06:13:03 +03:00
|
|
|
#ifdef IBMBIDI
|
|
|
|
/**
|
|
|
|
* Check if bidi enabled (set depending on the presence of RTL
|
|
|
|
* characters or when default directionality is RTL).
|
|
|
|
* If enabled, we should apply the Unicode Bidi Algorithm
|
|
|
|
*
|
|
|
|
* @lina 07/12/2000
|
|
|
|
*/
|
2001-05-16 17:40:08 +04:00
|
|
|
NS_IMETHOD GetBidiEnabled(PRBool* aBidiEnabled) const = 0;
|
2001-03-09 06:13:03 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set bidi enabled. This means we should apply the Unicode Bidi Algorithm
|
|
|
|
*
|
|
|
|
* @lina 07/12/2000
|
|
|
|
*/
|
2001-05-16 17:40:08 +04:00
|
|
|
NS_IMETHOD SetBidiEnabled(PRBool aBidiEnabled) const = 0;
|
2001-03-09 06:13:03 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set visual or implicit mode into the pres context.
|
|
|
|
*
|
|
|
|
* Visual directionality is a presentation method that displays text
|
|
|
|
* as if it were a uni-directional, according to the primary display
|
|
|
|
* direction only.
|
|
|
|
*
|
|
|
|
* Implicit directionality is a presentation method in which the
|
|
|
|
* direction is determined by the Bidi algorithm according to the
|
|
|
|
* category of the characters and the category of the adjacent
|
|
|
|
* characters, and according to their primary direction.
|
|
|
|
*
|
|
|
|
* @lina 05/02/2000
|
|
|
|
*/
|
|
|
|
NS_IMETHOD SetVisualMode(PRBool aIsVisual) = 0;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Check whether the content should be treated as visual.
|
|
|
|
*
|
|
|
|
* @lina 05/02/2000
|
|
|
|
*/
|
|
|
|
NS_IMETHOD IsVisualMode(PRBool& aIsVisual) const = 0;
|
|
|
|
|
|
|
|
//Mohamed
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get a Bidi presentation utilities object
|
|
|
|
*/
|
|
|
|
NS_IMETHOD GetBidiUtils(nsBidiPresUtils** aBidiUtils) = 0;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the Bidi options for the presentation context
|
|
|
|
*/
|
2001-04-14 01:50:54 +04:00
|
|
|
NS_IMETHOD SetBidi(PRUint32 aBidiOptions, PRBool aForceReflow = PR_FALSE) = 0;
|
2001-03-09 06:13:03 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the Bidi options for the presentation context
|
|
|
|
*/
|
2002-08-06 08:26:35 +04:00
|
|
|
NS_IMETHOD GetBidi(PRUint32* aBidiOptions) const = 0;
|
2001-03-09 06:13:03 +03:00
|
|
|
//ahmed
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Check for Bidi text mode and direction
|
|
|
|
* @return aResult == TRUE if the text mode is visual and the direction is right-to-left
|
|
|
|
*/
|
2002-08-06 08:26:35 +04:00
|
|
|
NS_IMETHOD IsVisRTL(PRBool &aResult) const = 0;
|
2001-03-09 06:13:03 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Check for Arabic encoding
|
|
|
|
* @return aResult == TRUE if the document encoding is an Arabic codepage
|
|
|
|
*/
|
2002-08-06 08:26:35 +04:00
|
|
|
NS_IMETHOD IsArabicEncoding(PRBool &aResult) const = 0;
|
2001-03-09 06:13:03 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the Bidi capabilities of the system
|
|
|
|
* @param aIsBidi == TRUE if the system has the capability of reordering Bidi text
|
|
|
|
*/
|
|
|
|
NS_IMETHOD SetIsBidiSystem(PRBool aIsBidi) = 0;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the Bidi capabilities of the system
|
|
|
|
* @return aResult == TRUE if the system has the capability of reordering Bidi text
|
|
|
|
*/
|
|
|
|
NS_IMETHOD GetIsBidiSystem(PRBool &aResult) const = 0;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the document charset
|
|
|
|
*/
|
2003-06-17 20:40:34 +04:00
|
|
|
NS_IMETHOD GetBidiCharset(nsACString &aCharSet) const = 0;
|
2001-12-11 08:57:37 +03:00
|
|
|
|
|
|
|
|
2001-03-09 06:13:03 +03:00
|
|
|
#endif // IBMBIDI
|
|
|
|
|
2001-01-27 17:09:34 +03:00
|
|
|
/**
|
|
|
|
* Render only Selection
|
|
|
|
*/
|
|
|
|
NS_IMETHOD SetIsRenderingOnlySelection(PRBool aResult) = 0;
|
|
|
|
NS_IMETHOD IsRenderingOnlySelection(PRBool* aResult) = 0;
|
|
|
|
|
2001-12-18 01:51:39 +03:00
|
|
|
/*
|
|
|
|
* Obtain a native them for rendering our widgets (both form controls and html)
|
|
|
|
*/
|
|
|
|
NS_IMETHOD GetTheme(nsITheme** aResult) = 0;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Notify the pres context that the theme has changed. An internal switch
|
|
|
|
* means it's one of our Mozilla themes that changed (e.g., Modern to Classic).
|
|
|
|
* Otherwise, the OS is telling us that the native theme for the platform
|
|
|
|
* has changed.
|
|
|
|
*/
|
|
|
|
NS_IMETHOD ThemeChanged() = 0;
|
|
|
|
|
2002-06-04 21:47:54 +04:00
|
|
|
/*
|
|
|
|
* Notify the pres context that a system color has changed
|
|
|
|
*/
|
|
|
|
NS_IMETHOD SysColorChanged() = 0;
|
|
|
|
|
2003-01-09 09:49:07 +03:00
|
|
|
/*
|
|
|
|
* Fill in an nsStyleBackground to be used to paint the background for an
|
|
|
|
* element. This applies the rules for propagating backgrounds between
|
|
|
|
* BODY, the root element, and the canvas.
|
|
|
|
*/
|
|
|
|
NS_IMETHOD FindFrameBackground(nsIFrame* aFrame,
|
|
|
|
const nsStyleBackground** aBackground,
|
|
|
|
PRBool* aIsCanavs,
|
|
|
|
PRBool* aFoundBackground) = 0;
|
|
|
|
|
2000-04-21 18:59:47 +04:00
|
|
|
#ifdef MOZ_REFLOW_PERF
|
2001-02-22 16:58:17 +03:00
|
|
|
NS_IMETHOD CountReflows(const char * aName, PRUint32 aType, nsIFrame * aFrame) = 0;
|
2001-03-13 04:47:22 +03:00
|
|
|
NS_IMETHOD PaintCount(const char * aName, nsIRenderingContext* aRendingContext, nsIFrame * aFrame, PRUint32 aColor) = 0;
|
2000-04-21 18:59:47 +04:00
|
|
|
#endif
|
2003-06-19 22:16:53 +04:00
|
|
|
|
|
|
|
protected:
|
|
|
|
// IMPORTANT: The ownership implicit in the following member variables
|
|
|
|
// has been explicitly checked. If you add any members to this class,
|
|
|
|
// please make the ownership explicit (pinkerton, scc).
|
|
|
|
|
|
|
|
nsIPresShell* mShell; // [WEAK]
|
|
|
|
nsIDeviceContext* mDeviceContext; // [STRONG] could be weak, but
|
|
|
|
// better safe than sorry.
|
|
|
|
// Cannot reintroduce cycles
|
|
|
|
// since there is no dependency
|
|
|
|
// from gfx back to layout.
|
|
|
|
nsIEventStateManager* mEventManager; // [STRONG]
|
2004-01-21 12:35:59 +03:00
|
|
|
nsILookAndFeel* mLookAndFeel; // [STRONG]
|
2004-01-28 03:18:22 +03:00
|
|
|
nsIAtom* mMedium; // initialized by subclass ctors;
|
|
|
|
// weak pointer to static atom
|
2003-06-19 22:16:53 +04:00
|
|
|
|
2004-02-01 13:09:07 +03:00
|
|
|
nsILinkHandler* mLinkHandler; // [WEAK]
|
|
|
|
nsILanguageAtom* mLanguage; // [STRONG]
|
|
|
|
|
2004-02-01 01:41:40 +03:00
|
|
|
PRInt32 mFontScaler;
|
|
|
|
|
2004-02-01 13:09:07 +03:00
|
|
|
nsRect mVisibleArea;
|
|
|
|
|
2004-02-01 01:41:40 +03:00
|
|
|
nscolor mDefaultColor;
|
|
|
|
nscolor mBackgroundColor;
|
|
|
|
|
|
|
|
nscolor mLinkColor;
|
|
|
|
nscolor mActiveLinkColor;
|
|
|
|
nscolor mVisitedLinkColor;
|
|
|
|
|
|
|
|
nscolor mFocusBackgroundColor;
|
|
|
|
nscolor mFocusTextColor;
|
|
|
|
|
|
|
|
PRUint8 mFocusRingWidth;
|
|
|
|
|
2003-12-25 00:51:50 +03:00
|
|
|
nsCompatibility mCompatibilityMode;
|
2003-12-26 07:24:11 +03:00
|
|
|
PRUint16 mImageAnimationMode;
|
1998-04-14 00:24:54 +04:00
|
|
|
};
|
|
|
|
|
1998-07-31 09:54:59 +04:00
|
|
|
// Bit values for StartLoadImage's aImageStatus
|
1998-05-09 07:21:19 +04:00
|
|
|
#define NS_LOAD_IMAGE_STATUS_ERROR 0x1
|
|
|
|
#define NS_LOAD_IMAGE_STATUS_SIZE 0x2
|
|
|
|
#define NS_LOAD_IMAGE_STATUS_BITS 0x4
|
|
|
|
|
1998-04-14 00:24:54 +04:00
|
|
|
// Factory method to create a "galley" presentation context (galley is
|
|
|
|
// a kind of view that has no limit to the size of a page)
|
2003-03-05 18:08:41 +03:00
|
|
|
nsresult
|
|
|
|
NS_NewGalleyContext(nsIPresContext** aInstancePtrResult);
|
1998-04-14 00:24:54 +04:00
|
|
|
|
2000-04-21 18:59:47 +04:00
|
|
|
#ifdef MOZ_REFLOW_PERF
|
2001-03-13 04:47:22 +03:00
|
|
|
|
2000-04-21 18:59:47 +04:00
|
|
|
#define DO_GLOBAL_REFLOW_COUNT(_name, _type) \
|
2001-02-22 16:58:17 +03:00
|
|
|
aPresContext->CountReflows((_name), (_type), (nsIFrame*)this);
|
2000-04-21 18:59:47 +04:00
|
|
|
#else
|
|
|
|
#define DO_GLOBAL_REFLOW_COUNT(_name, _type)
|
|
|
|
#endif // MOZ_REFLOW_PERF
|
|
|
|
|
2001-03-13 04:47:22 +03:00
|
|
|
#if defined(MOZ_REFLOW_PERF_DSP) && defined(MOZ_REFLOW_PERF)
|
|
|
|
#define DO_GLOBAL_REFLOW_COUNT_DSP(_name, _rend) \
|
|
|
|
if (NS_FRAME_PAINT_LAYER_FOREGROUND == aWhichLayer) { \
|
|
|
|
aPresContext->PaintCount((_name), (_rend), (nsIFrame*)this, 0); \
|
|
|
|
}
|
|
|
|
#define DO_GLOBAL_REFLOW_COUNT_DSP_J(_name, _rend, _just) \
|
|
|
|
if (NS_FRAME_PAINT_LAYER_FOREGROUND == aWhichLayer) { \
|
|
|
|
aPresContext->PaintCount((_name), (_rend), (nsIFrame*)this, (_just)); \
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
#define DO_GLOBAL_REFLOW_COUNT_DSP(_name, _rend)
|
|
|
|
#define DO_GLOBAL_REFLOW_COUNT_DSP_J(_name, _rend, _just)
|
|
|
|
#endif // MOZ_REFLOW_PERF_DSP
|
|
|
|
|
1998-04-14 00:24:54 +04:00
|
|
|
#endif /* nsIPresContext_h___ */
|