2001-09-29 00:14:13 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
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
|
|
|
|
2012-09-14 20:10:08 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
2017-06-18 14:37:50 +03:00
|
|
|
#include "mozilla/NotNull.h"
|
2017-04-11 07:51:30 +03:00
|
|
|
#include "mozilla/UniquePtr.h"
|
2013-11-20 23:18:25 +04:00
|
|
|
#include "mozilla/WeakPtr.h"
|
1998-07-16 08:34:59 +04:00
|
|
|
#include "nsColor.h"
|
2001-07-16 06:40:48 +04:00
|
|
|
#include "nsCoord.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-07-29 23:41:39 +04:00
|
|
|
#include "nsFont.h"
|
2013-09-02 02:21:01 +04:00
|
|
|
#include "gfxFontConstants.h"
|
2013-08-23 21:56:20 +04:00
|
|
|
#include "nsIAtom.h"
|
2004-07-29 23:41:39 +04:00
|
|
|
#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"
|
2016-02-23 19:10:00 +03:00
|
|
|
#include "nsIWidgetListener.h"
|
2015-04-03 22:39:23 +03:00
|
|
|
#include "nsLanguageAtomService.h"
|
2007-01-30 03:06:41 +03:00
|
|
|
#include "nsGkAtoms.h"
|
2007-08-11 01:25:24 +04:00
|
|
|
#include "nsCycleCollectionParticipant.h"
|
2008-02-08 22:52:46 +03:00
|
|
|
#include "nsChangeHint.h"
|
2013-01-15 16:22:03 +04:00
|
|
|
#include <algorithm>
|
2017-07-05 18:22:00 +03:00
|
|
|
#include "gfxTypes.h"
|
2008-07-07 06:28:24 +04:00
|
|
|
#include "gfxRect.h"
|
2008-11-26 02:22:38 +03:00
|
|
|
#include "nsTArray.h"
|
|
|
|
#include "nsAutoPtr.h"
|
2013-06-23 16:03:39 +04:00
|
|
|
#include "mozilla/MemoryReporting.h"
|
2009-10-02 22:05:32 +04:00
|
|
|
#include "mozilla/TimeStamp.h"
|
2013-09-07 00:15:04 +04:00
|
|
|
#include "mozilla/AppUnits.h"
|
2011-04-22 07:17:31 +04:00
|
|
|
#include "prclist.h"
|
2013-08-14 15:33:03 +04:00
|
|
|
#include "nsThreadUtils.h"
|
2013-08-24 00:20:07 +04:00
|
|
|
#include "ScrollbarStyles.h"
|
2014-05-23 16:52:36 +04:00
|
|
|
#include "nsIMessageManager.h"
|
2014-09-25 09:45:36 +04:00
|
|
|
#include "mozilla/RestyleLogging.h"
|
2015-09-29 03:13:52 +03:00
|
|
|
#include "Units.h"
|
2016-02-24 10:01:12 +03:00
|
|
|
#include "prenv.h"
|
2016-03-31 22:47:20 +03:00
|
|
|
#include "mozilla/StaticPresData.h"
|
2016-07-27 03:27:56 +03:00
|
|
|
#include "mozilla/StyleBackendType.h"
|
2008-10-01 07:01:53 +04:00
|
|
|
|
2012-07-30 08:29:41 +04:00
|
|
|
class nsAString;
|
2017-04-11 07:51:30 +03:00
|
|
|
class nsBidi;
|
2012-07-30 08:29:41 +04:00
|
|
|
class nsIPrintSettings;
|
2013-11-20 23:18:25 +04:00
|
|
|
class nsDocShell;
|
|
|
|
class nsIDocShell;
|
2012-07-30 08:29:41 +04:00
|
|
|
class nsIDocument;
|
|
|
|
class nsITheme;
|
|
|
|
class nsIContent;
|
1998-05-12 02:57:05 +04:00
|
|
|
class nsIFrame;
|
2004-02-24 00:29:06 +03:00
|
|
|
class nsFrameManager;
|
1998-04-14 00:24:54 +04:00
|
|
|
class nsILinkHandler;
|
1998-05-19 01:03:10 +04:00
|
|
|
class nsIAtom;
|
2006-09-12 08:36:03 +04:00
|
|
|
class nsIRunnable;
|
2015-03-06 11:44:23 +03:00
|
|
|
class gfxUserFontEntry;
|
2008-10-01 07:01:53 +04:00
|
|
|
class gfxUserFontSet;
|
2013-11-25 08:59:56 +04:00
|
|
|
class gfxTextPerfMetrics;
|
2014-09-24 08:34:00 +04:00
|
|
|
class nsPluginFrame;
|
2009-10-08 07:22:42 +04:00
|
|
|
class nsTransitionManager;
|
2011-04-12 10:18:44 +04:00
|
|
|
class nsAnimationManager;
|
2013-08-14 15:29:51 +04:00
|
|
|
class nsRefreshDriver;
|
2013-08-20 02:55:18 +04:00
|
|
|
class nsIWidget;
|
2013-09-23 15:52:25 +04:00
|
|
|
class nsDeviceContext;
|
2014-12-22 19:35:54 +03:00
|
|
|
class gfxMissingFontRecorder;
|
2001-03-13 04:47:22 +03:00
|
|
|
|
2013-07-20 23:14:24 +04:00
|
|
|
namespace mozilla {
|
2016-01-13 01:54:53 +03:00
|
|
|
class EffectCompositor;
|
2017-06-18 14:37:50 +03:00
|
|
|
class Encoding;
|
2014-04-01 08:09:23 +04:00
|
|
|
class EventStateManager;
|
2014-06-12 05:11:00 +04:00
|
|
|
class CounterStyleManager;
|
2017-02-13 06:21:33 +03:00
|
|
|
class RestyleManager;
|
2013-08-14 15:33:03 +04:00
|
|
|
namespace layers {
|
|
|
|
class ContainerLayer;
|
2015-01-29 22:41:54 +03:00
|
|
|
class LayerManager;
|
2015-07-13 18:25:42 +03:00
|
|
|
} // namespace layers
|
2016-12-23 03:52:12 +03:00
|
|
|
namespace dom {
|
|
|
|
class Element;
|
|
|
|
} // namespace dom
|
2015-07-13 18:25:42 +03:00
|
|
|
} // namespace mozilla
|
2013-07-20 23:14:24 +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 {
|
2014-11-27 22:06:14 +03:00
|
|
|
kPresContext_UseDocumentFonts = 1,
|
2006-03-26 04:48:03 +04:00
|
|
|
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 {
|
2012-01-26 03:52:26 +04:00
|
|
|
kPresContext_ScrollbarSide = 1,
|
2006-03-26 04:48:03 +04:00
|
|
|
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.
|
2012-08-22 19:56:38 +04:00
|
|
|
const uint8_t kPresContext_DefaultVariableFont_ID = 0x00; // kGenericFont_moz_variable
|
|
|
|
const uint8_t kPresContext_DefaultFixedFont_ID = 0x01; // kGenericFont_moz_fixed
|
2001-09-27 22:34:30 +04:00
|
|
|
|
2006-04-18 09:44:02 +04:00
|
|
|
#ifdef DEBUG
|
|
|
|
struct nsAutoLayoutPhase;
|
|
|
|
|
|
|
|
enum nsLayoutPhase {
|
|
|
|
eLayoutPhase_Paint,
|
|
|
|
eLayoutPhase_Reflow,
|
|
|
|
eLayoutPhase_FrameC,
|
|
|
|
eLayoutPhase_COUNT
|
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
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)
|
2012-08-04 22:52:21 +04:00
|
|
|
#define NS_AUTHOR_SPECIFIED_TEXT_SHADOW (1 << 3)
|
2008-04-26 03:12:45 +04:00
|
|
|
|
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
|
|
|
|
2016-10-12 14:27:38 +03:00
|
|
|
class nsPresContext : public nsIObserver,
|
|
|
|
public mozilla::SupportsWeakPtr<nsPresContext> {
|
2004-07-30 01:00:58 +04:00
|
|
|
public:
|
2017-06-18 14:37:50 +03:00
|
|
|
using Encoding = mozilla::Encoding;
|
|
|
|
template <typename T> using NotNull = mozilla::NotNull<T>;
|
2016-03-31 22:47:20 +03:00
|
|
|
typedef mozilla::LangGroupFontPrefs LangGroupFontPrefs;
|
2014-09-15 23:30:00 +04:00
|
|
|
typedef mozilla::ScrollbarStyles ScrollbarStyles;
|
2016-03-31 22:47:20 +03:00
|
|
|
typedef mozilla::StaticPresData StaticPresData;
|
2010-03-29 05:46:55 +04:00
|
|
|
|
2007-08-11 01:25:24 +04:00
|
|
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
2004-07-29 23:41:39 +04:00
|
|
|
NS_DECL_NSIOBSERVER
|
2007-08-11 01:25:24 +04:00
|
|
|
NS_DECL_CYCLE_COLLECTION_CLASS(nsPresContext)
|
2016-10-12 14:27:38 +03:00
|
|
|
MOZ_DECLARE_WEAKREFERENCE_TYPENAME(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
|
|
|
};
|
|
|
|
|
2014-06-02 16:08:24 +04:00
|
|
|
nsPresContext(nsIDocument* aDocument, nsPresContextType aType);
|
2004-07-29 23:41:39 +04:00
|
|
|
|
1998-06-25 08:24:45 +04:00
|
|
|
/**
|
|
|
|
* Initialize the presentation context from a particular device.
|
|
|
|
*/
|
2014-06-02 16:08:21 +04:00
|
|
|
nsresult Init(nsDeviceContext* aDeviceContext);
|
1998-11-26 21:08:44 +03:00
|
|
|
|
1998-04-14 00:24:54 +04:00
|
|
|
/**
|
2016-07-27 03:43:56 +03:00
|
|
|
* Set and detach presentation shell that this context is bound to.
|
1998-04-14 00:24:54 +04:00
|
|
|
* A presentation context may only be bound to a single shell.
|
|
|
|
*/
|
2016-07-27 03:27:56 +03:00
|
|
|
void AttachShell(nsIPresShell* aShell, mozilla::StyleBackendType aBackendType);
|
2016-07-27 03:43:56 +03:00
|
|
|
void DetachShell();
|
2004-07-29 23:41:39 +04:00
|
|
|
|
|
|
|
|
2014-06-02 16:08:21 +04:00
|
|
|
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
|
|
|
|
2012-05-04 09:00:57 +04:00
|
|
|
/**
|
|
|
|
* Returns the parent prescontext for this one. Returns null if this is a
|
|
|
|
* root.
|
|
|
|
*/
|
|
|
|
nsPresContext* GetParentPresContext();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the prescontext of the toplevel content document that contains
|
|
|
|
* this presentation, or null if there isn't one.
|
|
|
|
*/
|
|
|
|
nsPresContext* GetToplevelContentDocumentPresContext();
|
|
|
|
|
2012-09-26 09:47:45 +04:00
|
|
|
/**
|
|
|
|
* Returns the nearest widget for the root frame of this.
|
|
|
|
*
|
|
|
|
* @param aOffset If non-null the offset from the origin of the root
|
|
|
|
* frame's view to the widget's origin (usually positive)
|
|
|
|
* expressed in appunits of this will be returned in
|
|
|
|
* aOffset.
|
|
|
|
*/
|
|
|
|
nsIWidget* GetNearestWidget(nsPoint* aOffset = nullptr);
|
|
|
|
|
2013-02-06 06:50:02 +04:00
|
|
|
/**
|
|
|
|
* Returns the root widget for this.
|
|
|
|
* Note that the widget is a mediater with IME.
|
|
|
|
*/
|
|
|
|
nsIWidget* GetRootWidget();
|
|
|
|
|
2010-01-26 16:10:12 +03:00
|
|
|
/**
|
|
|
|
* Return the presentation context for the root of the view manager
|
2012-07-30 18:20:58 +04:00
|
|
|
* hierarchy that contains this presentation context, or nullptr if it can't
|
2010-01-26 16:10:12 +03:00
|
|
|
* be found (e.g. it's detached).
|
|
|
|
*/
|
|
|
|
nsRootPresContext* GetRootPresContext();
|
2016-01-22 04:09:04 +03:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
virtual bool IsRoot() { return false; }
|
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;
|
|
|
|
}
|
|
|
|
|
2013-03-16 08:31:38 +04:00
|
|
|
#ifdef MOZILLA_INTERNAL_API
|
2017-01-04 22:52:26 +03:00
|
|
|
mozilla::StyleSetHandle StyleSet() const { return GetPresShell()->StyleSet(); }
|
2004-02-24 00:29:06 +03:00
|
|
|
|
|
|
|
nsFrameManager* FrameManager()
|
2013-07-20 23:14:25 +04:00
|
|
|
{ return PresShell()->FrameManager(); }
|
|
|
|
|
|
|
|
nsCSSFrameConstructor* FrameConstructor()
|
|
|
|
{ return PresShell()->FrameConstructor(); }
|
2009-10-08 07:22:42 +04:00
|
|
|
|
2016-01-13 01:54:53 +03:00
|
|
|
mozilla::EffectCompositor* EffectCompositor() { return mEffectCompositor; }
|
2009-10-08 07:22:42 +04:00
|
|
|
nsTransitionManager* TransitionManager() { return mTransitionManager; }
|
2011-04-12 10:18:44 +04:00
|
|
|
nsAnimationManager* AnimationManager() { return mAnimationManager; }
|
2009-10-08 07:22:42 +04:00
|
|
|
|
2009-12-23 22:10:30 +03:00
|
|
|
nsRefreshDriver* RefreshDriver() { return mRefreshDriver; }
|
2013-07-20 23:14:24 +04:00
|
|
|
|
2017-02-13 06:21:33 +03:00
|
|
|
mozilla::RestyleManager* RestyleManager() {
|
2016-07-27 03:27:56 +03:00
|
|
|
MOZ_ASSERT(mRestyleManager);
|
|
|
|
return mRestyleManager;
|
|
|
|
}
|
2014-06-12 05:11:00 +04:00
|
|
|
|
2017-01-04 22:52:26 +03:00
|
|
|
mozilla::CounterStyleManager* CounterStyleManager() const {
|
2014-06-12 05:11:00 +04:00
|
|
|
return mCounterStyleManager;
|
|
|
|
}
|
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.
|
2014-10-09 01:26:57 +04:00
|
|
|
* For aRestyleHint, see RestyleManager::RebuildAllStyleData.
|
2014-06-12 05:12:00 +04:00
|
|
|
* Also rebuild the user font set and counter style manager.
|
2008-12-04 19:09:53 +03:00
|
|
|
*/
|
2014-10-09 01:26:57 +04:00
|
|
|
void RebuildAllStyleData(nsChangeHint aExtraHint, nsRestyleHint aRestyleHint);
|
2008-12-04 19:09:53 +03:00
|
|
|
/**
|
|
|
|
* Just like RebuildAllStyleData, except (1) asynchronous and (2) it
|
|
|
|
* doesn't rebuild the user font set.
|
|
|
|
*/
|
2014-10-09 01:27:02 +04:00
|
|
|
void PostRebuildAllStyleDataEvent(nsChangeHint aExtraHint,
|
|
|
|
nsRestyleHint aRestyleHint);
|
2008-01-09 12:38:28 +03:00
|
|
|
|
2014-10-09 01:27:03 +04:00
|
|
|
/**
|
|
|
|
* Handle changes in the values of media features (used in media
|
|
|
|
* queries).
|
|
|
|
*
|
|
|
|
* There are three sensible values to use for aRestyleHint:
|
|
|
|
* * nsRestyleHint(0) to rebuild style data, with rerunning of
|
|
|
|
* selector matching, only if media features have changed
|
|
|
|
* * eRestyle_ForceDescendants to force rebuilding of style data (but
|
|
|
|
* still only rerun selector matching if media query results have
|
|
|
|
* changed). (RebuildAllStyleData always adds
|
|
|
|
* eRestyle_ForceDescendants internally, so here we're only using
|
|
|
|
* it to distinguish from nsRestyleHint(0) whether we need to call
|
|
|
|
* RebuildAllStyleData at all.)
|
|
|
|
* * eRestyle_Subtree to force rebuilding of style data with
|
|
|
|
* rerunning of selector matching
|
|
|
|
*
|
|
|
|
* For aChangeHint, see RestyleManager::RebuildAllStyleData. (Passing
|
|
|
|
* a nonzero aChangeHint forces rebuilding style data even if
|
|
|
|
* nsRestyleHint(0) is passed.)
|
|
|
|
*/
|
|
|
|
void MediaFeatureValuesChanged(nsRestyleHint aRestyleHint,
|
2012-11-09 10:40:41 +04:00
|
|
|
nsChangeHint aChangeHint = nsChangeHint(0));
|
2016-02-23 19:10:00 +03:00
|
|
|
/**
|
|
|
|
* Calls MediaFeatureValuesChanged for this pres context and all descendant
|
|
|
|
* subdocuments that have a pres context. This should be used for media
|
|
|
|
* features that must be updated in all subdocuments e.g. display-mode.
|
|
|
|
*/
|
|
|
|
void MediaFeatureValuesChangedAllDocuments(nsRestyleHint aRestyleHint,
|
|
|
|
nsChangeHint aChangeHint = nsChangeHint(0));
|
|
|
|
|
2008-07-26 20:14:48 +04:00
|
|
|
void PostMediaFeatureValuesChangedEvent();
|
2014-06-02 16:08:21 +04:00
|
|
|
void HandleMediaFeatureValuesChangedEvent();
|
2008-07-26 20:14:48 +04:00
|
|
|
void FlushPendingMediaFeatureValuesChanged() {
|
|
|
|
if (mPendingMediaFeatureValuesChanged)
|
2014-10-09 01:27:03 +04:00
|
|
|
MediaFeatureValuesChanged(nsRestyleHint(0));
|
2008-07-26 20:14:48 +04:00
|
|
|
}
|
|
|
|
|
2016-02-23 19:10:00 +03:00
|
|
|
/**
|
|
|
|
* Updates the size mode on all remote children and recursively notifies this
|
|
|
|
* document and all subdocuments (including remote children) that a media
|
|
|
|
* feature value has changed.
|
|
|
|
*/
|
|
|
|
void SizeModeChanged(nsSizeMode aSizeMode);
|
|
|
|
|
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.
|
|
|
|
*/
|
2012-07-30 08:29:41 +04:00
|
|
|
nsCompatibility CompatibilityMode() const;
|
|
|
|
|
2006-12-05 18:46:18 +03:00
|
|
|
/**
|
|
|
|
* Notify the context that the document's compatibility mode has changed
|
1998-07-31 09:54:59 +04:00
|
|
|
*/
|
2014-06-02 16:08:21 +04:00
|
|
|
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
|
|
|
|
*/
|
2012-08-22 19:56:38 +04:00
|
|
|
uint16_t ImageAnimationMode() const { return mImageAnimationMode; }
|
2014-06-02 16:08:21 +04:00
|
|
|
virtual void SetImageAnimationModeExternal(uint16_t aMode);
|
|
|
|
void SetImageAnimationModeInternal(uint16_t aMode);
|
2013-03-16 08:31:38 +04:00
|
|
|
#ifdef MOZILLA_INTERNAL_API
|
2012-08-22 19:56:38 +04:00
|
|
|
void SetImageAnimationMode(uint16_t aMode)
|
2004-07-29 23:41:39 +04:00
|
|
|
{ SetImageAnimationModeInternal(aMode); }
|
|
|
|
#else
|
2012-08-22 19:56:38 +04:00
|
|
|
void SetImageAnimationMode(uint16_t aMode)
|
2004-07-29 23:41:39 +04:00
|
|
|
{ SetImageAnimationModeExternal(aMode); }
|
|
|
|
#endif
|
2000-05-13 05:39:20 +04:00
|
|
|
|
2014-03-20 10:49:25 +04:00
|
|
|
/**
|
1998-12-02 03:28:57 +03:00
|
|
|
* Get medium of presentation
|
|
|
|
*/
|
2013-07-17 19:39:19 +04:00
|
|
|
nsIAtom* Medium() {
|
|
|
|
if (!mIsEmulatingMedia)
|
|
|
|
return mMedium;
|
|
|
|
return mMediaEmulated;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Render the document as if being viewed on a device with the specified
|
|
|
|
* media type.
|
|
|
|
*/
|
|
|
|
void EmulateMedium(const nsAString& aMediaType);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Restore the viewer's natural medium
|
|
|
|
*/
|
|
|
|
void StopEmulatingMedium();
|
1998-12-02 03:28:57 +03:00
|
|
|
|
2004-02-01 01:41:40 +03:00
|
|
|
/**
|
2012-01-26 03:52:26 +04:00
|
|
|
* Get the default font for the given language and generic font ID.
|
2012-07-30 18:20:58 +04:00
|
|
|
* If aLanguage is nullptr, the document's language is used.
|
2012-01-26 03:52:26 +04:00
|
|
|
*
|
2016-03-31 22:47:20 +03:00
|
|
|
* See the comment in StaticPresData::GetDefaultFont.
|
2004-02-01 01:41:40 +03:00
|
|
|
*/
|
2014-06-02 16:08:21 +04:00
|
|
|
const nsFont* GetDefaultFont(uint8_t aFontID,
|
2017-05-26 01:04:13 +03:00
|
|
|
nsIAtom *aLanguage, bool* aNeedsToCache = nullptr) const
|
2016-03-31 22:47:20 +03:00
|
|
|
{
|
|
|
|
nsIAtom* lang = aLanguage ? aLanguage : mLanguage.get();
|
2017-05-26 01:04:13 +03:00
|
|
|
const LangGroupFontPrefs* prefs = GetFontPrefsForLang(lang, aNeedsToCache);
|
|
|
|
if (aNeedsToCache && *aNeedsToCache) {
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
return StaticPresData::Get()->GetDefaultFontHelper(aFontID, lang, prefs);
|
2016-03-31 22:47:20 +03:00
|
|
|
}
|
1998-07-17 09:41:41 +04:00
|
|
|
|
2017-05-20 22:47:36 +03:00
|
|
|
void ForceCacheLang(nsIAtom *aLanguage);
|
|
|
|
void CacheAllLangs();
|
|
|
|
|
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
|
2011-09-29 10:19:26 +04:00
|
|
|
bool 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_UnderlineLinks:
|
|
|
|
return mUnderlineLinks;
|
|
|
|
default:
|
|
|
|
NS_ERROR("Invalid arg passed to GetCachedBoolPref");
|
|
|
|
}
|
|
|
|
|
2011-10-17 18:59:28 +04:00
|
|
|
return false;
|
2004-02-20 20:49:01 +03:00
|
|
|
}
|
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
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t 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) {
|
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");
|
|
|
|
}
|
|
|
|
|
2011-10-17 18:59:28 +04:00
|
|
|
return false;
|
2004-04-13 04:28:44 +04:00
|
|
|
}
|
2000-10-11 12:33:01 +04:00
|
|
|
|
2014-03-20 10:49:25 +04:00
|
|
|
/**
|
2000-10-11 12:33:01 +04:00
|
|
|
* Get the default colors
|
1998-07-17 09:41:41 +04:00
|
|
|
*/
|
2016-01-06 04:08:45 +03:00
|
|
|
nscolor DefaultColor() const { return mDefaultColor; }
|
|
|
|
nscolor DefaultBackgroundColor() const { return mBackgroundColor; }
|
|
|
|
nscolor DefaultLinkColor() const { return mLinkColor; }
|
|
|
|
nscolor DefaultActiveLinkColor() const { return mActiveLinkColor; }
|
|
|
|
nscolor DefaultVisitedLinkColor() const { return mVisitedLinkColor; }
|
|
|
|
nscolor FocusBackgroundColor() const { return mFocusBackgroundColor; }
|
|
|
|
nscolor FocusTextColor() const { return mFocusTextColor; }
|
2004-02-01 01:41:40 +03:00
|
|
|
|
2011-06-01 15:43:31 +04:00
|
|
|
/**
|
|
|
|
* Body text color, for use in quirks mode only.
|
|
|
|
*/
|
2016-01-06 04:08:45 +03:00
|
|
|
nscolor BodyTextColor() const { return mBodyTextColor; }
|
2011-06-01 15:43:31 +04:00
|
|
|
void SetBodyTextColor(nscolor aColor) { mBodyTextColor = aColor; }
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool GetUseFocusColors() const { return mUseFocusColors; }
|
2012-08-22 19:56:38 +04:00
|
|
|
uint8_t FocusRingWidth() const { return mFocusRingWidth; }
|
2011-09-29 10:19:26 +04:00
|
|
|
bool GetFocusRingOnAnything() const { return mFocusRingOnAnything; }
|
2012-08-22 19:56:38 +04:00
|
|
|
uint8_t GetFocusRingStyle() const { return mFocusRingStyle; }
|
2008-10-09 03:28:31 +04:00
|
|
|
|
2014-06-02 16:08:21 +04:00
|
|
|
void SetContainer(nsIDocShell* aContainer);
|
1998-04-14 00:24:54 +04:00
|
|
|
|
2013-11-20 23:18:25 +04:00
|
|
|
virtual nsISupports* GetContainerWeakExternal() const;
|
|
|
|
nsISupports* GetContainerWeakInternal() const;
|
2013-03-16 08:31:38 +04:00
|
|
|
#ifdef MOZILLA_INTERNAL_API
|
2013-11-20 23:18:25 +04:00
|
|
|
nsISupports* GetContainerWeak() const
|
|
|
|
{ return GetContainerWeakInternal(); }
|
2004-07-29 23:41:39 +04:00
|
|
|
#else
|
2013-11-20 23:18:25 +04:00
|
|
|
nsISupports* GetContainerWeak() const
|
|
|
|
{ return GetContainerWeakExternal(); }
|
2004-07-29 23:41:39 +04:00
|
|
|
#endif
|
1998-04-14 00:24:54 +04:00
|
|
|
|
2013-11-20 23:18:25 +04:00
|
|
|
nsIDocShell* GetDocShell() const;
|
|
|
|
|
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
|
|
|
|
2014-02-04 03:47:57 +04:00
|
|
|
/**
|
|
|
|
* Detach this pres context - i.e. cancel relevant timers,
|
|
|
|
* SetLinkHandler(null), SetContainer(null) etc.
|
|
|
|
* Only to be used by the DocumentViewer.
|
|
|
|
*/
|
|
|
|
virtual void Detach();
|
|
|
|
|
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
|
|
|
*/
|
2016-02-18 18:13:35 +03:00
|
|
|
nsRect GetVisibleArea() const { 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) {
|
2011-04-19 07:07:23 +04:00
|
|
|
if (!r.IsEqualEdges(mVisibleArea)) {
|
2008-12-29 18:07:37 +03:00
|
|
|
mVisibleArea = r;
|
|
|
|
// Visible area does not affect media queries when paginated.
|
2012-10-20 03:21:06 +04:00
|
|
|
if (!IsPaginated() && HasCachedStyleData()) {
|
|
|
|
mPendingViewportChange = true;
|
2008-12-29 18:07:37 +03:00
|
|
|
PostMediaFeatureValuesChangedEvent();
|
2012-10-20 03:21:06 +04:00
|
|
|
}
|
2008-12-29 18:07:37 +03:00
|
|
|
}
|
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.
|
|
|
|
*/
|
2011-09-29 10:19:26 +04:00
|
|
|
bool IsPaginated() const { return mPaginated; }
|
2014-03-20 10:49:25 +04:00
|
|
|
|
2001-11-03 17:59:39 +03:00
|
|
|
/**
|
|
|
|
* Sets whether the presentation context can scroll for a paginated
|
|
|
|
* context.
|
|
|
|
*/
|
2014-06-02 16:08:21 +04:00
|
|
|
void SetPaginatedScrolling(bool aResult);
|
2001-11-03 17:59:39 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Return true if this presentation context can scroll for paginated
|
|
|
|
* context.
|
|
|
|
*/
|
2011-09-29 10:19:26 +04:00
|
|
|
bool 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
|
|
|
*/
|
2011-09-29 10:19:26 +04:00
|
|
|
bool IsRootPaginatedDocument() { return mIsRootPaginatedDocument; }
|
|
|
|
void SetIsRootPaginatedDocument(bool aIsRootPaginatedDocument)
|
2006-03-30 04:27:42 +04:00
|
|
|
{ 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
|
|
|
|
2017-01-04 22:52:26 +03:00
|
|
|
nsDeviceContext* DeviceContext() const { return mDeviceContext; }
|
2014-04-01 08:09:23 +04:00
|
|
|
mozilla::EventStateManager* EventStateManager() { return mEventManager; }
|
2015-11-28 03:56:33 +03:00
|
|
|
nsIAtom* GetLanguageFromCharset() const { return mLanguage; }
|
|
|
|
already_AddRefed<nsIAtom> GetContentLanguage() const;
|
2000-04-21 18:59:47 +04:00
|
|
|
|
2017-02-25 15:22:52 +03:00
|
|
|
/**
|
|
|
|
* Get/set a text zoom factor that is applied on top of the normal text zoom
|
|
|
|
* set by the front-end/user.
|
|
|
|
*/
|
|
|
|
float GetSystemFontScale() const { return mSystemFontScale; }
|
|
|
|
void SetSystemFontScale(float aFontScale) {
|
|
|
|
MOZ_ASSERT(aFontScale > 0.0f, "invalid font scale");
|
|
|
|
if (aFontScale == mSystemFontScale || IsPrintingOrPrintPreview()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
mSystemFontScale = aFontScale;
|
|
|
|
UpdateEffectiveTextZoom();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get/set the text zoom factor in use.
|
|
|
|
* This value should be used if you're interested in the pure text zoom value
|
|
|
|
* controlled by the front-end, e.g. when transferring zoom levels to a new
|
|
|
|
* document.
|
|
|
|
* Code that wants to use this value for layouting and rendering purposes
|
|
|
|
* should consider using EffectiveTextZoom() instead, so as to take the system
|
|
|
|
* font scale into account as well.
|
|
|
|
*/
|
2017-01-04 22:52:26 +03:00
|
|
|
float TextZoom() const { return mTextZoom; }
|
2007-07-26 07:34:16 +04:00
|
|
|
void SetTextZoom(float aZoom) {
|
2015-11-16 19:32:39 +03:00
|
|
|
MOZ_ASSERT(aZoom > 0.0f, "invalid zoom factor");
|
2009-01-17 00:32:08 +03:00
|
|
|
if (aZoom == mTextZoom)
|
|
|
|
return;
|
|
|
|
|
2005-08-13 15:54:22 +04:00
|
|
|
mTextZoom = aZoom;
|
2017-02-25 15:22:52 +03:00
|
|
|
UpdateEffectiveTextZoom();
|
2005-08-13 15:54:22 +04:00
|
|
|
}
|
2007-07-26 07:34:16 +04:00
|
|
|
|
2017-02-25 15:22:52 +03:00
|
|
|
protected:
|
|
|
|
void UpdateEffectiveTextZoom();
|
|
|
|
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
* Corresponds to the product of text zoom and system font scale, limited
|
|
|
|
* by zoom.maxPercent and minPercent.
|
|
|
|
* As the system font scale is automatically set by the PresShell, code that
|
|
|
|
* e.g. wants to transfer zoom levels to a new document should use TextZoom()
|
|
|
|
* instead, which corresponds to the text zoom level that was actually set by
|
|
|
|
* the front-end/user.
|
|
|
|
*/
|
|
|
|
float EffectiveTextZoom() const { return mEffectiveTextZoom; }
|
|
|
|
|
2012-01-26 03:52:26 +04:00
|
|
|
/**
|
|
|
|
* Get the minimum font size for the specified language. If aLanguage
|
2014-02-25 23:07:47 +04:00
|
|
|
* is nullptr, then the document's language is used. This combines
|
|
|
|
* the language-specific global preference with the per-presentation
|
|
|
|
* base minimum font size.
|
2012-01-26 03:52:26 +04:00
|
|
|
*/
|
2017-05-24 04:15:47 +03:00
|
|
|
int32_t MinFontSize(nsIAtom *aLanguage, bool* aNeedsToCache = nullptr) const {
|
|
|
|
const LangGroupFontPrefs *prefs = GetFontPrefsForLang(aLanguage, aNeedsToCache);
|
|
|
|
if (aNeedsToCache && *aNeedsToCache) {
|
|
|
|
return 0;
|
|
|
|
}
|
2014-02-25 23:07:47 +04:00
|
|
|
return std::max(mBaseMinFontSize, prefs->mMinimumFontSize);
|
2011-03-11 07:33:43 +03:00
|
|
|
}
|
2014-03-20 10:49:25 +04:00
|
|
|
|
2014-02-25 23:07:47 +04:00
|
|
|
/**
|
|
|
|
* Get the per-presentation base minimum font size. This size is
|
|
|
|
* independent of the language-specific global preference.
|
|
|
|
*/
|
|
|
|
int32_t BaseMinFontSize() const {
|
|
|
|
return mBaseMinFontSize;
|
|
|
|
}
|
2014-03-20 10:49:25 +04:00
|
|
|
|
2014-02-25 23:07:47 +04:00
|
|
|
/**
|
|
|
|
* Set the per-presentation base minimum font size. This size is
|
|
|
|
* independent of the language-specific global preference.
|
|
|
|
*/
|
|
|
|
void SetBaseMinFontSize(int32_t aMinFontSize) {
|
|
|
|
if (aMinFontSize == mBaseMinFontSize)
|
2011-03-11 07:33:43 +03:00
|
|
|
return;
|
|
|
|
|
2014-02-25 23:07:47 +04:00
|
|
|
mBaseMinFontSize = aMinFontSize;
|
2011-03-11 07:33:43 +03:00
|
|
|
if (HasCachedStyleData()) {
|
2012-01-26 03:52:26 +04:00
|
|
|
// Media queries could have changed, since we changed the meaning
|
2011-03-11 07:33:43 +03:00
|
|
|
// of 'em' units in them.
|
2014-10-09 01:27:04 +04:00
|
|
|
MediaFeatureValuesChanged(eRestyle_ForceDescendants,
|
|
|
|
NS_STYLE_HINT_REFLOW);
|
2011-03-11 07:33:43 +03: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
|
|
|
|
2016-08-25 14:15:19 +03:00
|
|
|
float GetOverrideDPPX() { return mOverrideDPPX; }
|
|
|
|
void SetOverrideDPPX(float aDPPX);
|
|
|
|
|
2007-07-26 13:47:43 +04:00
|
|
|
nscoord GetAutoQualityMinFontSize() {
|
|
|
|
return DevPixelsToAppUnits(mAutoQualityMinFontSizePixelsPref);
|
|
|
|
}
|
2012-05-05 17:25:45 +04:00
|
|
|
|
|
|
|
/**
|
2015-03-10 17:28:23 +03:00
|
|
|
* Return the device's screen size in inches, for font size
|
2012-05-05 17:25:45 +04:00
|
|
|
* inflation.
|
|
|
|
*
|
2012-06-12 09:43:31 +04:00
|
|
|
* If |aChanged| is non-null, then aChanged is filled in with whether
|
2015-03-10 17:28:23 +03:00
|
|
|
* the screen size value has changed since either:
|
2012-06-12 09:43:31 +04:00
|
|
|
* a. the last time the function was called with non-null aChanged, or
|
|
|
|
* b. the first time the function was called.
|
2012-05-05 17:25:45 +04:00
|
|
|
*/
|
2015-03-10 17:28:23 +03:00
|
|
|
gfxSize ScreenSizeInchesForFontInflation(bool* aChanged = nullptr);
|
2012-05-05 17:25:45 +04:00
|
|
|
|
2013-09-07 00:15:04 +04:00
|
|
|
static int32_t AppUnitsPerCSSPixel() { return mozilla::AppUnitsPerCSSPixel(); }
|
2013-09-23 15:52:25 +04:00
|
|
|
int32_t AppUnitsPerDevPixel() const;
|
|
|
|
static int32_t AppUnitsPerCSSInch() { return mozilla::AppUnitsPerCSSInch(); }
|
2007-02-07 10:46:44 +03:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
static nscoord CSSPixelsToAppUnits(int32_t aPixels)
|
2013-08-05 06:58:41 +04:00
|
|
|
{ return NSToCoordRoundWithClamp(float(aPixels) *
|
2013-09-07 00:15:04 +04:00
|
|
|
float(AppUnitsPerCSSPixel())); }
|
2007-02-07 10:46:44 +03:00
|
|
|
|
|
|
|
static nscoord CSSPixelsToAppUnits(float aPixels)
|
2013-08-05 06:58:41 +04:00
|
|
|
{ return NSToCoordRoundWithClamp(aPixels *
|
2013-09-07 00:15:04 +04:00
|
|
|
float(AppUnitsPerCSSPixel())); }
|
2007-02-07 10:46:44 +03:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
static int32_t AppUnitsToIntCSSPixels(nscoord aAppUnits)
|
2007-02-07 10:46:44 +03:00
|
|
|
{ return NSAppUnitsToIntPixels(aAppUnits,
|
2013-09-07 00:15:04 +04:00
|
|
|
float(AppUnitsPerCSSPixel())); }
|
2007-02-07 10:46:44 +03:00
|
|
|
|
|
|
|
static float AppUnitsToFloatCSSPixels(nscoord aAppUnits)
|
|
|
|
{ return NSAppUnitsToFloatPixels(aAppUnits,
|
2013-09-07 00:15:04 +04:00
|
|
|
float(AppUnitsPerCSSPixel())); }
|
2007-02-07 10:46:44 +03:00
|
|
|
|
2016-03-23 13:46:36 +03:00
|
|
|
static double AppUnitsToDoubleCSSPixels(nscoord aAppUnits)
|
|
|
|
{ return NSAppUnitsToDoublePixels(aAppUnits,
|
|
|
|
double(AppUnitsPerCSSPixel())); }
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
nscoord DevPixelsToAppUnits(int32_t aPixels) const
|
2013-09-23 15:52:25 +04:00
|
|
|
{ return NSIntPixelsToAppUnits(aPixels, AppUnitsPerDevPixel()); }
|
2007-02-07 10:46:44 +03:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t AppUnitsToDevPixels(nscoord aAppUnits) const
|
2007-02-07 10:46:44 +03:00
|
|
|
{ return NSAppUnitsToIntPixels(aAppUnits,
|
2013-09-07 00:15:04 +04:00
|
|
|
float(AppUnitsPerDevPixel())); }
|
2007-02-07 10:46:44 +03:00
|
|
|
|
2016-04-22 20:40:39 +03:00
|
|
|
float AppUnitsToFloatDevPixels(nscoord aAppUnits)
|
|
|
|
{ return aAppUnits / float(AppUnitsPerDevPixel()); }
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t CSSPixelsToDevPixels(int32_t aPixels)
|
2009-06-18 12:35:11 +04:00
|
|
|
{ return AppUnitsToDevPixels(CSSPixelsToAppUnits(aPixels)); }
|
|
|
|
|
|
|
|
float CSSPixelsToDevPixels(float aPixels)
|
|
|
|
{
|
|
|
|
return NSAppUnitsToFloatPixels(CSSPixelsToAppUnits(aPixels),
|
2013-09-23 15:52:25 +04:00
|
|
|
float(AppUnitsPerDevPixel()));
|
2009-06-18 12:35:11 +04:00
|
|
|
}
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t DevPixelsToIntCSSPixels(int32_t aPixels)
|
2009-06-18 12:35:11 +04:00
|
|
|
{ return AppUnitsToIntCSSPixels(DevPixelsToAppUnits(aPixels)); }
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
float DevPixelsToFloatCSSPixels(int32_t aPixels)
|
2009-06-18 12:35:11 +04:00
|
|
|
{ return AppUnitsToFloatCSSPixels(DevPixelsToAppUnits(aPixels)); }
|
|
|
|
|
2015-09-29 03:13:52 +03:00
|
|
|
mozilla::CSSToLayoutDeviceScale CSSToDevPixelScale() const
|
|
|
|
{
|
|
|
|
return mozilla::CSSToLayoutDeviceScale(
|
|
|
|
float(AppUnitsPerCSSPixel()) / float(AppUnitsPerDevPixel()));
|
|
|
|
}
|
|
|
|
|
2008-02-16 18:31:27 +03:00
|
|
|
// If there is a remainder, it is rounded to nearest app units.
|
2013-09-23 15:52:25 +04:00
|
|
|
nscoord GfxUnitsToAppUnits(gfxFloat aGfxUnits) const;
|
2008-02-16 18:31:27 +03:00
|
|
|
|
2013-09-23 15:52:25 +04:00
|
|
|
gfxFloat AppUnitsToGfxUnits(nscoord aAppUnits) const;
|
2007-08-22 15:13:46 +04:00
|
|
|
|
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)); }
|
|
|
|
|
2010-08-13 13:58:04 +04:00
|
|
|
static nscoord CSSTwipsToAppUnits(float aTwips)
|
2010-08-13 13:58:01 +04:00
|
|
|
{ return NSToCoordRoundWithClamp(
|
2013-09-23 15:52:25 +04:00
|
|
|
mozilla::AppUnitsPerCSSInch() * 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
|
2010-08-13 13:58:04 +04:00
|
|
|
static nsMargin CSSTwipsToAppUnits(const nsIntMargin &marginInTwips)
|
2013-03-06 12:05:55 +04:00
|
|
|
{ return nsMargin(CSSTwipsToAppUnits(float(marginInTwips.top)),
|
2010-08-20 16:45:07 +04:00
|
|
|
CSSTwipsToAppUnits(float(marginInTwips.right)),
|
2013-03-06 12:05:55 +04:00
|
|
|
CSSTwipsToAppUnits(float(marginInTwips.bottom)),
|
|
|
|
CSSTwipsToAppUnits(float(marginInTwips.left))); }
|
2010-08-13 13:58:04 +04:00
|
|
|
|
|
|
|
static nscoord CSSPointsToAppUnits(float aPoints)
|
2013-09-23 15:52:25 +04:00
|
|
|
{ return NSToCoordRound(aPoints * mozilla::AppUnitsPerCSSInch() /
|
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)); }
|
|
|
|
|
2015-09-30 03:48:41 +03:00
|
|
|
/**
|
|
|
|
* This checks the root element and the HTML BODY, if any, for an "overflow"
|
|
|
|
* property that should be applied to the viewport. If one is found then we
|
|
|
|
* return the element that we took the overflow from (which should then be
|
|
|
|
* treated as "overflow: visible"), and we store the overflow style here.
|
|
|
|
* If the document is in fullscreen, and the fullscreen element is not the
|
|
|
|
* root, the scrollbar of viewport will be suppressed.
|
|
|
|
* @return if scroll was propagated from some content node, the content node
|
|
|
|
* it was propagated from.
|
|
|
|
*/
|
|
|
|
nsIContent* UpdateViewportScrollbarStylesOverride();
|
2017-05-10 23:53:27 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the cached result from the last call to
|
|
|
|
* UpdateViewportScrollbarStylesOverride() -- i.e. return the node
|
|
|
|
* whose scrollbar styles we have propagated to the viewport (or nullptr if
|
|
|
|
* there is no such node).
|
|
|
|
*/
|
|
|
|
nsIContent* GetViewportScrollbarStylesOverrideNode() const {
|
|
|
|
return mViewportScrollbarOverrideNode;
|
|
|
|
}
|
|
|
|
|
|
|
|
const ScrollbarStyles& GetViewportScrollbarStylesOverride() const
|
2004-04-13 06:56:03 +04:00
|
|
|
{
|
2014-09-15 23:30:00 +04:00
|
|
|
return mViewportStyleScrollbar;
|
2004-04-13 06:56:03 +04:00
|
|
|
}
|
|
|
|
|
2016-12-23 03:52:12 +03:00
|
|
|
/**
|
|
|
|
* Check whether the given element would propagate its scrollbar styles to the
|
|
|
|
* viewport in non-paginated mode. Must only be called if IsPaginated().
|
|
|
|
*/
|
|
|
|
bool ElementWouldPropagateScrollbarStyles(mozilla::dom::Element* aElement);
|
|
|
|
|
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
|
|
|
*/
|
2011-09-29 10:19:26 +04:00
|
|
|
bool GetBackgroundImageDraw() const { return mDrawImageBackground; }
|
|
|
|
void SetBackgroundImageDraw(bool aCanDraw)
|
2004-02-20 20:49:01 +03:00
|
|
|
{
|
|
|
|
mDrawImageBackground = aCanDraw;
|
|
|
|
}
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool GetBackgroundColorDraw() const { return mDrawColorBackground; }
|
|
|
|
void SetBackgroundColorDraw(bool aCanDraw)
|
2004-02-20 20:49:01 +03:00
|
|
|
{
|
|
|
|
mDrawColorBackground = aCanDraw;
|
|
|
|
}
|
2014-03-20 10:49:25 +04:00
|
|
|
|
2001-03-09 06:13:03 +03:00
|
|
|
/**
|
|
|
|
* 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
|
|
|
|
*/
|
2013-03-16 08:31:38 +04:00
|
|
|
#ifdef MOZILLA_INTERNAL_API
|
2011-09-29 10:19:26 +04:00
|
|
|
bool BidiEnabled() const { return BidiEnabledInternal(); }
|
2004-07-29 23:41:39 +04:00
|
|
|
#else
|
2011-09-29 10:19:26 +04:00
|
|
|
bool BidiEnabled() const { return BidiEnabledExternal(); }
|
2004-07-29 23:41:39 +04:00
|
|
|
#endif
|
2012-07-30 08:29:41 +04:00
|
|
|
virtual bool BidiEnabledExternal() const;
|
|
|
|
bool BidiEnabledInternal() const;
|
2001-03-09 06:13:03 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set bidi enabled. This means we should apply the Unicode Bidi Algorithm
|
|
|
|
*
|
|
|
|
* @lina 07/12/2000
|
|
|
|
*/
|
2014-06-02 16:08:21 +04:00
|
|
|
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
|
2014-03-20 10:49:25 +04:00
|
|
|
* direction only.
|
2001-03-09 06:13:03 +03:00
|
|
|
*
|
|
|
|
* 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
|
|
|
|
*/
|
2011-09-29 10:19:26 +04:00
|
|
|
void SetVisualMode(bool aIsVisual)
|
2004-02-20 20:49:01 +03:00
|
|
|
{
|
|
|
|
mIsVisual = aIsVisual;
|
|
|
|
}
|
2001-03-09 06:13:03 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Check whether the content should be treated as visual.
|
|
|
|
*
|
|
|
|
* @lina 05/02/2000
|
|
|
|
*/
|
2011-09-29 10:19:26 +04:00
|
|
|
bool IsVisualMode() const { return mIsVisual; }
|
2001-03-09 06:13:03 +03:00
|
|
|
|
2016-11-09 04:39:28 +03:00
|
|
|
enum class InteractionType : uint32_t {
|
|
|
|
eClickInteraction,
|
|
|
|
eKeyInteraction,
|
|
|
|
eMouseMoveInteraction,
|
|
|
|
eScrollInteraction
|
|
|
|
};
|
|
|
|
|
2017-02-01 07:49:06 +03:00
|
|
|
void RecordInteractionTime(InteractionType aType,
|
|
|
|
const mozilla::TimeStamp& aTimeStamp);
|
2016-11-09 04:39:28 +03:00
|
|
|
|
|
|
|
void DisableInteractionTimeRecording()
|
|
|
|
{
|
|
|
|
mInteractionTimeEnabled = false;
|
|
|
|
}
|
|
|
|
|
2001-03-09 06:13:03 +03:00
|
|
|
//Mohamed
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the Bidi options for the presentation context
|
2014-03-20 10:49:25 +04:00
|
|
|
*/
|
2014-06-02 16:08:21 +04:00
|
|
|
void SetBidi(uint32_t aBidiOptions,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool aForceRestyle = 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.
|
2012-07-30 08:29:41 +04:00
|
|
|
*/
|
2014-06-02 16:08:21 +04:00
|
|
|
uint32_t GetBidi() const;
|
2001-03-09 06:13:03 +03:00
|
|
|
|
2001-01-27 17:09:34 +03:00
|
|
|
/**
|
|
|
|
* Render only Selection
|
|
|
|
*/
|
2011-09-29 10:19:26 +04:00
|
|
|
void SetIsRenderingOnlySelection(bool aResult)
|
2004-02-20 20:49:01 +03:00
|
|
|
{
|
|
|
|
mIsRenderingOnlySelection = aResult;
|
|
|
|
}
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool IsRenderingOnlySelection() const { return mIsRenderingOnlySelection; }
|
2001-01-27 17:09:34 +03:00
|
|
|
|
2014-06-02 16:08:21 +04:00
|
|
|
bool IsTopLevelWindowInactive();
|
2010-03-17 20:10:57 +03:00
|
|
|
|
2001-12-18 01:51:39 +03:00
|
|
|
/*
|
|
|
|
* Obtain a native them for rendering our widgets (both form controls and html)
|
|
|
|
*/
|
2014-06-02 16:08:21 +04:00
|
|
|
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.
|
|
|
|
*/
|
2014-06-02 16:08:21 +04:00
|
|
|
void ThemeChanged();
|
2001-12-18 01:51:39 +03:00
|
|
|
|
2012-10-16 23:41:20 +04:00
|
|
|
/*
|
|
|
|
* Notify the pres context that the resolution of the user interface has
|
|
|
|
* changed. This happens if a window is moved between HiDPI and non-HiDPI
|
|
|
|
* displays, so that the ratio of points to device pixels changes.
|
2015-06-08 08:39:28 +03:00
|
|
|
* The notification happens asynchronously.
|
2012-10-16 23:41:20 +04:00
|
|
|
*/
|
2014-06-02 16:08:21 +04:00
|
|
|
void UIResolutionChanged();
|
2012-10-16 23:41:20 +04:00
|
|
|
|
2015-06-08 08:39:28 +03:00
|
|
|
/*
|
|
|
|
* Like UIResolutionChanged() but invalidates values immediately.
|
|
|
|
*/
|
|
|
|
void UIResolutionChangedSync();
|
|
|
|
|
2002-06-04 21:47:54 +04:00
|
|
|
/*
|
|
|
|
* Notify the pres context that a system color has changed
|
|
|
|
*/
|
2014-06-02 16:08:21 +04:00
|
|
|
void SysColorChanged();
|
2004-07-29 23:41:39 +04:00
|
|
|
|
|
|
|
/** Printing methods below should only be used for Medium() == print **/
|
2014-06-02 16:08:21 +04:00
|
|
|
void SetPrintSettings(nsIPrintSettings *aPrintSettings);
|
2004-07-29 23:41:39 +04:00
|
|
|
|
|
|
|
nsIPrintSettings* GetPrintSettings() { return mPrintSettings; }
|
2002-06-04 21:47:54 +04:00
|
|
|
|
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.
|
|
|
|
*/
|
2014-06-02 16:08:21 +04:00
|
|
|
bool EnsureVisible();
|
2014-03-20 10:49:25 +04:00
|
|
|
|
2000-04-21 18:59:47 +04:00
|
|
|
#ifdef MOZ_REFLOW_PERF
|
2014-06-02 16:08:21 +04:00
|
|
|
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
|
|
|
|
2015-01-12 02:43:10 +03:00
|
|
|
void ConstructedFrame() {
|
|
|
|
++mFramesConstructed;
|
|
|
|
}
|
|
|
|
void ReflowedFrame() {
|
|
|
|
++mFramesReflowed;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint64_t FramesConstructedCount() {
|
|
|
|
return mFramesConstructed;
|
|
|
|
}
|
|
|
|
uint64_t FramesReflowedCount() {
|
|
|
|
return mFramesReflowed;
|
|
|
|
}
|
|
|
|
|
2017-03-02 08:51:40 +03:00
|
|
|
/*
|
|
|
|
* Helper functions for a telemetry scroll probe
|
|
|
|
* for more information see bug 1340904
|
|
|
|
*/
|
|
|
|
void SetTelemetryScrollY(nscoord aScrollY)
|
|
|
|
{
|
|
|
|
nscoord delta = abs(aScrollY - mTelemetryScrollLastY);
|
|
|
|
mTelemetryScrollLastY = aScrollY;
|
|
|
|
|
|
|
|
mTelemetryScrollTotalY += delta;
|
|
|
|
if (aScrollY > mTelemetryScrollMaxY) {
|
|
|
|
mTelemetryScrollMaxY = aScrollY;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
nscoord TelemetryScrollMaxY() const
|
|
|
|
{
|
|
|
|
return mTelemetryScrollMaxY;
|
|
|
|
}
|
|
|
|
nscoord TelemetryScrollTotalY() const
|
|
|
|
{
|
|
|
|
return mTelemetryScrollTotalY;
|
|
|
|
}
|
|
|
|
|
2016-11-16 12:11:00 +03:00
|
|
|
static nscoord GetBorderWidthForKeyword(unsigned int aBorderWidthKeyword)
|
|
|
|
{
|
|
|
|
// This table maps border-width enums 'thin', 'medium', 'thick'
|
|
|
|
// to actual nscoord values.
|
|
|
|
static const nscoord kBorderWidths[] = {
|
|
|
|
CSSPixelsToAppUnits(1),
|
|
|
|
CSSPixelsToAppUnits(3),
|
|
|
|
CSSPixelsToAppUnits(5)
|
|
|
|
};
|
|
|
|
MOZ_ASSERT(size_t(aBorderWidthKeyword) < mozilla::ArrayLength(kBorderWidths));
|
|
|
|
|
|
|
|
return kBorderWidths[aBorderWidthKeyword];
|
|
|
|
}
|
2004-11-26 21:40:58 +03:00
|
|
|
|
2013-11-25 08:59:56 +04:00
|
|
|
gfxTextPerfMetrics *GetTextPerfMetrics() { return mTextPerf; }
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool IsDynamic() { return (mType == eContext_PageLayout || mType == eContext_Galley); }
|
|
|
|
bool 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); }
|
2017-02-25 15:22:52 +03:00
|
|
|
bool IsPrintingOrPrintPreview() { return (mType == eContext_Print || 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?
|
2014-02-07 07:08:49 +04:00
|
|
|
bool IsChrome() const { return mIsChrome; }
|
2014-03-07 08:02:59 +04:00
|
|
|
bool IsChromeOriginImage() const { return mIsChromeOriginImage; }
|
2014-02-07 07:08:49 +04:00
|
|
|
void UpdateIsChrome();
|
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.
|
2016-08-26 01:14:44 +03:00
|
|
|
bool HasAuthorSpecifiedRules(const nsIFrame *aFrame,
|
|
|
|
uint32_t 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?
|
2011-09-29 10:19:26 +04:00
|
|
|
bool UseDocumentColors() const {
|
2014-11-27 22:06:14 +03:00
|
|
|
MOZ_ASSERT(mUseDocumentColors || !(IsChrome() || IsChromeOriginImage()),
|
|
|
|
"We should never have a chrome doc or image that can't use its colors.");
|
|
|
|
return mUseDocumentColors;
|
2007-11-16 06:46:42 +03:00
|
|
|
}
|
|
|
|
|
2013-07-22 19:51:38 +04:00
|
|
|
// Explicitly enable and disable paint flashing.
|
|
|
|
void SetPaintFlashing(bool aPaintFlashing) {
|
|
|
|
mPaintFlashing = aPaintFlashing;
|
|
|
|
mPaintFlashingInitialized = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
// This method should be used instead of directly accessing mPaintFlashing,
|
|
|
|
// as that value may be out of date when mPaintFlashingInitialized is false.
|
|
|
|
bool GetPaintFlashing() const;
|
|
|
|
|
2015-05-07 03:56:00 +03:00
|
|
|
bool SuppressingResizeReflow() const { return mSuppressResizeReflow; }
|
2014-03-20 10:49:25 +04:00
|
|
|
|
2017-01-26 00:34:22 +03:00
|
|
|
gfxUserFontSet* GetUserFontSet(bool aFlushUserFontSet = true);
|
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).
|
2015-03-06 11:44:23 +03:00
|
|
|
void UserFontSetUpdated(gfxUserFontEntry* aUpdatedFont = nullptr);
|
2008-12-08 19:08:05 +03:00
|
|
|
|
2014-12-22 19:35:54 +03:00
|
|
|
gfxMissingFontRecorder *MissingFontRecorder() { return mMissingFonts; }
|
|
|
|
void NotifyMissingFonts();
|
|
|
|
|
2014-06-12 05:12:00 +04:00
|
|
|
void FlushCounterStyles();
|
|
|
|
void RebuildCounterStyles(); // asynchronously
|
|
|
|
|
2009-12-31 18:56:33 +03:00
|
|
|
// Ensure that it is safe to hand out CSS rules outside the layout
|
|
|
|
// engine by ensuring that all CSS style sheets have unique inners
|
|
|
|
// and, if necessary, synchronously rebuilding all style data.
|
2013-11-11 12:00:33 +04:00
|
|
|
void EnsureSafeToHandOutCSSRules();
|
2009-12-31 18:56:33 +03:00
|
|
|
|
2017-02-17 05:15:45 +03:00
|
|
|
// Mark an area as invalidated, associated with a given transaction id (allocated
|
|
|
|
// by nsRefreshDriver::GetTransactionId).
|
|
|
|
// Invalidated regions will be dispatched to MozAfterPaint events when
|
|
|
|
// NotifyDidPaintForSubtree is called for the transaction id (or any higher id).
|
|
|
|
void NotifyInvalidation(uint64_t aTransactionId, const nsRect& aRect);
|
2012-08-29 09:47:18 +04:00
|
|
|
// aRect is in device pixels
|
2017-02-17 05:15:45 +03:00
|
|
|
void NotifyInvalidation(uint64_t aTransactionId, const nsIntRect& aRect);
|
2017-02-17 05:16:15 +03:00
|
|
|
void NotifyDidPaintForSubtree(uint64_t aTransactionId = 0,
|
2016-04-13 23:59:15 +03:00
|
|
|
const mozilla::TimeStamp& aTimeStamp = mozilla::TimeStamp());
|
2017-02-17 01:50:58 +03:00
|
|
|
void FireDOMPaintEvent(nsTArray<nsRect>* aList, uint64_t aTransactionId,
|
2017-01-26 08:01:33 +03:00
|
|
|
mozilla::TimeStamp aTimeStamp = mozilla::TimeStamp());
|
2011-01-15 12:40:33 +03:00
|
|
|
|
2012-08-29 09:47:18 +04:00
|
|
|
// Callback for catching invalidations in ContainerLayers
|
|
|
|
// Passed to LayerProperties::ComputeDifference
|
|
|
|
static void NotifySubDocInvalidation(mozilla::layers::ContainerLayer* aContainer,
|
|
|
|
const nsIntRegion& aRegion);
|
2013-08-14 15:33:03 +04:00
|
|
|
void SetNotifySubDocInvalidationData(mozilla::layers::ContainerLayer* aContainer);
|
|
|
|
static void ClearNotifySubDocInvalidationData(mozilla::layers::ContainerLayer* aContainer);
|
2012-08-29 09:47:18 +04:00
|
|
|
bool IsDOMPaintEventPending();
|
2009-02-27 03:21:55 +03:00
|
|
|
|
2015-09-17 05:08:20 +03:00
|
|
|
/**
|
|
|
|
* Returns the RestyleManager's restyle generation counter.
|
|
|
|
*/
|
|
|
|
uint64_t GetRestyleGeneration() const;
|
|
|
|
|
2014-10-02 06:32:09 +04:00
|
|
|
/**
|
|
|
|
* Returns whether there are any pending restyles or reflows.
|
|
|
|
*/
|
|
|
|
bool HasPendingRestyleOrReflow();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Informs the document's FontFaceSet that the refresh driver ticked,
|
|
|
|
* flushing style and layout.
|
|
|
|
*/
|
|
|
|
void NotifyFontFaceSetOnRefresh();
|
|
|
|
|
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.
|
|
|
|
*/
|
2011-09-29 10:19:26 +04:00
|
|
|
void ReflowStarted(bool aInterruptible);
|
2009-04-22 03:53:52 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* A class that can be used to temporarily disable reflow interruption.
|
|
|
|
*/
|
|
|
|
class InterruptPreventer;
|
|
|
|
friend class InterruptPreventer;
|
2013-04-12 07:20:45 +04:00
|
|
|
class MOZ_STACK_CLASS InterruptPreventer {
|
2009-04-22 03:53:52 +04:00
|
|
|
public:
|
2014-08-08 03:48:38 +04:00
|
|
|
explicit InterruptPreventer(nsPresContext* aCtx) :
|
2009-04-22 03:53:52 +04:00
|
|
|
mCtx(aCtx),
|
|
|
|
mInterruptsEnabled(aCtx->mInterruptsEnabled),
|
|
|
|
mHasPendingInterrupt(aCtx->mHasPendingInterrupt)
|
|
|
|
{
|
2011-10-17 18:59:28 +04:00
|
|
|
mCtx->mInterruptsEnabled = false;
|
|
|
|
mCtx->mHasPendingInterrupt = false;
|
2009-04-22 03:53:52 +04:00
|
|
|
}
|
|
|
|
~InterruptPreventer() {
|
|
|
|
mCtx->mInterruptsEnabled = mInterruptsEnabled;
|
|
|
|
mCtx->mHasPendingInterrupt = mHasPendingInterrupt;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
nsPresContext* mCtx;
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mInterruptsEnabled;
|
|
|
|
bool mHasPendingInterrupt;
|
2009-04-22 03:53:52 +04:00
|
|
|
};
|
2014-03-20 10:49:25 +04:00
|
|
|
|
2009-04-22 03:53:52 +04:00
|
|
|
/**
|
|
|
|
* 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.
|
|
|
|
*/
|
2011-09-29 10:19:26 +04:00
|
|
|
bool CheckForInterrupt(nsIFrame* aFrame);
|
2009-04-22 03:53:52 +04:00
|
|
|
/**
|
|
|
|
* 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
|
|
|
*/
|
2011-09-29 10:19:26 +04:00
|
|
|
bool HasPendingInterrupt() { return mHasPendingInterrupt; }
|
2016-08-24 16:15:42 +03:00
|
|
|
/**
|
|
|
|
* Sets a flag that will trip a reflow interrupt. This only bypasses the
|
|
|
|
* interrupt timeout and the pending event check; other checks such as whether
|
|
|
|
* interrupts are enabled and the interrupt check skipping still take effect.
|
|
|
|
*/
|
|
|
|
void SetPendingInterruptFromTest() { mPendingInterruptFromTest = true; }
|
2009-04-22 03:53:52 +04:00
|
|
|
|
2009-12-25 00:20:05 +03:00
|
|
|
/**
|
|
|
|
* If we have a presshell, and if the given content's current
|
|
|
|
* document is the same as our presshell's document, return the
|
|
|
|
* content's primary frame. Otherwise, return null. Only use this
|
|
|
|
* if you care about which presshell the primary frame is in.
|
|
|
|
*/
|
2012-07-30 08:29:41 +04:00
|
|
|
nsIFrame* GetPrimaryFrameFor(nsIContent* aContent);
|
2009-12-25 00:20:05 +03:00
|
|
|
|
2013-06-23 16:03:39 +04:00
|
|
|
virtual size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
|
|
|
|
virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const {
|
2012-01-25 12:52:51 +04:00
|
|
|
return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf);
|
2010-06-01 06:19:35 +04:00
|
|
|
}
|
|
|
|
|
2016-02-24 17:57:43 +03:00
|
|
|
bool IsRootContentDocument() const;
|
2010-09-11 22:24:50 +04:00
|
|
|
|
2016-11-11 00:00:45 +03:00
|
|
|
bool HadNonBlankPaint() const {
|
|
|
|
return mHadNonBlankPaint;
|
|
|
|
}
|
|
|
|
|
|
|
|
void NotifyNonBlankPaint();
|
|
|
|
|
2012-09-06 08:58:44 +04:00
|
|
|
bool IsGlyph() const {
|
|
|
|
return mIsGlyph;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SetIsGlyph(bool aValue) {
|
|
|
|
mIsGlyph = aValue;
|
|
|
|
}
|
|
|
|
|
2012-10-26 21:04:20 +04:00
|
|
|
bool UsesRootEMUnits() const {
|
|
|
|
return mUsesRootEMUnits;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SetUsesRootEMUnits(bool aValue) {
|
|
|
|
mUsesRootEMUnits = aValue;
|
|
|
|
}
|
|
|
|
|
2015-03-06 11:44:14 +03:00
|
|
|
bool UsesExChUnits() const {
|
|
|
|
return mUsesExChUnits;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SetUsesExChUnits(bool aValue) {
|
|
|
|
mUsesExChUnits = aValue;
|
|
|
|
}
|
|
|
|
|
2012-10-20 03:21:06 +04:00
|
|
|
bool UsesViewportUnits() const {
|
|
|
|
return mUsesViewportUnits;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SetUsesViewportUnits(bool aValue) {
|
|
|
|
mUsesViewportUnits = aValue;
|
|
|
|
}
|
|
|
|
|
2012-12-12 01:12:43 +04:00
|
|
|
// true if there are OMTA transition updates for the current document which
|
|
|
|
// have been throttled, and therefore some style information may not be up
|
|
|
|
// to date
|
|
|
|
bool ExistThrottledUpdates() const {
|
|
|
|
return mExistThrottledUpdates;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SetExistThrottledUpdates(bool aExistThrottledUpdates) {
|
|
|
|
mExistThrottledUpdates = aExistThrottledUpdates;
|
|
|
|
}
|
|
|
|
|
2013-11-07 17:40:23 +04:00
|
|
|
bool IsDeviceSizePageSize();
|
|
|
|
|
2014-03-11 02:41:17 +04:00
|
|
|
bool HasWarnedAboutPositionedTableParts() const {
|
|
|
|
return mHasWarnedAboutPositionedTableParts;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SetHasWarnedAboutPositionedTableParts() {
|
|
|
|
mHasWarnedAboutPositionedTableParts = true;
|
|
|
|
}
|
|
|
|
|
2016-06-10 07:10:03 +03:00
|
|
|
bool HasWarnedAboutTooLargeDashedOrDottedRadius() const {
|
|
|
|
return mHasWarnedAboutTooLargeDashedOrDottedRadius;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SetHasWarnedAboutTooLargeDashedOrDottedRadius() {
|
|
|
|
mHasWarnedAboutTooLargeDashedOrDottedRadius = true;
|
|
|
|
}
|
|
|
|
|
2017-04-11 07:51:30 +03:00
|
|
|
nsBidi& GetBidiEngine();
|
|
|
|
|
2003-06-19 22:16:53 +04:00
|
|
|
protected:
|
2006-09-12 08:36:03 +04:00
|
|
|
friend class nsRunnableMethod<nsPresContext>;
|
2014-06-02 16:08:21 +04:00
|
|
|
void ThemeChangedInternal();
|
|
|
|
void SysColorChangedInternal();
|
2016-04-07 12:01:30 +03:00
|
|
|
|
|
|
|
// update device context's resolution from the widget
|
2014-06-02 16:08:21 +04:00
|
|
|
void UIResolutionChangedInternal();
|
2012-10-16 23:41:20 +04:00
|
|
|
|
2016-04-07 12:01:30 +03:00
|
|
|
// if aScale > 0.0, use it as resolution scale factor to the device context
|
|
|
|
// (otherwise get it from the widget)
|
|
|
|
void UIResolutionChangedInternalScale(double aScale);
|
|
|
|
|
|
|
|
// aData here is a pointer to a double that holds the CSS to device-pixel
|
|
|
|
// scale factor from the parent, which will be applied to the subdocument's
|
|
|
|
// device context instead of retrieving a scale from the widget.
|
2014-06-02 16:08:21 +04:00
|
|
|
static bool
|
2012-10-16 23:41:20 +04:00
|
|
|
UIResolutionChangedSubdocumentCallback(nsIDocument* aDocument, void* aData);
|
2008-11-26 02:22:38 +03:00
|
|
|
|
2014-06-02 16:08:21 +04:00
|
|
|
void SetImgAnimations(nsIContent *aParent, uint16_t aMode);
|
|
|
|
void SetSMILAnimations(nsIDocument *aDoc, uint16_t aNewMode,
|
2012-08-22 19:56:38 +04:00
|
|
|
uint16_t aOldMode);
|
2014-06-02 16:08:21 +04:00
|
|
|
void GetDocumentColorPreferences();
|
2005-08-24 03:52:16 +04:00
|
|
|
|
2014-06-02 16:08:21 +04:00
|
|
|
void PreferenceChanged(const char* aPrefName);
|
|
|
|
static void PrefChangedCallback(const char*, void*);
|
2004-07-29 23:41:39 +04:00
|
|
|
|
2014-06-02 16:08:21 +04:00
|
|
|
void UpdateAfterPreferencesChanged();
|
|
|
|
static void PrefChangedUpdateTimerCallback(nsITimer *aTimer, void *aClosure);
|
2005-08-24 03:52:16 +04:00
|
|
|
|
2014-06-02 16:08:21 +04:00
|
|
|
void GetUserPreferences();
|
2012-01-26 03:52:26 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Fetch the user's font preferences for the given aLanguage's
|
|
|
|
* langugage group.
|
|
|
|
*/
|
2017-05-26 01:04:13 +03:00
|
|
|
const LangGroupFontPrefs* GetFontPrefsForLang(nsIAtom *aLanguage, bool* aNeedsToCache = nullptr) const
|
2016-03-31 22:47:20 +03:00
|
|
|
{
|
|
|
|
nsIAtom* lang = aLanguage ? aLanguage : mLanguage.get();
|
2017-05-26 01:04:13 +03:00
|
|
|
return StaticPresData::Get()->GetFontPrefsForLangHelper(lang, &mLangGroupFontPrefs, aNeedsToCache);
|
2012-01-26 03:52:26 +04:00
|
|
|
}
|
2004-07-29 23:41:39 +04:00
|
|
|
|
2017-06-18 14:37:50 +03:00
|
|
|
void UpdateCharSet(NotNull<const Encoding*> aCharSet);
|
2004-07-29 23:41:39 +04:00
|
|
|
|
2017-02-17 05:16:15 +03:00
|
|
|
static bool NotifyDidPaintSubdocumentCallback(nsIDocument* aDocument, void* aData);
|
|
|
|
|
2012-01-12 00:58:44 +04:00
|
|
|
public:
|
2017-06-18 14:37:50 +03:00
|
|
|
void DoChangeCharSet(NotNull<const Encoding*> aCharSet);
|
2012-01-12 00:58:44 +04:00
|
|
|
|
2012-08-29 09:47:18 +04:00
|
|
|
/**
|
|
|
|
* Checks for MozAfterPaint listeners on the document
|
|
|
|
*/
|
|
|
|
bool MayHavePaintEventListener();
|
|
|
|
|
|
|
|
/**
|
2014-03-20 10:49:25 +04:00
|
|
|
* Checks for MozAfterPaint listeners on the document and
|
2012-08-29 09:47:18 +04:00
|
|
|
* any subdocuments, except for subdocuments that are non-top-level
|
|
|
|
* content documents.
|
|
|
|
*/
|
|
|
|
bool MayHavePaintEventListenerInSubDocument();
|
|
|
|
|
2014-09-25 09:45:36 +04:00
|
|
|
#ifdef RESTYLE_LOGGING
|
|
|
|
// Controls for whether debug information about restyling in this
|
|
|
|
// document should be output.
|
|
|
|
bool RestyleLoggingEnabled() const { return mRestyleLoggingEnabled; }
|
|
|
|
void StartRestyleLogging() { mRestyleLoggingEnabled = true; }
|
|
|
|
void StopRestyleLogging() { mRestyleLoggingEnabled = false; }
|
|
|
|
#endif
|
|
|
|
|
2015-01-09 11:55:18 +03:00
|
|
|
void InvalidatePaintedLayers();
|
|
|
|
|
2012-01-12 00:58:44 +04:00
|
|
|
protected:
|
2014-10-29 23:24:02 +03:00
|
|
|
// May be called multiple times (unlink, destructor)
|
|
|
|
void Destroy();
|
|
|
|
|
2011-04-12 00:57:29 +04:00
|
|
|
void AppUnitsPerDevPixelChanged();
|
|
|
|
|
2014-06-12 05:12:00 +04:00
|
|
|
void HandleRebuildCounterStyles() {
|
|
|
|
mPostedFlushCounterStyles = false;
|
|
|
|
FlushCounterStyles();
|
|
|
|
}
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool HavePendingInputEvent();
|
2009-04-22 03:53:52 +04:00
|
|
|
|
2008-12-29 18:07:36 +03:00
|
|
|
// Can't be inline because we can't include nsStyleSet.h.
|
2011-09-29 10:19:26 +04:00
|
|
|
bool HasCachedStyleData();
|
2008-12-29 18:07:36 +03:00
|
|
|
|
2015-08-04 03:13:07 +03:00
|
|
|
// Creates a one-shot timer with the given aCallback & aDelay.
|
|
|
|
// Returns a refcounted pointer to the timer (or nullptr on failure).
|
|
|
|
already_AddRefed<nsITimer> CreateTimer(nsTimerCallbackFunc aCallback,
|
2017-02-14 02:45:23 +03:00
|
|
|
const char* aName,
|
2015-08-04 03:13:07 +03:00
|
|
|
uint32_t aDelay);
|
2015-07-31 00:24:51 +03:00
|
|
|
|
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).
|
2012-07-30 08:29:33 +04:00
|
|
|
|
2004-07-29 23:41:39 +04:00
|
|
|
nsPresContextType mType;
|
2015-06-16 15:25:00 +03:00
|
|
|
// the nsPresShell owns a strong reference to the nsPresContext, and is responsible
|
|
|
|
// for nulling this pointer before it is destroyed
|
|
|
|
nsIPresShell* MOZ_NON_OWNING_REF mShell; // [WEAK]
|
2006-05-19 14:26:44 +04:00
|
|
|
nsCOMPtr<nsIDocument> mDocument;
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<nsDeviceContext> mDeviceContext; // [STRONG] could be weak, but
|
2012-07-30 08:36:32 +04:00
|
|
|
// better safe than sorry.
|
|
|
|
// Cannot reintroduce cycles
|
|
|
|
// since there is no dependency
|
|
|
|
// from gfx back to layout.
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<mozilla::EventStateManager> mEventManager;
|
|
|
|
RefPtr<nsRefreshDriver> mRefreshDriver;
|
2016-01-13 01:54:53 +03:00
|
|
|
RefPtr<mozilla::EffectCompositor> mEffectCompositor;
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<nsTransitionManager> mTransitionManager;
|
|
|
|
RefPtr<nsAnimationManager> mAnimationManager;
|
2017-02-13 06:21:33 +03:00
|
|
|
RefPtr<mozilla::RestyleManager> mRestyleManager;
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<mozilla::CounterStyleManager> mCounterStyleManager;
|
2015-06-16 15:17:00 +03:00
|
|
|
nsIAtom* MOZ_UNSAFE_REF("always a static atom") mMedium; // initialized by subclass ctors
|
2013-07-17 19:39:19 +04:00
|
|
|
nsCOMPtr<nsIAtom> mMediaEmulated;
|
2003-06-19 22:16:53 +04:00
|
|
|
|
2015-06-16 15:30:00 +03:00
|
|
|
// This pointer is nulled out through SetLinkHandler() in the destructors of
|
|
|
|
// the classes which set it. (using SetLinkHandler() again).
|
|
|
|
nsILinkHandler* MOZ_NON_OWNING_REF mLinkHandler;
|
2010-02-24 20:57:44 +03:00
|
|
|
|
|
|
|
// Formerly mLangGroup; moving from charset-oriented langGroup to
|
|
|
|
// maintaining actual language settings everywhere (see bug 524107).
|
|
|
|
// This may in fact hold a langGroup such as x-western rather than
|
|
|
|
// a specific language, however (e.g, if it is inferred from the
|
|
|
|
// charset rather than explicitly specified as a lang attribute).
|
2012-07-30 08:29:23 +04:00
|
|
|
nsCOMPtr<nsIAtom> mLanguage;
|
2004-02-01 13:09:07 +03:00
|
|
|
|
2012-01-25 05:21:28 +04:00
|
|
|
public:
|
|
|
|
// The following are public member variables so that we can use them
|
|
|
|
// with mozilla::AutoToggle or mozilla::AutoRestore.
|
|
|
|
|
2012-05-21 09:18:27 +04:00
|
|
|
// Should we disable font size inflation because we're inside of
|
|
|
|
// shrink-wrapping calculations on an inflation container?
|
|
|
|
bool mInflationDisabledForShrinkWrap;
|
|
|
|
|
2012-01-25 05:21:28 +04:00
|
|
|
protected:
|
2012-04-07 21:36:49 +04:00
|
|
|
|
2013-11-20 23:18:25 +04:00
|
|
|
mozilla::WeakPtr<nsDocShell> mContainer;
|
2004-07-29 23:41:39 +04:00
|
|
|
|
2014-02-25 23:07:47 +04:00
|
|
|
// Base minimum font size, independent of the language-specific global preference. Defaults to 0
|
|
|
|
int32_t mBaseMinFontSize;
|
2017-02-25 15:22:52 +03:00
|
|
|
float mSystemFontScale; // Internal text zoom factor, defaults to 1.0
|
2005-08-13 15:54:22 +04:00
|
|
|
float mTextZoom; // Text zoom, defaults to 1.0
|
2017-02-25 15:22:52 +03:00
|
|
|
float mEffectiveTextZoom; // Text zoom * system font scale
|
2007-08-08 00:38:35 +04:00
|
|
|
float mFullZoom; // Page zoom, defaults to 1.0
|
2016-08-25 14:15:19 +03:00
|
|
|
float mOverrideDPPX; // DPPX overrided, defaults to 0.0
|
2015-03-10 17:28:23 +03:00
|
|
|
gfxSize mLastFontInflationScreenSize;
|
2012-05-05 17:25:45 +04:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t mCurAppUnitsPerDevPixel;
|
|
|
|
int32_t mAutoQualityMinFontSizePixelsPref;
|
2005-08-13 15:54:22 +04:00
|
|
|
|
2004-07-29 23:41:39 +04:00
|
|
|
nsCOMPtr<nsITheme> mTheme;
|
2015-04-03 22:39:23 +03:00
|
|
|
nsLanguageAtomService* mLangService;
|
2004-07-29 23:41:39 +04:00
|
|
|
nsCOMPtr<nsIPrintSettings> mPrintSettings;
|
2005-08-24 03:52:16 +04:00
|
|
|
nsCOMPtr<nsITimer> mPrefChangedTimer;
|
2004-07-29 23:41:39 +04:00
|
|
|
|
2017-04-11 07:51:30 +03:00
|
|
|
mozilla::UniquePtr<nsBidi> mBidiEngine;
|
|
|
|
|
2017-02-17 05:16:15 +03:00
|
|
|
struct TransactionInvalidations {
|
|
|
|
uint64_t mTransactionId;
|
|
|
|
nsTArray<nsRect> mInvalidations;
|
|
|
|
};
|
|
|
|
AutoTArray<TransactionInvalidations, 4> mTransactions;
|
2008-09-18 13:47:21 +04:00
|
|
|
|
2013-11-25 08:59:56 +04:00
|
|
|
// text performance metrics
|
|
|
|
nsAutoPtr<gfxTextPerfMetrics> mTextPerf;
|
|
|
|
|
2014-12-22 19:35:54 +03:00
|
|
|
nsAutoPtr<gfxMissingFontRecorder> mMissingFonts;
|
|
|
|
|
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;
|
|
|
|
|
2011-06-01 15:43:31 +04:00
|
|
|
nscolor mBodyTextColor;
|
|
|
|
|
2017-05-10 23:53:27 +03:00
|
|
|
// This is a non-owning pointer. May be null. If non-null, it's guaranteed
|
|
|
|
// to be pointing to a node that's still alive, because we'll reset it in
|
|
|
|
// UpdateViewportScrollbarStylesOverride() as part of the cleanup code
|
|
|
|
// when this node is removed from the document. (For <body> and the root node,
|
|
|
|
// this call happens in nsCSSFrameConstructor::ContentRemoved(). For
|
|
|
|
// fullscreen elements, it happens in the fullscreen-specific cleanup
|
|
|
|
// invoked by Element::UnbindFromTree().)
|
|
|
|
nsIContent* MOZ_NON_OWNING_REF mViewportScrollbarOverrideNode;
|
2014-09-15 23:30:00 +04:00
|
|
|
ScrollbarStyles mViewportStyleScrollbar;
|
2017-05-10 23:53:27 +03:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
uint8_t mFocusRingWidth;
|
2004-04-13 06:56:03 +04:00
|
|
|
|
2012-12-12 01:12:43 +04:00
|
|
|
bool mExistThrottledUpdates;
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
uint16_t mImageAnimationMode;
|
|
|
|
uint16_t mImageAnimationModePref;
|
2004-07-29 23:41:39 +04:00
|
|
|
|
2016-03-31 22:47:20 +03:00
|
|
|
// Most documents will only use one (or very few) language groups. Rather
|
|
|
|
// than have the overhead of a hash lookup, we simply look along what will
|
|
|
|
// typically be a very short (usually of length 1) linked list. There are 31
|
|
|
|
// language groups, so in the worst case scenario we'll need to traverse 31
|
|
|
|
// link items.
|
2012-01-26 03:52:26 +04:00
|
|
|
LangGroupFontPrefs mLangGroupFontPrefs;
|
2004-02-20 20:49:01 +03:00
|
|
|
|
2017-05-20 22:47:36 +03:00
|
|
|
bool mFontGroupCacheDirty;
|
|
|
|
nsTHashtable<nsRefPtrHashKey<nsIAtom>> mLanguagesUsed;
|
|
|
|
|
2004-11-26 21:40:58 +03:00
|
|
|
nscoord mBorderWidthTable[3];
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t mInterruptChecksToSkip;
|
2009-04-22 03:53:52 +04:00
|
|
|
|
2015-01-12 02:43:10 +03:00
|
|
|
// Counters for tests and tools that want to detect frame construction
|
|
|
|
// or reflow.
|
2016-05-09 21:26:35 +03:00
|
|
|
uint64_t mElementsRestyled;
|
2015-01-12 02:43:10 +03:00
|
|
|
uint64_t mFramesConstructed;
|
|
|
|
uint64_t mFramesReflowed;
|
|
|
|
|
2009-10-02 22:05:32 +04:00
|
|
|
mozilla::TimeStamp mReflowStartTime;
|
|
|
|
|
2016-11-09 04:39:28 +03:00
|
|
|
// Time of various first interaction types, used to report time from
|
|
|
|
// first paint of the top level content pres shell to first interaction.
|
2017-02-01 07:49:06 +03:00
|
|
|
mozilla::TimeStamp mFirstNonBlankPaintTime;
|
2016-11-09 04:39:28 +03:00
|
|
|
mozilla::TimeStamp mFirstClickTime;
|
|
|
|
mozilla::TimeStamp mFirstKeyTime;
|
|
|
|
mozilla::TimeStamp mFirstMouseMoveTime;
|
|
|
|
mozilla::TimeStamp mFirstScrollTime;
|
|
|
|
bool mInteractionTimeEnabled;
|
|
|
|
|
2012-12-12 01:12:43 +04:00
|
|
|
// last time we did a full style flush
|
|
|
|
mozilla::TimeStamp mLastStyleUpdateForAllAnimations;
|
|
|
|
|
2017-03-02 08:51:40 +03:00
|
|
|
nscoord mTelemetryScrollLastY;
|
|
|
|
nscoord mTelemetryScrollMaxY;
|
|
|
|
nscoord mTelemetryScrollTotalY;
|
|
|
|
|
2009-04-22 03:53:52 +04:00
|
|
|
unsigned mHasPendingInterrupt : 1;
|
2016-08-24 16:15:42 +03:00
|
|
|
unsigned mPendingInterruptFromTest : 1;
|
2009-04-22 03:53:52 +04:00
|
|
|
unsigned mInterruptsEnabled : 1;
|
2004-02-20 20:49:01 +03:00
|
|
|
unsigned mUseDocumentFonts : 1;
|
|
|
|
unsigned mUseDocumentColors : 1;
|
|
|
|
unsigned mUnderlineLinks : 1;
|
2011-01-25 03:23:08 +03:00
|
|
|
unsigned mSendAfterPaintToContent : 1;
|
2004-02-20 20:49:01 +03:00
|
|
|
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;
|
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;
|
2012-10-16 23:41:20 +04:00
|
|
|
unsigned mPendingUIResolutionChanged : 1;
|
2008-07-26 20:14:48 +04:00
|
|
|
unsigned mPendingMediaFeatureValuesChanged : 1;
|
2008-02-08 22:52:46 +03:00
|
|
|
unsigned mPrefChangePendingNeedsReflow : 1;
|
2013-07-17 19:39:19 +04:00
|
|
|
unsigned mIsEmulatingMedia : 1;
|
2008-11-26 02:22:38 +03:00
|
|
|
|
2012-09-06 08:58:44 +04:00
|
|
|
// Are we currently drawing an SVG glyph?
|
|
|
|
unsigned mIsGlyph : 1;
|
|
|
|
|
2012-10-26 21:04:20 +04:00
|
|
|
// Does the associated document use root-em (rem) units?
|
|
|
|
unsigned mUsesRootEMUnits : 1;
|
2015-03-06 11:44:14 +03:00
|
|
|
// Does the associated document use ex or ch units?
|
|
|
|
unsigned mUsesExChUnits : 1;
|
2012-10-26 21:04:20 +04:00
|
|
|
// Does the associated document use viewport units (vw/vh/vmin/vmax)?
|
2012-10-20 03:21:06 +04:00
|
|
|
unsigned mUsesViewportUnits : 1;
|
|
|
|
|
|
|
|
// Has there been a change to the viewport's dimensions?
|
|
|
|
unsigned mPendingViewportChange : 1;
|
|
|
|
|
2014-06-12 05:12:00 +04:00
|
|
|
// Is the current mCounterStyleManager valid?
|
|
|
|
unsigned mCounterStylesDirty : 1;
|
|
|
|
// Do we currently have an event posted to call FlushCounterStyles?
|
|
|
|
unsigned mPostedFlushCounterStyles: 1;
|
|
|
|
|
2010-05-13 16:19:50 +04:00
|
|
|
// resize reflow is suppressed when the only change has been to zoom
|
2008-01-29 07:10:59 +03:00
|
|
|
// the document rather than to change the document's dimensions
|
2015-05-07 03:56:00 +03:00
|
|
|
unsigned mSuppressResizeReflow : 1;
|
2008-01-29 07:10:59 +03:00
|
|
|
|
2004-02-20 20:49:01 +03:00
|
|
|
unsigned mIsVisual : 1;
|
2004-07-29 23:41:39 +04:00
|
|
|
|
2011-01-15 12:40:33 +03:00
|
|
|
unsigned mFireAfterPaintEvents : 1;
|
2010-07-16 01:08:08 +04:00
|
|
|
|
2014-02-07 07:08:49 +04:00
|
|
|
unsigned mIsChrome : 1;
|
2014-03-07 08:02:59 +04:00
|
|
|
unsigned mIsChromeOriginImage : 1;
|
2010-04-10 22:03:40 +04:00
|
|
|
|
2013-07-22 19:51:38 +04:00
|
|
|
// Should we paint flash in this context? Do not use this variable directly.
|
|
|
|
// Use GetPaintFlashing() method instead.
|
|
|
|
mutable unsigned mPaintFlashing : 1;
|
|
|
|
mutable unsigned mPaintFlashingInitialized : 1;
|
|
|
|
|
2014-03-11 02:41:17 +04:00
|
|
|
unsigned mHasWarnedAboutPositionedTableParts : 1;
|
|
|
|
|
2016-06-10 07:10:03 +03:00
|
|
|
unsigned mHasWarnedAboutTooLargeDashedOrDottedRadius : 1;
|
|
|
|
|
2015-06-26 06:49:58 +03:00
|
|
|
// Have we added quirk.css to the style set?
|
|
|
|
unsigned mQuirkSheetAdded : 1;
|
|
|
|
|
2015-07-31 06:47:26 +03:00
|
|
|
// Is there a pref update to process once we have a container?
|
|
|
|
unsigned mNeedsPrefUpdate : 1;
|
|
|
|
|
2016-11-11 00:00:45 +03:00
|
|
|
// Has NotifyNonBlankPaint been called on this PresContext?
|
|
|
|
unsigned mHadNonBlankPaint : 1;
|
|
|
|
|
2014-09-25 09:45:36 +04:00
|
|
|
#ifdef RESTYLE_LOGGING
|
|
|
|
// Should we output debug information about restyling for this document?
|
2017-06-17 01:17:35 +03:00
|
|
|
unsigned mRestyleLoggingEnabled : 1;
|
2014-09-25 09:45:36 +04:00
|
|
|
#endif
|
|
|
|
|
2004-07-29 23:41:39 +04:00
|
|
|
#ifdef DEBUG
|
2017-06-17 01:17:35 +03:00
|
|
|
unsigned mInitialized : 1;
|
2004-07-29 23:41:39 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2005-07-31 00:57:07 +04:00
|
|
|
protected:
|
2004-07-29 23:41:39 +04:00
|
|
|
|
2014-06-02 16:08:24 +04:00
|
|
|
virtual ~nsPresContext();
|
2004-07-29 23:41:39 +04:00
|
|
|
|
2012-06-06 11:36:38 +04:00
|
|
|
nscolor MakeColorPref(const nsString& aColor);
|
|
|
|
|
2013-07-09 21:30:58 +04:00
|
|
|
void LastRelease();
|
|
|
|
|
2006-04-18 09:44:02 +04:00
|
|
|
#ifdef DEBUG
|
|
|
|
private:
|
|
|
|
friend struct nsAutoLayoutPhase;
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t mLayoutPhaseCount[eLayoutPhase_COUNT];
|
2006-04-18 09:44:02 +04:00
|
|
|
public:
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t LayoutPhaseCount(nsLayoutPhase aPhase) {
|
2006-04-18 09:44:02 +04:00
|
|
|
return mLayoutPhaseCount[aPhase];
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
1998-04-14 00:24:54 +04:00
|
|
|
};
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
class nsRootPresContext final : public nsPresContext {
|
2009-07-22 04:44:54 +04:00
|
|
|
public:
|
2014-06-02 16:08:24 +04:00
|
|
|
nsRootPresContext(nsIDocument* aDocument, nsPresContextType aType);
|
2009-07-22 04:45:00 +04:00
|
|
|
virtual ~nsRootPresContext();
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void Detach() override;
|
2009-07-22 04:45:00 +04:00
|
|
|
|
2011-01-15 12:40:33 +03:00
|
|
|
/**
|
|
|
|
* Ensure that NotifyDidPaintForSubtree is eventually called on this
|
|
|
|
* object after a timeout.
|
|
|
|
*/
|
2017-02-17 05:16:15 +03:00
|
|
|
void EnsureEventualDidPaintEvent(uint64_t aTransactionId);
|
2011-01-15 12:40:33 +03:00
|
|
|
|
2017-02-17 05:16:15 +03:00
|
|
|
/**
|
|
|
|
* Cancels any pending eventual did paint timer for transaction
|
|
|
|
* ids up to and including aTransactionId.
|
|
|
|
*/
|
|
|
|
void CancelDidPaintTimers(uint64_t aTransactionId);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Cancel all pending eventual did paint timers.
|
|
|
|
*/
|
|
|
|
void CancelAllDidPaintTimers();
|
2011-01-15 12:40:33 +03:00
|
|
|
|
2009-07-22 04:45:00 +04:00
|
|
|
/**
|
|
|
|
* 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.
|
|
|
|
*/
|
2012-08-14 08:06:42 +04:00
|
|
|
void RegisterPluginForGeometryUpdates(nsIContent* aPlugin);
|
2009-07-22 04:45:00 +04:00
|
|
|
/**
|
|
|
|
* Stops a plugin receiving geometry updates (position and clip
|
|
|
|
* region). If the plugin was not already registered, this does
|
|
|
|
* nothing.
|
|
|
|
*/
|
2012-08-14 08:06:42 +04:00
|
|
|
void UnregisterPluginForGeometryUpdates(nsIContent* aPlugin);
|
2009-07-22 04:45:00 +04:00
|
|
|
|
2012-10-06 17:03:23 +04:00
|
|
|
bool NeedToComputePluginGeometryUpdates()
|
|
|
|
{
|
|
|
|
return mRegisteredPlugins.Count() > 0;
|
|
|
|
}
|
2009-07-22 04:45:00 +04:00
|
|
|
/**
|
2012-10-06 17:03:23 +04:00
|
|
|
* Compute geometry updates for each plugin given that aList is the display
|
|
|
|
* list for aFrame. The updates are not yet applied;
|
|
|
|
* ApplyPluginGeometryUpdates is responsible for that. In the meantime they
|
2014-09-24 08:34:00 +04:00
|
|
|
* are stored on each nsPluginFrame.
|
2012-10-06 17:03:23 +04:00
|
|
|
* This needs to be called even when aFrame is a popup, since although
|
|
|
|
* windowed plugins aren't allowed in popups, windowless plugins are
|
|
|
|
* and ComputePluginGeometryUpdates needs to be called for them.
|
2017-01-17 20:07:05 +03:00
|
|
|
* aBuilder and aList can be null. This indicates that all plugins are
|
|
|
|
* hidden because we're in a background tab.
|
2009-07-22 04:45:00 +04:00
|
|
|
*/
|
2012-10-06 17:03:23 +04:00
|
|
|
void ComputePluginGeometryUpdates(nsIFrame* aFrame,
|
|
|
|
nsDisplayListBuilder* aBuilder,
|
|
|
|
nsDisplayList* aList);
|
2009-07-22 04:45:00 +04:00
|
|
|
|
2009-07-22 04:45:02 +04:00
|
|
|
/**
|
2012-10-06 17:03:23 +04:00
|
|
|
* Apply the stored plugin geometry updates. This should normally be called
|
|
|
|
* in DidPaint so the plugins are moved/clipped immediately after we've
|
|
|
|
* updated our window, so they look in sync with our window.
|
2009-07-22 04:45:02 +04:00
|
|
|
*/
|
2012-10-06 17:03:23 +04:00
|
|
|
void ApplyPluginGeometryUpdates();
|
2009-07-22 04:45:02 +04:00
|
|
|
|
2015-01-29 22:41:54 +03:00
|
|
|
/**
|
|
|
|
* Transfer stored plugin geometry updates to the compositor. Called during
|
|
|
|
* reflow, data is shipped over with layer updates. e10s specific.
|
|
|
|
*/
|
|
|
|
void CollectPluginGeometryUpdates(mozilla::layers::LayerManager* aLayerManager);
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool IsRoot() override { return true; }
|
2010-01-26 16:10:12 +03:00
|
|
|
|
2010-09-17 23:09:08 +04:00
|
|
|
/**
|
|
|
|
* Increment DOM-modification generation counter to indicate that
|
|
|
|
* the DOM has changed in a way that might lead to style changes/
|
|
|
|
* reflows/frame creation and destruction.
|
|
|
|
*/
|
|
|
|
void IncrementDOMGeneration() { mDOMGeneration++; }
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the current DOM generation counter.
|
|
|
|
*/
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t GetDOMGeneration() { return mDOMGeneration; }
|
2010-09-17 23:09:08 +04:00
|
|
|
|
2011-10-26 08:14:31 +04:00
|
|
|
/**
|
|
|
|
* Add a runnable that will get called before the next paint. They will get
|
|
|
|
* run eventually even if painting doesn't happen. They might run well before
|
|
|
|
* painting happens.
|
|
|
|
*/
|
|
|
|
void AddWillPaintObserver(nsIRunnable* aRunnable);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Run all runnables that need to get called before the next paint.
|
|
|
|
*/
|
|
|
|
void FlushWillPaintObservers();
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const override;
|
2011-12-09 09:01:52 +04:00
|
|
|
|
2011-10-26 08:14:31 +04:00
|
|
|
protected:
|
2012-10-06 17:03:23 +04:00
|
|
|
/**
|
|
|
|
* Start a timer to ensure we eventually run ApplyPluginGeometryUpdates.
|
|
|
|
*/
|
|
|
|
void InitApplyPluginGeometryTimer();
|
|
|
|
/**
|
|
|
|
* Cancel the timer that ensures we eventually run ApplyPluginGeometryUpdates.
|
|
|
|
*/
|
|
|
|
void CancelApplyPluginGeometryTimer();
|
|
|
|
|
2016-04-26 03:23:21 +03:00
|
|
|
class RunWillPaintObservers : public mozilla::Runnable {
|
2011-10-26 08:14:31 +04:00
|
|
|
public:
|
2017-02-11 09:11:48 +03:00
|
|
|
explicit RunWillPaintObservers(nsRootPresContext* aPresContext)
|
|
|
|
: Runnable("nsPresContextType::RunWillPaintObservers")
|
|
|
|
, mPresContext(aPresContext) {}
|
2012-07-30 18:20:58 +04:00
|
|
|
void Revoke() { mPresContext = nullptr; }
|
2015-03-21 19:28:04 +03:00
|
|
|
NS_IMETHOD Run() override
|
2011-10-26 08:14:31 +04:00
|
|
|
{
|
|
|
|
if (mPresContext) {
|
|
|
|
mPresContext->FlushWillPaintObservers();
|
|
|
|
}
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2015-06-17 12:48:00 +03:00
|
|
|
// The lifetime of this reference is handled by an nsRevocableEventPtr
|
|
|
|
nsRootPresContext* MOZ_NON_OWNING_REF mPresContext;
|
2011-10-26 08:14:31 +04:00
|
|
|
};
|
|
|
|
|
2011-12-24 07:52:26 +04:00
|
|
|
friend class nsPresContext;
|
|
|
|
|
2017-02-17 05:16:15 +03:00
|
|
|
struct NotifyDidPaintTimer {
|
|
|
|
uint64_t mTransactionId;
|
|
|
|
nsCOMPtr<nsITimer> mTimer;
|
|
|
|
};
|
|
|
|
AutoTArray<NotifyDidPaintTimer, 4> mNotifyDidPaintTimers;
|
|
|
|
|
2012-10-06 17:03:23 +04:00
|
|
|
nsCOMPtr<nsITimer> mApplyPluginGeometryTimer;
|
2012-08-14 08:06:42 +04:00
|
|
|
nsTHashtable<nsRefPtrHashKey<nsIContent> > mRegisteredPlugins;
|
2011-10-26 08:14:31 +04:00
|
|
|
nsTArray<nsCOMPtr<nsIRunnable> > mWillPaintObservers;
|
|
|
|
nsRevocableEventPtr<RunWillPaintObservers> mWillPaintFallbackEvent;
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t mDOMGeneration;
|
2009-07-22 04:44:54 +04:00
|
|
|
};
|
|
|
|
|
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) \
|
2014-03-20 10:49:25 +04:00
|
|
|
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___ */
|