michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- michael@0: * This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. michael@0: * michael@0: * This Original Code has been modified by IBM Corporation. michael@0: * Modifications made by IBM described herein are michael@0: * Copyright (c) International Business Machines michael@0: * Corporation, 2000 michael@0: * michael@0: * Modifications to Mozilla code or documentation michael@0: * identified per MPL Section 3.3 michael@0: * michael@0: * Date Modified by Description of modification michael@0: * 05/03/2000 IBM Corp. Observer related defines for reflow michael@0: */ michael@0: michael@0: /* a presentation of a document, part 2 */ michael@0: michael@0: #ifndef nsIPresShell_h___ michael@0: #define nsIPresShell_h___ michael@0: michael@0: #include "mozilla/EventForwards.h" michael@0: #include "mozilla/MemoryReporting.h" michael@0: #include "mozilla/WeakPtr.h" michael@0: #include "gfxPoint.h" michael@0: #include "nsTHashtable.h" michael@0: #include "nsHashKeys.h" michael@0: #include "nsISupports.h" michael@0: #include "nsQueryFrame.h" michael@0: #include "nsCoord.h" michael@0: #include "nsColor.h" michael@0: #include "nsCompatibility.h" michael@0: #include "nsFrameManagerBase.h" michael@0: #include "mozFlushType.h" michael@0: #include "nsWeakReference.h" michael@0: #include // for FILE definition michael@0: #include "nsChangeHint.h" michael@0: #include "nsRefPtrHashtable.h" michael@0: #include "nsClassHashtable.h" michael@0: #include "nsPresArena.h" michael@0: #include "nsIImageLoadingContent.h" michael@0: #include "nsMargin.h" michael@0: #include "nsFrameState.h" michael@0: michael@0: class nsIContent; michael@0: class nsDocShell; michael@0: class nsIDocument; michael@0: class nsIFrame; michael@0: class nsPresContext; michael@0: class nsStyleSet; michael@0: class nsViewManager; michael@0: class nsView; michael@0: class nsRenderingContext; michael@0: class nsIPageSequenceFrame; michael@0: class nsAString; michael@0: class nsCaret; michael@0: class nsFrameSelection; michael@0: class nsFrameManager; michael@0: class nsILayoutHistoryState; michael@0: class nsIReflowCallback; michael@0: class nsIDOMNode; michael@0: class nsIntRegion; michael@0: class nsIStyleSheet; michael@0: class nsCSSFrameConstructor; michael@0: class nsISelection; michael@0: template class nsCOMArray; michael@0: class nsWeakFrame; michael@0: class nsIScrollableFrame; michael@0: class gfxContext; michael@0: class nsIDOMEvent; michael@0: class nsDisplayList; michael@0: class nsDisplayListBuilder; michael@0: class nsPIDOMWindow; michael@0: struct nsPoint; michael@0: struct nsIntPoint; michael@0: struct nsIntRect; michael@0: struct nsRect; michael@0: class nsRegion; michael@0: class nsRefreshDriver; michael@0: class nsARefreshObserver; michael@0: class nsAPostRefreshObserver; michael@0: #ifdef ACCESSIBILITY michael@0: class nsAccessibilityService; michael@0: namespace mozilla { michael@0: namespace a11y { michael@0: class DocAccessible; michael@0: } // namespace a11y michael@0: } // namespace mozilla michael@0: #endif michael@0: class nsIWidget; michael@0: struct nsArenaMemoryStats; michael@0: michael@0: typedef short SelectionType; michael@0: michael@0: namespace mozilla { michael@0: class EventStates; michael@0: michael@0: namespace dom { michael@0: class Element; michael@0: class Touch; michael@0: class Selection; michael@0: class ShadowRoot; michael@0: } // namespace dom michael@0: michael@0: namespace layers { michael@0: class LayerManager; michael@0: } // namespace layers michael@0: michael@0: namespace gfx { michael@0: class SourceSurface; michael@0: } // namespace gfx michael@0: } // namespace mozilla michael@0: michael@0: // Flags to pass to SetCapturingContent michael@0: // michael@0: // when assigning capture, ignore whether capture is allowed or not michael@0: #define CAPTURE_IGNOREALLOWED 1 michael@0: // true if events should be targeted at the capturing content or its children michael@0: #define CAPTURE_RETARGETTOELEMENT 2 michael@0: // true if the current capture wants drags to be prevented michael@0: #define CAPTURE_PREVENTDRAG 4 michael@0: // true when the mouse is pointer locked, and events are sent to locked element michael@0: #define CAPTURE_POINTERLOCK 8 michael@0: michael@0: typedef struct CapturingContentInfo { michael@0: // capture should only be allowed during a mousedown event michael@0: bool mAllowed; michael@0: bool mPointerLock; michael@0: bool mRetargetToElement; michael@0: bool mPreventDrag; michael@0: nsIContent* mContent; michael@0: } CapturingContentInfo; michael@0: michael@0: //61e60df7-128a-4cdd-a684-5f0bd2ceb61f michael@0: #define NS_IPRESSHELL_IID \ michael@0: { 0x61e60df7, 0x128a, 0x4cdd, \ michael@0: {0xa6, 0x84, 0x5f, 0x0b, 0xd2, 0xce, 0xb6, 0x1f}} michael@0: michael@0: // debug VerifyReflow flags michael@0: #define VERIFY_REFLOW_ON 0x01 michael@0: #define VERIFY_REFLOW_NOISY 0x02 michael@0: #define VERIFY_REFLOW_ALL 0x04 michael@0: #define VERIFY_REFLOW_DUMP_COMMANDS 0x08 michael@0: #define VERIFY_REFLOW_NOISY_RC 0x10 michael@0: #define VERIFY_REFLOW_REALLY_NOISY_RC 0x20 michael@0: #define VERIFY_REFLOW_DURING_RESIZE_REFLOW 0x40 michael@0: michael@0: #undef NOISY_INTERRUPTIBLE_REFLOW michael@0: michael@0: enum nsRectVisibility { michael@0: nsRectVisibility_kVisible, michael@0: nsRectVisibility_kAboveViewport, michael@0: nsRectVisibility_kBelowViewport, michael@0: nsRectVisibility_kLeftOfViewport, michael@0: nsRectVisibility_kRightOfViewport michael@0: }; michael@0: michael@0: /** michael@0: * Presentation shell interface. Presentation shells are the michael@0: * controlling point for managing the presentation of a document. The michael@0: * presentation shell holds a live reference to the document, the michael@0: * presentation context, the style manager, the style set and the root michael@0: * frame.

michael@0: * michael@0: * When this object is Release'd, it will release the document, the michael@0: * presentation context, the style manager, the style set and the root michael@0: * frame. michael@0: */ michael@0: michael@0: class nsIPresShell : public nsISupports michael@0: { michael@0: public: michael@0: NS_DECLARE_STATIC_IID_ACCESSOR(NS_IPRESSHELL_IID) michael@0: michael@0: protected: michael@0: typedef mozilla::layers::LayerManager LayerManager; michael@0: typedef mozilla::gfx::SourceSurface SourceSurface; michael@0: michael@0: enum eRenderFlag { michael@0: STATE_IGNORING_VIEWPORT_SCROLLING = 0x1, michael@0: STATE_DRAWWINDOW_NOT_FLUSHING = 0x2 michael@0: }; michael@0: typedef uint8_t RenderFlags; // for storing the above flags michael@0: michael@0: public: michael@0: /** michael@0: * All callers are responsible for calling |Destroy| after calling michael@0: * |EndObservingDocument|. It needs to be separate only because form michael@0: * controls incorrectly store their data in the frames rather than the michael@0: * content model and printing calls |EndObservingDocument| multiple michael@0: * times to make form controls behave nicely when printed. michael@0: */ michael@0: virtual NS_HIDDEN_(void) Destroy() = 0; michael@0: michael@0: bool IsDestroying() { return mIsDestroying; } michael@0: michael@0: /** michael@0: * Make a one-way transition into a "zombie" state. In this state, michael@0: * no reflow is done, no painting is done, and no refresh driver michael@0: * ticks are processed. This is a dangerous state: it can leave michael@0: * areas of the composition target unpainted if callers aren't michael@0: * careful. (Don't let your zombie presshell out of the shed.) michael@0: * michael@0: * This is used in cases where a presshell is created for reasons michael@0: * other than reflow/painting. michael@0: */ michael@0: virtual NS_HIDDEN_(void) MakeZombie() = 0; michael@0: michael@0: /** michael@0: * All frames owned by the shell are allocated from an arena. They michael@0: * are also recycled using free lists. Separate free lists are michael@0: * maintained for each frame type (aID), which must always correspond michael@0: * to the same aSize value. AllocateFrame returns zero-filled memory. michael@0: * AllocateFrame is infallible and will abort on out-of-memory. michael@0: */ michael@0: void* AllocateFrame(nsQueryFrame::FrameIID aID, size_t aSize) michael@0: { michael@0: #ifdef DEBUG michael@0: mPresArenaAllocCount++; michael@0: #endif michael@0: void* result = mFrameArena.AllocateByFrameID(aID, aSize); michael@0: memset(result, 0, aSize); michael@0: return result; michael@0: } michael@0: michael@0: void FreeFrame(nsQueryFrame::FrameIID aID, void* aPtr) michael@0: { michael@0: #ifdef DEBUG michael@0: mPresArenaAllocCount--; michael@0: #endif michael@0: if (!mIsDestroying) michael@0: mFrameArena.FreeByFrameID(aID, aPtr); michael@0: } michael@0: michael@0: /** michael@0: * This is for allocating other types of objects (not frames). Separate free michael@0: * lists are maintained for each type (aID), which must always correspond to michael@0: * the same aSize value. AllocateByObjectID returns zero-filled memory. michael@0: * AllocateByObjectID is infallible and will abort on out-of-memory. michael@0: */ michael@0: void* AllocateByObjectID(nsPresArena::ObjectID aID, size_t aSize) michael@0: { michael@0: #ifdef DEBUG michael@0: mPresArenaAllocCount++; michael@0: #endif michael@0: void* result = mFrameArena.AllocateByObjectID(aID, aSize); michael@0: memset(result, 0, aSize); michael@0: return result; michael@0: } michael@0: michael@0: void FreeByObjectID(nsPresArena::ObjectID aID, void* aPtr) michael@0: { michael@0: #ifdef DEBUG michael@0: mPresArenaAllocCount--; michael@0: #endif michael@0: if (!mIsDestroying) michael@0: mFrameArena.FreeByObjectID(aID, aPtr); michael@0: } michael@0: michael@0: /** michael@0: * Other objects closely related to the frame tree that are allocated michael@0: * from a separate set of per-size free lists. Note that different types michael@0: * of objects that has the same size are allocated from the same list. michael@0: * AllocateMisc does *not* clear the memory that it returns. michael@0: * AllocateMisc is infallible and will abort on out-of-memory. michael@0: * michael@0: * @deprecated use AllocateByObjectID/FreeByObjectID instead michael@0: */ michael@0: void* AllocateMisc(size_t aSize) michael@0: { michael@0: #ifdef DEBUG michael@0: mPresArenaAllocCount++; michael@0: #endif michael@0: return mFrameArena.AllocateBySize(aSize); michael@0: } michael@0: michael@0: void FreeMisc(size_t aSize, void* aPtr) michael@0: { michael@0: #ifdef DEBUG michael@0: mPresArenaAllocCount--; michael@0: #endif michael@0: if (!mIsDestroying) michael@0: mFrameArena.FreeBySize(aSize, aPtr); michael@0: } michael@0: michael@0: nsIDocument* GetDocument() const { return mDocument; } michael@0: michael@0: nsPresContext* GetPresContext() const { return mPresContext; } michael@0: michael@0: nsViewManager* GetViewManager() const { return mViewManager; } michael@0: michael@0: #ifdef ACCESSIBILITY michael@0: /** michael@0: * Return the document accessible for this pres shell if there is one. michael@0: */ michael@0: mozilla::a11y::DocAccessible* GetDocAccessible() const michael@0: { michael@0: return mDocAccessible; michael@0: } michael@0: michael@0: /** michael@0: * Set the document accessible for this pres shell. michael@0: */ michael@0: void SetDocAccessible(mozilla::a11y::DocAccessible* aDocAccessible) michael@0: { michael@0: mDocAccessible = aDocAccessible; michael@0: } michael@0: #endif michael@0: michael@0: #ifdef MOZILLA_INTERNAL_API michael@0: nsStyleSet* StyleSet() const { return mStyleSet; } michael@0: michael@0: nsCSSFrameConstructor* FrameConstructor() const { return mFrameConstructor; } michael@0: michael@0: nsFrameManager* FrameManager() const { michael@0: // reinterpret_cast is valid since nsFrameManager does not add michael@0: // any members over nsFrameManagerBase. michael@0: return reinterpret_cast michael@0: (const_cast(this)->mFrameManager); michael@0: } michael@0: michael@0: #endif michael@0: michael@0: /* Enable/disable author style level. Disabling author style disables the entire michael@0: * author level of the cascade, including the HTML preshint level. michael@0: */ michael@0: // XXX these could easily be inlined, but there is a circular #include michael@0: // problem with nsStyleSet. michael@0: NS_HIDDEN_(void) SetAuthorStyleDisabled(bool aDisabled); michael@0: NS_HIDDEN_(bool) GetAuthorStyleDisabled() const; michael@0: michael@0: /* michael@0: * Called when stylesheets are added/removed/enabled/disabled to rebuild michael@0: * all style data for a given pres shell without necessarily reconstructing michael@0: * all of the frames. This will not reconstruct style synchronously; if michael@0: * you need to do that, call FlushPendingNotifications to flush out style michael@0: * reresolves. michael@0: * // XXXbz why do we have this on the interface anyway? The only consumer michael@0: * is calling AddOverrideStyleSheet/RemoveOverrideStyleSheet, and I think michael@0: * those should just handle reconstructing style data... michael@0: */ michael@0: virtual NS_HIDDEN_(void) ReconstructStyleDataExternal(); michael@0: NS_HIDDEN_(void) ReconstructStyleDataInternal(); michael@0: #ifdef MOZILLA_INTERNAL_API michael@0: void ReconstructStyleData() { ReconstructStyleDataInternal(); } michael@0: #else michael@0: void ReconstructStyleData() { ReconstructStyleDataExternal(); } michael@0: #endif michael@0: michael@0: /** Setup all style rules required to implement preferences michael@0: * - used for background/text/link colors and link underlining michael@0: * may be extended for any prefs that are implemented via style rules michael@0: * - aForceReflow argument is used to force a full reframe to make the rules show michael@0: * (only used when the current page needs to reflect changed pref rules) michael@0: * michael@0: * - initially created for bugs 31816, 20760, 22963 michael@0: */ michael@0: virtual NS_HIDDEN_(nsresult) SetPreferenceStyleRules(bool aForceReflow) = 0; michael@0: michael@0: /** michael@0: * FrameSelection will return the Frame based selection API. michael@0: * You cannot go back and forth anymore with QI between nsIDOM sel and michael@0: * nsIFrame sel. michael@0: */ michael@0: already_AddRefed FrameSelection(); michael@0: michael@0: /** michael@0: * ConstFrameSelection returns an object which methods are safe to use for michael@0: * example in nsIFrame code. michael@0: */ michael@0: const nsFrameSelection* ConstFrameSelection() const { return mSelection; } michael@0: michael@0: // Make shell be a document observer. If called after Destroy() has michael@0: // been called on the shell, this will be ignored. michael@0: virtual NS_HIDDEN_(void) BeginObservingDocument() = 0; michael@0: michael@0: // Make shell stop being a document observer michael@0: virtual NS_HIDDEN_(void) EndObservingDocument() = 0; michael@0: michael@0: /** michael@0: * Return whether Initialize() was previously called. michael@0: */ michael@0: bool DidInitialize() const { return mDidInitialize; } michael@0: michael@0: /** michael@0: * Perform initialization. Constructs the frame for the root content michael@0: * object and then enqueues a reflow of the frame model into the michael@0: * specified width and height. michael@0: * michael@0: * The coordinates for aWidth and aHeight must be in standard nscoords. michael@0: * michael@0: * Callers of this method must hold a reference to this shell that michael@0: * is guaranteed to survive through arbitrary script execution. michael@0: * Calling Initialize can execute arbitrary script. michael@0: */ michael@0: virtual NS_HIDDEN_(nsresult) Initialize(nscoord aWidth, nscoord aHeight) = 0; michael@0: michael@0: /** michael@0: * Reflow the frame model into a new width and height. The michael@0: * coordinates for aWidth and aHeight must be in standard nscoord's. michael@0: */ michael@0: virtual NS_HIDDEN_(nsresult) ResizeReflow(nscoord aWidth, nscoord aHeight) = 0; michael@0: /** michael@0: * Reflow, and also change presshell state so as to only permit michael@0: * reflowing off calls to ResizeReflowOverride() in the future. michael@0: * ResizeReflow() calls are ignored after ResizeReflowOverride(). michael@0: */ michael@0: virtual NS_HIDDEN_(nsresult) ResizeReflowOverride(nscoord aWidth, nscoord aHeight) = 0; michael@0: michael@0: /** michael@0: * Returns true if ResizeReflowOverride has been called. michael@0: */ michael@0: virtual bool GetIsViewportOverridden() = 0; michael@0: michael@0: /** michael@0: * Return true if the presshell expects layout flush. michael@0: */ michael@0: virtual bool IsLayoutFlushObserver() = 0; michael@0: michael@0: /** michael@0: * Called when document load completes. michael@0: */ michael@0: virtual NS_HIDDEN_(void) LoadComplete() = 0; michael@0: michael@0: /** michael@0: * This calls through to the frame manager to get the root frame. michael@0: */ michael@0: virtual NS_HIDDEN_(nsIFrame*) GetRootFrameExternal() const; michael@0: nsIFrame* GetRootFrame() const { michael@0: #ifdef MOZILLA_INTERNAL_API michael@0: return mFrameManager->GetRootFrame(); michael@0: #else michael@0: return GetRootFrameExternal(); michael@0: #endif michael@0: } michael@0: michael@0: /* michael@0: * Get root scroll frame from FrameManager()->GetRootFrame(). michael@0: */ michael@0: nsIFrame* GetRootScrollFrame() const; michael@0: michael@0: /* michael@0: * The same as GetRootScrollFrame, but returns an nsIScrollableFrame michael@0: */ michael@0: nsIScrollableFrame* GetRootScrollFrameAsScrollable() const; michael@0: michael@0: /* michael@0: * The same as GetRootScrollFrame, but returns an nsIScrollableFrame. michael@0: * Can be called by code not linked into gklayout. michael@0: */ michael@0: virtual nsIScrollableFrame* GetRootScrollFrameAsScrollableExternal() const; michael@0: michael@0: /* michael@0: * Gets nearest scrollable frame from current focused content or DOM michael@0: * selection if there is no focused content. The frame is scrollable with michael@0: * overflow:scroll or overflow:auto in some direction when aDirection is michael@0: * eEither. Otherwise, this returns a nearest frame that is scrollable in michael@0: * the specified direction. michael@0: */ michael@0: enum ScrollDirection { eHorizontal, eVertical, eEither }; michael@0: nsIScrollableFrame* GetFrameToScrollAsScrollable(ScrollDirection aDirection); michael@0: michael@0: /** michael@0: * Returns the page sequence frame associated with the frame hierarchy. michael@0: * Returns nullptr if not a paginated view. michael@0: */ michael@0: virtual NS_HIDDEN_(nsIPageSequenceFrame*) GetPageSequenceFrame() const = 0; michael@0: michael@0: /** michael@0: * Gets the real primary frame associated with the content object. michael@0: * michael@0: * In the case of absolutely positioned elements and floated elements, michael@0: * the real primary frame is the frame that is out of the flow and not the michael@0: * placeholder frame. michael@0: */ michael@0: virtual NS_HIDDEN_(nsIFrame*) GetRealPrimaryFrameFor(nsIContent* aContent) const = 0; michael@0: michael@0: /** michael@0: * Gets the placeholder frame associated with the specified frame. This is michael@0: * a helper frame that forwards the request to the frame manager. michael@0: */ michael@0: virtual NS_HIDDEN_(nsIFrame*) GetPlaceholderFrameFor(nsIFrame* aFrame) const = 0; michael@0: michael@0: /** michael@0: * Tell the pres shell that a frame needs to be marked dirty and needs michael@0: * Reflow. It's OK if this is an ancestor of the frame needing reflow as michael@0: * long as the ancestor chain between them doesn't cross a reflow root. michael@0: * michael@0: * The bit to add should be NS_FRAME_IS_DIRTY, NS_FRAME_HAS_DIRTY_CHILDREN michael@0: * or nsFrameState(0); passing 0 means that dirty bits won't be set on the michael@0: * frame or its ancestors/descendants, but that intrinsic widths will still michael@0: * be marked dirty. Passing aIntrinsicDirty = eResize and aBitToAdd = 0 michael@0: * would result in no work being done, so don't do that. michael@0: */ michael@0: enum IntrinsicDirty { michael@0: // XXXldb eResize should be renamed michael@0: eResize, // don't mark any intrinsic widths dirty michael@0: eTreeChange, // mark intrinsic widths dirty on aFrame and its ancestors michael@0: eStyleChange // Do eTreeChange, plus all of aFrame's descendants michael@0: }; michael@0: virtual NS_HIDDEN_(void) FrameNeedsReflow(nsIFrame *aFrame, michael@0: IntrinsicDirty aIntrinsicDirty, michael@0: nsFrameState aBitToAdd) = 0; michael@0: michael@0: /** michael@0: * Calls FrameNeedsReflow on all fixed position children of the root frame. michael@0: */ michael@0: virtual void MarkFixedFramesForReflow(IntrinsicDirty aIntrinsicDirty); michael@0: michael@0: /** michael@0: * Tell the presshell that the given frame's reflow was interrupted. This michael@0: * will mark as having dirty children a path from the given frame (inclusive) michael@0: * to the nearest ancestor with a dirty subtree, or to the reflow root michael@0: * currently being reflowed if no such ancestor exists (inclusive). This is michael@0: * to be done immediately after reflow of the current reflow root completes. michael@0: * This method must only be called during reflow, and the frame it's being michael@0: * called on must be in the process of being reflowed when it's called. This michael@0: * method doesn't mark any intrinsic widths dirty and doesn't add any bits michael@0: * other than NS_FRAME_HAS_DIRTY_CHILDREN. michael@0: */ michael@0: virtual NS_HIDDEN_(void) FrameNeedsToContinueReflow(nsIFrame *aFrame) = 0; michael@0: michael@0: virtual NS_HIDDEN_(void) CancelAllPendingReflows() = 0; michael@0: michael@0: /** michael@0: * Recreates the frames for a node michael@0: */ michael@0: virtual NS_HIDDEN_(nsresult) RecreateFramesFor(nsIContent* aContent) = 0; michael@0: michael@0: void PostRecreateFramesFor(mozilla::dom::Element* aElement); michael@0: void RestyleForAnimation(mozilla::dom::Element* aElement, michael@0: nsRestyleHint aHint); michael@0: michael@0: // ShadowRoot has APIs that can change styles so we only michael@0: // want to restyle elements in the ShadowRoot and not the whole michael@0: // document. michael@0: virtual void RestyleShadowRoot(mozilla::dom::ShadowRoot* aShadowRoot) = 0; michael@0: michael@0: /** michael@0: * Determine if it is safe to flush all pending notifications michael@0: * @param aIsSafeToFlush true if it is safe, false otherwise. michael@0: * michael@0: */ michael@0: virtual NS_HIDDEN_(bool) IsSafeToFlush() const = 0; michael@0: michael@0: /** michael@0: * Flush pending notifications of the type specified. This method michael@0: * will not affect the content model; it'll just affect style and michael@0: * frames. Callers that actually want up-to-date presentation (other michael@0: * than the document itself) should probably be calling michael@0: * nsIDocument::FlushPendingNotifications. michael@0: * michael@0: * @param aType the type of notifications to flush michael@0: */ michael@0: virtual NS_HIDDEN_(void) FlushPendingNotifications(mozFlushType aType) = 0; michael@0: virtual NS_HIDDEN_(void) FlushPendingNotifications(mozilla::ChangesToFlush aType) = 0; michael@0: michael@0: /** michael@0: * Callbacks will be called even if reflow itself fails for michael@0: * some reason. michael@0: */ michael@0: virtual NS_HIDDEN_(nsresult) PostReflowCallback(nsIReflowCallback* aCallback) = 0; michael@0: virtual NS_HIDDEN_(void) CancelReflowCallback(nsIReflowCallback* aCallback) = 0; michael@0: michael@0: virtual NS_HIDDEN_(void) ClearFrameRefs(nsIFrame* aFrame) = 0; michael@0: michael@0: /** michael@0: * Get a reference rendering context. This is a context that should not michael@0: * be rendered to, but is suitable for measuring text and performing michael@0: * other non-rendering operations. Guaranteed to return non-null. michael@0: */ michael@0: virtual already_AddRefed CreateReferenceRenderingContext() = 0; michael@0: michael@0: /** michael@0: * Informs the pres shell that the document is now at the anchor with michael@0: * the given name. If |aScroll| is true, scrolls the view of the michael@0: * document so that the anchor with the specified name is displayed at michael@0: * the top of the window. If |aAnchorName| is empty, then this informs michael@0: * the pres shell that there is no current target, and |aScroll| must michael@0: * be false. michael@0: */ michael@0: virtual NS_HIDDEN_(nsresult) GoToAnchor(const nsAString& aAnchorName, bool aScroll) = 0; michael@0: michael@0: /** michael@0: * Tells the presshell to scroll again to the last anchor scrolled to by michael@0: * GoToAnchor, if any. This scroll only happens if the scroll michael@0: * position has not changed since the last GoToAnchor. This is called michael@0: * by nsDocumentViewer::LoadComplete. This clears the last anchor michael@0: * scrolled to by GoToAnchor (we don't want to keep it alive if it's michael@0: * removed from the DOM), so don't call this more than once. michael@0: */ michael@0: virtual NS_HIDDEN_(nsresult) ScrollToAnchor() = 0; michael@0: michael@0: enum { michael@0: SCROLL_TOP = 0, michael@0: SCROLL_BOTTOM = 100, michael@0: SCROLL_LEFT = 0, michael@0: SCROLL_RIGHT = 100, michael@0: SCROLL_CENTER = 50, michael@0: SCROLL_MINIMUM = -1 michael@0: }; michael@0: michael@0: enum WhenToScroll { michael@0: SCROLL_ALWAYS, michael@0: SCROLL_IF_NOT_VISIBLE, michael@0: SCROLL_IF_NOT_FULLY_VISIBLE michael@0: }; michael@0: typedef struct ScrollAxis { michael@0: int16_t mWhereToScroll; michael@0: WhenToScroll mWhenToScroll : 8; michael@0: bool mOnlyIfPerceivedScrollableDirection : 1; michael@0: /** michael@0: * @param aWhere: Either a percentage or a special value. michael@0: * nsIPresShell defines: michael@0: * * (Default) SCROLL_MINIMUM = -1: The visible area is michael@0: * scrolled to show the entire frame. If the frame is too michael@0: * large, the top and left edges are given precedence. michael@0: * * SCROLL_TOP = 0: The frame's upper edge is aligned with the michael@0: * top edge of the visible area. michael@0: * * SCROLL_BOTTOM = 100: The frame's bottom edge is aligned michael@0: * with the bottom edge of the visible area. michael@0: * * SCROLL_LEFT = 0: The frame's left edge is aligned with the michael@0: * left edge of the visible area. michael@0: * * SCROLL_RIGHT = 100: The frame's right edge is aligned with michael@0: * the right edge of the visible area. michael@0: * * SCROLL_CENTER = 50: The frame is centered along the axis michael@0: * the ScrollAxis is used for. michael@0: * michael@0: * Other values are treated as a percentage, and the point michael@0: * "percent" down the frame is placed at the point "percent" michael@0: * down the visible area. michael@0: * @param aWhen: michael@0: * * (Default) SCROLL_IF_NOT_FULLY_VISIBLE: Move the frame only michael@0: * if it is not fully visible (including if it's not visible michael@0: * at all). Note that in this case if the frame is too large to michael@0: * fit in view, it will only be scrolled if more of it can fit michael@0: * than is already in view. michael@0: * * SCROLL_IF_NOT_VISIBLE: Move the frame only if none of it michael@0: * is visible. michael@0: * * SCROLL_ALWAYS: Move the frame regardless of its current michael@0: * visibility. michael@0: * @param aOnlyIfPerceivedScrollableDirection: michael@0: * If the direction is not a perceived scrollable direction (i.e. michael@0: * no scrollbar showing and less than one device pixel of michael@0: * scrollable distance), don't scroll. Defaults to false. michael@0: */ michael@0: ScrollAxis(int16_t aWhere = SCROLL_MINIMUM, michael@0: WhenToScroll aWhen = SCROLL_IF_NOT_FULLY_VISIBLE, michael@0: bool aOnlyIfPerceivedScrollableDirection = false) : michael@0: mWhereToScroll(aWhere), mWhenToScroll(aWhen), michael@0: mOnlyIfPerceivedScrollableDirection(aOnlyIfPerceivedScrollableDirection) michael@0: {} michael@0: } ScrollAxis; michael@0: /** michael@0: * Scrolls the view of the document so that the primary frame of the content michael@0: * is displayed in the window. Layout is flushed before scrolling. michael@0: * michael@0: * @param aContent The content object of which primary frame should be michael@0: * scrolled into view. michael@0: * @param aVertical How to align the frame vertically and when to do so. michael@0: * This is a ScrollAxis of Where and When. michael@0: * @param aHorizontal How to align the frame horizontally and when to do so. michael@0: * This is a ScrollAxis of Where and When. michael@0: * @param aFlags If SCROLL_FIRST_ANCESTOR_ONLY is set, only the nearest michael@0: * scrollable ancestor is scrolled, otherwise all michael@0: * scrollable ancestors may be scrolled if necessary. michael@0: * If SCROLL_OVERFLOW_HIDDEN is set then we may scroll in a michael@0: * direction even if overflow:hidden is specified in that michael@0: * direction; otherwise we will not scroll in that direction michael@0: * when overflow:hidden is set for that direction. michael@0: * If SCROLL_NO_PARENT_FRAMES is set then we only scroll michael@0: * nodes in this document, not in any parent documents which michael@0: * contain this document in a iframe or the like. michael@0: */ michael@0: virtual NS_HIDDEN_(nsresult) ScrollContentIntoView(nsIContent* aContent, michael@0: ScrollAxis aVertical, michael@0: ScrollAxis aHorizontal, michael@0: uint32_t aFlags) = 0; michael@0: michael@0: enum { michael@0: SCROLL_FIRST_ANCESTOR_ONLY = 0x01, michael@0: SCROLL_OVERFLOW_HIDDEN = 0x02, michael@0: SCROLL_NO_PARENT_FRAMES = 0x04 michael@0: }; michael@0: /** michael@0: * Scrolls the view of the document so that the given area of a frame michael@0: * is visible, if possible. Layout is not flushed before scrolling. michael@0: * michael@0: * @param aRect relative to aFrame michael@0: * @param aVertical see ScrollContentIntoView and ScrollAxis michael@0: * @param aHorizontal see ScrollContentIntoView and ScrollAxis michael@0: * @param aFlags if SCROLL_FIRST_ANCESTOR_ONLY is set, only the michael@0: * nearest scrollable ancestor is scrolled, otherwise all michael@0: * scrollable ancestors may be scrolled if necessary michael@0: * if SCROLL_OVERFLOW_HIDDEN is set then we may scroll in a direction michael@0: * even if overflow:hidden is specified in that direction; otherwise michael@0: * we will not scroll in that direction when overflow:hidden is michael@0: * set for that direction michael@0: * If SCROLL_NO_PARENT_FRAMES is set then we only scroll michael@0: * nodes in this document, not in any parent documents which michael@0: * contain this document in a iframe or the like. michael@0: * @return true if any scrolling happened, false if no scrolling happened michael@0: */ michael@0: virtual bool ScrollFrameRectIntoView(nsIFrame* aFrame, michael@0: const nsRect& aRect, michael@0: ScrollAxis aVertical, michael@0: ScrollAxis aHorizontal, michael@0: uint32_t aFlags) = 0; michael@0: michael@0: /** michael@0: * Determine if a rectangle specified in the frame's coordinate system michael@0: * intersects the viewport "enough" to be considered visible. michael@0: * @param aFrame frame that aRect coordinates are specified relative to michael@0: * @param aRect rectangle in twips to test for visibility michael@0: * @param aMinTwips is the minimum distance in from the edge of the viewport michael@0: * that an object must be to be counted visible michael@0: * @return nsRectVisibility_kVisible if the rect is visible michael@0: * nsRectVisibility_kAboveViewport michael@0: * nsRectVisibility_kBelowViewport michael@0: * nsRectVisibility_kLeftOfViewport michael@0: * nsRectVisibility_kRightOfViewport rectangle is outside the viewport michael@0: * in the specified direction michael@0: */ michael@0: virtual nsRectVisibility GetRectVisibility(nsIFrame *aFrame, michael@0: const nsRect &aRect, michael@0: nscoord aMinTwips) const = 0; michael@0: michael@0: /** michael@0: * Suppress notification of the frame manager that frames are michael@0: * being destroyed. michael@0: */ michael@0: virtual NS_HIDDEN_(void) SetIgnoreFrameDestruction(bool aIgnore) = 0; michael@0: michael@0: /** michael@0: * Notification sent by a frame informing the pres shell that it is about to michael@0: * be destroyed. michael@0: * This allows any outstanding references to the frame to be cleaned up michael@0: */ michael@0: virtual NS_HIDDEN_(void) NotifyDestroyingFrame(nsIFrame* aFrame) = 0; michael@0: michael@0: /** michael@0: * Get the caret, if it exists. AddRefs it. michael@0: */ michael@0: virtual NS_HIDDEN_(already_AddRefed) GetCaret() const = 0; michael@0: michael@0: /** michael@0: * Invalidate the caret's current position if it's outside of its frame's michael@0: * boundaries. This function is useful if you're batching selection michael@0: * notifications and might remove the caret's frame out from under it. michael@0: */ michael@0: virtual NS_HIDDEN_(void) MaybeInvalidateCaretPosition() = 0; michael@0: michael@0: /** michael@0: * Set the current caret to a new caret. To undo this, call RestoreCaret. michael@0: */ michael@0: virtual void SetCaret(nsCaret *aNewCaret) = 0; michael@0: michael@0: /** michael@0: * Restore the caret to the original caret that this pres shell was created michael@0: * with. michael@0: */ michael@0: virtual void RestoreCaret() = 0; michael@0: michael@0: /** michael@0: * Should the images have borders etc. Actual visual effects are determined michael@0: * by the frames. Visual effects may not effect layout, only display. michael@0: * Takes effect on next repaint, does not force a repaint itself. michael@0: * michael@0: * @param aInEnable if true, visual selection effects are enabled michael@0: * if false visual selection effects are disabled michael@0: */ michael@0: NS_IMETHOD SetSelectionFlags(int16_t aInEnable) = 0; michael@0: michael@0: /** michael@0: * Gets the current state of non text selection effects michael@0: * @return current state of non text selection, michael@0: * as set by SetDisplayNonTextSelection michael@0: */ michael@0: int16_t GetSelectionFlags() const { return mSelectionFlags; } michael@0: michael@0: virtual mozilla::dom::Selection* GetCurrentSelection(SelectionType aType) = 0; michael@0: michael@0: /** michael@0: * Interface to dispatch events via the presshell michael@0: * @note The caller must have a strong reference to the PresShell. michael@0: */ michael@0: virtual NS_HIDDEN_(nsresult) HandleEventWithTarget( michael@0: mozilla::WidgetEvent* aEvent, michael@0: nsIFrame* aFrame, michael@0: nsIContent* aContent, michael@0: nsEventStatus* aStatus) = 0; michael@0: michael@0: /** michael@0: * Dispatch event to content only (NOT full processing) michael@0: * @note The caller must have a strong reference to the PresShell. michael@0: */ michael@0: virtual NS_HIDDEN_(nsresult) HandleDOMEventWithTarget( michael@0: nsIContent* aTargetContent, michael@0: mozilla::WidgetEvent* aEvent, michael@0: nsEventStatus* aStatus) = 0; michael@0: michael@0: /** michael@0: * Dispatch event to content only (NOT full processing) michael@0: * @note The caller must have a strong reference to the PresShell. michael@0: */ michael@0: virtual NS_HIDDEN_(nsresult) HandleDOMEventWithTarget(nsIContent* aTargetContent, michael@0: nsIDOMEvent* aEvent, michael@0: nsEventStatus* aStatus) = 0; michael@0: michael@0: /** michael@0: * Gets the current target event frame from the PresShell michael@0: */ michael@0: virtual NS_HIDDEN_(nsIFrame*) GetEventTargetFrame() = 0; michael@0: michael@0: /** michael@0: * Gets the current target event frame from the PresShell michael@0: */ michael@0: virtual NS_HIDDEN_(already_AddRefed) GetEventTargetContent( michael@0: mozilla::WidgetEvent* aEvent) = 0; michael@0: michael@0: /** michael@0: * Get and set the history state for the current document michael@0: */ michael@0: michael@0: virtual NS_HIDDEN_(nsresult) CaptureHistoryState(nsILayoutHistoryState** aLayoutHistoryState) = 0; michael@0: michael@0: /** michael@0: * Determine if reflow is currently locked michael@0: * returns true if reflow is locked, false otherwise michael@0: */ michael@0: bool IsReflowLocked() const { return mIsReflowing; } michael@0: michael@0: /** michael@0: * Called to find out if painting is suppressed for this presshell. If it is suppressd, michael@0: * we don't allow the painting of any layer but the background, and we don't michael@0: * recur into our children. michael@0: */ michael@0: bool IsPaintingSuppressed() const { return mPaintingSuppressed; } michael@0: michael@0: /** michael@0: * Pause painting by freezing the refresh driver of this and all parent michael@0: * presentations. This may not have the desired effect if this pres shell michael@0: * has its own refresh driver. michael@0: */ michael@0: virtual void PausePainting() = 0; michael@0: michael@0: /** michael@0: * Resume painting by thawing the refresh driver of this and all parent michael@0: * presentations. This may not have the desired effect if this pres shell michael@0: * has its own refresh driver. michael@0: */ michael@0: virtual void ResumePainting() = 0; michael@0: michael@0: /** michael@0: * Unsuppress painting. michael@0: */ michael@0: virtual NS_HIDDEN_(void) UnsuppressPainting() = 0; michael@0: michael@0: /** michael@0: * Called to disable nsITheme support in a specific presshell. michael@0: */ michael@0: void DisableThemeSupport() michael@0: { michael@0: // Doesn't have to be dynamic. Just set the bool. michael@0: mIsThemeSupportDisabled = true; michael@0: } michael@0: michael@0: /** michael@0: * Indicates whether theme support is enabled. michael@0: */ michael@0: bool IsThemeSupportEnabled() const { return !mIsThemeSupportDisabled; } michael@0: michael@0: /** michael@0: * Get the set of agent style sheets for this presentation michael@0: */ michael@0: virtual nsresult GetAgentStyleSheets(nsCOMArray& aSheets) = 0; michael@0: michael@0: /** michael@0: * Replace the set of agent style sheets michael@0: */ michael@0: virtual nsresult SetAgentStyleSheets(const nsCOMArray& aSheets) = 0; michael@0: michael@0: /** michael@0: * Add an override style sheet for this presentation michael@0: */ michael@0: virtual nsresult AddOverrideStyleSheet(nsIStyleSheet *aSheet) = 0; michael@0: michael@0: /** michael@0: * Remove an override style sheet michael@0: */ michael@0: virtual nsresult RemoveOverrideStyleSheet(nsIStyleSheet *aSheet) = 0; michael@0: michael@0: /** michael@0: * Reconstruct frames for all elements in the document michael@0: */ michael@0: virtual nsresult ReconstructFrames() = 0; michael@0: michael@0: /** michael@0: * Notify that a content node's state has changed michael@0: */ michael@0: virtual void ContentStateChanged(nsIDocument* aDocument, michael@0: nsIContent* aContent, michael@0: mozilla::EventStates aStateMask) = 0; michael@0: michael@0: /** michael@0: * See if reflow verification is enabled. To enable reflow verification add michael@0: * "verifyreflow:1" to your NSPR_LOG_MODULES environment variable michael@0: * (any non-zero debug level will work). Or, call SetVerifyReflowEnable michael@0: * with true. michael@0: */ michael@0: static bool GetVerifyReflowEnable(); michael@0: michael@0: /** michael@0: * Set the verify-reflow enable flag. michael@0: */ michael@0: static void SetVerifyReflowEnable(bool aEnabled); michael@0: michael@0: virtual nsIFrame* GetAbsoluteContainingBlock(nsIFrame* aFrame); michael@0: michael@0: #ifdef MOZ_REFLOW_PERF michael@0: virtual NS_HIDDEN_(void) DumpReflows() = 0; michael@0: virtual NS_HIDDEN_(void) CountReflows(const char * aName, nsIFrame * aFrame) = 0; michael@0: virtual NS_HIDDEN_(void) PaintCount(const char * aName, michael@0: nsRenderingContext* aRenderingContext, michael@0: nsPresContext * aPresContext, michael@0: nsIFrame * aFrame, michael@0: const nsPoint& aOffset, michael@0: uint32_t aColor) = 0; michael@0: virtual NS_HIDDEN_(void) SetPaintFrameCount(bool aOn) = 0; michael@0: virtual bool IsPaintingFrameCounts() = 0; michael@0: #endif michael@0: michael@0: #ifdef DEBUG michael@0: // Debugging hooks michael@0: virtual void ListStyleContexts(nsIFrame *aRootFrame, FILE *out, michael@0: int32_t aIndent = 0) = 0; michael@0: michael@0: virtual void ListStyleSheets(FILE *out, int32_t aIndent = 0) = 0; michael@0: virtual void VerifyStyleTree() = 0; michael@0: #endif michael@0: michael@0: #ifdef ACCESSIBILITY michael@0: /** michael@0: * Return true if accessibility is active. michael@0: */ michael@0: static bool IsAccessibilityActive(); michael@0: michael@0: /** michael@0: * Return accessibility service if accessibility is active. michael@0: */ michael@0: static nsAccessibilityService* AccService(); michael@0: #endif michael@0: michael@0: /** michael@0: * Stop all active elements (plugins and the caret) in this presentation and michael@0: * in the presentations of subdocuments. Resets painting to a suppressed state. michael@0: * XXX this should include image animations michael@0: */ michael@0: virtual void Freeze() = 0; michael@0: bool IsFrozen() { return mFrozen; } michael@0: michael@0: /** michael@0: * Restarts active elements (plugins) in this presentation and in the michael@0: * presentations of subdocuments, then do a full invalidate of the content area. michael@0: */ michael@0: virtual void Thaw() = 0; michael@0: michael@0: virtual void FireOrClearDelayedEvents(bool aFireEvents) = 0; michael@0: michael@0: /** michael@0: * When this shell is disconnected from its containing docshell, we michael@0: * lose our container pointer. However, we'd still like to be able to target michael@0: * user events at the docshell's parent. This pointer allows us to do that. michael@0: * It should not be used for any other purpose. michael@0: */ michael@0: void SetForwardingContainer(const mozilla::WeakPtr &aContainer); michael@0: michael@0: /** michael@0: * Render the document into an arbitrary gfxContext michael@0: * Designed for getting a picture of a document or a piece of a document michael@0: * Note that callers will generally want to call FlushPendingNotifications michael@0: * to get an up-to-date view of the document michael@0: * @param aRect is the region to capture into the offscreen buffer, in the michael@0: * root frame's coordinate system (if aIgnoreViewportScrolling is false) michael@0: * or in the root scrolled frame's coordinate system michael@0: * (if aIgnoreViewportScrolling is true). The coordinates are in appunits. michael@0: * @param aFlags see below; michael@0: * set RENDER_IS_UNTRUSTED if the contents may be passed to malicious michael@0: * agents. E.g. we might choose not to paint the contents of sensitive widgets michael@0: * such as the file name in a file upload widget, and we might choose not michael@0: * to paint themes. michael@0: * set RENDER_IGNORE_VIEWPORT_SCROLLING to ignore michael@0: * clipping/scrolling/scrollbar painting due to scrolling in the viewport michael@0: * set RENDER_CARET to draw the caret if one would be visible michael@0: * (by default the caret is never drawn) michael@0: * set RENDER_USE_LAYER_MANAGER to force rendering to go through michael@0: * the layer manager for the window. This may be unexpectedly slow michael@0: * (if the layer manager must read back data from the GPU) or low-quality michael@0: * (if the layer manager reads back pixel data and scales it michael@0: * instead of rendering using the appropriate scaling). It may also michael@0: * slow everything down if the area rendered does not correspond to the michael@0: * normal visible area of the window. michael@0: * set RENDER_ASYNC_DECODE_IMAGES to avoid having images synchronously michael@0: * decoded during rendering. michael@0: * (by default images decode synchronously with RenderDocument) michael@0: * set RENDER_DOCUMENT_RELATIVE to interpret |aRect| relative to the michael@0: * document instead of the CSS viewport michael@0: * @param aBackgroundColor a background color to render onto michael@0: * @param aRenderedContext the gfxContext to render to. We render so that michael@0: * one CSS pixel in the source document is rendered to one unit in the current michael@0: * transform. michael@0: */ michael@0: enum { michael@0: RENDER_IS_UNTRUSTED = 0x01, michael@0: RENDER_IGNORE_VIEWPORT_SCROLLING = 0x02, michael@0: RENDER_CARET = 0x04, michael@0: RENDER_USE_WIDGET_LAYERS = 0x08, michael@0: RENDER_ASYNC_DECODE_IMAGES = 0x10, michael@0: RENDER_DOCUMENT_RELATIVE = 0x20, michael@0: RENDER_DRAWWINDOW_NOT_FLUSHING = 0x40 michael@0: }; michael@0: virtual NS_HIDDEN_(nsresult) RenderDocument(const nsRect& aRect, uint32_t aFlags, michael@0: nscolor aBackgroundColor, michael@0: gfxContext* aRenderedContext) = 0; michael@0: michael@0: /** michael@0: * Renders a node aNode to a surface and returns it. The aRegion may be used michael@0: * to clip the rendering. This region is measured in CSS pixels from the michael@0: * edge of the presshell area. The aPoint, aScreenRect and aSurface michael@0: * arguments function in a similar manner as RenderSelection. michael@0: */ michael@0: virtual mozilla::TemporaryRef michael@0: RenderNode(nsIDOMNode* aNode, michael@0: nsIntRegion* aRegion, michael@0: nsIntPoint& aPoint, michael@0: nsIntRect* aScreenRect) = 0; michael@0: michael@0: /** michael@0: * Renders a selection to a surface and returns it. This method is primarily michael@0: * intended to create the drag feedback when dragging a selection. michael@0: * michael@0: * aScreenRect will be filled in with the bounding rectangle of the michael@0: * selection area on screen. michael@0: * michael@0: * If the area of the selection is large, the image will be scaled down. michael@0: * The argument aPoint is used in this case as a reference point when michael@0: * determining the new screen rectangle after scaling. Typically, this michael@0: * will be the mouse position, so that the screen rectangle is positioned michael@0: * such that the mouse is over the same point in the scaled image as in michael@0: * the original. When scaling does not occur, the mouse point isn't used michael@0: * as the position can be determined from the displayed frames. michael@0: */ michael@0: virtual mozilla::TemporaryRef michael@0: RenderSelection(nsISelection* aSelection, michael@0: nsIntPoint& aPoint, michael@0: nsIntRect* aScreenRect) = 0; michael@0: michael@0: void AddWeakFrameInternal(nsWeakFrame* aWeakFrame); michael@0: virtual void AddWeakFrameExternal(nsWeakFrame* aWeakFrame); michael@0: michael@0: void AddWeakFrame(nsWeakFrame* aWeakFrame) michael@0: { michael@0: #ifdef MOZILLA_INTERNAL_API michael@0: AddWeakFrameInternal(aWeakFrame); michael@0: #else michael@0: AddWeakFrameExternal(aWeakFrame); michael@0: #endif michael@0: } michael@0: michael@0: void RemoveWeakFrameInternal(nsWeakFrame* aWeakFrame); michael@0: virtual void RemoveWeakFrameExternal(nsWeakFrame* aWeakFrame); michael@0: michael@0: void RemoveWeakFrame(nsWeakFrame* aWeakFrame) michael@0: { michael@0: #ifdef MOZILLA_INTERNAL_API michael@0: RemoveWeakFrameInternal(aWeakFrame); michael@0: #else michael@0: RemoveWeakFrameExternal(aWeakFrame); michael@0: #endif michael@0: } michael@0: michael@0: #ifdef DEBUG michael@0: nsIFrame* GetDrawEventTargetFrame() { return mDrawEventTargetFrame; } michael@0: #endif michael@0: michael@0: /** michael@0: * Stop or restart non synthetic test mouse event handling on *all* michael@0: * presShells. michael@0: * michael@0: * @param aDisable If true, disable all non synthetic test mouse michael@0: * events on all presShells. Otherwise, enable them. michael@0: */ michael@0: virtual NS_HIDDEN_(void) DisableNonTestMouseEvents(bool aDisable) = 0; michael@0: michael@0: /** michael@0: * Record the background color of the most recently drawn canvas. This color michael@0: * is composited on top of the user's default background color and then used michael@0: * to draw the background color of the canvas. See PresShell::Paint, michael@0: * PresShell::PaintDefaultBackground, and nsDocShell::SetupNewViewer; michael@0: * bug 488242, bug 476557 and other bugs mentioned there. michael@0: */ michael@0: void SetCanvasBackground(nscolor aColor) { mCanvasBackgroundColor = aColor; } michael@0: nscolor GetCanvasBackground() { return mCanvasBackgroundColor; } michael@0: michael@0: /** michael@0: * Use the current frame tree (if it exists) to update the background michael@0: * color of the most recently drawn canvas. michael@0: */ michael@0: virtual void UpdateCanvasBackground() = 0; michael@0: michael@0: /** michael@0: * Add a solid color item to the bottom of aList with frame aFrame and bounds michael@0: * aBounds. Checks first if this needs to be done by checking if aFrame is a michael@0: * canvas frame (if the FORCE_DRAW flag is passed then this check is skipped). michael@0: * aBackstopColor is composed behind the background color of the canvas, it is michael@0: * transparent by default. michael@0: */ michael@0: enum { michael@0: FORCE_DRAW = 0x01 michael@0: }; michael@0: virtual void AddCanvasBackgroundColorItem(nsDisplayListBuilder& aBuilder, michael@0: nsDisplayList& aList, michael@0: nsIFrame* aFrame, michael@0: const nsRect& aBounds, michael@0: nscolor aBackstopColor = NS_RGBA(0,0,0,0), michael@0: uint32_t aFlags = 0) = 0; michael@0: michael@0: michael@0: /** michael@0: * Add a solid color item to the bottom of aList with frame aFrame and michael@0: * bounds aBounds representing the dark grey background behind the page of a michael@0: * print preview presentation. michael@0: */ michael@0: virtual void AddPrintPreviewBackgroundItem(nsDisplayListBuilder& aBuilder, michael@0: nsDisplayList& aList, michael@0: nsIFrame* aFrame, michael@0: const nsRect& aBounds) = 0; michael@0: michael@0: /** michael@0: * Computes the backstop color for the view: transparent if in a transparent michael@0: * widget, otherwise the PresContext default background color. This color is michael@0: * only visible if the contents of the view as a whole are translucent. michael@0: */ michael@0: virtual nscolor ComputeBackstopColor(nsView* aDisplayRoot) = 0; michael@0: michael@0: void ObserveNativeAnonMutationsForPrint(bool aObserve) michael@0: { michael@0: mObservesMutationsForPrint = aObserve; michael@0: } michael@0: bool ObservesNativeAnonMutationsForPrint() michael@0: { michael@0: return mObservesMutationsForPrint; michael@0: } michael@0: michael@0: virtual nsresult SetIsActive(bool aIsActive) = 0; michael@0: michael@0: bool IsActive() michael@0: { michael@0: return mIsActive; michael@0: } michael@0: michael@0: // mouse capturing michael@0: michael@0: static CapturingContentInfo gCaptureInfo; michael@0: michael@0: static nsRefPtrHashtable* gCaptureTouchList; michael@0: static bool gPreventMouseEvents; michael@0: michael@0: // Keeps a map between pointerId and element that currently capturing pointer michael@0: // with such pointerId. If pointerId is absent in this map then nobody is michael@0: // capturing it. michael@0: static nsRefPtrHashtable* gPointerCaptureList; michael@0: michael@0: struct PointerInfo michael@0: { michael@0: bool mActiveState; michael@0: uint16_t mPointerType; michael@0: PointerInfo(bool aActiveState, uint16_t aPointerType) : michael@0: mActiveState(aActiveState), mPointerType(aPointerType) {} michael@0: }; michael@0: // Keeps information about pointers such as pointerId, activeState, pointerType michael@0: static nsClassHashtable* gActivePointersIds; michael@0: michael@0: static void DispatchGotOrLostPointerCaptureEvent(bool aIsGotCapture, michael@0: uint32_t aPointerId, michael@0: nsIContent* aCaptureTarget); michael@0: static void SetPointerCapturingContent(uint32_t aPointerId, nsIContent* aContent); michael@0: static void ReleasePointerCapturingContent(uint32_t aPointerId, nsIContent* aContent); michael@0: static nsIContent* GetPointerCapturingContent(uint32_t aPointerId); michael@0: michael@0: // GetPointerInfo returns true if pointer with aPointerId is situated in device, false otherwise. michael@0: // aActiveState is additional information, which shows state of pointer like button state for mouse. michael@0: static bool GetPointerInfo(uint32_t aPointerId, bool& aActiveState); michael@0: michael@0: /** michael@0: * When capturing content is set, it traps all mouse events and retargets michael@0: * them at this content node. If capturing is not allowed michael@0: * (gCaptureInfo.mAllowed is false), then capturing is not set. However, if michael@0: * the CAPTURE_IGNOREALLOWED flag is set, the allowed state is ignored and michael@0: * capturing is set regardless. To disable capture, pass null for the value michael@0: * of aContent. michael@0: * michael@0: * If CAPTURE_RETARGETTOELEMENT is set, all mouse events are targeted at michael@0: * aContent only. Otherwise, mouse events are targeted at aContent or its michael@0: * descendants. That is, descendants of aContent receive mouse events as michael@0: * they normally would, but mouse events outside of aContent are retargeted michael@0: * to aContent. michael@0: * michael@0: * If CAPTURE_PREVENTDRAG is set then drags are prevented from starting while michael@0: * this capture is active. michael@0: * michael@0: * If CAPTURE_POINTERLOCK is set, similar to CAPTURE_RETARGETTOELEMENT, then michael@0: * events are targeted at aContent, but capturing is held more strongly (i.e., michael@0: * calls to SetCapturingContent won't unlock unless CAPTURE_POINTERLOCK is michael@0: * set again). michael@0: */ michael@0: static void SetCapturingContent(nsIContent* aContent, uint8_t aFlags); michael@0: michael@0: /** michael@0: * Return the active content currently capturing the mouse if any. michael@0: */ michael@0: static nsIContent* GetCapturingContent() michael@0: { michael@0: return gCaptureInfo.mContent; michael@0: } michael@0: michael@0: /** michael@0: * Allow or disallow mouse capturing. michael@0: */ michael@0: static void AllowMouseCapture(bool aAllowed) michael@0: { michael@0: gCaptureInfo.mAllowed = aAllowed; michael@0: } michael@0: michael@0: /** michael@0: * Returns true if there is an active mouse capture that wants to prevent michael@0: * drags. michael@0: */ michael@0: static bool IsMouseCapturePreventingDrag() michael@0: { michael@0: return gCaptureInfo.mPreventDrag && gCaptureInfo.mContent; michael@0: } michael@0: michael@0: /** michael@0: * Keep track of how many times this presshell has been rendered to michael@0: * a window. michael@0: */ michael@0: uint64_t GetPaintCount() { return mPaintCount; } michael@0: void IncrementPaintCount() { ++mPaintCount; } michael@0: michael@0: /** michael@0: * Get the root DOM window of this presShell. michael@0: */ michael@0: virtual already_AddRefed GetRootWindow() = 0; michael@0: michael@0: /** michael@0: * Get the layer manager for the widget of the root view, if it has michael@0: * one. michael@0: */ michael@0: virtual LayerManager* GetLayerManager() = 0; michael@0: michael@0: /** michael@0: * Track whether we're ignoring viewport scrolling for the purposes michael@0: * of painting. If we are ignoring, then layers aren't clipped to michael@0: * the CSS viewport and scrollbars aren't drawn. michael@0: */ michael@0: virtual void SetIgnoreViewportScrolling(bool aIgnore) = 0; michael@0: bool IgnoringViewportScrolling() const michael@0: { return mRenderFlags & STATE_IGNORING_VIEWPORT_SCROLLING; } michael@0: michael@0: /** michael@0: * Set a "resolution" for the document, which if not 1.0 will michael@0: * allocate more or fewer pixels for rescalable content by a factor michael@0: * of |resolution| in both dimensions. Return NS_OK iff the michael@0: * resolution bounds are sane, and the resolution of this was michael@0: * actually updated. michael@0: * michael@0: * The resolution defaults to 1.0. michael@0: */ michael@0: virtual nsresult SetResolution(float aXResolution, float aYResolution) = 0; michael@0: gfxSize GetResolution() { return gfxSize(mXResolution, mYResolution); } michael@0: float GetXResolution() { return mXResolution; } michael@0: float GetYResolution() { return mYResolution; } michael@0: virtual gfxSize GetCumulativeResolution() = 0; michael@0: michael@0: /** michael@0: * Returns whether we are in a DrawWindow() call that used the michael@0: * DRAWWINDOW_DO_NOT_FLUSH flag. michael@0: */ michael@0: bool InDrawWindowNotFlushing() const michael@0: { return mRenderFlags & STATE_DRAWWINDOW_NOT_FLUSHING; } michael@0: michael@0: /** michael@0: * Set the isFirstPaint flag. michael@0: */ michael@0: void SetIsFirstPaint(bool aIsFirstPaint) { mIsFirstPaint = aIsFirstPaint; } michael@0: michael@0: /** michael@0: * Get the isFirstPaint flag. michael@0: */ michael@0: bool GetIsFirstPaint() const { return mIsFirstPaint; } michael@0: michael@0: uint32_t GetPresShellId() { return mPresShellId; } michael@0: michael@0: /** michael@0: * Dispatch a mouse move event based on the most recent mouse position if michael@0: * this PresShell is visible. This is used when the contents of the page michael@0: * moved (aFromScroll is false) or scrolled (aFromScroll is true). michael@0: */ michael@0: virtual void SynthesizeMouseMove(bool aFromScroll) = 0; michael@0: michael@0: enum PaintFlags { michael@0: /* Update the layer tree and paint ThebesLayers. If this is not specified, michael@0: * we may still have to do it if the layer tree lost ThebesLayer contents michael@0: * we need for compositing. */ michael@0: PAINT_LAYERS = 0x01, michael@0: /* Composite layers to the window. */ michael@0: PAINT_COMPOSITE = 0x02, michael@0: }; michael@0: virtual void Paint(nsView* aViewToPaint, const nsRegion& aDirtyRegion, michael@0: uint32_t aFlags) = 0; michael@0: virtual nsresult HandleEvent(nsIFrame* aFrame, michael@0: mozilla::WidgetGUIEvent* aEvent, michael@0: bool aDontRetargetEvents, michael@0: nsEventStatus* aEventStatus) = 0; michael@0: virtual bool ShouldIgnoreInvalidation() = 0; michael@0: /** michael@0: * Notify that we're going to call Paint with PAINT_LAYERS michael@0: * on the pres shell for a widget (which might not be this one, since michael@0: * WillPaint is called on all presshells in the same toplevel window as the michael@0: * painted widget). This is issued at a time when it's safe to modify michael@0: * widget geometry. michael@0: */ michael@0: virtual void WillPaint() = 0; michael@0: /** michael@0: * Notify that we're going to call Paint with PAINT_COMPOSITE. michael@0: * Fires on the presshell for the painted widget. michael@0: * This is issued at a time when it's safe to modify widget geometry. michael@0: */ michael@0: virtual void WillPaintWindow() = 0; michael@0: /** michael@0: * Notify that we called Paint with PAINT_COMPOSITE. michael@0: * Fires on the presshell for the painted widget. michael@0: * This is issued at a time when it's safe to modify widget geometry. michael@0: */ michael@0: virtual void DidPaintWindow() = 0; michael@0: michael@0: /** michael@0: * Ensures that the refresh driver is running, and schedules a view michael@0: * manager flush on the next tick. michael@0: * michael@0: * @param aType PAINT_DELAYED_COMPRESS : Schedule a paint to be executed after a delay, and michael@0: * put FrameLayerBuilder in 'compressed' mode that avoids short cut optimizations. michael@0: */ michael@0: enum PaintType { michael@0: PAINT_DEFAULT, michael@0: PAINT_DELAYED_COMPRESS michael@0: }; michael@0: virtual void ScheduleViewManagerFlush(PaintType aType = PAINT_DEFAULT) = 0; michael@0: virtual void ClearMouseCaptureOnView(nsView* aView) = 0; michael@0: virtual bool IsVisible() = 0; michael@0: virtual void DispatchSynthMouseMove(mozilla::WidgetGUIEvent* aEvent, michael@0: bool aFlushOnHoverChange) = 0; michael@0: michael@0: virtual void AddSizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf, michael@0: nsArenaMemoryStats *aArenaObjectsSize, michael@0: size_t *aPresShellSize, michael@0: size_t *aStyleSetsSize, michael@0: size_t *aTextRunsSize, michael@0: size_t *aPresContextSize) = 0; michael@0: michael@0: /** michael@0: * Methods that retrieve the cached font inflation preferences. michael@0: */ michael@0: uint32_t FontSizeInflationEmPerLine() const { michael@0: return mFontSizeInflationEmPerLine; michael@0: } michael@0: michael@0: uint32_t FontSizeInflationMinTwips() const { michael@0: return mFontSizeInflationMinTwips; michael@0: } michael@0: michael@0: uint32_t FontSizeInflationLineThreshold() const { michael@0: return mFontSizeInflationLineThreshold; michael@0: } michael@0: michael@0: bool FontSizeInflationForceEnabled() const { michael@0: return mFontSizeInflationForceEnabled; michael@0: } michael@0: michael@0: bool FontSizeInflationDisabledInMasterProcess() const { michael@0: return mFontSizeInflationDisabledInMasterProcess; michael@0: } michael@0: michael@0: /** michael@0: * Determine if font size inflation is enabled. This value is cached until michael@0: * it becomes dirty. michael@0: * michael@0: * @returns true, if font size inflation is enabled; false otherwise. michael@0: */ michael@0: bool FontSizeInflationEnabled(); michael@0: michael@0: /** michael@0: * Notify the pres shell that an event occurred making the current value of michael@0: * mFontSizeInflationEnabled invalid. This will schedule a recomputation of michael@0: * whether font size inflation is enabled on the next call to michael@0: * FontSizeInflationEnabled(). michael@0: */ michael@0: void NotifyFontSizeInflationEnabledIsDirty() michael@0: { michael@0: mFontSizeInflationEnabledIsDirty = true; michael@0: } michael@0: michael@0: virtual void AddInvalidateHiddenPresShellObserver(nsRefreshDriver *aDriver) = 0; michael@0: michael@0: void InvalidatePresShellIfHidden(); michael@0: void CancelInvalidatePresShellIfHidden(); michael@0: michael@0: // Schedule an update of the list of visible images. michael@0: virtual void ScheduleImageVisibilityUpdate() = 0; michael@0: michael@0: // Clears the current list of visible images on this presshell and replaces it michael@0: // with images that are in the display list aList. michael@0: virtual void RebuildImageVisibility(const nsDisplayList& aList) = 0; michael@0: michael@0: // Ensures the image is in the list of visible images. michael@0: virtual void EnsureImageInVisibleList(nsIImageLoadingContent* aImage) = 0; michael@0: michael@0: // Removes the image from the list of visible images if it is present there. michael@0: virtual void RemoveImageFromVisibleList(nsIImageLoadingContent* aImage) = 0; michael@0: michael@0: // Whether we should assume all images are visible. michael@0: virtual bool AssumeAllImagesVisible() = 0; michael@0: michael@0: /** michael@0: * Refresh observer management. michael@0: */ michael@0: protected: michael@0: virtual bool AddRefreshObserverExternal(nsARefreshObserver* aObserver, michael@0: mozFlushType aFlushType); michael@0: bool AddRefreshObserverInternal(nsARefreshObserver* aObserver, michael@0: mozFlushType aFlushType); michael@0: virtual bool RemoveRefreshObserverExternal(nsARefreshObserver* aObserver, michael@0: mozFlushType aFlushType); michael@0: bool RemoveRefreshObserverInternal(nsARefreshObserver* aObserver, michael@0: mozFlushType aFlushType); michael@0: michael@0: /** michael@0: * Do computations necessary to determine if font size inflation is enabled. michael@0: * This value is cached after computation, as the computation is somewhat michael@0: * expensive. michael@0: */ michael@0: void RecomputeFontSizeInflationEnabled(); michael@0: michael@0: public: michael@0: bool AddRefreshObserver(nsARefreshObserver* aObserver, michael@0: mozFlushType aFlushType) { michael@0: #ifdef MOZILLA_INTERNAL_API michael@0: return AddRefreshObserverInternal(aObserver, aFlushType); michael@0: #else michael@0: return AddRefreshObserverExternal(aObserver, aFlushType); michael@0: #endif michael@0: } michael@0: michael@0: bool RemoveRefreshObserver(nsARefreshObserver* aObserver, michael@0: mozFlushType aFlushType) { michael@0: #ifdef MOZILLA_INTERNAL_API michael@0: return RemoveRefreshObserverInternal(aObserver, aFlushType); michael@0: #else michael@0: return RemoveRefreshObserverExternal(aObserver, aFlushType); michael@0: #endif michael@0: } michael@0: michael@0: virtual bool AddPostRefreshObserver(nsAPostRefreshObserver* aObserver); michael@0: virtual bool RemovePostRefreshObserver(nsAPostRefreshObserver* aObserver); michael@0: michael@0: /** michael@0: * Initialize and shut down static variables. michael@0: */ michael@0: static void InitializeStatics(); michael@0: static void ReleaseStatics(); michael@0: michael@0: // If a frame in the subtree rooted at aFrame is capturing the mouse then michael@0: // clears that capture. michael@0: static void ClearMouseCapture(nsIFrame* aFrame); michael@0: michael@0: void SetScrollPositionClampingScrollPortSize(nscoord aWidth, nscoord aHeight); michael@0: bool IsScrollPositionClampingScrollPortSizeSet() { michael@0: return mScrollPositionClampingScrollPortSizeSet; michael@0: } michael@0: nsSize GetScrollPositionClampingScrollPortSize() { michael@0: NS_ASSERTION(mScrollPositionClampingScrollPortSizeSet, "asking for scroll port when its not set?"); michael@0: return mScrollPositionClampingScrollPortSize; michael@0: } michael@0: michael@0: void SetContentDocumentFixedPositionMargins(const nsMargin& aMargins); michael@0: const nsMargin& GetContentDocumentFixedPositionMargins() { michael@0: return mContentDocumentFixedPositionMargins; michael@0: } michael@0: michael@0: virtual void WindowSizeMoveDone() = 0; michael@0: virtual void SysColorChanged() = 0; michael@0: virtual void ThemeChanged() = 0; michael@0: virtual void BackingScaleFactorChanged() = 0; michael@0: michael@0: nscoord MaxLineBoxWidth() { michael@0: return mMaxLineBoxWidth; michael@0: } michael@0: michael@0: void SetMaxLineBoxWidth(nscoord aMaxLineBoxWidth); michael@0: michael@0: /** michael@0: * Returns whether or not there is a reflow on zoom event pending. A reflow michael@0: * on zoom event is a change to the max line box width, followed by a reflow. michael@0: * This subsequent reflow event should treat all frames as though they resized michael@0: * horizontally (and thus reflow all their descendants), rather than marking michael@0: * all frames dirty from the root. This is the way the pres shell indicates michael@0: * that an hresize reflow should take place during reflow state construction. michael@0: */ michael@0: bool IsReflowOnZoomPending() { michael@0: return mReflowOnZoomPending; michael@0: } michael@0: michael@0: /** michael@0: * Clear the flag indicating whether a reflow on zoom event is pending. This michael@0: * is performed at the very end of DoReflow(). michael@0: */ michael@0: void ClearReflowOnZoomPending() { michael@0: mReflowOnZoomPending = false; michael@0: } michael@0: michael@0: /** michael@0: * Documents belonging to an invisible DocShell must not be painted ever. michael@0: */ michael@0: bool IsNeverPainting() { michael@0: return mIsNeverPainting; michael@0: } michael@0: michael@0: void SetNeverPainting(bool aNeverPainting) { michael@0: mIsNeverPainting = aNeverPainting; michael@0: } michael@0: michael@0: protected: michael@0: friend class nsRefreshDriver; michael@0: michael@0: // IMPORTANT: The ownership implicit in the following member variables michael@0: // has been explicitly checked. If you add any members to this class, michael@0: // please make the ownership explicit (pinkerton, scc). michael@0: michael@0: // These are the same Document and PresContext owned by the DocViewer. michael@0: // we must share ownership. michael@0: nsIDocument* mDocument; // [STRONG] michael@0: nsPresContext* mPresContext; // [STRONG] michael@0: nsStyleSet* mStyleSet; // [OWNS] michael@0: nsCSSFrameConstructor* mFrameConstructor; // [OWNS] michael@0: nsViewManager* mViewManager; // [WEAK] docViewer owns it so I don't have to michael@0: nsPresArena mFrameArena; michael@0: nsFrameSelection* mSelection; michael@0: // Pointer into mFrameConstructor - this is purely so that FrameManager() and michael@0: // GetRootFrame() can be inlined: michael@0: nsFrameManagerBase* mFrameManager; michael@0: mozilla::WeakPtr mForwardingContainer; michael@0: nsRefreshDriver* mHiddenInvalidationObserverRefreshDriver; michael@0: #ifdef ACCESSIBILITY michael@0: mozilla::a11y::DocAccessible* mDocAccessible; michael@0: #endif michael@0: michael@0: #ifdef DEBUG michael@0: nsIFrame* mDrawEventTargetFrame; michael@0: // Ensure that every allocation from the PresArena is eventually freed. michael@0: uint32_t mPresArenaAllocCount; michael@0: #endif michael@0: michael@0: // Count of the number of times this presshell has been painted to a window. michael@0: uint64_t mPaintCount; michael@0: michael@0: nsSize mScrollPositionClampingScrollPortSize; michael@0: michael@0: // This margin is intended to be used when laying out fixed position children michael@0: // on this PresShell's viewport frame. See the documentation of michael@0: // nsIDOMWindowUtils.setContentDocumentFixedPositionMargins for details of michael@0: // their use. michael@0: nsMargin mContentDocumentFixedPositionMargins; michael@0: michael@0: // A list of weak frames. This is a pointer to the last item in the list. michael@0: nsWeakFrame* mWeakFrames; michael@0: michael@0: // Most recent canvas background color. michael@0: nscolor mCanvasBackgroundColor; michael@0: michael@0: // Used to force allocation and rendering of proportionally more or michael@0: // less pixels in the given dimension. michael@0: float mXResolution; michael@0: float mYResolution; michael@0: michael@0: int16_t mSelectionFlags; michael@0: michael@0: // Flags controlling how our document is rendered. These persist michael@0: // between paints and so are tied with retained layer pixels. michael@0: // PresShell flushes retained layers when the rendering state michael@0: // changes in a way that prevents us from being able to (usefully) michael@0: // re-use old pixels. michael@0: RenderFlags mRenderFlags; michael@0: michael@0: // Indicates that the whole document must be restyled. Changes to scoped michael@0: // style sheets are recorded in mChangedScopeStyleRoots rather than here michael@0: // in mStylesHaveChanged. michael@0: bool mStylesHaveChanged : 1; michael@0: bool mDidInitialize : 1; michael@0: bool mIsDestroying : 1; michael@0: bool mIsZombie : 1; michael@0: bool mIsReflowing : 1; michael@0: michael@0: // For all documents we initially lock down painting. michael@0: bool mPaintingSuppressed : 1; michael@0: michael@0: // Whether or not form controls should use nsITheme in this shell. michael@0: bool mIsThemeSupportDisabled : 1; michael@0: michael@0: bool mIsActive : 1; michael@0: bool mFrozen : 1; michael@0: bool mIsFirstPaint : 1; michael@0: bool mObservesMutationsForPrint : 1; michael@0: michael@0: // If true, we have a reflow scheduled. Guaranteed to be false if michael@0: // mReflowContinueTimer is non-null. michael@0: bool mReflowScheduled : 1; michael@0: michael@0: bool mSuppressInterruptibleReflows : 1; michael@0: bool mScrollPositionClampingScrollPortSizeSet : 1; michael@0: michael@0: uint32_t mPresShellId; michael@0: michael@0: // List of subtrees rooted at style scope roots that need to be restyled. michael@0: // When a change to a scoped style sheet is made, we add the style scope michael@0: // root to this array rather than setting mStylesHaveChanged = true, since michael@0: // we know we don't need to restyle the whole document. However, if in the michael@0: // same update block we have already had other changes that require michael@0: // the whole document to be restyled (i.e., mStylesHaveChanged is already michael@0: // true), then we don't bother adding the scope root here. michael@0: nsAutoTArray,1> mChangedScopeStyleRoots; michael@0: michael@0: static nsIContent* gKeyDownTarget; michael@0: michael@0: // Cached font inflation values. This is done to prevent changing of font michael@0: // inflation until a page is reloaded. michael@0: uint32_t mFontSizeInflationEmPerLine; michael@0: uint32_t mFontSizeInflationMinTwips; michael@0: uint32_t mFontSizeInflationLineThreshold; michael@0: bool mFontSizeInflationForceEnabled; michael@0: bool mFontSizeInflationDisabledInMasterProcess; michael@0: bool mFontSizeInflationEnabled; michael@0: bool mPaintingIsFrozen; michael@0: michael@0: // Dirty bit indicating that mFontSizeInflationEnabled needs to be recomputed. michael@0: bool mFontSizeInflationEnabledIsDirty; michael@0: michael@0: // Flag to indicate whether or not there is a reflow on zoom event pending. michael@0: // See IsReflowOnZoomPending() for more information. michael@0: bool mReflowOnZoomPending; michael@0: michael@0: // The maximum width of a line box. Text on a single line that exceeds this michael@0: // width will be wrapped. A value of 0 indicates that no limit is enforced. michael@0: nscoord mMaxLineBoxWidth; michael@0: michael@0: // If a document belongs to an invisible DocShell, this flag must be set michael@0: // to true, so we can avoid any paint calls for widget related to this michael@0: // presshell. michael@0: bool mIsNeverPainting; michael@0: }; michael@0: michael@0: NS_DEFINE_STATIC_IID_ACCESSOR(nsIPresShell, NS_IPRESSHELL_IID) michael@0: michael@0: #endif /* nsIPresShell_h___ */