Merge mozilla-central and tracemonkey. (a=blockers)
[mozilla-central.git] / layout / base / nsIPresShell.h
blobde2343f10c465d5ad717f9ce38af240333c2333b
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 * ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
13 * License.
15 * The Original Code is mozilla.org code.
17 * The Initial Developer of the Original Code is
18 * Netscape Communications Corporation.
19 * Portions created by the Initial Developer are Copyright (C) 1998
20 * the Initial Developer. All Rights Reserved.
22 * Contributor(s):
23 * Steve Clark <buster@netscape.com>
24 * Dan Rosen <dr@netscape.com>
25 * Mihai Sucan <mihai.sucan@gmail.com>
27 * Alternatively, the contents of this file may be used under the terms of
28 * either of the GNU General Public License Version 2 or later (the "GPL"),
29 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
30 * in which case the provisions of the GPL or the LGPL are applicable instead
31 * of those above. If you wish to allow use of your version of this file only
32 * under the terms of either the GPL or the LGPL, and not to allow others to
33 * use your version of this file under the terms of the MPL, indicate your
34 * decision by deleting the provisions above and replace them with the notice
35 * and other provisions required by the GPL or the LGPL. If you do not delete
36 * the provisions above, a recipient may use your version of this file under
37 * the terms of any one of the MPL, the GPL or the LGPL.
39 * ***** END LICENSE BLOCK *****
41 * This Original Code has been modified by IBM Corporation.
42 * Modifications made by IBM described herein are
43 * Copyright (c) International Business Machines
44 * Corporation, 2000
46 * Modifications to Mozilla code or documentation
47 * identified per MPL Section 3.3
49 * Date Modified by Description of modification
50 * 05/03/2000 IBM Corp. Observer related defines for reflow
53 /* a presentation of a document, part 2 */
55 #ifndef nsIPresShell_h___
56 #define nsIPresShell_h___
58 #include "nsTHashtable.h"
59 #include "nsHashKeys.h"
60 #include "nsISupports.h"
61 #include "nsQueryFrame.h"
62 #include "nsCoord.h"
63 #include "nsColor.h"
64 #include "nsEvent.h"
65 #include "nsCompatibility.h"
66 #include "nsFrameManagerBase.h"
67 #include "nsRect.h"
68 #include "mozFlushType.h"
69 #include "nsWeakReference.h"
70 #include <stdio.h> // for FILE definition
71 #include "nsChangeHint.h"
73 class nsIContent;
74 class nsIDocument;
75 class nsIFrame;
76 class nsPresContext;
77 class nsStyleSet;
78 class nsIViewManager;
79 class nsIView;
80 class nsIRenderingContext;
81 class nsIPageSequenceFrame;
82 class nsAString;
83 class nsCaret;
84 class nsFrameSelection;
85 class nsFrameManager;
86 class nsILayoutHistoryState;
87 class nsIReflowCallback;
88 class nsIDOMNode;
89 class nsIntRegion;
90 class nsIStyleSheet;
91 class nsCSSFrameConstructor;
92 class nsISelection;
93 template<class E> class nsCOMArray;
94 class nsWeakFrame;
95 class nsIScrollableFrame;
96 class gfxASurface;
97 class gfxContext;
98 class nsIDOMEvent;
99 class nsDisplayList;
100 class nsDisplayListBuilder;
101 class nsPIDOMWindow;
102 struct nsPoint;
103 struct nsIntPoint;
104 struct nsIntRect;
105 class nsRefreshDriver;
106 class nsARefreshObserver;
107 #ifdef ACCESSIBILITY
108 class nsAccessibilityService;
109 #endif
111 typedef short SelectionType;
112 typedef PRUint64 nsFrameState;
114 namespace mozilla {
115 namespace dom {
116 class Element;
117 } // namespace dom
119 namespace layers{
120 class LayerManager;
121 } // namespace layers
122 } // namespace mozilla
124 // Flags to pass to SetCapturingContent
126 // when assigning capture, ignore whether capture is allowed or not
127 #define CAPTURE_IGNOREALLOWED 1
128 // true if events should be targeted at the capturing content or its children
129 #define CAPTURE_RETARGETTOELEMENT 2
130 // true if the current capture wants drags to be prevented
131 #define CAPTURE_PREVENTDRAG 4
133 typedef struct CapturingContentInfo {
134 // capture should only be allowed during a mousedown event
135 PRPackedBool mAllowed;
136 PRPackedBool mRetargetToElement;
137 PRPackedBool mPreventDrag;
138 nsIContent* mContent;
139 } CapturingContentInfo;
141 #define NS_IPRESSHELL_IID \
142 { 0xd1978bee, 0x43b9, 0x40de, \
143 { 0x95, 0x47, 0x85, 0x06, 0x5e, 0x02, 0xec, 0xb4 } }
145 #define NS_IPRESSHELL_MOZILLA_2_0_BRANCH_IID \
146 { 0x4abb9970, 0xd7ce, 0x4c02, \
147 { 0x8a, 0xdb, 0x42, 0xc6, 0xbd, 0xa8, 0x95, 0xb7 } }
149 #define NS_IPRESSHELL_MOZILLA_2_0_BRANCH2_IID \
150 { 0x5ff6fd00, 0x1ba9, 0x11e0, \
151 { 0xac, 0x64, 0x08, 0x00, 0x20, 0x0c, 0x9a, 0x66 } }
153 // Constants for ScrollContentIntoView() function
154 #define NS_PRESSHELL_SCROLL_TOP 0
155 #define NS_PRESSHELL_SCROLL_BOTTOM 100
156 #define NS_PRESSHELL_SCROLL_LEFT 0
157 #define NS_PRESSHELL_SCROLL_RIGHT 100
158 #define NS_PRESSHELL_SCROLL_CENTER 50
159 #define NS_PRESSHELL_SCROLL_ANYWHERE -1
160 #define NS_PRESSHELL_SCROLL_IF_NOT_VISIBLE -2
162 // debug VerifyReflow flags
163 #define VERIFY_REFLOW_ON 0x01
164 #define VERIFY_REFLOW_NOISY 0x02
165 #define VERIFY_REFLOW_ALL 0x04
166 #define VERIFY_REFLOW_DUMP_COMMANDS 0x08
167 #define VERIFY_REFLOW_NOISY_RC 0x10
168 #define VERIFY_REFLOW_REALLY_NOISY_RC 0x20
169 #define VERIFY_REFLOW_DURING_RESIZE_REFLOW 0x40
171 #undef NOISY_INTERRUPTIBLE_REFLOW
173 enum nsRectVisibility {
174 nsRectVisibility_kVisible,
175 nsRectVisibility_kAboveViewport,
176 nsRectVisibility_kBelowViewport,
177 nsRectVisibility_kLeftOfViewport,
178 nsRectVisibility_kRightOfViewport
181 class nsIPresShell_MOZILLA_2_0_BRANCH : public nsISupports {
182 public:
183 NS_DECLARE_STATIC_IID_ACCESSOR(NS_IPRESSHELL_MOZILLA_2_0_BRANCH_IID)
185 virtual PRBool GetIsViewportOverridden() = 0;
188 * Add a solid color item to the bottom of aList with frame aFrame and bounds
189 * aBounds. Checks first if this needs to be done by checking if aFrame is a
190 * canvas frame (if the FORCE_DRAW flag is passed then this check is skipped).
191 * aBackstopColor is composed behind the background color of the canvas, it is
192 * transparent by default. The ROOT_CONTENT_DOC_BG flag indicates that this is
193 * the background for the root content document.
195 enum {
196 FORCE_DRAW = 0x01,
197 ROOT_CONTENT_DOC_BG = 0x02
199 virtual nsresult AddCanvasBackgroundColorItem2(nsDisplayListBuilder& aBuilder,
200 nsDisplayList& aList,
201 nsIFrame* aFrame,
202 const nsRect& aBounds,
203 nscolor aBackstopColor = NS_RGBA(0,0,0,0),
204 PRUint32 aFlags = 0) = 0;
208 NS_DEFINE_STATIC_IID_ACCESSOR(nsIPresShell_MOZILLA_2_0_BRANCH,
209 NS_IPRESSHELL_MOZILLA_2_0_BRANCH_IID)
211 class nsIPresShell_MOZILLA_2_0_BRANCH2 : public nsISupports {
212 public:
213 NS_DECLARE_STATIC_IID_ACCESSOR(NS_IPRESSHELL_MOZILLA_2_0_BRANCH2_IID)
216 * Return true if the presshell expects layout flush.
218 virtual PRBool IsLayoutFlushObserver() = 0;
221 NS_DEFINE_STATIC_IID_ACCESSOR(nsIPresShell_MOZILLA_2_0_BRANCH2,
222 NS_IPRESSHELL_MOZILLA_2_0_BRANCH2_IID)
225 * Presentation shell interface. Presentation shells are the
226 * controlling point for managing the presentation of a document. The
227 * presentation shell holds a live reference to the document, the
228 * presentation context, the style manager, the style set and the root
229 * frame. <p>
231 * When this object is Release'd, it will release the document, the
232 * presentation context, the style manager, the style set and the root
233 * frame.
236 // hack to make egcs / gcc 2.95.2 happy
237 class nsIPresShell_base : public nsISupports
239 public:
240 NS_DECLARE_STATIC_IID_ACCESSOR(NS_IPRESSHELL_IID)
243 NS_DEFINE_STATIC_IID_ACCESSOR(nsIPresShell_base, NS_IPRESSHELL_IID)
245 class nsIPresShell : public nsIPresShell_base
247 protected:
248 typedef mozilla::layers::LayerManager LayerManager;
250 enum {
251 STATE_IGNORING_VIEWPORT_SCROLLING = 0x1,
252 STATE_USING_DISPLAYPORT = 0x2
255 public:
256 virtual NS_HIDDEN_(nsresult) Init(nsIDocument* aDocument,
257 nsPresContext* aPresContext,
258 nsIViewManager* aViewManager,
259 nsStyleSet* aStyleSet,
260 nsCompatibility aCompatMode) = 0;
263 * All callers are responsible for calling |Destroy| after calling
264 * |EndObservingDocument|. It needs to be separate only because form
265 * controls incorrectly store their data in the frames rather than the
266 * content model and printing calls |EndObservingDocument| multiple
267 * times to make form controls behave nicely when printed.
269 virtual NS_HIDDEN_(void) Destroy() = 0;
271 PRBool IsDestroying() { return mIsDestroying; }
273 // All frames owned by the shell are allocated from an arena. They
274 // are also recycled using free lists. Separate free lists are
275 // maintained for each frame type (aCode), which must always
276 // correspond to the same aSize value. AllocateFrame clears the
277 // memory that it returns.
278 virtual void* AllocateFrame(nsQueryFrame::FrameIID aCode, size_t aSize) = 0;
279 virtual void FreeFrame(nsQueryFrame::FrameIID aCode, void* aChunk) = 0;
281 // Objects closely related to the frame tree, but that are not
282 // actual frames (subclasses of nsFrame) are also allocated from the
283 // arena, and recycled via a separate set of per-size free lists.
284 // AllocateMisc does *not* clear the memory that it returns.
285 virtual void* AllocateMisc(size_t aSize) = 0;
286 virtual void FreeMisc(size_t aSize, void* aChunk) = 0;
289 * Stack memory allocation:
291 * Callers who wish to allocate memory whose lifetime corresponds to
292 * the lifetime of a stack-allocated object can use this API. The
293 * caller must use a pair of calls to PushStackMemory and
294 * PopStackMemory, such that all stack object lifetimes are either
295 * entirely between the calls or containing both calls.
297 * Then, between the calls, the caller can call AllocateStackMemory to
298 * allocate memory from an arena pool that will be freed by the call
299 * to PopStackMemory.
301 * The allocations cannot be for more than 4044 bytes.
303 virtual void PushStackMemory() = 0;
304 virtual void PopStackMemory() = 0;
305 virtual void* AllocateStackMemory(size_t aSize) = 0;
307 nsIDocument* GetDocument() const { return mDocument; }
309 nsPresContext* GetPresContext() const { return mPresContext; }
311 nsIViewManager* GetViewManager() const { return mViewManager; }
313 #ifdef _IMPL_NS_LAYOUT
314 nsStyleSet* StyleSet() const { return mStyleSet; }
316 nsCSSFrameConstructor* FrameConstructor() const { return mFrameConstructor; }
318 nsFrameManager* FrameManager() const {
319 return reinterpret_cast<nsFrameManager*>
320 (&const_cast<nsIPresShell*>(this)->mFrameManager);
323 #endif
325 /* Enable/disable author style level. Disabling author style disables the entire
326 * author level of the cascade, including the HTML preshint level.
328 // XXX these could easily be inlined, but there is a circular #include
329 // problem with nsStyleSet.
330 NS_HIDDEN_(void) SetAuthorStyleDisabled(PRBool aDisabled);
331 NS_HIDDEN_(PRBool) GetAuthorStyleDisabled() const;
334 * Called when stylesheets are added/removed/enabled/disabled to rebuild
335 * all style data for a given pres shell without necessarily reconstructing
336 * all of the frames. This will not reconstruct style synchronously; if
337 * you need to do that, call FlushPendingNotifications to flush out style
338 * reresolves.
339 * // XXXbz why do we have this on the interface anyway? The only consumer
340 * is calling AddOverrideStyleSheet/RemoveOverrideStyleSheet, and I think
341 * those should just handle reconstructing style data...
343 virtual NS_HIDDEN_(void) ReconstructStyleDataExternal();
344 NS_HIDDEN_(void) ReconstructStyleDataInternal();
345 #ifdef _IMPL_NS_LAYOUT
346 void ReconstructStyleData() { ReconstructStyleDataInternal(); }
347 #else
348 void ReconstructStyleData() { ReconstructStyleDataExternal(); }
349 #endif
351 /** Setup all style rules required to implement preferences
352 * - used for background/text/link colors and link underlining
353 * may be extended for any prefs that are implemented via style rules
354 * - aForceReflow argument is used to force a full reframe to make the rules show
355 * (only used when the current page needs to reflect changed pref rules)
357 * - initially created for bugs 31816, 20760, 22963
359 virtual NS_HIDDEN_(nsresult) SetPreferenceStyleRules(PRBool aForceReflow) = 0;
362 * FrameSelection will return the Frame based selection API.
363 * You cannot go back and forth anymore with QI between nsIDOM sel and
364 * nsIFrame sel.
366 already_AddRefed<nsFrameSelection> FrameSelection();
369 * ConstFrameSelection returns an object which methods are safe to use for
370 * example in nsIFrame code.
372 const nsFrameSelection* ConstFrameSelection() const { return mSelection; }
374 // Make shell be a document observer. If called after Destroy() has
375 // been called on the shell, this will be ignored.
376 virtual NS_HIDDEN_(void) BeginObservingDocument() = 0;
378 // Make shell stop being a document observer
379 virtual NS_HIDDEN_(void) EndObservingDocument() = 0;
382 * Return whether InitialReflow() was previously called.
384 PRBool DidInitialReflow() const { return mDidInitialReflow; }
387 * Perform the initial reflow. Constructs the frame for the root content
388 * object and then reflows the frame model into the specified width and
389 * height.
391 * The coordinates for aWidth and aHeight must be in standard nscoords.
393 * Callers of this method must hold a reference to this shell that
394 * is guaranteed to survive through arbitrary script execution.
395 * Calling InitialReflow can execute arbitrary script.
397 virtual NS_HIDDEN_(nsresult) InitialReflow(nscoord aWidth, nscoord aHeight) = 0;
400 * Reflow the frame model into a new width and height. The
401 * coordinates for aWidth and aHeight must be in standard nscoord's.
403 virtual NS_HIDDEN_(nsresult) ResizeReflow(nscoord aWidth, nscoord aHeight) = 0;
405 * Reflow, and also change presshell state so as to only permit
406 * reflowing off calls to ResizeReflowOverride() in the future.
407 * ResizeReflow() calls are ignored after ResizeReflowOverride().
409 virtual NS_HIDDEN_(nsresult) ResizeReflowOverride(nscoord aWidth, nscoord aHeight) = 0;
412 * Reflow the frame model with a reflow reason of eReflowReason_StyleChange
414 virtual NS_HIDDEN_(void) StyleChangeReflow() = 0;
417 * This calls through to the frame manager to get the root frame.
419 virtual NS_HIDDEN_(nsIFrame*) GetRootFrameExternal() const;
420 nsIFrame* GetRootFrame() const {
421 #ifdef _IMPL_NS_LAYOUT
422 return mFrameManager.GetRootFrame();
423 #else
424 return GetRootFrameExternal();
425 #endif
429 * Get root scroll frame from FrameManager()->GetRootFrame().
431 nsIFrame* GetRootScrollFrame() const;
434 * The same as GetRootScrollFrame, but returns an nsIScrollableFrame
436 nsIScrollableFrame* GetRootScrollFrameAsScrollable() const;
439 * The same as GetRootScrollFrame, but returns an nsIScrollableFrame.
440 * Can be called by code not linked into gklayout.
442 virtual nsIScrollableFrame* GetRootScrollFrameAsScrollableExternal() const;
445 * Gets nearest scrollable frame from current focused content or DOM
446 * selection if there is no focused content. The frame is scrollable with
447 * overflow:scroll or overflow:auto in some direction when aDirection is
448 * eEither. Otherwise, this returns a nearest frame that is scrollable in
449 * the specified direction.
451 enum ScrollDirection { eHorizontal, eVertical, eEither };
452 nsIScrollableFrame* GetFrameToScrollAsScrollable(ScrollDirection aDirection);
455 * Returns the page sequence frame associated with the frame hierarchy.
456 * Returns NULL if not a paginated view.
458 virtual NS_HIDDEN_(nsIPageSequenceFrame*) GetPageSequenceFrame() const = 0;
461 * Gets the real primary frame associated with the content object.
463 * In the case of absolutely positioned elements and floated elements,
464 * the real primary frame is the frame that is out of the flow and not the
465 * placeholder frame.
467 virtual NS_HIDDEN_(nsIFrame*) GetRealPrimaryFrameFor(nsIContent* aContent) const = 0;
470 * Gets the placeholder frame associated with the specified frame. This is
471 * a helper frame that forwards the request to the frame manager.
473 virtual NS_HIDDEN_(nsIFrame*) GetPlaceholderFrameFor(nsIFrame* aFrame) const = 0;
476 * Tell the pres shell that a frame needs to be marked dirty and needs
477 * Reflow. It's OK if this is an ancestor of the frame needing reflow as
478 * long as the ancestor chain between them doesn't cross a reflow root. The
479 * bit to add should be either NS_FRAME_IS_DIRTY or
480 * NS_FRAME_HAS_DIRTY_CHILDREN (but not both!).
482 enum IntrinsicDirty {
483 // XXXldb eResize should be renamed
484 eResize, // don't mark any intrinsic widths dirty
485 eTreeChange, // mark intrinsic widths dirty on aFrame and its ancestors
486 eStyleChange // Do eTreeChange, plus all of aFrame's descendants
488 virtual NS_HIDDEN_(void) FrameNeedsReflow(nsIFrame *aFrame,
489 IntrinsicDirty aIntrinsicDirty,
490 nsFrameState aBitToAdd) = 0;
493 * Tell the presshell that the given frame's reflow was interrupted. This
494 * will mark as having dirty children a path from the given frame (inclusive)
495 * to the nearest ancestor with a dirty subtree, or to the reflow root
496 * currently being reflowed if no such ancestor exists (inclusive). This is
497 * to be done immediately after reflow of the current reflow root completes.
498 * This method must only be called during reflow, and the frame it's being
499 * called on must be in the process of being reflowed when it's called. This
500 * method doesn't mark any intrinsic widths dirty and doesn't add any bits
501 * other than NS_FRAME_HAS_DIRTY_CHILDREN.
503 virtual NS_HIDDEN_(void) FrameNeedsToContinueReflow(nsIFrame *aFrame) = 0;
505 virtual NS_HIDDEN_(void) CancelAllPendingReflows() = 0;
508 * Recreates the frames for a node
510 virtual NS_HIDDEN_(nsresult) RecreateFramesFor(nsIContent* aContent) = 0;
512 void PostRecreateFramesFor(mozilla::dom::Element* aElement);
513 void RestyleForAnimation(mozilla::dom::Element* aElement,
514 nsRestyleHint aHint);
517 * Determine if it is safe to flush all pending notifications
518 * @param aIsSafeToFlush PR_TRUE if it is safe, PR_FALSE otherwise.
521 virtual NS_HIDDEN_(PRBool) IsSafeToFlush() const = 0;
524 * Flush pending notifications of the type specified. This method
525 * will not affect the content model; it'll just affect style and
526 * frames. Callers that actually want up-to-date presentation (other
527 * than the document itself) should probably be calling
528 * nsIDocument::FlushPendingNotifications.
530 * @param aType the type of notifications to flush
532 virtual NS_HIDDEN_(void) FlushPendingNotifications(mozFlushType aType) = 0;
535 * Callbacks will be called even if reflow itself fails for
536 * some reason.
538 virtual NS_HIDDEN_(nsresult) PostReflowCallback(nsIReflowCallback* aCallback) = 0;
539 virtual NS_HIDDEN_(void) CancelReflowCallback(nsIReflowCallback* aCallback) = 0;
541 virtual NS_HIDDEN_(void) ClearFrameRefs(nsIFrame* aFrame) = 0;
544 * Get a reference rendering context. This is a context that should not
545 * be rendered to, but is suitable for measuring text and performing
546 * other non-rendering operations.
548 virtual already_AddRefed<nsIRenderingContext> GetReferenceRenderingContext() = 0;
551 * Informs the pres shell that the document is now at the anchor with
552 * the given name. If |aScroll| is true, scrolls the view of the
553 * document so that the anchor with the specified name is displayed at
554 * the top of the window. If |aAnchorName| is empty, then this informs
555 * the pres shell that there is no current target, and |aScroll| must
556 * be false.
558 virtual NS_HIDDEN_(nsresult) GoToAnchor(const nsAString& aAnchorName, PRBool aScroll) = 0;
561 * Tells the presshell to scroll again to the last anchor scrolled to by
562 * GoToAnchor, if any. This scroll only happens if the scroll
563 * position has not changed since the last GoToAnchor. This is called
564 * by nsDocumentViewer::LoadComplete. This clears the last anchor
565 * scrolled to by GoToAnchor (we don't want to keep it alive if it's
566 * removed from the DOM), so don't call this more than once.
568 virtual NS_HIDDEN_(nsresult) ScrollToAnchor() = 0;
571 * Scrolls the view of the document so that the primary frame of the content
572 * is displayed in the window. Layout is flushed before scrolling.
574 * @param aContent The content object of which primary frame should be
575 * scrolled into view.
576 * @param aVPercent How to align the frame vertically. A value of 0
577 * (NS_PRESSHELL_SCROLL_TOP) means the frame's upper edge is
578 * aligned with the top edge of the visible area. A value of
579 * 100 (NS_PRESSHELL_SCROLL_BOTTOM) means the frame's bottom
580 * edge is aligned with the bottom edge of the visible area.
581 * For values in between, the point "aVPercent" down the frame
582 * is placed at the point "aVPercent" down the visible area. A
583 * value of 50 (NS_PRESSHELL_SCROLL_CENTER) centers the frame
584 * vertically. A value of NS_PRESSHELL_SCROLL_ANYWHERE means move
585 * the frame the minimum amount necessary in order for the entire
586 * frame to be visible vertically (if possible)
587 * @param aHPercent How to align the frame horizontally. A value of 0
588 * (NS_PRESSHELL_SCROLL_LEFT) means the frame's left edge is
589 * aligned with the left edge of the visible area. A value of
590 * 100 (NS_PRESSHELL_SCROLL_RIGHT) means the frame's right
591 * edge is aligned with the right edge of the visible area.
592 * For values in between, the point "aVPercent" across the frame
593 * is placed at the point "aVPercent" across the visible area.
594 * A value of 50 (NS_PRESSHELL_SCROLL_CENTER) centers the frame
595 * horizontally . A value of NS_PRESSHELL_SCROLL_ANYWHERE means move
596 * the frame the minimum amount necessary in order for the entire
597 * frame to be visible horizontally (if possible)
598 * @param aFlags If SCROLL_FIRST_ANCESTOR_ONLY is set, only the nearest
599 * scrollable ancestor is scrolled, otherwise all
600 * scrollable ancestors may be scrolled if necessary.
601 * If SCROLL_OVERFLOW_HIDDEN is set then we may scroll in a
602 * direction even if overflow:hidden is specified in that
603 * direction; otherwise we will not scroll in that direction
604 * when overflow:hidden is set for that direction.
605 * If SCROLL_NO_PARENT_FRAMES is set then we only scroll
606 * nodes in this document, not in any parent documents which
607 * contain this document in a iframe or the like.
609 virtual NS_HIDDEN_(nsresult) ScrollContentIntoView(nsIContent* aContent,
610 PRIntn aVPercent,
611 PRIntn aHPercent,
612 PRUint32 aFlags) = 0;
614 enum {
615 SCROLL_FIRST_ANCESTOR_ONLY = 0x01,
616 SCROLL_OVERFLOW_HIDDEN = 0x02,
617 SCROLL_NO_PARENT_FRAMES = 0x04
620 * Scrolls the view of the document so that the given area of a frame
621 * is visible, if possible. Layout is not flushed before scrolling.
623 * @param aRect relative to aFrame
624 * @param aVPercent see ScrollContentIntoView
625 * @param aHPercent see ScrollContentIntoView
626 * @param aFlags if SCROLL_FIRST_ANCESTOR_ONLY is set, only the
627 * nearest scrollable ancestor is scrolled, otherwise all
628 * scrollable ancestors may be scrolled if necessary
629 * if SCROLL_OVERFLOW_HIDDEN is set then we may scroll in a direction
630 * even if overflow:hidden is specified in that direction; otherwise
631 * we will not scroll in that direction when overflow:hidden is
632 * set for that direction
633 * If SCROLL_NO_PARENT_FRAMES is set then we only scroll
634 * nodes in this document, not in any parent documents which
635 * contain this document in a iframe or the like.
636 * @return true if any scrolling happened, false if no scrolling happened
638 virtual PRBool ScrollFrameRectIntoView(nsIFrame* aFrame,
639 const nsRect& aRect,
640 PRIntn aVPercent,
641 PRIntn aHPercent,
642 PRUint32 aFlags) = 0;
645 * Determine if a rectangle specified in the frame's coordinate system
646 * intersects the viewport "enough" to be considered visible.
647 * @param aFrame frame that aRect coordinates are specified relative to
648 * @param aRect rectangle in twips to test for visibility
649 * @param aMinTwips is the minimum distance in from the edge of the viewport
650 * that an object must be to be counted visible
651 * @return nsRectVisibility_kVisible if the rect is visible
652 * nsRectVisibility_kAboveViewport
653 * nsRectVisibility_kBelowViewport
654 * nsRectVisibility_kLeftOfViewport
655 * nsRectVisibility_kRightOfViewport rectangle is outside the viewport
656 * in the specified direction
658 virtual nsRectVisibility GetRectVisibility(nsIFrame *aFrame,
659 const nsRect &aRect,
660 nscoord aMinTwips) const = 0;
663 * Suppress notification of the frame manager that frames are
664 * being destroyed.
666 virtual NS_HIDDEN_(void) SetIgnoreFrameDestruction(PRBool aIgnore) = 0;
669 * Notification sent by a frame informing the pres shell that it is about to
670 * be destroyed.
671 * This allows any outstanding references to the frame to be cleaned up
673 virtual NS_HIDDEN_(void) NotifyDestroyingFrame(nsIFrame* aFrame) = 0;
676 * Get link location.
678 virtual NS_HIDDEN_(nsresult) GetLinkLocation(nsIDOMNode* aNode, nsAString& aLocation) const = 0;
681 * Get the caret, if it exists. AddRefs it.
683 virtual NS_HIDDEN_(already_AddRefed<nsCaret>) GetCaret() const = 0;
686 * Invalidate the caret's current position if it's outside of its frame's
687 * boundaries. This function is useful if you're batching selection
688 * notifications and might remove the caret's frame out from under it.
690 virtual NS_HIDDEN_(void) MaybeInvalidateCaretPosition() = 0;
693 * Set the current caret to a new caret. To undo this, call RestoreCaret.
695 virtual void SetCaret(nsCaret *aNewCaret) = 0;
698 * Restore the caret to the original caret that this pres shell was created
699 * with.
701 virtual void RestoreCaret() = 0;
704 * Should the images have borders etc. Actual visual effects are determined
705 * by the frames. Visual effects may not effect layout, only display.
706 * Takes effect on next repaint, does not force a repaint itself.
708 * @param aInEnable if PR_TRUE, visual selection effects are enabled
709 * if PR_FALSE visual selection effects are disabled
711 NS_IMETHOD SetSelectionFlags(PRInt16 aInEnable) = 0;
713 /**
714 * Gets the current state of non text selection effects
715 * @return current state of non text selection,
716 * as set by SetDisplayNonTextSelection
718 PRInt16 GetSelectionFlags() const { return mSelectionFlags; }
720 virtual nsISelection* GetCurrentSelection(SelectionType aType) = 0;
723 * Interface to dispatch events via the presshell
724 * @note The caller must have a strong reference to the PresShell.
726 virtual NS_HIDDEN_(nsresult) HandleEventWithTarget(nsEvent* aEvent,
727 nsIFrame* aFrame,
728 nsIContent* aContent,
729 nsEventStatus* aStatus) = 0;
732 * Dispatch event to content only (NOT full processing)
733 * @note The caller must have a strong reference to the PresShell.
735 virtual NS_HIDDEN_(nsresult) HandleDOMEventWithTarget(nsIContent* aTargetContent,
736 nsEvent* aEvent,
737 nsEventStatus* aStatus) = 0;
740 * Dispatch event to content only (NOT full processing)
741 * @note The caller must have a strong reference to the PresShell.
743 virtual NS_HIDDEN_(nsresult) HandleDOMEventWithTarget(nsIContent* aTargetContent,
744 nsIDOMEvent* aEvent,
745 nsEventStatus* aStatus) = 0;
748 * Gets the current target event frame from the PresShell
750 virtual NS_HIDDEN_(nsIFrame*) GetEventTargetFrame() = 0;
753 * Gets the current target event frame from the PresShell
755 virtual NS_HIDDEN_(already_AddRefed<nsIContent>) GetEventTargetContent(nsEvent* aEvent) = 0;
758 * Get and set the history state for the current document
761 virtual NS_HIDDEN_(nsresult) CaptureHistoryState(nsILayoutHistoryState** aLayoutHistoryState, PRBool aLeavingPage = PR_FALSE) = 0;
764 * Determine if reflow is currently locked
765 * returns PR_TRUE if reflow is locked, PR_FALSE otherwise
767 PRBool IsReflowLocked() const { return mIsReflowing; }
770 * Called to find out if painting is suppressed for this presshell. If it is suppressd,
771 * we don't allow the painting of any layer but the background, and we don't
772 * recur into our children.
774 PRBool IsPaintingSuppressed() const { return mPaintingSuppressed; }
777 * Unsuppress painting.
779 virtual NS_HIDDEN_(void) UnsuppressPainting() = 0;
782 * Called to disable nsITheme support in a specific presshell.
784 void DisableThemeSupport()
786 // Doesn't have to be dynamic. Just set the bool.
787 mIsThemeSupportDisabled = PR_TRUE;
791 * Indicates whether theme support is enabled.
793 PRBool IsThemeSupportEnabled() const { return !mIsThemeSupportDisabled; }
796 * Get the set of agent style sheets for this presentation
798 virtual nsresult GetAgentStyleSheets(nsCOMArray<nsIStyleSheet>& aSheets) = 0;
801 * Replace the set of agent style sheets
803 virtual nsresult SetAgentStyleSheets(const nsCOMArray<nsIStyleSheet>& aSheets) = 0;
806 * Add an override style sheet for this presentation
808 virtual nsresult AddOverrideStyleSheet(nsIStyleSheet *aSheet) = 0;
811 * Remove an override style sheet
813 virtual nsresult RemoveOverrideStyleSheet(nsIStyleSheet *aSheet) = 0;
816 * Reconstruct frames for all elements in the document
818 virtual nsresult ReconstructFrames() = 0;
821 * Given aFrame, the root frame of a stacking context, find its descendant
822 * frame under the point aPt that receives a mouse event at that location,
823 * or nsnull if there is no such frame.
824 * @param aPt the point, relative to the frame origin
826 virtual nsIFrame* GetFrameForPoint(nsIFrame* aFrame, nsPoint aPt) = 0;
829 * See if reflow verification is enabled. To enable reflow verification add
830 * "verifyreflow:1" to your NSPR_LOG_MODULES environment variable
831 * (any non-zero debug level will work). Or, call SetVerifyReflowEnable
832 * with PR_TRUE.
834 static PRBool GetVerifyReflowEnable();
837 * Set the verify-reflow enable flag.
839 static void SetVerifyReflowEnable(PRBool aEnabled);
841 virtual nsIFrame* GetAbsoluteContainingBlock(nsIFrame* aFrame);
843 #ifdef MOZ_REFLOW_PERF
844 virtual NS_HIDDEN_(void) DumpReflows() = 0;
845 virtual NS_HIDDEN_(void) CountReflows(const char * aName, nsIFrame * aFrame) = 0;
846 virtual NS_HIDDEN_(void) PaintCount(const char * aName,
847 nsIRenderingContext* aRenderingContext,
848 nsPresContext * aPresContext,
849 nsIFrame * aFrame,
850 PRUint32 aColor) = 0;
851 virtual NS_HIDDEN_(void) SetPaintFrameCount(PRBool aOn) = 0;
852 virtual PRBool IsPaintingFrameCounts() = 0;
853 #endif
855 #ifdef DEBUG
856 // Debugging hooks
857 virtual void ListStyleContexts(nsIFrame *aRootFrame, FILE *out,
858 PRInt32 aIndent = 0) = 0;
860 virtual void ListStyleSheets(FILE *out, PRInt32 aIndent = 0) = 0;
861 virtual void VerifyStyleTree() = 0;
862 #endif
864 static PRBool gIsAccessibilityActive;
865 static PRBool IsAccessibilityActive() { return gIsAccessibilityActive; }
867 #ifdef ACCESSIBILITY
869 * Return accessibility service if accessibility is active.
871 static nsAccessibilityService* AccService();
872 #endif
875 * Stop all active elements (plugins and the caret) in this presentation and
876 * in the presentations of subdocuments. Resets painting to a suppressed state.
877 * XXX this should include image animations
879 virtual void Freeze() = 0;
880 PRBool IsFrozen() { return mFrozen; }
883 * Restarts active elements (plugins) in this presentation and in the
884 * presentations of subdocuments, then do a full invalidate of the content area.
886 virtual void Thaw() = 0;
888 virtual void FireOrClearDelayedEvents(PRBool aFireEvents) = 0;
891 * When this shell is disconnected from its containing docshell, we
892 * lose our container pointer. However, we'd still like to be able to target
893 * user events at the docshell's parent. This pointer allows us to do that.
894 * It should not be used for any other purpose.
896 void SetForwardingContainer(nsWeakPtr aContainer)
898 mForwardingContainer = aContainer;
902 * Render the document into an arbitrary gfxContext
903 * Designed for getting a picture of a document or a piece of a document
904 * Note that callers will generally want to call FlushPendingNotifications
905 * to get an up-to-date view of the document
906 * @param aRect is the region to capture into the offscreen buffer, in the
907 * root frame's coordinate system (if aIgnoreViewportScrolling is false)
908 * or in the root scrolled frame's coordinate system
909 * (if aIgnoreViewportScrolling is true). The coordinates are in appunits.
910 * @param aFlags see below;
911 * set RENDER_IS_UNTRUSTED if the contents may be passed to malicious
912 * agents. E.g. we might choose not to paint the contents of sensitive widgets
913 * such as the file name in a file upload widget, and we might choose not
914 * to paint themes.
915 * set RENDER_IGNORE_VIEWPORT_SCROLLING to ignore
916 * clipping/scrolling/scrollbar painting due to scrolling in the viewport
917 * set RENDER_CARET to draw the caret if one would be visible
918 * (by default the caret is never drawn)
919 * set RENDER_USE_LAYER_MANAGER to force rendering to go through
920 * the layer manager for the window. This may be unexpectedly slow
921 * (if the layer manager must read back data from the GPU) or low-quality
922 * (if the layer manager reads back pixel data and scales it
923 * instead of rendering using the appropriate scaling). It may also
924 * slow everything down if the area rendered does not correspond to the
925 * normal visible area of the window.
926 * set RENDER_ASYNC_DECODE_IMAGES to avoid having images synchronously
927 * decoded during rendering.
928 * (by default images decode synchronously with RenderDocument)
929 * set RENDER_DOCUMENT_RELATIVE to interpret |aRect| relative to the
930 * document instead of the CSS viewport
931 * @param aBackgroundColor a background color to render onto
932 * @param aRenderedContext the gfxContext to render to. We render so that
933 * one CSS pixel in the source document is rendered to one unit in the current
934 * transform.
936 enum {
937 RENDER_IS_UNTRUSTED = 0x01,
938 RENDER_IGNORE_VIEWPORT_SCROLLING = 0x02,
939 RENDER_CARET = 0x04,
940 RENDER_USE_WIDGET_LAYERS = 0x08,
941 RENDER_ASYNC_DECODE_IMAGES = 0x10,
942 RENDER_DOCUMENT_RELATIVE = 0x20
944 virtual NS_HIDDEN_(nsresult) RenderDocument(const nsRect& aRect, PRUint32 aFlags,
945 nscolor aBackgroundColor,
946 gfxContext* aRenderedContext) = 0;
949 * Renders a node aNode to a surface and returns it. The aRegion may be used
950 * to clip the rendering. This region is measured in CSS pixels from the
951 * edge of the presshell area. The aPoint, aScreenRect and aSurface
952 * arguments function in a similar manner as RenderSelection.
954 virtual already_AddRefed<gfxASurface> RenderNode(nsIDOMNode* aNode,
955 nsIntRegion* aRegion,
956 nsIntPoint& aPoint,
957 nsIntRect* aScreenRect) = 0;
960 * Renders a selection to a surface and returns it. This method is primarily
961 * intended to create the drag feedback when dragging a selection.
963 * aScreenRect will be filled in with the bounding rectangle of the
964 * selection area on screen.
966 * If the area of the selection is large, the image will be scaled down.
967 * The argument aPoint is used in this case as a reference point when
968 * determining the new screen rectangle after scaling. Typically, this
969 * will be the mouse position, so that the screen rectangle is positioned
970 * such that the mouse is over the same point in the scaled image as in
971 * the original. When scaling does not occur, the mouse point isn't used
972 * as the position can be determined from the displayed frames.
974 virtual already_AddRefed<gfxASurface> RenderSelection(nsISelection* aSelection,
975 nsIntPoint& aPoint,
976 nsIntRect* aScreenRect) = 0;
978 void AddWeakFrameInternal(nsWeakFrame* aWeakFrame);
979 virtual void AddWeakFrameExternal(nsWeakFrame* aWeakFrame);
981 void AddWeakFrame(nsWeakFrame* aWeakFrame)
983 #ifdef _IMPL_NS_LAYOUT
984 AddWeakFrameInternal(aWeakFrame);
985 #else
986 AddWeakFrameExternal(aWeakFrame);
987 #endif
990 void RemoveWeakFrameInternal(nsWeakFrame* aWeakFrame);
991 virtual void RemoveWeakFrameExternal(nsWeakFrame* aWeakFrame);
993 void RemoveWeakFrame(nsWeakFrame* aWeakFrame)
995 #ifdef _IMPL_NS_LAYOUT
996 RemoveWeakFrameInternal(aWeakFrame);
997 #else
998 RemoveWeakFrameExternal(aWeakFrame);
999 #endif
1002 #ifdef NS_DEBUG
1003 nsIFrame* GetDrawEventTargetFrame() { return mDrawEventTargetFrame; }
1004 #endif
1007 * Stop or restart non synthetic test mouse event handling on *all*
1008 * presShells.
1010 * @param aDisable If true, disable all non synthetic test mouse
1011 * events on all presShells. Otherwise, enable them.
1013 virtual NS_HIDDEN_(void) DisableNonTestMouseEvents(PRBool aDisable) = 0;
1016 * Record the background color of the most recently drawn canvas. This color
1017 * is composited on top of the user's default background color and then used
1018 * to draw the background color of the canvas. See PresShell::Paint,
1019 * PresShell::PaintDefaultBackground, and nsDocShell::SetupNewViewer;
1020 * bug 488242, bug 476557 and other bugs mentioned there.
1022 void SetCanvasBackground(nscolor aColor) { mCanvasBackgroundColor = aColor; }
1023 nscolor GetCanvasBackground() { return mCanvasBackgroundColor; }
1026 * Use the current frame tree (if it exists) to update the background
1027 * color of the most recently drawn canvas.
1029 virtual void UpdateCanvasBackground() = 0;
1032 * Add a solid color item to the bottom of aList with frame aFrame and
1033 * bounds aBounds. Checks first if this needs to be done by checking if
1034 * aFrame is a canvas frame (if aForceDraw is true then this check is
1035 * skipped). aBackstopColor is composed behind the background color of
1036 * the canvas, it is transparent by default.
1038 virtual nsresult AddCanvasBackgroundColorItem(nsDisplayListBuilder& aBuilder,
1039 nsDisplayList& aList,
1040 nsIFrame* aFrame,
1041 const nsRect& aBounds,
1042 nscolor aBackstopColor = NS_RGBA(0,0,0,0),
1043 PRBool aForceDraw = PR_FALSE) = 0;
1046 * Add a solid color item to the bottom of aList with frame aFrame and
1047 * bounds aBounds representing the dark grey background behind the page of a
1048 * print preview presentation.
1050 virtual nsresult AddPrintPreviewBackgroundItem(nsDisplayListBuilder& aBuilder,
1051 nsDisplayList& aList,
1052 nsIFrame* aFrame,
1053 const nsRect& aBounds) = 0;
1056 * Computes the backstop color for the view: transparent if in a transparent
1057 * widget, otherwise the PresContext default background color. This color is
1058 * only visible if the contents of the view as a whole are translucent.
1060 virtual nscolor ComputeBackstopColor(nsIView* aDisplayRoot) = 0;
1062 void ObserveNativeAnonMutationsForPrint(PRBool aObserve)
1064 mObservesMutationsForPrint = aObserve;
1066 PRBool ObservesNativeAnonMutationsForPrint()
1068 return mObservesMutationsForPrint;
1071 virtual nsresult SetIsActive(PRBool aIsActive) = 0;
1073 PRBool IsActive()
1075 return mIsActive;
1078 // mouse capturing
1080 static CapturingContentInfo gCaptureInfo;
1083 * When capturing content is set, it traps all mouse events and retargets
1084 * them at this content node. If capturing is not allowed
1085 * (gCaptureInfo.mAllowed is false), then capturing is not set. However, if
1086 * the CAPTURE_IGNOREALLOWED flag is set, the allowed state is ignored and
1087 * capturing is set regardless. To disable capture, pass null for the value
1088 * of aContent.
1090 * If CAPTURE_RETARGETTOELEMENT is set, all mouse events are targeted at
1091 * aContent only. Otherwise, mouse events are targeted at aContent or its
1092 * descendants. That is, descendants of aContent receive mouse events as
1093 * they normally would, but mouse events outside of aContent are retargeted
1094 * to aContent.
1096 * If CAPTURE_PREVENTDRAG is set then drags are prevented from starting while
1097 * this capture is active.
1099 static void SetCapturingContent(nsIContent* aContent, PRUint8 aFlags);
1102 * Return the active content currently capturing the mouse if any.
1104 static nsIContent* GetCapturingContent()
1106 return gCaptureInfo.mContent;
1110 * Allow or disallow mouse capturing.
1112 static void AllowMouseCapture(PRBool aAllowed)
1114 gCaptureInfo.mAllowed = aAllowed;
1118 * Returns true if there is an active mouse capture that wants to prevent
1119 * drags.
1121 static PRBool IsMouseCapturePreventingDrag()
1123 return gCaptureInfo.mPreventDrag && gCaptureInfo.mContent;
1127 * Keep track of how many times this presshell has been rendered to
1128 * a window.
1130 PRUint64 GetPaintCount() { return mPaintCount; }
1131 void IncrementPaintCount() { ++mPaintCount; }
1134 * Get the root DOM window of this presShell.
1136 virtual already_AddRefed<nsPIDOMWindow> GetRootWindow() = 0;
1139 * Get the layer manager for the widget of the root view, if it has
1140 * one.
1142 virtual LayerManager* GetLayerManager() = 0;
1145 * Track whether we're ignoring viewport scrolling for the purposes
1146 * of painting. If we are ignoring, then layers aren't clipped to
1147 * the CSS viewport and scrollbars aren't drawn.
1149 virtual void SetIgnoreViewportScrolling(PRBool aIgnore) = 0;
1150 PRBool IgnoringViewportScrolling() const
1151 { return mRenderFlags & STATE_IGNORING_VIEWPORT_SCROLLING; }
1154 * Set up a "displayport", which overrides what everything else thinks
1155 * is the visible region of this document with the specified
1156 * displayport rect.
1158 virtual void SetDisplayPort(const nsRect& aDisplayPort) = 0;
1159 PRBool UsingDisplayPort() const
1160 { return mRenderFlags & STATE_USING_DISPLAYPORT; }
1163 * Return the displayport being used. |UsingDisplayPort()| must be
1164 * true.
1166 nsRect GetDisplayPort()
1168 NS_ABORT_IF_FALSE(UsingDisplayPort(), "no displayport defined!");
1169 return mDisplayPort;
1173 * Set a "resolution" for the document, which if not 1.0 will
1174 * allocate more or fewer pixels for rescalable content by a factor
1175 * of |resolution| in both dimensions. Return NS_OK iff the
1176 * resolution bounds are sane, and the resolution of this was
1177 * actually updated.
1179 * The resolution defaults to 1.0.
1181 virtual nsresult SetResolution(float aXResolution, float aYResolution) = 0;
1182 float GetXResolution() { return mXResolution; }
1183 float GetYResolution() { return mYResolution; }
1186 * Dispatch a mouse move event based on the most recent mouse position if
1187 * this PresShell is visible. This is used when the contents of the page
1188 * moved (aFromScroll is false) or scrolled (aFromScroll is true).
1190 virtual void SynthesizeMouseMove(PRBool aFromScroll) = 0;
1193 * Refresh observer management.
1195 protected:
1196 virtual PRBool AddRefreshObserverExternal(nsARefreshObserver* aObserver,
1197 mozFlushType aFlushType);
1198 PRBool AddRefreshObserverInternal(nsARefreshObserver* aObserver,
1199 mozFlushType aFlushType);
1200 virtual PRBool RemoveRefreshObserverExternal(nsARefreshObserver* aObserver,
1201 mozFlushType aFlushType);
1202 PRBool RemoveRefreshObserverInternal(nsARefreshObserver* aObserver,
1203 mozFlushType aFlushType);
1204 public:
1205 PRBool AddRefreshObserver(nsARefreshObserver* aObserver,
1206 mozFlushType aFlushType) {
1207 #ifdef _IMPL_NS_LAYOUT
1208 return AddRefreshObserverInternal(aObserver, aFlushType);
1209 #else
1210 return AddRefreshObserverExternal(aObserver, aFlushType);
1211 #endif
1214 PRBool RemoveRefreshObserver(nsARefreshObserver* aObserver,
1215 mozFlushType aFlushType) {
1216 #ifdef _IMPL_NS_LAYOUT
1217 return RemoveRefreshObserverInternal(aObserver, aFlushType);
1218 #else
1219 return RemoveRefreshObserverExternal(aObserver, aFlushType);
1220 #endif
1224 * Initialize and shut down static variables.
1226 static void InitializeStatics();
1227 static void ReleaseStatics();
1229 protected:
1230 friend class nsRefreshDriver;
1232 // IMPORTANT: The ownership implicit in the following member variables
1233 // has been explicitly checked. If you add any members to this class,
1234 // please make the ownership explicit (pinkerton, scc).
1236 // these are the same Document and PresContext owned by the DocViewer.
1237 // we must share ownership.
1238 nsIDocument* mDocument; // [STRONG]
1239 nsPresContext* mPresContext; // [STRONG]
1240 nsStyleSet* mStyleSet; // [OWNS]
1241 nsCSSFrameConstructor* mFrameConstructor; // [OWNS]
1242 nsIViewManager* mViewManager; // [WEAK] docViewer owns it so I don't have to
1243 nsFrameSelection* mSelection;
1244 nsFrameManagerBase mFrameManager; // [OWNS]
1245 nsWeakPtr mForwardingContainer;
1247 #ifdef NS_DEBUG
1248 nsIFrame* mDrawEventTargetFrame;
1249 #endif
1251 // Count of the number of times this presshell has been painted to
1252 // a window
1253 PRUint64 mPaintCount;
1255 PRInt16 mSelectionFlags;
1257 PRPackedBool mStylesHaveChanged;
1258 PRPackedBool mDidInitialReflow;
1259 PRPackedBool mIsDestroying;
1260 PRPackedBool mIsReflowing;
1261 PRPackedBool mPaintingSuppressed; // For all documents we initially lock down painting.
1262 PRPackedBool mIsThemeSupportDisabled; // Whether or not form controls should use nsITheme in this shell.
1263 PRPackedBool mIsActive;
1264 PRPackedBool mFrozen;
1266 PRPackedBool mObservesMutationsForPrint;
1268 PRPackedBool mReflowScheduled; // If true, we have a reflow
1269 // scheduled. Guaranteed to be
1270 // false if mReflowContinueTimer
1271 // is non-null.
1273 PRPackedBool mSuppressInterruptibleReflows;
1275 // A list of weak frames. This is a pointer to the last item in the list.
1276 nsWeakFrame* mWeakFrames;
1278 // Most recent canvas background color.
1279 nscolor mCanvasBackgroundColor;
1281 // Flags controlling how our document is rendered. These persist
1282 // between paints and so are tied with retained layer pixels.
1283 // PresShell flushes retained layers when the rendering state
1284 // changes in a way that prevents us from being able to (usefully)
1285 // re-use old pixels.
1286 PRUint32 mRenderFlags;
1287 // If displayport rendering has been requested, |UsingDisplayPort()|
1288 // is true and |mDisplayPort| defines the "visible rect" we
1289 // maintain.
1290 nsRect mDisplayPort;
1292 // Used to force allocation and rendering of proportionally more or
1293 // less pixels in the given dimension.
1294 float mXResolution;
1295 float mYResolution;
1297 // Live pres shells, for memory and other tracking
1298 typedef nsPtrHashKey<nsIPresShell> PresShellPtrKey;
1299 static nsTHashtable<PresShellPtrKey> *sLiveShells;
1301 static nsIContent* gKeyDownTarget;
1305 * Create a new empty presentation shell. Upon success, call Init
1306 * before attempting to use the shell.
1308 nsresult
1309 NS_NewPresShell(nsIPresShell** aInstancePtrResult);
1311 #endif /* nsIPresShell_h___ */