2001-09-29 00:14:13 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
2004-04-18 18:30:37 +04:00
|
|
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
1998-04-14 00:24:54 +04:00
|
|
|
*
|
2004-04-18 18:30:37 +04:00
|
|
|
* The contents of this file are subject to the Mozilla 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/MPL/
|
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.
|
|
|
|
*
|
2004-04-18 18:30:37 +04:00
|
|
|
* The Initial Developer of the Original Code is
|
2001-09-29 00:14:13 +04:00
|
|
|
* 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):
|
2008-07-26 20:14:48 +04:00
|
|
|
* L. David Baron <dbaron@dbaron.org>, Mozilla Corporation
|
2001-09-29 00:14:13 +04:00
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
2004-04-18 18:30:37 +04:00
|
|
|
* either of 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"),
|
2001-09-29 00:14:13 +04:00
|
|
|
* 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
|
2004-04-18 18:30:37 +04:00
|
|
|
* use your version of this file under the terms of the MPL, indicate your
|
2001-09-29 00:14:13 +04:00
|
|
|
* 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
|
2004-04-18 18:30:37 +04:00
|
|
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
2001-09-29 00:14:13 +04:00
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
2006-03-30 09:56:38 +04:00
|
|
|
|
|
|
|
/* a presentation of a document, part 1 */
|
|
|
|
|
2004-08-01 03:15:21 +04:00
|
|
|
#ifndef nsPresContext_h___
|
|
|
|
#define nsPresContext_h___
|
1998-04-14 00:24:54 +04:00
|
|
|
|
|
|
|
#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"
|
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"
|
2004-02-11 07:57:07 +03:00
|
|
|
#include "nsIDeviceContext.h"
|
2004-07-29 23:41:39 +04:00
|
|
|
#include "nsFont.h"
|
|
|
|
#include "nsIWeakReference.h"
|
|
|
|
#include "nsITheme.h"
|
|
|
|
#include "nsILanguageAtomService.h"
|
|
|
|
#include "nsIObserver.h"
|
2005-08-24 03:52:16 +04:00
|
|
|
#include "nsITimer.h"
|
2004-07-29 23:41:39 +04:00
|
|
|
#include "nsCRT.h"
|
|
|
|
#include "nsIPrintSettings.h"
|
2004-08-24 22:50:29 +04:00
|
|
|
#include "nsPropertyTable.h"
|
2007-01-30 03:06:41 +03:00
|
|
|
#include "nsGkAtoms.h"
|
2006-05-19 14:26:44 +04:00
|
|
|
#include "nsIDocument.h"
|
2009-02-19 22:03:28 +03:00
|
|
|
#include "nsRefPtrHashtable.h"
|
2007-08-11 01:25:24 +04:00
|
|
|
#include "nsCycleCollectionParticipant.h"
|
2008-02-08 22:52:46 +03:00
|
|
|
#include "nsChangeHint.h"
|
2008-07-07 06:28:24 +04:00
|
|
|
// This also pulls in gfxTypes.h, which we cannot include directly.
|
|
|
|
#include "gfxRect.h"
|
2008-09-18 13:47:21 +04:00
|
|
|
#include "nsRegion.h"
|
2008-11-26 02:22:38 +03:00
|
|
|
#include "nsTArray.h"
|
|
|
|
#include "nsAutoPtr.h"
|
2009-02-18 07:11:09 +03:00
|
|
|
#include "nsThreadUtils.h"
|
2009-06-11 23:30:24 +04:00
|
|
|
#include "nsContentUtils.h"
|
2009-07-22 04:45:00 +04:00
|
|
|
#include "nsIWidget.h"
|
2009-10-02 22:05:32 +04:00
|
|
|
#include "mozilla/TimeStamp.h"
|
2008-10-01 07:01:53 +04:00
|
|
|
|
2008-10-29 00:34:03 +03:00
|
|
|
class nsImageLoader;
|
2001-03-09 06:13:03 +03:00
|
|
|
#ifdef IBMBIDI
|
|
|
|
class nsBidiPresUtils;
|
|
|
|
#endif // IBMBIDI
|
1998-04-14 00:24:54 +04:00
|
|
|
|
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;
|
|
|
|
class nsIFontMetrics;
|
|
|
|
class nsIFrame;
|
2004-02-24 00:29:06 +03:00
|
|
|
class nsFrameManager;
|
1998-04-14 00:24:54 +04:00
|
|
|
class nsILinkHandler;
|
2003-02-22 03:32:13 +03:00
|
|
|
class nsStyleContext;
|
1998-05-19 01:03:10 +04:00
|
|
|
class nsIAtom;
|
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;
|
2004-06-09 03:53:59 +04:00
|
|
|
class nsIAtom;
|
2003-01-09 09:49:07 +03:00
|
|
|
struct nsStyleBackground;
|
2009-02-19 22:03:28 +03:00
|
|
|
struct nsStyleBorder;
|
2006-09-12 08:36:03 +04:00
|
|
|
class nsIRunnable;
|
2008-10-01 07:01:53 +04:00
|
|
|
class gfxUserFontSet;
|
2009-01-19 12:21:29 +03:00
|
|
|
class nsUserFontSet;
|
2008-11-27 06:50:16 +03:00
|
|
|
struct nsFontFaceRuleContainer;
|
2009-07-22 04:45:00 +04:00
|
|
|
class nsObjectFrame;
|
1998-04-14 00:24:54 +04:00
|
|
|
|
2001-03-13 04:47:22 +03:00
|
|
|
#ifdef MOZ_REFLOW_PERF
|
|
|
|
class nsIRenderingContext;
|
|
|
|
#endif
|
|
|
|
|
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,
|
2004-06-21 14:32:27 +04:00
|
|
|
eLanguageSpecificTransformType_Japanese
|
2000-09-21 02:59:20 +04:00
|
|
|
};
|
|
|
|
|
2000-10-11 12:33:01 +04:00
|
|
|
// supported values for cached bool types
|
2006-03-26 04:48:03 +04:00
|
|
|
enum nsPresContext_CachedBoolPrefType {
|
|
|
|
kPresContext_UseDocumentColors = 1,
|
|
|
|
kPresContext_UseDocumentFonts,
|
|
|
|
kPresContext_UnderlineLinks
|
|
|
|
};
|
2000-10-11 12:33:01 +04:00
|
|
|
|
2001-09-27 22:34:30 +04:00
|
|
|
// supported values for cached integer pref types
|
2006-03-26 04:48:03 +04:00
|
|
|
enum nsPresContext_CachedIntPrefType {
|
|
|
|
kPresContext_MinimumFontSize = 1,
|
|
|
|
kPresContext_ScrollbarSide,
|
|
|
|
kPresContext_BidiDirection
|
|
|
|
};
|
2001-09-27 22:34:30 +04:00
|
|
|
|
|
|
|
// 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
|
|
|
|
|
2006-04-18 09:44:02 +04:00
|
|
|
#ifdef DEBUG
|
|
|
|
struct nsAutoLayoutPhase;
|
|
|
|
|
|
|
|
enum nsLayoutPhase {
|
|
|
|
eLayoutPhase_Paint,
|
|
|
|
eLayoutPhase_Reflow,
|
|
|
|
eLayoutPhase_FrameC,
|
|
|
|
eLayoutPhase_COUNT
|
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
2009-09-04 08:49:18 +04:00
|
|
|
class nsInvalidateRequestList {
|
|
|
|
public:
|
|
|
|
struct Request {
|
|
|
|
nsRect mRect;
|
|
|
|
PRUint32 mFlags;
|
|
|
|
};
|
|
|
|
|
|
|
|
nsTArray<Request> mRequests;
|
|
|
|
};
|
|
|
|
|
2008-04-26 03:12:45 +04:00
|
|
|
/* Used by nsPresContext::HasAuthorSpecifiedRules */
|
|
|
|
#define NS_AUTHOR_SPECIFIED_BACKGROUND (1 << 0)
|
|
|
|
#define NS_AUTHOR_SPECIFIED_BORDER (1 << 1)
|
|
|
|
#define NS_AUTHOR_SPECIFIED_PADDING (1 << 2)
|
|
|
|
|
2009-07-22 04:44:54 +04:00
|
|
|
class nsRootPresContext;
|
|
|
|
|
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.
|
2004-07-30 01:00:58 +04:00
|
|
|
|
2005-12-02 15:02:44 +03:00
|
|
|
class nsPresContext : public nsIObserver {
|
2004-07-30 01:00:58 +04:00
|
|
|
public:
|
2007-08-11 01:25:24 +04:00
|
|
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
2004-07-29 23:41:39 +04:00
|
|
|
NS_DECL_NSIOBSERVER
|
|
|
|
NS_DECL_AND_IMPL_ZEROING_OPERATOR_NEW
|
2007-08-11 01:25:24 +04:00
|
|
|
NS_DECL_CYCLE_COLLECTION_CLASS(nsPresContext)
|
2004-07-29 23:41:39 +04:00
|
|
|
|
|
|
|
enum nsPresContextType {
|
|
|
|
eContext_Galley, // unpaginated screen presentation
|
|
|
|
eContext_PrintPreview, // paginated screen presentation
|
2006-04-01 05:19:28 +04:00
|
|
|
eContext_Print, // paginated printer presentation
|
|
|
|
eContext_PageLayout // paginated & editable.
|
2004-07-29 23:41:39 +04:00
|
|
|
};
|
|
|
|
|
2006-05-19 14:26:44 +04:00
|
|
|
nsPresContext(nsIDocument* aDocument, nsPresContextType aType) NS_HIDDEN;
|
2004-07-29 23:41:39 +04:00
|
|
|
|
1998-06-25 08:24:45 +04:00
|
|
|
/**
|
|
|
|
* Initialize the presentation context from a particular device.
|
|
|
|
*/
|
2004-07-29 23:41:39 +04:00
|
|
|
NS_HIDDEN_(nsresult) Init(nsIDeviceContext* aDeviceContext);
|
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.
|
|
|
|
*/
|
2004-07-29 23:41:39 +04:00
|
|
|
NS_HIDDEN_(void) SetShell(nsIPresShell* aShell);
|
|
|
|
|
|
|
|
|
|
|
|
NS_HIDDEN_(nsPresContextType) Type() const { return mType; }
|
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
|
|
|
|
2006-11-30 02:09:13 +03:00
|
|
|
// Find the prescontext for the root of the view manager hierarchy that contains
|
|
|
|
// this prescontext.
|
2009-07-22 04:44:54 +04:00
|
|
|
nsRootPresContext* RootPresContext();
|
2006-11-30 02:09:13 +03:00
|
|
|
|
2006-05-19 14:26:44 +04:00
|
|
|
nsIDocument* Document() const
|
|
|
|
{
|
|
|
|
NS_ASSERTION(!mShell || !mShell->GetDocument() ||
|
|
|
|
mShell->GetDocument() == mDocument,
|
|
|
|
"nsPresContext doesn't have the same document as nsPresShell!");
|
|
|
|
return mDocument;
|
|
|
|
}
|
|
|
|
|
2004-01-28 03:18:22 +03:00
|
|
|
#ifdef _IMPL_NS_LAYOUT
|
|
|
|
nsStyleSet* StyleSet() { return GetPresShell()->StyleSet(); }
|
2004-02-24 00:29:06 +03:00
|
|
|
|
|
|
|
nsFrameManager* FrameManager()
|
|
|
|
{ return GetPresShell()->FrameManager(); }
|
2004-01-28 03:18:22 +03:00
|
|
|
#endif
|
1998-04-14 00:24:54 +04:00
|
|
|
|
2008-12-04 19:09:53 +03:00
|
|
|
/**
|
|
|
|
* Rebuilds all style data by throwing out the old rule tree and
|
|
|
|
* building a new one, and additionally applying aExtraHint (which
|
|
|
|
* must not contain nsChangeHint_ReconstructFrame) to the root frame.
|
|
|
|
* Also rebuild the user font set.
|
|
|
|
*/
|
2008-02-08 22:52:46 +03:00
|
|
|
void RebuildAllStyleData(nsChangeHint aExtraHint);
|
2008-12-04 19:09:53 +03:00
|
|
|
/**
|
|
|
|
* Just like RebuildAllStyleData, except (1) asynchronous and (2) it
|
|
|
|
* doesn't rebuild the user font set.
|
|
|
|
*/
|
|
|
|
void PostRebuildAllStyleDataEvent(nsChangeHint aExtraHint);
|
2008-01-09 12:38:28 +03:00
|
|
|
|
2008-07-26 20:14:48 +04:00
|
|
|
void MediaFeatureValuesChanged(PRBool aCallerWillRebuildStyleData);
|
|
|
|
void PostMediaFeatureValuesChangedEvent();
|
|
|
|
NS_HIDDEN_(void) HandleMediaFeatureValuesChangedEvent();
|
|
|
|
void FlushPendingMediaFeatureValuesChanged() {
|
|
|
|
if (mPendingMediaFeatureValuesChanged)
|
|
|
|
MediaFeatureValuesChanged(PR_FALSE);
|
|
|
|
}
|
|
|
|
|
1998-07-31 09:54:59 +04:00
|
|
|
/**
|
2006-12-05 18:46:18 +03:00
|
|
|
* Access compatibility mode for this context. This is the same as
|
|
|
|
* our document's compatibility mode.
|
|
|
|
*/
|
|
|
|
nsCompatibility CompatibilityMode() const {
|
|
|
|
return Document()->GetCompatibilityMode();
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* Notify the context that the document's compatibility mode has changed
|
1998-07-31 09:54:59 +04:00
|
|
|
*/
|
2006-12-05 18:46:18 +03:00
|
|
|
NS_HIDDEN_(void) CompatibilityModeChanged();
|
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; }
|
2008-03-13 05:58:34 +03:00
|
|
|
void RestoreImageAnimationMode() { SetImageAnimationMode(mImageAnimationModePref); }
|
2004-08-29 07:08:44 +04:00
|
|
|
virtual NS_HIDDEN_(void) SetImageAnimationModeExternal(PRUint16 aMode);
|
2004-07-29 23:41:39 +04:00
|
|
|
NS_HIDDEN_(void) SetImageAnimationModeInternal(PRUint16 aMode);
|
|
|
|
#ifdef _IMPL_NS_LAYOUT
|
|
|
|
void SetImageAnimationMode(PRUint16 aMode)
|
|
|
|
{ SetImageAnimationModeInternal(aMode); }
|
|
|
|
#else
|
|
|
|
void SetImageAnimationMode(PRUint16 aMode)
|
|
|
|
{ SetImageAnimationModeExternal(aMode); }
|
|
|
|
#endif
|
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
|
|
|
|
2004-04-13 04:28:44 +04:00
|
|
|
void* AllocateFromShell(size_t aSize)
|
|
|
|
{
|
|
|
|
if (mShell)
|
2009-08-18 07:21:06 +04:00
|
|
|
return mShell->AllocateMisc(aSize);
|
2004-04-13 04:28:44 +04:00
|
|
|
return nsnull;
|
|
|
|
}
|
|
|
|
|
|
|
|
void FreeToShell(size_t aSize, void* aFreeChunk)
|
|
|
|
{
|
2009-01-30 07:39:23 +03:00
|
|
|
NS_ASSERTION(mShell, "freeing after shutdown");
|
2004-04-13 04:28:44 +04:00
|
|
|
if (mShell)
|
2009-08-18 07:21:06 +04:00
|
|
|
mShell->FreeMisc(aSize, aFreeChunk);
|
2004-04-13 04:28:44 +04:00
|
|
|
}
|
2001-06-01 02:19:43 +04:00
|
|
|
|
1998-04-14 00:24:54 +04:00
|
|
|
/**
|
|
|
|
* Get the font metrics for a given font.
|
2009-01-17 06:44:21 +03:00
|
|
|
*
|
|
|
|
* If aUseUserFontSet is false, don't build or use the user font set.
|
|
|
|
* This is intended only for nsRuleNode::CalcLengthWithInitialFont
|
|
|
|
* (which is used from media query matching, which is in turn called
|
|
|
|
* when building the user font set).
|
1998-04-14 00:24:54 +04:00
|
|
|
*/
|
2004-07-29 23:41:39 +04:00
|
|
|
NS_HIDDEN_(already_AddRefed<nsIFontMetrics>)
|
2009-01-17 06:44:21 +03:00
|
|
|
GetMetricsFor(const nsFont& aFont, PRBool aUseUserFontSet = PR_TRUE);
|
1998-04-14 00:24:54 +04:00
|
|
|
|
2004-02-01 01:41:40 +03:00
|
|
|
/**
|
2005-11-21 01:05:24 +03:00
|
|
|
* Get the default font corresponding to the given ID. This object is
|
2004-02-01 01:41:40 +03:00
|
|
|
* read-only, you must copy the font to modify it.
|
2007-07-26 03:12:38 +04:00
|
|
|
*
|
|
|
|
* When aFontID is kPresContext_DefaultVariableFontID or
|
|
|
|
* kPresContext_DefaultFixedFontID (which equals
|
|
|
|
* kGenericFont_moz_fixed, which is used for the -moz-fixed generic),
|
|
|
|
* the nsFont returned has its name as a CSS generic family (serif or
|
|
|
|
* sans-serif for the former, monospace for the latter), and its size
|
|
|
|
* as the default font size for variable or fixed fonts for the pres
|
|
|
|
* context's language group.
|
|
|
|
*
|
|
|
|
* For aFontID corresponds to a CSS Generic, the nsFont returned has
|
|
|
|
* its name as the name or names of the fonts in the user's
|
|
|
|
* preferences for the given generic and the pres context's language
|
|
|
|
* group, and its size set to the default variable font size.
|
2004-02-01 01:41:40 +03:00
|
|
|
*/
|
2008-10-10 00:46:43 +04:00
|
|
|
NS_HIDDEN_(const nsFont*) GetDefaultFont(PRUint8 aFontID) const;
|
1998-07-17 09:41:41 +04:00
|
|
|
|
2004-04-13 04:28:44 +04:00
|
|
|
/** Get a cached boolean pref, by its type */
|
2000-10-11 12:33:01 +04:00
|
|
|
// * - initially created for bugs 31816, 20760, 22963
|
2006-03-26 04:48:03 +04:00
|
|
|
PRBool GetCachedBoolPref(nsPresContext_CachedBoolPrefType aPrefType) const
|
2004-02-20 20:49:01 +03:00
|
|
|
{
|
|
|
|
// If called with a constant parameter, the compiler should optimize
|
|
|
|
// this switch statement away.
|
|
|
|
switch (aPrefType) {
|
|
|
|
case kPresContext_UseDocumentFonts:
|
|
|
|
return mUseDocumentFonts;
|
|
|
|
case kPresContext_UseDocumentColors:
|
|
|
|
return mUseDocumentColors;
|
|
|
|
case kPresContext_UnderlineLinks:
|
|
|
|
return mUnderlineLinks;
|
|
|
|
default:
|
|
|
|
NS_ERROR("Invalid arg passed to GetCachedBoolPref");
|
|
|
|
}
|
|
|
|
|
|
|
|
return PR_FALSE;
|
|
|
|
}
|
2001-09-27 22:34:30 +04:00
|
|
|
|
2004-04-13 04:28:44 +04:00
|
|
|
/** Get a cached integer pref, by its type */
|
2001-09-27 22:34:30 +04:00
|
|
|
// * - initially created for bugs 30910, 61883, 74186, 84398
|
2006-03-26 04:48:03 +04:00
|
|
|
PRInt32 GetCachedIntPref(nsPresContext_CachedIntPrefType aPrefType) const
|
2004-04-13 04:28:44 +04:00
|
|
|
{
|
|
|
|
// If called with a constant parameter, the compiler should optimize
|
|
|
|
// this switch statement away.
|
|
|
|
switch (aPrefType) {
|
|
|
|
case kPresContext_MinimumFontSize:
|
|
|
|
return mMinimumFontSize;
|
2006-03-26 04:48:03 +04:00
|
|
|
case kPresContext_ScrollbarSide:
|
|
|
|
return mPrefScrollbarSide;
|
|
|
|
case kPresContext_BidiDirection:
|
|
|
|
return mPrefBidiDirection;
|
2004-04-13 04:28:44 +04:00
|
|
|
default:
|
|
|
|
NS_ERROR("invalid arg passed to GetCachedIntPref");
|
|
|
|
}
|
|
|
|
|
|
|
|
return PR_FALSE;
|
|
|
|
}
|
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; }
|
|
|
|
|
2004-02-20 20:49:01 +03:00
|
|
|
PRBool GetUseFocusColors() const { return mUseFocusColors; }
|
2004-02-01 01:41:40 +03:00
|
|
|
PRUint8 FocusRingWidth() const { return mFocusRingWidth; }
|
2004-02-20 20:49:01 +03:00
|
|
|
PRBool GetFocusRingOnAnything() const { return mFocusRingOnAnything; }
|
2008-10-09 03:28:31 +04:00
|
|
|
PRUint8 GetFocusRingStyle() const { return mFocusRingStyle; }
|
|
|
|
|
2009-02-19 04:13:24 +03:00
|
|
|
/**
|
2009-02-19 22:03:28 +03:00
|
|
|
* The types of image load types that the pres context needs image
|
|
|
|
* loaders to track invalidation for.
|
2009-02-19 04:13:24 +03:00
|
|
|
*/
|
2009-02-19 22:03:28 +03:00
|
|
|
enum ImageLoadType {
|
|
|
|
BACKGROUND_IMAGE,
|
|
|
|
BORDER_IMAGE,
|
|
|
|
IMAGE_LOAD_TYPE_COUNT
|
|
|
|
};
|
|
|
|
|
2009-02-19 18:29:27 +03:00
|
|
|
/**
|
2009-02-19 22:03:28 +03:00
|
|
|
* Set the list of image loaders that track invalidation for a
|
|
|
|
* specific frame and type of image. This list will replace any
|
|
|
|
* previous list for that frame and image type (and null will remove
|
|
|
|
* any previous list).
|
2009-02-19 18:29:27 +03:00
|
|
|
*/
|
2009-02-19 22:03:28 +03:00
|
|
|
NS_HIDDEN_(void) SetImageLoaders(nsIFrame* aTargetFrame,
|
|
|
|
ImageLoadType aType,
|
|
|
|
nsImageLoader* aImageLoaders);
|
2008-10-29 00:36:17 +03:00
|
|
|
|
2009-02-19 22:03:28 +03:00
|
|
|
/**
|
|
|
|
* Make an appropriate SetImageLoaders call (including potentially
|
|
|
|
* with null aImageLoaders) given that aFrame draws its background
|
|
|
|
* based on aStyleBackground.
|
|
|
|
*/
|
|
|
|
NS_HIDDEN_(void) SetupBackgroundImageLoaders(nsIFrame* aFrame,
|
|
|
|
const nsStyleBackground*
|
|
|
|
aStyleBackground);
|
2009-02-19 05:59:47 +03:00
|
|
|
|
2009-02-19 22:03:28 +03:00
|
|
|
/**
|
|
|
|
* Make an appropriate SetImageLoaders call (including potentially
|
|
|
|
* with null aImageLoaders) given that aFrame draws its border
|
|
|
|
* based on aStyleBorder.
|
|
|
|
*/
|
|
|
|
NS_HIDDEN_(void) SetupBorderImageLoaders(nsIFrame* aFrame,
|
|
|
|
const nsStyleBorder* aStyleBorder);
|
2009-02-19 20:06:18 +03:00
|
|
|
|
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
|
2009-02-19 22:03:28 +03:00
|
|
|
* ensure that the image loads get disassociated from the prescontext
|
1998-04-14 00:24:54 +04:00
|
|
|
*/
|
2004-07-29 23:41:39 +04:00
|
|
|
NS_HIDDEN_(void) StopImagesFor(nsIFrame* aTargetFrame);
|
1998-04-14 00:24:54 +04:00
|
|
|
|
2004-07-29 23:41:39 +04:00
|
|
|
NS_HIDDEN_(void) SetContainer(nsISupports* aContainer);
|
1998-04-14 00:24:54 +04:00
|
|
|
|
2007-11-16 06:46:42 +03:00
|
|
|
virtual NS_HIDDEN_(already_AddRefed<nsISupports>) GetContainerExternal() const;
|
|
|
|
NS_HIDDEN_(already_AddRefed<nsISupports>) GetContainerInternal() const;
|
2004-07-29 23:41:39 +04:00
|
|
|
#ifdef _IMPL_NS_LAYOUT
|
2007-11-16 06:46:42 +03:00
|
|
|
already_AddRefed<nsISupports> GetContainer() const
|
2004-07-29 23:41:39 +04:00
|
|
|
{ return GetContainerInternal(); }
|
|
|
|
#else
|
2007-11-16 06:46:42 +03:00
|
|
|
already_AddRefed<nsISupports> GetContainer() const
|
2004-07-29 23:41:39 +04:00
|
|
|
{ return GetContainerExternal(); }
|
|
|
|
#endif
|
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.
|
2008-12-09 03:33:46 +03:00
|
|
|
* This is the size of the visible area that is used for
|
1998-07-13 23:49:07 +04:00
|
|
|
* 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
|
|
|
*/
|
2008-07-26 20:14:48 +04:00
|
|
|
void SetVisibleArea(const nsRect& r) {
|
2008-12-29 18:07:37 +03:00
|
|
|
if (!r.IsExactEqual(mVisibleArea)) {
|
|
|
|
mVisibleArea = r;
|
|
|
|
// Visible area does not affect media queries when paginated.
|
|
|
|
if (!IsPaginated() && HasCachedStyleData())
|
|
|
|
PostMediaFeatureValuesChangedEvent();
|
|
|
|
}
|
2008-07-26 20:14:48 +04:00
|
|
|
}
|
1998-04-14 00:24:54 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Return true if this presentation context is a paginated
|
|
|
|
* context.
|
|
|
|
*/
|
2004-03-03 21:24:20 +03:00
|
|
|
PRBool IsPaginated() const { return mPaginated; }
|
2006-09-20 02:05:33 +04:00
|
|
|
|
2001-11-03 17:59:39 +03:00
|
|
|
/**
|
|
|
|
* Sets whether the presentation context can scroll for a paginated
|
|
|
|
* context.
|
|
|
|
*/
|
2004-07-29 23:41:39 +04:00
|
|
|
NS_HIDDEN_(void) SetPaginatedScrolling(PRBool aResult);
|
2001-11-03 17:59:39 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Return true if this presentation context can scroll for paginated
|
|
|
|
* context.
|
|
|
|
*/
|
2004-03-03 21:24:20 +03:00
|
|
|
PRBool HasPaginatedScrolling() const { return mCanPaginatedScroll; }
|
2001-11-03 17:59:39 +03:00
|
|
|
|
1998-04-14 00:24:54 +04:00
|
|
|
/**
|
2006-03-30 04:27:42 +04:00
|
|
|
* Get/set the size of a page
|
1998-04-14 00:24:54 +04:00
|
|
|
*/
|
2006-03-30 04:27:42 +04:00
|
|
|
nsSize GetPageSize() { return mPageSize; }
|
|
|
|
void SetPageSize(nsSize aSize) { mPageSize = aSize; }
|
1998-04-14 00:24:54 +04:00
|
|
|
|
|
|
|
/**
|
2006-03-30 04:27:42 +04:00
|
|
|
* Get/set whether this document should be treated as having real pages
|
|
|
|
* XXX This raises the obvious question of why a document that isn't a page
|
|
|
|
* is paginated; there isn't a good reason except history
|
1998-04-14 00:24:54 +04:00
|
|
|
*/
|
2006-03-30 04:27:42 +04:00
|
|
|
PRBool IsRootPaginatedDocument() { return mIsRootPaginatedDocument; }
|
|
|
|
void SetIsRootPaginatedDocument(PRBool aIsRootPaginatedDocument)
|
|
|
|
{ mIsRootPaginatedDocument = aIsRootPaginatedDocument; }
|
1999-02-12 20:45:58 +03:00
|
|
|
|
2006-01-21 12:31:45 +03:00
|
|
|
/**
|
2007-02-07 10:46:44 +03:00
|
|
|
* Get/set the print scaling level; used by nsPageFrame to scale up
|
|
|
|
* pages. Set safe to call before reflow, get guaranteed to be set
|
|
|
|
* properly after reflow.
|
|
|
|
*/
|
1998-04-14 00:24:54 +04:00
|
|
|
|
2007-02-07 10:46:44 +03:00
|
|
|
float GetPageScale() { return mPageScale; }
|
|
|
|
void SetPageScale(float aScale) { mPageScale = aScale; }
|
1998-04-14 00:24:54 +04:00
|
|
|
|
2007-02-14 01:36:59 +03:00
|
|
|
/**
|
|
|
|
* Get/set the scaling facor to use when rendering the pages for print preview.
|
|
|
|
* Only safe to get after print preview set up; safe to set anytime.
|
|
|
|
* This is a scaling factor for the display of the print preview. It
|
|
|
|
* does not affect layout. It only affects the size of the onscreen pages
|
|
|
|
* in print preview.
|
|
|
|
* XXX Temporary: see http://wiki.mozilla.org/Gecko:PrintPreview
|
|
|
|
*/
|
|
|
|
float GetPrintPreviewScale() { return mPPScale; }
|
|
|
|
void SetPrintPreviewScale(float aScale) { mPPScale = aScale; }
|
1998-11-14 04:52:27 +03:00
|
|
|
|
2004-02-03 01:17:21 +03:00
|
|
|
nsIDeviceContext* DeviceContext() { return mDeviceContext; }
|
2004-02-27 20:17:37 +03:00
|
|
|
nsIEventStateManager* EventStateManager() { return mEventManager; }
|
2004-06-09 03:53:59 +04:00
|
|
|
nsIAtom* GetLangGroup() { return mLangGroup; }
|
2000-04-21 18:59:47 +04:00
|
|
|
|
2005-08-13 15:54:22 +04:00
|
|
|
float TextZoom() { return mTextZoom; }
|
2007-07-26 07:34:16 +04:00
|
|
|
void SetTextZoom(float aZoom) {
|
2009-01-17 00:32:08 +03:00
|
|
|
if (aZoom == mTextZoom)
|
|
|
|
return;
|
|
|
|
|
2005-08-13 15:54:22 +04:00
|
|
|
mTextZoom = aZoom;
|
2009-01-17 00:32:08 +03:00
|
|
|
if (HasCachedStyleData()) {
|
|
|
|
// Media queries could have changed since we changed the meaning
|
|
|
|
// of 'em' units in them.
|
|
|
|
MediaFeatureValuesChanged(PR_TRUE);
|
2008-12-29 18:07:36 +03:00
|
|
|
RebuildAllStyleData(NS_STYLE_HINT_REFLOW);
|
2009-01-17 00:32:08 +03:00
|
|
|
}
|
2005-08-13 15:54:22 +04:00
|
|
|
}
|
2007-07-26 07:34:16 +04:00
|
|
|
|
2007-08-08 00:38:35 +04:00
|
|
|
float GetFullZoom() { return mFullZoom; }
|
2007-07-26 07:34:16 +04:00
|
|
|
void SetFullZoom(float aZoom);
|
2005-08-13 15:54:22 +04:00
|
|
|
|
2007-07-26 13:47:43 +04:00
|
|
|
nscoord GetAutoQualityMinFontSize() {
|
|
|
|
return DevPixelsToAppUnits(mAutoQualityMinFontSizePixelsPref);
|
|
|
|
}
|
|
|
|
|
2007-02-07 10:46:44 +03:00
|
|
|
static PRInt32 AppUnitsPerCSSPixel() { return nsIDeviceContext::AppUnitsPerCSSPixel(); }
|
|
|
|
PRInt32 AppUnitsPerDevPixel() const { return mDeviceContext->AppUnitsPerDevPixel(); }
|
|
|
|
PRInt32 AppUnitsPerInch() const { return mDeviceContext->AppUnitsPerInch(); }
|
|
|
|
|
|
|
|
static nscoord CSSPixelsToAppUnits(PRInt32 aPixels)
|
|
|
|
{ return NSIntPixelsToAppUnits(aPixels,
|
|
|
|
nsIDeviceContext::AppUnitsPerCSSPixel()); }
|
|
|
|
|
|
|
|
static nscoord CSSPixelsToAppUnits(float aPixels)
|
|
|
|
{ return NSFloatPixelsToAppUnits(aPixels,
|
2008-10-17 09:45:25 +04:00
|
|
|
float(nsIDeviceContext::AppUnitsPerCSSPixel())); }
|
2007-02-07 10:46:44 +03:00
|
|
|
|
|
|
|
static PRInt32 AppUnitsToIntCSSPixels(nscoord aAppUnits)
|
|
|
|
{ return NSAppUnitsToIntPixels(aAppUnits,
|
2008-10-17 09:45:25 +04:00
|
|
|
float(nsIDeviceContext::AppUnitsPerCSSPixel())); }
|
2007-02-07 10:46:44 +03:00
|
|
|
|
|
|
|
static float AppUnitsToFloatCSSPixels(nscoord aAppUnits)
|
|
|
|
{ return NSAppUnitsToFloatPixels(aAppUnits,
|
2008-10-17 09:45:25 +04:00
|
|
|
float(nsIDeviceContext::AppUnitsPerCSSPixel())); }
|
2007-02-07 10:46:44 +03:00
|
|
|
|
|
|
|
nscoord DevPixelsToAppUnits(PRInt32 aPixels) const
|
|
|
|
{ return NSIntPixelsToAppUnits(aPixels,
|
|
|
|
mDeviceContext->AppUnitsPerDevPixel()); }
|
|
|
|
|
|
|
|
PRInt32 AppUnitsToDevPixels(nscoord aAppUnits) const
|
|
|
|
{ return NSAppUnitsToIntPixels(aAppUnits,
|
2008-10-17 09:45:25 +04:00
|
|
|
float(mDeviceContext->AppUnitsPerDevPixel())); }
|
2007-02-07 10:46:44 +03:00
|
|
|
|
2009-06-18 12:35:11 +04:00
|
|
|
PRInt32 CSSPixelsToDevPixels(PRInt32 aPixels)
|
|
|
|
{ return AppUnitsToDevPixels(CSSPixelsToAppUnits(aPixels)); }
|
|
|
|
|
|
|
|
float CSSPixelsToDevPixels(float aPixels)
|
|
|
|
{
|
|
|
|
return NSAppUnitsToFloatPixels(CSSPixelsToAppUnits(aPixels),
|
|
|
|
float(mDeviceContext->AppUnitsPerDevPixel()));
|
|
|
|
}
|
|
|
|
|
|
|
|
PRInt32 DevPixelsToIntCSSPixels(PRInt32 aPixels)
|
|
|
|
{ return AppUnitsToIntCSSPixels(DevPixelsToAppUnits(aPixels)); }
|
|
|
|
|
|
|
|
float DevPixelsToFloatCSSPixels(PRInt32 aPixels)
|
|
|
|
{ return AppUnitsToFloatCSSPixels(DevPixelsToAppUnits(aPixels)); }
|
|
|
|
|
2008-02-16 18:31:27 +03:00
|
|
|
// If there is a remainder, it is rounded to nearest app units.
|
|
|
|
nscoord GfxUnitsToAppUnits(gfxFloat aGfxUnits) const
|
|
|
|
{ return mDeviceContext->GfxUnitsToAppUnits(aGfxUnits); }
|
|
|
|
|
2007-08-22 15:13:46 +04:00
|
|
|
gfxFloat AppUnitsToGfxUnits(nscoord aAppUnits) const
|
|
|
|
{ return mDeviceContext->AppUnitsToGfxUnits(aAppUnits); }
|
|
|
|
|
2008-07-07 06:28:24 +04:00
|
|
|
gfxRect AppUnitsToGfxUnits(const nsRect& aAppRect) const
|
|
|
|
{ return gfxRect(AppUnitsToGfxUnits(aAppRect.x),
|
|
|
|
AppUnitsToGfxUnits(aAppRect.y),
|
|
|
|
AppUnitsToGfxUnits(aAppRect.width),
|
|
|
|
AppUnitsToGfxUnits(aAppRect.height)); }
|
|
|
|
|
2007-02-07 10:46:44 +03:00
|
|
|
nscoord TwipsToAppUnits(PRInt32 aTwips) const
|
2009-08-06 11:36:54 +04:00
|
|
|
{ return NSCoordSaturatingMultiply(mDeviceContext->AppUnitsPerInch(),
|
|
|
|
NS_TWIPS_TO_INCHES(aTwips)); }
|
2007-02-07 10:46:44 +03:00
|
|
|
|
2008-03-19 23:51:42 +03:00
|
|
|
// Margin-specific version, since they often need TwipsToAppUnits
|
2009-01-15 06:27:09 +03:00
|
|
|
nsMargin TwipsToAppUnits(const nsIntMargin &marginInTwips) const
|
2008-03-19 23:51:42 +03:00
|
|
|
{ return nsMargin(TwipsToAppUnits(marginInTwips.left),
|
|
|
|
TwipsToAppUnits(marginInTwips.top),
|
|
|
|
TwipsToAppUnits(marginInTwips.right),
|
|
|
|
TwipsToAppUnits(marginInTwips.bottom)); }
|
|
|
|
|
2007-02-07 10:46:44 +03:00
|
|
|
nscoord PointsToAppUnits(float aPoints) const
|
|
|
|
{ return NSToCoordRound(aPoints * mDeviceContext->AppUnitsPerInch() /
|
2008-04-08 04:27:10 +04:00
|
|
|
POINTS_PER_INCH_FLOAT); }
|
2005-08-13 15:54:22 +04:00
|
|
|
|
2007-08-14 20:39:54 +04:00
|
|
|
nscoord RoundAppUnitsToNearestDevPixels(nscoord aAppUnits) const
|
|
|
|
{ return DevPixelsToAppUnits(AppUnitsToDevPixels(aAppUnits)); }
|
|
|
|
|
2004-09-05 04:04:04 +04:00
|
|
|
struct ScrollbarStyles {
|
|
|
|
// Always one of NS_STYLE_OVERFLOW_SCROLL, NS_STYLE_OVERFLOW_HIDDEN,
|
|
|
|
// or NS_STYLE_OVERFLOW_AUTO.
|
|
|
|
PRUint8 mHorizontal, mVertical;
|
|
|
|
ScrollbarStyles(PRUint8 h, PRUint8 v) : mHorizontal(h), mVertical(v) {}
|
|
|
|
ScrollbarStyles() {}
|
|
|
|
};
|
|
|
|
void SetViewportOverflowOverride(PRUint8 aX, PRUint8 aY)
|
|
|
|
{
|
|
|
|
mViewportStyleOverflow.mHorizontal = aX;
|
|
|
|
mViewportStyleOverflow.mVertical = aY;
|
|
|
|
}
|
|
|
|
ScrollbarStyles GetViewportOverflowOverride()
|
2004-04-13 06:56:03 +04:00
|
|
|
{
|
2004-09-05 04:04:04 +04:00
|
|
|
return mViewportStyleOverflow;
|
2004-04-13 06:56:03 +04:00
|
|
|
}
|
|
|
|
|
2001-12-14 05:25:48 +03:00
|
|
|
/**
|
2005-11-21 01:05:24 +03:00
|
|
|
* Set and get methods for controlling the background drawing
|
2001-12-14 05:25:48 +03:00
|
|
|
*/
|
2004-02-20 20:49:01 +03:00
|
|
|
PRBool GetBackgroundImageDraw() const { return mDrawImageBackground; }
|
|
|
|
void SetBackgroundImageDraw(PRBool aCanDraw)
|
|
|
|
{
|
|
|
|
NS_ASSERTION(!(aCanDraw & ~1), "Value must be true or false");
|
|
|
|
mDrawImageBackground = aCanDraw;
|
|
|
|
}
|
|
|
|
|
|
|
|
PRBool GetBackgroundColorDraw() const { return mDrawColorBackground; }
|
|
|
|
void SetBackgroundColorDraw(PRBool aCanDraw)
|
|
|
|
{
|
|
|
|
NS_ASSERTION(!(aCanDraw & ~1), "Value must be true or false");
|
|
|
|
mDrawColorBackground = aCanDraw;
|
|
|
|
}
|
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
|
|
|
|
*/
|
2004-08-29 07:08:44 +04:00
|
|
|
virtual NS_HIDDEN_(PRBool) BidiEnabledExternal() const;
|
2004-07-29 23:41:39 +04:00
|
|
|
NS_HIDDEN_(PRBool) BidiEnabledInternal() const;
|
|
|
|
#ifdef _IMPL_NS_LAYOUT
|
|
|
|
PRBool BidiEnabled() const { return BidiEnabledInternal(); }
|
|
|
|
#else
|
|
|
|
PRBool BidiEnabled() const { return BidiEnabledExternal(); }
|
|
|
|
#endif
|
2001-03-09 06:13:03 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set bidi enabled. This means we should apply the Unicode Bidi Algorithm
|
|
|
|
*
|
|
|
|
* @lina 07/12/2000
|
|
|
|
*/
|
2008-06-16 13:28:17 +04:00
|
|
|
NS_HIDDEN_(void) SetBidiEnabled() const;
|
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
|
|
|
|
*/
|
2004-02-20 20:49:01 +03:00
|
|
|
void SetVisualMode(PRBool aIsVisual)
|
|
|
|
{
|
|
|
|
NS_ASSERTION(!(aIsVisual & ~1), "Value must be true or false");
|
|
|
|
mIsVisual = aIsVisual;
|
|
|
|
}
|
2001-03-09 06:13:03 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Check whether the content should be treated as visual.
|
|
|
|
*
|
|
|
|
* @lina 05/02/2000
|
|
|
|
*/
|
2004-02-20 20:49:01 +03:00
|
|
|
PRBool IsVisualMode() const { return mIsVisual; }
|
2001-03-09 06:13:03 +03:00
|
|
|
|
|
|
|
//Mohamed
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get a Bidi presentation utilities object
|
|
|
|
*/
|
2004-07-29 23:41:39 +04:00
|
|
|
NS_HIDDEN_(nsBidiPresUtils*) GetBidiUtils();
|
2001-03-09 06:13:03 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the Bidi options for the presentation context
|
|
|
|
*/
|
2004-07-29 23:41:39 +04:00
|
|
|
NS_HIDDEN_(void) SetBidi(PRUint32 aBidiOptions,
|
2008-01-09 12:38:28 +03:00
|
|
|
PRBool aForceRestyle = PR_FALSE);
|
2001-03-09 06:13:03 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the Bidi options for the presentation context
|
2005-11-09 01:45:49 +03:00
|
|
|
* Not inline so consumers of nsPresContext are not forced to
|
|
|
|
* include nsIDocument.
|
2001-03-09 06:13:03 +03:00
|
|
|
*/
|
2005-11-09 01:45:49 +03:00
|
|
|
NS_HIDDEN_(PRUint32) GetBidi() const;
|
2001-03-09 06:13:03 +03:00
|
|
|
#endif // IBMBIDI
|
|
|
|
|
2001-01-27 17:09:34 +03:00
|
|
|
/**
|
|
|
|
* Render only Selection
|
|
|
|
*/
|
2004-02-20 20:49:01 +03:00
|
|
|
void SetIsRenderingOnlySelection(PRBool aResult)
|
|
|
|
{
|
|
|
|
NS_ASSERTION(!(aResult & ~1), "Value must be true or false");
|
|
|
|
mIsRenderingOnlySelection = aResult;
|
|
|
|
}
|
|
|
|
|
|
|
|
PRBool IsRenderingOnlySelection() const { return mIsRenderingOnlySelection; }
|
2001-01-27 17:09:34 +03:00
|
|
|
|
2001-12-18 01:51:39 +03:00
|
|
|
/*
|
|
|
|
* Obtain a native them for rendering our widgets (both form controls and html)
|
|
|
|
*/
|
2004-07-29 23:41:39 +04:00
|
|
|
NS_HIDDEN_(nsITheme*) GetTheme();
|
2001-12-18 01:51:39 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* 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.
|
|
|
|
*/
|
2004-07-29 23:41:39 +04:00
|
|
|
NS_HIDDEN_(void) ThemeChanged();
|
2001-12-18 01:51:39 +03:00
|
|
|
|
2002-06-04 21:47:54 +04:00
|
|
|
/*
|
|
|
|
* Notify the pres context that a system color has changed
|
|
|
|
*/
|
2004-07-29 23:41:39 +04:00
|
|
|
NS_HIDDEN_(void) SysColorChanged();
|
|
|
|
|
|
|
|
/** Printing methods below should only be used for Medium() == print **/
|
|
|
|
NS_HIDDEN_(void) SetPrintSettings(nsIPrintSettings *aPrintSettings);
|
|
|
|
|
|
|
|
nsIPrintSettings* GetPrintSettings() { return mPrintSettings; }
|
2002-06-04 21:47:54 +04:00
|
|
|
|
2004-08-24 22:50:29 +04:00
|
|
|
/* Accessor for table of frame properties */
|
|
|
|
nsPropertyTable* PropertyTable() { return &mPropertyTable; }
|
|
|
|
|
2005-01-20 06:39:09 +03:00
|
|
|
/* Helper function that ensures that this prescontext is shown in its
|
|
|
|
docshell if it's the most recent prescontext for the docshell. Returns
|
|
|
|
whether the prescontext is now being shown.
|
|
|
|
*/
|
Bug 178324, refactor focus by moving all focus handling into one place and simplifying it, add many tests, fixes many other bugs too numerous to mention in this small checkin comment, r=josh,smichaud,ere,dbaron,marco,neil,gavin,smaug,sr=smaug (CLOSED TREE)
2009-06-10 22:00:39 +04:00
|
|
|
NS_HIDDEN_(PRBool) EnsureVisible();
|
2005-01-20 06:39:09 +03:00
|
|
|
|
2000-04-21 18:59:47 +04:00
|
|
|
#ifdef MOZ_REFLOW_PERF
|
2004-07-29 23:41:39 +04:00
|
|
|
NS_HIDDEN_(void) CountReflows(const char * aName,
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 08:38:33 +03:00
|
|
|
nsIFrame * aFrame);
|
2000-04-21 18:59:47 +04:00
|
|
|
#endif
|
2003-06-19 22:16:53 +04:00
|
|
|
|
2004-11-26 21:40:58 +03:00
|
|
|
/**
|
|
|
|
* This table maps border-width enums 'thin', 'medium', 'thick'
|
|
|
|
* to actual nscoord values.
|
|
|
|
*/
|
|
|
|
const nscoord* GetBorderWidthTable() { return mBorderWidthTable; }
|
|
|
|
|
2007-04-23 18:21:53 +04:00
|
|
|
PRBool IsDynamic() { return (mType == eContext_PageLayout || mType == eContext_Galley); }
|
2006-12-26 20:47:52 +03:00
|
|
|
PRBool IsScreen() { return (mMedium == nsGkAtoms::screen ||
|
2006-04-01 05:19:28 +04:00
|
|
|
mType == eContext_PageLayout ||
|
2007-04-23 18:21:53 +04:00
|
|
|
mType == eContext_PrintPreview); }
|
2006-04-01 05:19:28 +04:00
|
|
|
|
2007-05-17 01:10:31 +04:00
|
|
|
// Is this presentation in a chrome docshell?
|
2007-11-16 06:46:42 +03:00
|
|
|
PRBool IsChrome() const;
|
2007-05-17 01:10:31 +04:00
|
|
|
|
2007-10-09 03:11:01 +04:00
|
|
|
// Public API for native theme code to get style internals.
|
2008-04-26 03:12:45 +04:00
|
|
|
virtual PRBool HasAuthorSpecifiedRules(nsIFrame *aFrame, PRUint32 ruleTypeMask) const;
|
2007-10-09 03:11:01 +04:00
|
|
|
|
2007-11-16 06:46:42 +03:00
|
|
|
// Is it OK to let the page specify colors and backgrounds?
|
|
|
|
PRBool UseDocumentColors() const {
|
|
|
|
return GetCachedBoolPref(kPresContext_UseDocumentColors) || IsChrome();
|
|
|
|
}
|
|
|
|
|
2008-01-29 07:10:59 +03:00
|
|
|
PRBool SupressingResizeReflow() const { return mSupressResizeReflow; }
|
2008-10-01 07:01:53 +04:00
|
|
|
|
2008-12-04 19:09:53 +03:00
|
|
|
virtual NS_HIDDEN_(gfxUserFontSet*) GetUserFontSetExternal();
|
|
|
|
NS_HIDDEN_(gfxUserFontSet*) GetUserFontSetInternal();
|
|
|
|
#ifdef _IMPL_NS_LAYOUT
|
|
|
|
gfxUserFontSet* GetUserFontSet() { return GetUserFontSetInternal(); }
|
|
|
|
#else
|
|
|
|
gfxUserFontSet* GetUserFontSet() { return GetUserFontSetExternal(); }
|
|
|
|
#endif
|
|
|
|
|
2008-11-26 02:22:38 +03:00
|
|
|
void FlushUserFontSet();
|
|
|
|
void RebuildUserFontSet(); // asynchronously
|
2008-01-29 07:10:59 +03:00
|
|
|
|
2008-12-08 19:08:05 +03:00
|
|
|
// Should be called whenever the set of fonts available in the user
|
|
|
|
// font set changes (e.g., because a new font loads, or because the
|
|
|
|
// user font set is changed and fonts become unavailable).
|
|
|
|
void UserFontSetUpdated();
|
|
|
|
|
2009-09-04 08:49:18 +04:00
|
|
|
PRBool MayHavePaintEventListener();
|
|
|
|
void NotifyInvalidation(const nsRect& aRect, PRUint32 aFlags);
|
2008-09-18 13:47:21 +04:00
|
|
|
void FireDOMPaintEvent();
|
2009-01-06 04:15:13 +03:00
|
|
|
PRBool IsDOMPaintEventPending() {
|
2009-09-04 08:49:18 +04:00
|
|
|
return !mInvalidateRequests.mRequests.IsEmpty();
|
2009-01-06 04:15:13 +03:00
|
|
|
}
|
2008-09-18 13:47:21 +04:00
|
|
|
|
2009-02-27 03:21:55 +03:00
|
|
|
void ClearMozAfterPaintEvents() {
|
2009-09-04 08:49:18 +04:00
|
|
|
mInvalidateRequests.mRequests.Clear();
|
2009-02-27 03:21:55 +03:00
|
|
|
}
|
|
|
|
|
2009-09-11 14:46:36 +04:00
|
|
|
PRBool IsProcessingAnimationStyleChange() const {
|
|
|
|
return mProcessingAnimationStyleChange;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SetProcessingAnimationStyleChange(PRBool aProcessing) {
|
2009-09-19 16:12:48 +04:00
|
|
|
NS_ASSERTION(aProcessing != PRBool(mProcessingAnimationStyleChange),
|
2009-09-11 14:46:36 +04:00
|
|
|
"should never nest");
|
|
|
|
mProcessingAnimationStyleChange = aProcessing;
|
|
|
|
}
|
|
|
|
|
2009-04-22 03:53:52 +04:00
|
|
|
/**
|
|
|
|
* Notify the prescontext that the presshell is about to reflow a reflow root.
|
|
|
|
* The single argument indicates whether this reflow should be interruptible.
|
|
|
|
* If aInterruptible is false then CheckForInterrupt and HasPendingInterrupt
|
|
|
|
* will always return false. If aInterruptible is true then CheckForInterrupt
|
|
|
|
* will return true when a pending event is detected. This is for use by the
|
|
|
|
* presshell only. Reflow code wanting to prevent interrupts should use
|
|
|
|
* InterruptPreventer.
|
|
|
|
*/
|
|
|
|
void ReflowStarted(PRBool aInterruptible);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A class that can be used to temporarily disable reflow interruption.
|
|
|
|
*/
|
|
|
|
class InterruptPreventer;
|
|
|
|
friend class InterruptPreventer;
|
|
|
|
class NS_STACK_CLASS InterruptPreventer {
|
|
|
|
public:
|
|
|
|
InterruptPreventer(nsPresContext* aCtx) :
|
|
|
|
mCtx(aCtx),
|
|
|
|
mInterruptsEnabled(aCtx->mInterruptsEnabled),
|
|
|
|
mHasPendingInterrupt(aCtx->mHasPendingInterrupt)
|
|
|
|
{
|
|
|
|
mCtx->mInterruptsEnabled = PR_FALSE;
|
|
|
|
mCtx->mHasPendingInterrupt = PR_FALSE;
|
|
|
|
}
|
|
|
|
~InterruptPreventer() {
|
|
|
|
mCtx->mInterruptsEnabled = mInterruptsEnabled;
|
|
|
|
mCtx->mHasPendingInterrupt = mHasPendingInterrupt;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
nsPresContext* mCtx;
|
|
|
|
PRBool mInterruptsEnabled;
|
|
|
|
PRBool mHasPendingInterrupt;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Check for interrupts. This may return true if a pending event is
|
2009-06-13 05:28:41 +04:00
|
|
|
* detected. Once it has returned true, it will keep returning true
|
|
|
|
* until ReflowStarted is called. In all cases where this returns true,
|
|
|
|
* the passed-in frame (which should be the frame whose reflow will be
|
|
|
|
* interrupted if true is returned) will be passed to
|
2009-04-22 03:53:52 +04:00
|
|
|
* nsIPresShell::FrameNeedsToContinueReflow.
|
|
|
|
*/
|
|
|
|
PRBool CheckForInterrupt(nsIFrame* aFrame);
|
|
|
|
/**
|
|
|
|
* Returns true if CheckForInterrupt has returned true since the last
|
2009-06-13 05:28:41 +04:00
|
|
|
* ReflowStarted call. Cannot itself trigger an interrupt check.
|
2009-04-22 03:53:52 +04:00
|
|
|
*/
|
|
|
|
PRBool HasPendingInterrupt() { return mHasPendingInterrupt; }
|
|
|
|
|
2009-09-03 04:28:37 +04:00
|
|
|
#ifdef MOZ_SMIL
|
|
|
|
/**
|
|
|
|
* Indicates that the given element's SMIL Override Style has changed,
|
|
|
|
* and as a result, we need to update our display.
|
|
|
|
*/
|
|
|
|
void SMILOverrideStyleChanged(nsIContent* aContent);
|
|
|
|
#endif // MOZ_SMIL
|
2003-06-19 22:16:53 +04:00
|
|
|
protected:
|
2006-09-12 08:36:03 +04:00
|
|
|
friend class nsRunnableMethod<nsPresContext>;
|
|
|
|
NS_HIDDEN_(void) ThemeChangedInternal();
|
|
|
|
NS_HIDDEN_(void) SysColorChangedInternal();
|
2008-11-26 02:22:38 +03:00
|
|
|
|
2004-07-29 23:41:39 +04:00
|
|
|
NS_HIDDEN_(void) SetImgAnimations(nsIContent *aParent, PRUint16 aMode);
|
2009-01-15 07:38:07 +03:00
|
|
|
#ifdef MOZ_SMIL
|
|
|
|
NS_HIDDEN_(void) SetSMILAnimations(nsIDocument *aDoc, PRUint16 aNewMode,
|
|
|
|
PRUint16 aOldMode);
|
|
|
|
#endif // MOZ_SMIL
|
2004-07-29 23:41:39 +04:00
|
|
|
NS_HIDDEN_(void) GetDocumentColorPreferences();
|
2005-08-24 03:52:16 +04:00
|
|
|
|
2004-07-29 23:41:39 +04:00
|
|
|
NS_HIDDEN_(void) PreferenceChanged(const char* aPrefName);
|
2008-10-10 19:04:34 +04:00
|
|
|
static NS_HIDDEN_(int) PrefChangedCallback(const char*, void*);
|
2004-07-29 23:41:39 +04:00
|
|
|
|
2005-08-24 03:52:16 +04:00
|
|
|
NS_HIDDEN_(void) UpdateAfterPreferencesChanged();
|
2008-10-10 19:04:34 +04:00
|
|
|
static NS_HIDDEN_(void) PrefChangedUpdateTimerCallback(nsITimer *aTimer, void *aClosure);
|
2005-08-24 03:52:16 +04:00
|
|
|
|
2004-07-29 23:41:39 +04:00
|
|
|
NS_HIDDEN_(void) GetUserPreferences();
|
|
|
|
NS_HIDDEN_(void) GetFontPreferences();
|
|
|
|
|
2004-08-10 01:19:15 +04:00
|
|
|
NS_HIDDEN_(void) UpdateCharSet(const nsAFlatCString& aCharSet);
|
2004-07-29 23:41:39 +04:00
|
|
|
|
2008-11-26 02:22:38 +03:00
|
|
|
void HandleRebuildUserFontSet() {
|
|
|
|
mPostedFlushUserFontSet = PR_FALSE;
|
|
|
|
FlushUserFontSet();
|
|
|
|
}
|
|
|
|
|
2009-04-22 03:53:52 +04:00
|
|
|
PRBool HavePendingInputEvent();
|
|
|
|
|
2008-12-29 18:07:36 +03:00
|
|
|
// Can't be inline because we can't include nsStyleSet.h.
|
|
|
|
PRBool HasCachedStyleData();
|
|
|
|
|
2003-06-19 22:16:53 +04:00
|
|
|
// 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).
|
|
|
|
|
2004-07-29 23:41:39 +04:00
|
|
|
nsPresContextType mType;
|
2003-06-19 22:16:53 +04:00
|
|
|
nsIPresShell* mShell; // [WEAK]
|
2006-05-19 14:26:44 +04:00
|
|
|
nsCOMPtr<nsIDocument> mDocument;
|
2003-06-19 22:16:53 +04:00
|
|
|
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]
|
2004-06-09 03:53:59 +04:00
|
|
|
nsIAtom* mLangGroup; // [STRONG]
|
2004-02-01 13:09:07 +03:00
|
|
|
|
2009-02-19 22:03:28 +03:00
|
|
|
nsRefPtrHashtable<nsVoidPtrHashKey, nsImageLoader>
|
|
|
|
mImageLoaders[IMAGE_LOAD_TYPE_COUNT];
|
|
|
|
|
2004-07-29 23:41:39 +04:00
|
|
|
nsWeakPtr mContainer;
|
|
|
|
|
2005-08-13 15:54:22 +04:00
|
|
|
float mTextZoom; // Text zoom, defaults to 1.0
|
2007-08-08 00:38:35 +04:00
|
|
|
float mFullZoom; // Page zoom, defaults to 1.0
|
2008-01-29 07:10:59 +03:00
|
|
|
|
2007-08-24 21:46:59 +04:00
|
|
|
PRInt32 mCurAppUnitsPerDevPixel;
|
2007-07-26 13:47:43 +04:00
|
|
|
PRInt32 mAutoQualityMinFontSizePixelsPref;
|
2005-08-13 15:54:22 +04:00
|
|
|
|
2004-07-29 23:41:39 +04:00
|
|
|
#ifdef IBMBIDI
|
|
|
|
nsBidiPresUtils* mBidiUtils;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
nsCOMPtr<nsITheme> mTheme;
|
|
|
|
nsCOMPtr<nsILanguageAtomService> mLangService;
|
|
|
|
nsCOMPtr<nsIPrintSettings> mPrintSettings;
|
2005-08-24 03:52:16 +04:00
|
|
|
nsCOMPtr<nsITimer> mPrefChangedTimer;
|
2004-07-29 23:41:39 +04:00
|
|
|
|
2004-08-24 22:50:29 +04:00
|
|
|
nsPropertyTable mPropertyTable;
|
|
|
|
|
2009-09-04 08:49:18 +04:00
|
|
|
nsInvalidateRequestList mInvalidateRequests;
|
2008-09-18 13:47:21 +04:00
|
|
|
|
2008-10-01 07:01:53 +04:00
|
|
|
// container for per-context fonts (downloadable, SVG, etc.)
|
2009-01-19 12:21:29 +03:00
|
|
|
nsUserFontSet* mUserFontSet;
|
2008-11-26 02:22:38 +03:00
|
|
|
// The list of @font-face rules that we put into mUserFontSet
|
2008-11-27 06:50:16 +03:00
|
|
|
nsTArray<nsFontFaceRuleContainer> mFontFaceRules;
|
2008-10-01 07:01:53 +04:00
|
|
|
|
2004-02-01 01:41:40 +03:00
|
|
|
PRInt32 mFontScaler;
|
2004-04-13 04:28:44 +04:00
|
|
|
nscoord mMinimumFontSize;
|
2004-02-01 01:41:40 +03:00
|
|
|
|
2004-02-01 13:09:07 +03:00
|
|
|
nsRect mVisibleArea;
|
2006-03-30 04:27:42 +04:00
|
|
|
nsSize mPageSize;
|
2007-02-07 10:46:44 +03:00
|
|
|
float mPageScale;
|
2007-02-14 01:36:59 +03:00
|
|
|
float mPPScale;
|
2004-02-01 13:09:07 +03:00
|
|
|
|
2004-02-01 01:41:40 +03:00
|
|
|
nscolor mDefaultColor;
|
|
|
|
nscolor mBackgroundColor;
|
|
|
|
|
|
|
|
nscolor mLinkColor;
|
|
|
|
nscolor mActiveLinkColor;
|
|
|
|
nscolor mVisitedLinkColor;
|
|
|
|
|
|
|
|
nscolor mFocusBackgroundColor;
|
|
|
|
nscolor mFocusTextColor;
|
|
|
|
|
2004-09-05 04:04:04 +04:00
|
|
|
ScrollbarStyles mViewportStyleOverflow;
|
2004-04-13 06:56:03 +04:00
|
|
|
PRUint8 mFocusRingWidth;
|
|
|
|
|
2003-12-26 07:24:11 +03:00
|
|
|
PRUint16 mImageAnimationMode;
|
2004-07-29 23:41:39 +04:00
|
|
|
PRUint16 mImageAnimationModePref;
|
|
|
|
|
|
|
|
nsFont mDefaultVariableFont;
|
|
|
|
nsFont mDefaultFixedFont;
|
|
|
|
nsFont mDefaultSerifFont;
|
|
|
|
nsFont mDefaultSansSerifFont;
|
|
|
|
nsFont mDefaultMonospaceFont;
|
|
|
|
nsFont mDefaultCursiveFont;
|
|
|
|
nsFont mDefaultFantasyFont;
|
2004-02-20 20:49:01 +03:00
|
|
|
|
2004-11-26 21:40:58 +03:00
|
|
|
nscoord mBorderWidthTable[3];
|
|
|
|
|
2009-04-22 03:53:52 +04:00
|
|
|
PRUint32 mInterruptChecksToSkip;
|
|
|
|
|
2009-10-02 22:05:32 +04:00
|
|
|
mozilla::TimeStamp mReflowStartTime;
|
|
|
|
|
2009-04-22 03:53:52 +04:00
|
|
|
unsigned mHasPendingInterrupt : 1;
|
|
|
|
unsigned mInterruptsEnabled : 1;
|
2004-02-20 20:49:01 +03:00
|
|
|
unsigned mUseDocumentFonts : 1;
|
|
|
|
unsigned mUseDocumentColors : 1;
|
|
|
|
unsigned mUnderlineLinks : 1;
|
|
|
|
unsigned mUseFocusColors : 1;
|
|
|
|
unsigned mFocusRingOnAnything : 1;
|
2008-10-09 03:28:31 +04:00
|
|
|
unsigned mFocusRingStyle : 1;
|
2004-02-20 20:49:01 +03:00
|
|
|
unsigned mDrawImageBackground : 1;
|
|
|
|
unsigned mDrawColorBackground : 1;
|
|
|
|
unsigned mNeverAnimate : 1;
|
|
|
|
unsigned mIsRenderingOnlySelection : 1;
|
2004-03-03 21:24:20 +03:00
|
|
|
unsigned mPaginated : 1;
|
|
|
|
unsigned mCanPaginatedScroll : 1;
|
2004-07-29 23:41:39 +04:00
|
|
|
unsigned mDoScaledTwips : 1;
|
|
|
|
unsigned mEnableJapaneseTransform : 1;
|
2006-03-30 04:27:42 +04:00
|
|
|
unsigned mIsRootPaginatedDocument : 1;
|
2006-03-26 04:48:03 +04:00
|
|
|
unsigned mPrefBidiDirection : 1;
|
|
|
|
unsigned mPrefScrollbarSide : 2;
|
2006-09-12 08:36:03 +04:00
|
|
|
unsigned mPendingSysColorChanged : 1;
|
|
|
|
unsigned mPendingThemeChanged : 1;
|
2008-07-26 20:14:48 +04:00
|
|
|
unsigned mPendingMediaFeatureValuesChanged : 1;
|
2008-02-08 22:52:46 +03:00
|
|
|
unsigned mPrefChangePendingNeedsReflow : 1;
|
2008-11-26 02:22:38 +03:00
|
|
|
|
|
|
|
// Is the current mUserFontSet valid?
|
2008-11-26 02:22:38 +03:00
|
|
|
unsigned mUserFontSetDirty : 1;
|
2008-11-26 02:22:38 +03:00
|
|
|
// Has GetUserFontSet() been called?
|
|
|
|
unsigned mGetUserFontSetCalled : 1;
|
|
|
|
// Do we currently have an event posted to call FlushUserFontSet?
|
|
|
|
unsigned mPostedFlushUserFontSet : 1;
|
2006-03-30 04:27:42 +04:00
|
|
|
|
2008-01-29 07:10:59 +03:00
|
|
|
// resize reflow is supressed when the only change has been to zoom
|
|
|
|
// the document rather than to change the document's dimensions
|
|
|
|
unsigned mSupressResizeReflow : 1;
|
|
|
|
|
2004-02-20 20:49:01 +03:00
|
|
|
unsigned mIsVisual : 1;
|
2004-07-29 23:41:39 +04:00
|
|
|
|
2009-09-11 14:46:36 +04:00
|
|
|
unsigned mProcessingAnimationStyleChange : 1;
|
|
|
|
|
2004-07-29 23:41:39 +04:00
|
|
|
#ifdef DEBUG
|
|
|
|
PRBool mInitialized;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2005-07-31 00:57:07 +04:00
|
|
|
protected:
|
2004-07-29 23:41:39 +04:00
|
|
|
|
2009-07-22 04:44:54 +04:00
|
|
|
virtual ~nsPresContext() NS_HIDDEN;
|
2004-07-29 23:41:39 +04:00
|
|
|
|
|
|
|
// these are private, use the list in nsFont.h if you want a public list
|
|
|
|
enum {
|
|
|
|
eDefaultFont_Variable,
|
|
|
|
eDefaultFont_Fixed,
|
|
|
|
eDefaultFont_Serif,
|
|
|
|
eDefaultFont_SansSerif,
|
|
|
|
eDefaultFont_Monospace,
|
|
|
|
eDefaultFont_Cursive,
|
|
|
|
eDefaultFont_Fantasy,
|
|
|
|
eDefaultFont_COUNT
|
|
|
|
};
|
|
|
|
|
2006-04-18 09:44:02 +04:00
|
|
|
#ifdef DEBUG
|
|
|
|
private:
|
|
|
|
friend struct nsAutoLayoutPhase;
|
|
|
|
PRUint32 mLayoutPhaseCount[eLayoutPhase_COUNT];
|
|
|
|
public:
|
|
|
|
PRUint32 LayoutPhaseCount(nsLayoutPhase aPhase) {
|
|
|
|
return mLayoutPhaseCount[aPhase];
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
1998-04-14 00:24:54 +04:00
|
|
|
};
|
|
|
|
|
2009-07-22 04:44:54 +04:00
|
|
|
class nsRootPresContext : public nsPresContext {
|
|
|
|
public:
|
|
|
|
nsRootPresContext(nsIDocument* aDocument, nsPresContextType aType) NS_HIDDEN;
|
2009-07-22 04:45:00 +04:00
|
|
|
virtual ~nsRootPresContext();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Registers a plugin to receive geometry updates (position and clip
|
|
|
|
* region) so it can update its widget.
|
|
|
|
* Callers must call UnregisterPluginForGeometryUpdates before
|
|
|
|
* the aPlugin frame is destroyed.
|
|
|
|
*/
|
|
|
|
void RegisterPluginForGeometryUpdates(nsObjectFrame* aPlugin);
|
|
|
|
/**
|
|
|
|
* Stops a plugin receiving geometry updates (position and clip
|
|
|
|
* region). If the plugin was not already registered, this does
|
|
|
|
* nothing.
|
|
|
|
*/
|
|
|
|
void UnregisterPluginForGeometryUpdates(nsObjectFrame* aPlugin);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Iterate through all plugins that are registered for geometry updates
|
|
|
|
* and update their position and clip region to match the current frame
|
|
|
|
* tree. Only frames at or under aChangedRoot can have changed their
|
|
|
|
* geometry.
|
|
|
|
*/
|
|
|
|
void UpdatePluginGeometry(nsIFrame* aChangedRoot);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Iterate through all plugins that are registered for geometry updates
|
|
|
|
* and compute their position and clip region according to the
|
|
|
|
* current frame tree. Only frames at or under aChangedRoot can have
|
|
|
|
* changed their geometry. The computed positions and clip regions are
|
|
|
|
* appended to aConfigurations.
|
|
|
|
*/
|
|
|
|
void GetPluginGeometryUpdates(nsIFrame* aChangedRoot,
|
|
|
|
nsTArray<nsIWidget::Configuration>* aConfigurations);
|
|
|
|
|
2009-07-22 04:45:02 +04:00
|
|
|
/**
|
|
|
|
* When all geometry updates have been applied, call this function
|
|
|
|
* in case the nsObjectFrames have work to do after the widgets
|
|
|
|
* have been updated.
|
|
|
|
*/
|
|
|
|
void DidApplyPluginGeometryUpdates();
|
|
|
|
|
2009-07-22 04:45:00 +04:00
|
|
|
private:
|
|
|
|
nsTHashtable<nsPtrHashKey<nsObjectFrame> > mRegisteredPlugins;
|
2009-07-22 04:44:54 +04:00
|
|
|
};
|
|
|
|
|
2006-04-18 09:44:02 +04:00
|
|
|
#ifdef DEBUG
|
|
|
|
|
|
|
|
struct nsAutoLayoutPhase {
|
|
|
|
nsAutoLayoutPhase(nsPresContext* aPresContext, nsLayoutPhase aPhase)
|
|
|
|
: mPresContext(aPresContext), mPhase(aPhase), mCount(0)
|
|
|
|
{
|
|
|
|
Enter();
|
|
|
|
}
|
|
|
|
|
|
|
|
~nsAutoLayoutPhase()
|
|
|
|
{
|
|
|
|
Exit();
|
|
|
|
NS_ASSERTION(mCount == 0, "imbalanced");
|
|
|
|
}
|
|
|
|
|
|
|
|
void Enter()
|
|
|
|
{
|
|
|
|
switch (mPhase) {
|
|
|
|
case eLayoutPhase_Paint:
|
|
|
|
NS_ASSERTION(mPresContext->mLayoutPhaseCount[eLayoutPhase_Paint] == 0,
|
|
|
|
"recurring into paint");
|
|
|
|
NS_ASSERTION(mPresContext->mLayoutPhaseCount[eLayoutPhase_Reflow] == 0,
|
|
|
|
"painting in the middle of reflow");
|
|
|
|
NS_ASSERTION(mPresContext->mLayoutPhaseCount[eLayoutPhase_FrameC] == 0,
|
|
|
|
"painting in the middle of frame construction");
|
|
|
|
break;
|
|
|
|
case eLayoutPhase_Reflow:
|
|
|
|
NS_ASSERTION(mPresContext->mLayoutPhaseCount[eLayoutPhase_Paint] == 0,
|
|
|
|
"reflowing in the middle of a paint");
|
|
|
|
NS_ASSERTION(mPresContext->mLayoutPhaseCount[eLayoutPhase_Reflow] == 0,
|
|
|
|
"recurring into reflow");
|
|
|
|
NS_ASSERTION(mPresContext->mLayoutPhaseCount[eLayoutPhase_FrameC] == 0,
|
|
|
|
"reflowing in the middle of frame construction");
|
|
|
|
break;
|
|
|
|
case eLayoutPhase_FrameC:
|
|
|
|
NS_ASSERTION(mPresContext->mLayoutPhaseCount[eLayoutPhase_Paint] == 0,
|
|
|
|
"constructing frames in the middle of a paint");
|
2007-07-05 00:40:14 +04:00
|
|
|
NS_ASSERTION(mPresContext->mLayoutPhaseCount[eLayoutPhase_Reflow] == 0,
|
|
|
|
"constructing frames in the middle of reflow");
|
2009-09-23 08:52:08 +04:00
|
|
|
NS_ASSERTION(mPresContext->mLayoutPhaseCount[eLayoutPhase_FrameC] == 0,
|
|
|
|
"recurring into frame construction");
|
2009-06-11 23:30:24 +04:00
|
|
|
NS_ASSERTION(!nsContentUtils::IsSafeToRunScript(),
|
|
|
|
"constructing frames and scripts are not blocked");
|
2006-04-18 09:44:02 +04:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
++(mPresContext->mLayoutPhaseCount[mPhase]);
|
|
|
|
++mCount;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Exit()
|
|
|
|
{
|
|
|
|
NS_ASSERTION(mCount > 0 && mPresContext->mLayoutPhaseCount[mPhase] > 0,
|
|
|
|
"imbalanced");
|
|
|
|
--(mPresContext->mLayoutPhaseCount[mPhase]);
|
|
|
|
--mCount;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
nsPresContext *mPresContext;
|
|
|
|
nsLayoutPhase mPhase;
|
|
|
|
PRUint32 mCount;
|
|
|
|
};
|
|
|
|
|
|
|
|
#define AUTO_LAYOUT_PHASE_ENTRY_POINT(pc_, phase_) \
|
|
|
|
nsAutoLayoutPhase autoLayoutPhase((pc_), (eLayoutPhase_##phase_))
|
|
|
|
#define LAYOUT_PHASE_TEMP_EXIT() \
|
|
|
|
PR_BEGIN_MACRO \
|
|
|
|
autoLayoutPhase.Exit(); \
|
|
|
|
PR_END_MACRO
|
|
|
|
#define LAYOUT_PHASE_TEMP_REENTER() \
|
|
|
|
PR_BEGIN_MACRO \
|
|
|
|
autoLayoutPhase.Enter(); \
|
|
|
|
PR_END_MACRO
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
#define AUTO_LAYOUT_PHASE_ENTRY_POINT(pc_, phase_) \
|
|
|
|
PR_BEGIN_MACRO PR_END_MACRO
|
|
|
|
#define LAYOUT_PHASE_TEMP_EXIT() \
|
|
|
|
PR_BEGIN_MACRO PR_END_MACRO
|
|
|
|
#define LAYOUT_PHASE_TEMP_REENTER() \
|
|
|
|
PR_BEGIN_MACRO PR_END_MACRO
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2000-04-21 18:59:47 +04:00
|
|
|
#ifdef MOZ_REFLOW_PERF
|
2001-03-13 04:47:22 +03:00
|
|
|
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 08:38:33 +03:00
|
|
|
#define DO_GLOBAL_REFLOW_COUNT(_name) \
|
|
|
|
aPresContext->CountReflows((_name), (nsIFrame*)this);
|
2000-04-21 18:59:47 +04:00
|
|
|
#else
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 08:38:33 +03:00
|
|
|
#define DO_GLOBAL_REFLOW_COUNT(_name)
|
2000-04-21 18:59:47 +04:00
|
|
|
#endif // MOZ_REFLOW_PERF
|
|
|
|
|
2004-08-01 03:15:21 +04:00
|
|
|
#endif /* nsPresContext_h___ */
|