1998-04-14 00:24:54 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
*
|
1999-11-06 06:40:37 +03:00
|
|
|
* The contents of this file are subject to the Netscape Public
|
|
|
|
* License Version 1.1 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.mozilla.org/NPL/
|
1998-04-14 00:24:54 +04:00
|
|
|
*
|
1999-11-06 06:40:37 +03:00
|
|
|
* Software distributed under the License is distributed on an "AS
|
|
|
|
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
|
|
|
* implied. See the License for the specific language governing
|
|
|
|
* rights and limitations under the License.
|
1998-04-14 00:24:54 +04:00
|
|
|
*
|
1999-11-06 06:40:37 +03:00
|
|
|
* The Original Code is mozilla.org code.
|
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is Netscape
|
1998-04-14 00:24:54 +04:00
|
|
|
* Communications Corporation. Portions created by Netscape are
|
1999-11-06 06:40:37 +03:00
|
|
|
* Copyright (C) 1998 Netscape Communications Corporation. All
|
|
|
|
* Rights Reserved.
|
2000-06-23 08:01:19 +04:00
|
|
|
*
|
2001-04-18 10:06:31 +04:00
|
|
|
* Contributor(s):
|
|
|
|
* Steve Clark <buster@netscape.com>
|
|
|
|
* Dan Rosen <dr@netscape.com>
|
2000-05-15 07:36:34 +04:00
|
|
|
*
|
|
|
|
* IBM Corporation
|
|
|
|
*
|
|
|
|
* This Original Code has been modified by IBM Corporation.
|
|
|
|
* Modifications made by IBM described herein are
|
|
|
|
* Copyright (c) International Business Machines
|
|
|
|
* Corporation, 2000
|
|
|
|
*
|
|
|
|
* Modifications to Mozilla code or documentation
|
|
|
|
* identified per MPL Section 3.3
|
|
|
|
*
|
|
|
|
* Date Modified by Description of modification
|
|
|
|
* 05/03/2000 IBM Corp. Observer related defines for reflow
|
1998-04-14 00:24:54 +04:00
|
|
|
*/
|
|
|
|
#ifndef nsIPresShell_h___
|
|
|
|
#define nsIPresShell_h___
|
|
|
|
|
1998-06-03 19:41:39 +04:00
|
|
|
#include "nsISupports.h"
|
1998-04-14 00:24:54 +04:00
|
|
|
#include "nsCoord.h"
|
2001-07-16 06:40:48 +04:00
|
|
|
#include "nsEvent.h"
|
2001-12-18 01:39:59 +03:00
|
|
|
#include "nsReflowType.h"
|
2002-06-26 01:16:17 +04:00
|
|
|
#include "nsCompatibility.h"
|
2004-01-08 01:30:53 +03:00
|
|
|
#include "nsCOMArray.h"
|
2004-03-06 07:46:11 +03:00
|
|
|
#include "nsFrameManagerBase.h"
|
2004-01-08 01:30:53 +03:00
|
|
|
#include <stdio.h> // for FILE definition
|
2000-04-27 11:37:12 +04:00
|
|
|
|
2001-12-18 01:39:59 +03:00
|
|
|
class nsIAtom;
|
1998-04-14 00:24:54 +04:00
|
|
|
class nsIContent;
|
2000-03-23 03:34:54 +03:00
|
|
|
class nsIContentIterator;
|
1998-04-14 00:24:54 +04:00
|
|
|
class nsIDocument;
|
1998-06-03 19:41:39 +04:00
|
|
|
class nsIDocumentObserver;
|
1998-04-14 00:24:54 +04:00
|
|
|
class nsIFrame;
|
|
|
|
class nsIPresContext;
|
2004-01-08 01:30:53 +03:00
|
|
|
class nsStyleSet;
|
1998-04-14 00:24:54 +04:00
|
|
|
class nsIViewManager;
|
1998-06-25 08:24:45 +04:00
|
|
|
class nsIDeviceContext;
|
1998-10-02 05:12:39 +04:00
|
|
|
class nsIRenderingContext;
|
1998-12-07 06:43:02 +03:00
|
|
|
class nsIPageSequenceFrame;
|
1999-01-23 10:00:39 +03:00
|
|
|
class nsString;
|
2002-02-20 01:49:12 +03:00
|
|
|
class nsAString;
|
1999-01-23 10:00:39 +03:00
|
|
|
class nsStringArray;
|
1999-02-13 07:45:44 +03:00
|
|
|
class nsICaret;
|
2003-02-22 03:32:13 +03:00
|
|
|
class nsStyleContext;
|
1999-07-18 06:27:19 +04:00
|
|
|
class nsIFrameSelection;
|
2004-02-24 00:29:06 +03:00
|
|
|
class nsFrameManager;
|
1999-08-31 02:38:58 +04:00
|
|
|
class nsILayoutHistoryState;
|
2000-07-14 03:00:59 +04:00
|
|
|
class nsIReflowCallback;
|
2000-10-09 07:08:41 +04:00
|
|
|
class nsISupportsArray;
|
2001-07-16 06:40:48 +04:00
|
|
|
class nsIDOMNode;
|
2001-12-18 01:39:59 +03:00
|
|
|
class nsHTMLReflowCommand;
|
2004-01-08 01:30:53 +03:00
|
|
|
class nsIStyleFrameConstruction;
|
|
|
|
class nsIStyleSheet;
|
2004-01-22 02:05:10 +03:00
|
|
|
class nsCSSFrameConstructor;
|
1998-04-14 00:24:54 +04:00
|
|
|
|
|
|
|
#define NS_IPRESSHELL_IID \
|
|
|
|
{ 0x76e79c60, 0x944e, 0x11d1, \
|
|
|
|
{0x93, 0x23, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32} }
|
|
|
|
|
1999-07-19 22:38:02 +04:00
|
|
|
// Constants uses for ScrollFrameIntoView() function
|
|
|
|
#define NS_PRESSHELL_SCROLL_TOP 0
|
|
|
|
#define NS_PRESSHELL_SCROLL_BOTTOM 100
|
|
|
|
#define NS_PRESSHELL_SCROLL_LEFT 0
|
|
|
|
#define NS_PRESSHELL_SCROLL_RIGHT 100
|
|
|
|
#define NS_PRESSHELL_SCROLL_CENTER 50
|
|
|
|
#define NS_PRESSHELL_SCROLL_ANYWHERE -1
|
2000-01-25 17:31:41 +03:00
|
|
|
#define NS_PRESSHELL_SCROLL_IF_NOT_VISIBLE -2
|
1999-02-19 01:51:46 +03:00
|
|
|
|
2000-03-23 02:19:10 +03:00
|
|
|
// debug VerifyReflow flags
|
|
|
|
#define VERIFY_REFLOW_ON 0x01
|
|
|
|
#define VERIFY_REFLOW_NOISY 0x02
|
|
|
|
#define VERIFY_REFLOW_ALL 0x04
|
|
|
|
#define VERIFY_REFLOW_DUMP_COMMANDS 0x08
|
|
|
|
#define VERIFY_REFLOW_NOISY_RC 0x10
|
|
|
|
#define VERIFY_REFLOW_REALLY_NOISY_RC 0x20
|
|
|
|
#define VERIFY_REFLOW_INCLUDE_SPACE_MANAGER 0x40
|
|
|
|
#define VERIFY_REFLOW_DURING_RESIZE_REFLOW 0x80
|
|
|
|
|
2001-10-01 00:35:55 +04:00
|
|
|
#ifdef IBMBIDI // Constant for Set/Get CaretBidiLevel
|
2001-03-09 06:13:03 +03:00
|
|
|
#define BIDI_LEVEL_UNDEFINED 0x80
|
|
|
|
#endif
|
|
|
|
|
2000-06-23 09:15:04 +04:00
|
|
|
// for PostAttributeChanged
|
|
|
|
enum nsAttributeChangeType {
|
|
|
|
eChangeType_Set = 0, // Set attribute
|
2000-06-23 17:21:57 +04:00
|
|
|
eChangeType_Remove = 1 // Remove attribute
|
2000-06-23 09:15:04 +04:00
|
|
|
};
|
|
|
|
|
1998-04-14 00:24:54 +04:00
|
|
|
/**
|
|
|
|
* Presentation shell interface. Presentation shells are the
|
|
|
|
* controlling point for managing the presentation of a document. The
|
|
|
|
* presentation shell holds a live reference to the document, the
|
|
|
|
* presentation context, the style manager, the style set and the root
|
|
|
|
* frame. <p>
|
|
|
|
*
|
|
|
|
* When this object is Release'd, it will release the document, the
|
|
|
|
* presentation context, the style manager, the style set and the root
|
|
|
|
* frame.
|
|
|
|
*/
|
1998-06-03 19:41:39 +04:00
|
|
|
class nsIPresShell : public nsISupports {
|
1998-04-14 00:24:54 +04:00
|
|
|
public:
|
2002-06-26 07:38:55 +04:00
|
|
|
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IPRESSHELL_IID)
|
1999-03-03 04:51:21 +03:00
|
|
|
|
1998-06-03 19:41:39 +04:00
|
|
|
NS_IMETHOD Init(nsIDocument* aDocument,
|
|
|
|
nsIPresContext* aPresContext,
|
|
|
|
nsIViewManager* aViewManager,
|
2004-01-08 01:30:53 +03:00
|
|
|
nsStyleSet* aStyleSet,
|
2002-06-26 01:16:17 +04:00
|
|
|
nsCompatibility aCompatMode) = 0;
|
1998-04-14 00:24:54 +04:00
|
|
|
|
2001-08-01 07:15:50 +04:00
|
|
|
/**
|
|
|
|
* All callers are responsible for calling |Destroy| after calling
|
|
|
|
* |EndObservingDocument|. It needs to be separate only because form
|
|
|
|
* controls incorrectly store their data in the frames rather than the
|
|
|
|
* content model and printing calls |EndObservingDocument| multiple
|
|
|
|
* times to make form controls behave nicely when printed.
|
|
|
|
*/
|
|
|
|
NS_IMETHOD Destroy() = 0;
|
|
|
|
|
1999-12-05 02:49:50 +03:00
|
|
|
// All frames owned by the shell are allocated from an arena. They are also recycled
|
|
|
|
// using free lists (separate free lists being maintained for each size_t).
|
|
|
|
// Methods for recycling frames.
|
|
|
|
NS_IMETHOD AllocateFrame(size_t aSize, void** aResult) = 0;
|
|
|
|
NS_IMETHOD FreeFrame(size_t aSize, void* aFreeChunk) = 0;
|
2000-03-31 11:02:06 +04:00
|
|
|
|
|
|
|
// Dynamic stack memory allocation
|
|
|
|
NS_IMETHOD PushStackMemory() = 0;
|
|
|
|
NS_IMETHOD PopStackMemory() = 0;
|
|
|
|
NS_IMETHOD AllocateStackMemory(size_t aSize, void** aResult) = 0;
|
1999-12-05 02:49:50 +03:00
|
|
|
|
1999-02-12 20:45:58 +03:00
|
|
|
NS_IMETHOD GetDocument(nsIDocument** aResult) = 0;
|
2003-06-19 22:16:53 +04:00
|
|
|
nsIDocument* GetDocument() { return mDocument; }
|
1998-04-14 00:24:54 +04:00
|
|
|
|
1999-02-12 20:45:58 +03:00
|
|
|
NS_IMETHOD GetPresContext(nsIPresContext** aResult) = 0;
|
2003-06-19 22:16:53 +04:00
|
|
|
nsIPresContext* GetPresContext() { return mPresContext; }
|
1998-04-14 00:24:54 +04:00
|
|
|
|
1999-02-12 20:45:58 +03:00
|
|
|
NS_IMETHOD GetViewManager(nsIViewManager** aResult) = 0;
|
2003-06-19 22:16:53 +04:00
|
|
|
nsIViewManager* GetViewManager() { return mViewManager; }
|
1998-04-14 00:24:54 +04:00
|
|
|
|
2004-01-08 01:30:53 +03:00
|
|
|
#ifdef _IMPL_NS_LAYOUT
|
|
|
|
nsStyleSet* StyleSet() { return mStyleSet; }
|
|
|
|
|
2004-01-22 02:05:10 +03:00
|
|
|
nsCSSFrameConstructor* FrameConstructor()
|
2004-01-08 01:30:53 +03:00
|
|
|
{
|
|
|
|
return mFrameConstructor;
|
|
|
|
}
|
1998-04-14 00:24:54 +04:00
|
|
|
|
2004-03-06 07:46:11 +03:00
|
|
|
nsFrameManager* FrameManager() const {
|
|
|
|
return NS_REINTERPRET_CAST(nsFrameManager*,
|
|
|
|
&NS_CONST_CAST(nsIPresShell*, this)->mFrameManager);
|
|
|
|
}
|
2004-02-24 00:29:06 +03:00
|
|
|
|
|
|
|
#endif
|
2003-07-12 04:48:16 +04:00
|
|
|
|
1999-01-23 10:00:39 +03:00
|
|
|
NS_IMETHOD GetActiveAlternateStyleSheet(nsString& aSheetTitle) = 0;
|
1999-02-12 20:45:58 +03:00
|
|
|
|
1999-01-23 10:00:39 +03:00
|
|
|
NS_IMETHOD SelectAlternateStyleSheet(const nsString& aSheetTitle) = 0;
|
|
|
|
|
2001-12-18 01:51:39 +03:00
|
|
|
/*
|
|
|
|
* Called when stylesheets are added/removed/enabled/disabled to rebuild
|
|
|
|
* all style data for a given pres shell without necessarily reconstructing
|
|
|
|
* all of the frames.
|
|
|
|
*/
|
2003-07-04 05:44:24 +04:00
|
|
|
NS_IMETHOD ReconstructStyleData() = 0;
|
2001-12-18 01:51:39 +03:00
|
|
|
|
2000-10-11 12:33:01 +04:00
|
|
|
/** Setup all style rules required to implement preferences
|
|
|
|
* - used for background/text/link colors and link underlining
|
|
|
|
* may be extended for any prefs that are implemented via style rules
|
|
|
|
* - aForceReflow argument is used to force a full reframe to make the rules show
|
|
|
|
* (only used when the current page needs to reflect changed pref rules)
|
|
|
|
*
|
|
|
|
* - initially created for bugs 31816, 20760, 22963
|
|
|
|
*/
|
|
|
|
NS_IMETHOD SetPreferenceStyleRules(PRBool aForceReflow) = 0;
|
|
|
|
|
|
|
|
/** Allow client to enable and disable the use of the preference style rules,
|
|
|
|
* by type.
|
|
|
|
* NOTE: type argument is currently ignored, but is in the API for
|
|
|
|
* future refinement
|
|
|
|
*
|
|
|
|
* - initially created for bugs 31816, 20760, 22963
|
|
|
|
*/
|
|
|
|
NS_IMETHOD EnablePrefStyleRules(PRBool aEnable, PRUint8 aPrefType=0xFF) = 0;
|
|
|
|
NS_IMETHOD ArePrefStyleRulesEnabled(PRBool& aEnabled) = 0;
|
|
|
|
|
1999-01-23 10:00:39 +03:00
|
|
|
/**
|
|
|
|
* Gather titles of all selectable (alternate and preferred) style sheets
|
|
|
|
* fills void array with nsString* caller must free strings
|
|
|
|
*/
|
|
|
|
NS_IMETHOD ListAlternateStyleSheets(nsStringArray& aTitleList) = 0;
|
|
|
|
|
1999-07-18 06:27:19 +04:00
|
|
|
/**
|
|
|
|
* GetFrameSelection will return the Frame based selection API you
|
|
|
|
* cannot go back and forth anymore with QI with nsIDOM sel and nsIFrame sel.
|
|
|
|
*/
|
2000-04-17 11:13:57 +04:00
|
|
|
NS_IMETHOD GetFrameSelection(nsIFrameSelection** aSelection) = 0;
|
1998-05-09 07:21:34 +04:00
|
|
|
|
1998-04-14 00:24:54 +04:00
|
|
|
// Make shell be a document observer
|
1998-12-29 07:56:31 +03:00
|
|
|
NS_IMETHOD BeginObservingDocument() = 0;
|
1998-04-14 00:24:54 +04:00
|
|
|
|
|
|
|
// Make shell stop being a document observer
|
1998-12-29 07:56:31 +03:00
|
|
|
NS_IMETHOD EndObservingDocument() = 0;
|
1998-04-14 00:24:54 +04:00
|
|
|
|
2002-09-06 09:44:31 +04:00
|
|
|
/**
|
|
|
|
* Determine if InitialReflow() was previously called.
|
|
|
|
* @param aDidInitialReflow PR_TRUE if InitalReflow() was previously called,
|
|
|
|
* PR_FALSE otherwise.
|
|
|
|
*/
|
|
|
|
NS_IMETHOD GetDidInitialReflow(PRBool *aDidInitialReflow) = 0;
|
|
|
|
|
1998-09-10 23:32:14 +04:00
|
|
|
/**
|
|
|
|
* Perform the initial reflow. Constructs the frame for the root content
|
|
|
|
* object and then reflows the frame model into the specified width and
|
|
|
|
* height.
|
|
|
|
*
|
|
|
|
* The coordinates for aWidth and aHeight must be in standard nscoord's.
|
|
|
|
*/
|
|
|
|
NS_IMETHOD InitialReflow(nscoord aWidth, nscoord aHeight) = 0;
|
|
|
|
|
1998-04-14 00:24:54 +04:00
|
|
|
/**
|
|
|
|
* Reflow the frame model into a new width and height. The
|
|
|
|
* coordinates for aWidth and aHeight must be in standard nscoord's.
|
|
|
|
*/
|
1998-08-28 06:49:49 +04:00
|
|
|
NS_IMETHOD ResizeReflow(nscoord aWidth, nscoord aHeight) = 0;
|
1998-04-14 00:24:54 +04:00
|
|
|
|
1998-11-06 19:16:01 +03:00
|
|
|
/**
|
|
|
|
* Reflow the frame model with a reflow reason of eReflowReason_StyleChange
|
|
|
|
*/
|
|
|
|
NS_IMETHOD StyleChangeReflow() = 0;
|
|
|
|
|
1999-02-12 20:45:58 +03:00
|
|
|
NS_IMETHOD GetRootFrame(nsIFrame** aFrame) const = 0;
|
1998-04-14 00:24:54 +04:00
|
|
|
|
1998-12-07 06:43:02 +03:00
|
|
|
/**
|
|
|
|
* Returns the page sequence frame associated with the frame hierarchy.
|
|
|
|
* Returns NULL if not a paginated view.
|
|
|
|
*/
|
1999-02-12 20:45:58 +03:00
|
|
|
NS_IMETHOD GetPageSequenceFrame(nsIPageSequenceFrame** aResult) const = 0;
|
1998-12-07 06:43:02 +03:00
|
|
|
|
1998-12-29 07:45:18 +03:00
|
|
|
/**
|
1999-08-05 07:09:22 +04:00
|
|
|
* Gets the primary frame associated with the content object. This is a
|
|
|
|
* helper function that just forwards the request to the frame manager.
|
1998-12-29 07:45:18 +03:00
|
|
|
*
|
|
|
|
* The primary frame is the frame that is most closely associated with the
|
|
|
|
* content. A frame is more closely associated with the content that another
|
|
|
|
* frame if the one frame contains directly or indirectly the other frame (e.g.,
|
|
|
|
* when a frame is scrolled there is a scroll frame that contains the frame
|
|
|
|
* being scrolled). The primary frame is always the first-in-flow.
|
|
|
|
*
|
|
|
|
* In the case of absolutely positioned elements and floated elements,
|
|
|
|
* the primary frame is the frame that is out of the flow and not the
|
|
|
|
* placeholder frame.
|
|
|
|
*/
|
|
|
|
NS_IMETHOD GetPrimaryFrameFor(nsIContent* aContent,
|
1999-02-12 20:45:58 +03:00
|
|
|
nsIFrame** aPrimaryFrame) const = 0;
|
1999-02-11 02:21:22 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns a layout object associated with the primary frame for the content object.
|
|
|
|
*
|
|
|
|
* @param aContent the content object for which we seek a layout object
|
|
|
|
* @param aResult the resulting layout object as an nsISupports, if found. Refcounted.
|
|
|
|
*/
|
|
|
|
NS_IMETHOD GetLayoutObjectFor(nsIContent* aContent,
|
|
|
|
nsISupports** aResult) const = 0;
|
1998-04-14 00:24:54 +04:00
|
|
|
|
1998-12-29 06:38:16 +03:00
|
|
|
/**
|
1999-08-05 07:09:22 +04:00
|
|
|
* Gets the placeholder frame associated with the specified frame. This is
|
|
|
|
* a helper frame that forwards the request to the frame manager.
|
1998-12-29 06:38:16 +03:00
|
|
|
*/
|
|
|
|
NS_IMETHOD GetPlaceholderFrameFor(nsIFrame* aFrame,
|
1999-02-12 20:45:58 +03:00
|
|
|
nsIFrame** aPlaceholderFrame) const = 0;
|
1998-12-29 06:38:16 +03:00
|
|
|
|
1999-07-17 03:25:15 +04:00
|
|
|
/**
|
|
|
|
* Reflow commands
|
|
|
|
*/
|
2001-12-18 01:39:59 +03:00
|
|
|
NS_IMETHOD AppendReflowCommand(nsHTMLReflowCommand* aReflowCommand) = 0;
|
|
|
|
NS_IMETHOD CancelReflowCommand(nsIFrame* aTargetFrame, nsReflowType* aCmdType) = 0;
|
2000-09-20 11:20:23 +04:00
|
|
|
NS_IMETHOD CancelAllReflowCommands() = 0;
|
2000-04-17 11:13:57 +04:00
|
|
|
|
2002-10-22 10:07:52 +04:00
|
|
|
/**
|
|
|
|
* Recreates the frames for a node
|
|
|
|
*/
|
|
|
|
NS_IMETHOD RecreateFramesFor(nsIContent* aContent) = 0;
|
2000-10-17 09:07:39 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Determine if it is safe to flush all pending notifications
|
|
|
|
* @param aIsSafeToFlush PR_TRUE if it is safe, PR_FALSE otherwise.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
NS_IMETHOD IsSafeToFlush(PRBool& aIsSafeToFlush) = 0;
|
|
|
|
|
2000-04-17 11:13:57 +04:00
|
|
|
/**
|
|
|
|
* Flush all pending notifications such that the presentation is
|
|
|
|
* in sync with the content.
|
2001-08-31 08:28:26 +04:00
|
|
|
* @param aUpdateViews PR_TRUE causes the affected views to be refreshed immediately.
|
2000-04-17 11:13:57 +04:00
|
|
|
*/
|
2001-08-31 08:28:26 +04:00
|
|
|
NS_IMETHOD FlushPendingNotifications(PRBool aUpdateViews) = 0;
|
2000-04-17 11:13:57 +04:00
|
|
|
|
|
|
|
/**
|
2000-06-23 09:15:04 +04:00
|
|
|
* Post a request to handle a DOM event after Reflow has finished.
|
|
|
|
*/
|
|
|
|
NS_IMETHOD PostDOMEvent(nsIContent* aContent, nsEvent* aEvent)=0;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Post a request to set and attribute after reflow has finished.
|
|
|
|
*/
|
|
|
|
NS_IMETHOD PostAttributeChange(nsIContent* aContent,
|
|
|
|
PRInt32 aNameSpaceID,
|
|
|
|
nsIAtom* aName,
|
|
|
|
const nsString& aValue,
|
|
|
|
PRBool aNotify,
|
|
|
|
nsAttributeChangeType aType) = 0;
|
|
|
|
|
2000-07-14 03:00:59 +04:00
|
|
|
NS_IMETHOD PostReflowCallback(nsIReflowCallback* aCallback) = 0;
|
2000-10-07 04:49:08 +04:00
|
|
|
NS_IMETHOD CancelReflowCallback(nsIReflowCallback* aCallback) = 0;
|
2000-06-23 09:15:04 +04:00
|
|
|
/**
|
2000-04-17 11:13:57 +04:00
|
|
|
* Reflow batching
|
|
|
|
*/
|
|
|
|
NS_IMETHOD BeginReflowBatching() = 0;
|
|
|
|
NS_IMETHOD EndReflowBatching(PRBool aFlushPendingReflows) = 0;
|
|
|
|
NS_IMETHOD GetReflowBatchingStatus(PRBool* aIsBatching) = 0;
|
1998-04-14 00:24:54 +04:00
|
|
|
|
1999-02-12 20:45:58 +03:00
|
|
|
NS_IMETHOD ClearFrameRefs(nsIFrame* aFrame) = 0;
|
|
|
|
|
1998-10-02 05:12:39 +04:00
|
|
|
/**
|
1999-07-17 03:25:15 +04:00
|
|
|
* Given a frame, create a rendering context suitable for use with
|
1998-10-02 05:12:39 +04:00
|
|
|
* the frame.
|
|
|
|
*/
|
1999-02-12 20:45:58 +03:00
|
|
|
NS_IMETHOD CreateRenderingContext(nsIFrame *aFrame,
|
|
|
|
nsIRenderingContext** aContext) = 0;
|
1998-10-02 05:12:39 +04:00
|
|
|
|
1999-07-17 03:25:15 +04:00
|
|
|
/**
|
|
|
|
* Notification that we were unable to render a replaced element.
|
|
|
|
* Called when the replaced element can not be rendered, and we should
|
|
|
|
* instead render the element's contents.
|
|
|
|
* The content object associated with aFrame should either be a IMG
|
|
|
|
* element, an OBJECT element, or an APPLET element
|
|
|
|
*/
|
2003-06-20 03:52:58 +04:00
|
|
|
NS_IMETHOD CantRenderReplacedElement(nsIFrame* aFrame) = 0;
|
1999-02-05 21:25:29 +03:00
|
|
|
|
1999-02-13 07:45:44 +03:00
|
|
|
|
1999-02-12 08:39:33 +03:00
|
|
|
/**
|
2003-01-14 02:10:53 +03:00
|
|
|
* Informs the pres shell that the document is now at the anchor with
|
|
|
|
* the given name. If |aScroll| is true, scrolls the view of the
|
|
|
|
* document so that the anchor with the specified name is displayed at
|
|
|
|
* the top of the window. If |aAnchorName| is empty, then this informs
|
|
|
|
* the pres shell that there is no current target, and |aScroll| must
|
|
|
|
* be false.
|
1999-02-12 08:39:33 +03:00
|
|
|
*/
|
2003-01-14 02:10:53 +03:00
|
|
|
NS_IMETHOD GoToAnchor(const nsAString& aAnchorName, PRBool aScroll) = 0;
|
1999-02-12 08:39:33 +03:00
|
|
|
|
1999-02-19 01:51:46 +03:00
|
|
|
/**
|
|
|
|
* Scrolls the view of the document so that the frame is displayed at the
|
|
|
|
* top of the window.
|
1999-07-19 22:38:02 +04:00
|
|
|
*
|
|
|
|
* @param aFrame The frame to scroll into view
|
|
|
|
* @param aVPercent How to align the frame vertically. A value of 0
|
|
|
|
* (NS_PRESSHELL_SCROLL_TOP) means the frame's upper edge is
|
|
|
|
* aligned with the top edge of the visible area. A value of
|
|
|
|
* 100 (NS_PRESSHELL_SCROLL_BOTTOM) means the frame's bottom
|
|
|
|
* edge is aligned with the bottom edge of the visible area.
|
|
|
|
* For values in between, the point "aVPercent" down the frame
|
|
|
|
* is placed at the point "aVPercent" down the visible area. A
|
|
|
|
* value of 50 (NS_PRESSHELL_SCROLL_CENTER) centers the frame
|
|
|
|
* vertically. A value of NS_PRESSHELL_SCROLL_ANYWHERE means move
|
|
|
|
* the frame the minimum amount necessary in order for the entire
|
|
|
|
* frame to be visible vertically (if possible)
|
|
|
|
* @param aHPercent How to align the frame horizontally. A value of 0
|
|
|
|
* (NS_PRESSHELL_SCROLL_LEFT) means the frame's left edge is
|
|
|
|
* aligned with the left edge of the visible area. A value of
|
|
|
|
* 100 (NS_PRESSHELL_SCROLL_RIGHT) means the frame's right
|
|
|
|
* edge is aligned with the right edge of the visible area.
|
|
|
|
* For values in between, the point "aVPercent" across the frame
|
|
|
|
* is placed at the point "aVPercent" across the visible area.
|
|
|
|
* A value of 50 (NS_PRESSHELL_SCROLL_CENTER) centers the frame
|
|
|
|
* horizontally . A value of NS_PRESSHELL_SCROLL_ANYWHERE means move
|
|
|
|
* the frame the minimum amount necessary in order for the entire
|
|
|
|
* frame to be visible horizontally (if possible)
|
1999-02-19 01:51:46 +03:00
|
|
|
*/
|
|
|
|
NS_IMETHOD ScrollFrameIntoView(nsIFrame *aFrame,
|
1999-07-19 22:38:02 +04:00
|
|
|
PRIntn aVPercent,
|
|
|
|
PRIntn aHPercent) const = 0;
|
1999-02-19 01:51:46 +03:00
|
|
|
|
2001-12-01 03:22:00 +03:00
|
|
|
/**
|
|
|
|
* Suppress notification of the frame manager that frames are
|
|
|
|
* being destroyed.
|
|
|
|
*/
|
|
|
|
NS_IMETHOD SetIgnoreFrameDestruction(PRBool aIgnore) = 0;
|
|
|
|
|
1999-07-17 03:25:15 +04:00
|
|
|
/**
|
|
|
|
* Notification sent by a frame informing the pres shell that it is about to
|
|
|
|
* be destroyed.
|
|
|
|
* This allows any outstanding references to the frame to be cleaned up
|
|
|
|
*/
|
|
|
|
NS_IMETHOD NotifyDestroyingFrame(nsIFrame* aFrame) = 0;
|
|
|
|
|
1999-03-01 22:21:01 +03:00
|
|
|
/**
|
1999-04-22 11:03:14 +04:00
|
|
|
* Notify the Clipboard that we have something to copy.
|
1999-03-01 22:21:01 +03:00
|
|
|
*/
|
1999-04-07 07:56:07 +04:00
|
|
|
NS_IMETHOD DoCopy() = 0;
|
1999-03-01 22:21:01 +03:00
|
|
|
|
2001-04-18 10:06:31 +04:00
|
|
|
/**
|
2002-08-02 01:36:02 +04:00
|
|
|
* Get link location.
|
2001-04-18 10:06:31 +04:00
|
|
|
*/
|
2002-08-02 01:36:02 +04:00
|
|
|
NS_IMETHOD GetLinkLocation(nsIDOMNode* aNode, nsAString& aLocation) = 0;
|
2001-04-18 10:06:31 +04:00
|
|
|
|
|
|
|
/**
|
2002-08-02 01:36:02 +04:00
|
|
|
* Get image location.
|
|
|
|
*/
|
|
|
|
NS_IMETHOD GetImageLocation(nsIDOMNode* aNode, nsAString& aLocation) = 0;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Copy image.
|
2001-04-18 10:06:31 +04:00
|
|
|
*/
|
|
|
|
NS_IMETHOD DoCopyImageContents(nsIDOMNode* aNode) = 0;
|
|
|
|
|
2003-04-22 22:11:12 +04:00
|
|
|
/**
|
|
|
|
* Get the doc or the selection as text or html.
|
|
|
|
*/
|
|
|
|
NS_IMETHOD DoGetContents(const nsACString& aMimeType, PRUint32 aFlags, PRBool aSelectionOnly, nsAString& outValue) = 0;
|
|
|
|
|
1999-02-13 07:45:44 +03:00
|
|
|
/**
|
|
|
|
* Get the caret, if it exists. AddRefs it.
|
|
|
|
*/
|
1999-08-05 00:46:16 +04:00
|
|
|
NS_IMETHOD GetCaret(nsICaret **aOutCaret) = 0;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Should the images have borders etc. Actual visual effects are determined
|
|
|
|
* by the frames. Visual effects may not effect layout, only display.
|
|
|
|
* Takes effect on next repaint, does not force a repaint itself.
|
|
|
|
*
|
|
|
|
* @param aEnabled if PR_TRUE, visual selection effects are enabled
|
|
|
|
* if PR_FALSE visual selection effects are disabled
|
|
|
|
* @return always NS_OK
|
|
|
|
*/
|
2001-12-18 04:29:49 +03:00
|
|
|
NS_IMETHOD SetSelectionFlags(PRInt16 aInEnable) = 0;
|
1999-08-05 00:46:16 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the current state of non text selection effects
|
|
|
|
* @param aEnabled [OUT] set to the current state of non text selection,
|
|
|
|
* as set by SetDisplayNonTextSelection
|
|
|
|
* @return if aOutEnabled==null, returns NS_ERROR_INVALID_ARG
|
|
|
|
* else NS_OK
|
|
|
|
*/
|
2001-12-18 04:29:49 +03:00
|
|
|
NS_IMETHOD GetSelectionFlags(PRInt16 *aOutEnabled) = 0;
|
1999-05-17 04:21:18 +04:00
|
|
|
|
2000-04-24 08:41:27 +04:00
|
|
|
/**
|
|
|
|
* Interface to dispatch events via the presshell
|
|
|
|
*/
|
|
|
|
NS_IMETHOD HandleEventWithTarget(nsEvent* aEvent,
|
|
|
|
nsIFrame* aFrame,
|
2000-09-20 11:20:23 +04:00
|
|
|
nsIContent* aContent,
|
2000-09-20 01:47:04 +04:00
|
|
|
PRUint32 aFlags,
|
2000-04-24 08:41:27 +04:00
|
|
|
nsEventStatus* aStatus) = 0;
|
|
|
|
|
2000-06-29 06:02:43 +04:00
|
|
|
/**
|
|
|
|
* Dispatch event to content only (NOT full processing)
|
|
|
|
*/
|
|
|
|
NS_IMETHOD HandleDOMEventWithTarget(nsIContent* aTargetContent,
|
|
|
|
nsEvent* aEvent,
|
|
|
|
nsEventStatus* aStatus) = 0;
|
|
|
|
|
2000-06-24 07:58:13 +04:00
|
|
|
/**
|
|
|
|
* Gets the current target event frame from the PresShell
|
|
|
|
*/
|
|
|
|
NS_IMETHOD GetEventTargetFrame(nsIFrame** aFrame) = 0;
|
|
|
|
|
2003-02-15 00:43:06 +03:00
|
|
|
/**
|
|
|
|
* Gets the current target event frame from the PresShell
|
|
|
|
*/
|
|
|
|
NS_IMETHOD GetEventTargetContent(nsEvent* aEvent, nsIContent** aContent) = 0;
|
|
|
|
|
1999-08-31 02:38:58 +04:00
|
|
|
/**
|
1999-08-31 18:35:50 +04:00
|
|
|
* Get and set the history state for the current document
|
1999-08-31 02:38:58 +04:00
|
|
|
*/
|
1999-12-06 10:44:18 +03:00
|
|
|
|
2000-06-15 04:35:46 +04:00
|
|
|
NS_IMETHOD CaptureHistoryState(nsILayoutHistoryState** aLayoutHistoryState, PRBool aLeavingPage = PR_FALSE) = 0;
|
1998-07-13 23:49:20 +04:00
|
|
|
|
2000-02-09 18:48:01 +03:00
|
|
|
/**
|
|
|
|
* Determine if reflow is currently locked
|
|
|
|
* @param aIsReflowLocked returns PR_TRUE if reflow is locked, PR_FALSE otherwise
|
|
|
|
*/
|
|
|
|
NS_IMETHOD IsReflowLocked(PRBool* aIsLocked) = 0;
|
|
|
|
|
2000-03-23 03:34:54 +03:00
|
|
|
/**
|
|
|
|
* Returns a content iterator to iterate the generated content nodes.
|
|
|
|
* You must specify whether you want to iterate the "before" generated
|
|
|
|
* content or the "after" generated content. If there is no generated
|
|
|
|
* content of the specified type for the promary frame associated with
|
|
|
|
* with the content object then NULL is returned
|
|
|
|
*/
|
|
|
|
enum GeneratedContentType {Before, After};
|
|
|
|
NS_IMETHOD GetGeneratedContentIterator(nsIContent* aContent,
|
|
|
|
GeneratedContentType aType,
|
|
|
|
nsIContentIterator** aIterator) const = 0;
|
|
|
|
|
2000-10-09 07:08:41 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Store the nsIAnonymousContentCreator-generated anonymous
|
2003-04-09 00:50:57 +04:00
|
|
|
* content that's associated with an element. The new anonymous content
|
|
|
|
* is added to whatever anonymous content might already be associated with
|
|
|
|
* the element.
|
2000-10-09 07:08:41 +04:00
|
|
|
* @param aContent the element with which the anonymous
|
|
|
|
* content is to be associated with
|
|
|
|
* @param aAnonymousElements an array of nsIContent
|
|
|
|
* objects, or null to indicate that any anonymous
|
|
|
|
* content should be dissociated from the aContent
|
|
|
|
*/
|
|
|
|
NS_IMETHOD SetAnonymousContentFor(nsIContent* aContent, nsISupportsArray* aAnonymousElements) = 0;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Retrieve the nsIAnonymousContentCreator-generated anonymous
|
|
|
|
* content that's associated with an element.
|
|
|
|
* @param aContent the element for which to retrieve the
|
|
|
|
* associated anonymous content
|
|
|
|
* @param aAnonymousElements an array of nsIContent objects,
|
|
|
|
* or null to indicate that there are no anonymous elements
|
|
|
|
* associated with aContent
|
|
|
|
*/
|
|
|
|
NS_IMETHOD GetAnonymousContentFor(nsIContent* aContent, nsISupportsArray** aAnonymousElements) = 0;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Release all nsIAnonymousContentCreator-generated
|
|
|
|
* anonymous content associated with the shell.
|
|
|
|
*/
|
|
|
|
NS_IMETHOD ReleaseAnonymousContent() = 0;
|
|
|
|
|
2001-04-25 23:52:49 +04:00
|
|
|
/**
|
|
|
|
* Called to find out if painting is suppressed for this presshell. If it is suppressd,
|
|
|
|
* we don't allow the painting of any layer but the background, and we don't
|
|
|
|
* recur into our children.
|
|
|
|
*/
|
|
|
|
NS_IMETHOD IsPaintingSuppressed(PRBool* aResult)=0;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Unsuppress painting.
|
|
|
|
*/
|
2001-05-02 02:54:11 +04:00
|
|
|
NS_IMETHOD UnsuppressPainting() = 0;
|
2001-04-25 23:52:49 +04:00
|
|
|
|
2002-09-21 05:03:38 +04:00
|
|
|
/**
|
|
|
|
* Called to disable nsITheme support in a specific presshell.
|
|
|
|
*/
|
|
|
|
NS_IMETHOD DisableThemeSupport() = 0;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Indicates whether theme support is enabled.
|
|
|
|
*/
|
|
|
|
virtual PRBool IsThemeSupportEnabled() = 0;
|
|
|
|
|
2004-01-08 01:30:53 +03:00
|
|
|
/**
|
|
|
|
* Get the set of agent style sheets for this presentation
|
|
|
|
*/
|
|
|
|
virtual nsresult GetAgentStyleSheets(nsCOMArray<nsIStyleSheet>& aSheets) = 0;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Replace the set of agent style sheets
|
|
|
|
*/
|
|
|
|
virtual nsresult SetAgentStyleSheets(const nsCOMArray<nsIStyleSheet>& aSheets) = 0;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Add an override style sheet for this presentation
|
|
|
|
*/
|
|
|
|
virtual nsresult AddOverrideStyleSheet(nsIStyleSheet *aSheet) = 0;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Remove an override style sheet
|
|
|
|
*/
|
|
|
|
virtual nsresult RemoveOverrideStyleSheet(nsIStyleSheet *aSheet) = 0;
|
|
|
|
|
2004-01-22 02:05:10 +03:00
|
|
|
/**
|
|
|
|
* Reconstruct frames for all elements in the document
|
|
|
|
*/
|
|
|
|
virtual nsresult ReconstructFrames() = 0;
|
|
|
|
|
1998-07-13 23:49:20 +04:00
|
|
|
/**
|
|
|
|
* See if reflow verification is enabled. To enable reflow verification add
|
|
|
|
* "verifyreflow:1" to your NSPR_LOG_MODULES environment variable
|
|
|
|
* (any non-zero debug level will work). Or, call SetVerifyReflowEnable
|
|
|
|
* with PR_TRUE.
|
|
|
|
*/
|
2001-10-23 05:37:21 +04:00
|
|
|
static PRBool GetVerifyReflowEnable();
|
1998-07-13 23:49:20 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the verify-reflow enable flag.
|
|
|
|
*/
|
2001-10-23 05:37:21 +04:00
|
|
|
static void SetVerifyReflowEnable(PRBool aEnabled);
|
1999-08-31 02:38:58 +04:00
|
|
|
|
2000-03-23 02:19:10 +03:00
|
|
|
/**
|
|
|
|
* Get the flags associated with the VerifyReflow debug tool
|
|
|
|
*/
|
2001-10-23 05:37:21 +04:00
|
|
|
static PRInt32 GetVerifyReflowFlags();
|
2000-04-21 18:59:47 +04:00
|
|
|
|
|
|
|
#ifdef MOZ_REFLOW_PERF
|
2000-04-29 03:31:13 +04:00
|
|
|
NS_IMETHOD DumpReflows() = 0;
|
2001-02-22 16:58:17 +03:00
|
|
|
NS_IMETHOD CountReflows(const char * aName, PRUint32 aType, nsIFrame * aFrame) = 0;
|
2001-03-13 04:47:22 +03:00
|
|
|
NS_IMETHOD PaintCount(const char * aName,
|
|
|
|
nsIRenderingContext* aRenderingContext,
|
|
|
|
nsIPresContext * aPresContext,
|
|
|
|
nsIFrame * aFrame,
|
|
|
|
PRUint32 aColor) = 0;
|
|
|
|
NS_IMETHOD SetPaintFrameCount(PRBool aOn) = 0;
|
2000-04-21 18:59:47 +04:00
|
|
|
#endif
|
|
|
|
|
2001-03-09 06:13:03 +03:00
|
|
|
#ifdef IBMBIDI
|
|
|
|
/**
|
2001-10-01 00:35:55 +04:00
|
|
|
* SetCaretBidiLevel will set the Bidi embedding level for the cursor. 0-63
|
2001-03-09 06:13:03 +03:00
|
|
|
*/
|
2001-10-01 00:35:55 +04:00
|
|
|
NS_IMETHOD SetCaretBidiLevel(PRUint8 aLevel) = 0;
|
2001-03-09 06:13:03 +03:00
|
|
|
|
|
|
|
/**
|
2001-10-01 00:35:55 +04:00
|
|
|
* GetCaretBidiLevel will get the Bidi embedding level for the cursor. 0-63
|
2001-03-09 06:13:03 +03:00
|
|
|
*/
|
2001-10-01 00:35:55 +04:00
|
|
|
NS_IMETHOD GetCaretBidiLevel(PRUint8 *aOutLevel) = 0;
|
2001-03-09 06:13:03 +03:00
|
|
|
|
|
|
|
/**
|
2001-10-01 00:35:55 +04:00
|
|
|
* UndefineCaretBidiLevel will set the Bidi embedding level for the cursor to an out-of-range value
|
2001-03-09 06:13:03 +03:00
|
|
|
*/
|
2001-10-01 00:35:55 +04:00
|
|
|
NS_IMETHOD UndefineCaretBidiLevel(void) = 0;
|
2001-03-09 06:13:03 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Reconstruct and reflow frame model
|
|
|
|
*/
|
|
|
|
NS_IMETHOD BidiStyleChangeReflow(void) = 0;
|
|
|
|
#endif
|
|
|
|
|
2004-01-08 01:30:53 +03:00
|
|
|
#ifdef DEBUG
|
|
|
|
// Debugging hooks
|
|
|
|
virtual void ListStyleContexts(nsIFrame *aRootFrame, FILE *out,
|
|
|
|
PRInt32 aIndent = 0) = 0;
|
|
|
|
|
|
|
|
virtual void ListStyleSheets(FILE *out, PRInt32 aIndent = 0) = 0;
|
|
|
|
#endif
|
|
|
|
|
2003-06-19 22:16:53 +04:00
|
|
|
protected:
|
|
|
|
// IMPORTANT: The ownership implicit in the following member variables
|
|
|
|
// has been explicitly checked. If you add any members to this class,
|
|
|
|
// please make the ownership explicit (pinkerton, scc).
|
|
|
|
|
|
|
|
// these are the same Document and PresContext owned by the DocViewer.
|
|
|
|
// we must share ownership.
|
|
|
|
nsIDocument* mDocument; // [STRONG]
|
|
|
|
nsIPresContext* mPresContext; // [STRONG]
|
2004-01-08 22:23:12 +03:00
|
|
|
nsStyleSet* mStyleSet; // [OWNS]
|
2004-01-22 02:05:10 +03:00
|
|
|
nsCSSFrameConstructor* mFrameConstructor; // [OWNS]
|
2003-06-19 22:16:53 +04:00
|
|
|
nsIViewManager* mViewManager; // [WEAK] docViewer owns it so I don't have to
|
2004-03-06 07:46:11 +03:00
|
|
|
nsFrameManagerBase mFrameManager; // [OWNS]
|
1998-04-14 00:24:54 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Create a new empty presentation shell. Upon success, call Init
|
|
|
|
* before attempting to use the shell.
|
|
|
|
*/
|
2003-03-05 18:08:41 +03:00
|
|
|
nsresult
|
|
|
|
NS_NewPresShell(nsIPresShell** aInstancePtrResult);
|
1998-04-14 00:24:54 +04:00
|
|
|
|
|
|
|
#endif /* nsIPresShell_h___ */
|