1998-09-10 19:32:14 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
*
|
1999-11-06 03:40:37 +00: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-09-10 19:32:14 +00:00
|
|
|
*
|
1999-11-06 03:40:37 +00: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-09-10 19:32:14 +00:00
|
|
|
*
|
1999-11-06 03:40:37 +00:00
|
|
|
* The Original Code is mozilla.org code.
|
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is Netscape
|
1998-09-10 19:32:14 +00:00
|
|
|
* Communications Corporation. Portions created by Netscape are
|
1999-11-06 03:40:37 +00:00
|
|
|
* Copyright (C) 1998 Netscape Communications Corporation. All
|
|
|
|
* Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s):
|
1998-09-10 19:32:14 +00:00
|
|
|
*/
|
|
|
|
#ifndef nsIStyleFrameConstruction_h___
|
|
|
|
#define nsIStyleFrameConstruction_h___
|
|
|
|
|
1999-02-05 03:55:55 +00:00
|
|
|
#include "nsISupports.h"
|
2001-01-16 22:10:04 +00:00
|
|
|
#include "nsIStyleSet.h"
|
1999-02-05 03:55:55 +00:00
|
|
|
|
1999-12-04 23:49:50 +00:00
|
|
|
class nsIPresShell;
|
1998-09-10 19:32:14 +00:00
|
|
|
class nsIPresContext;
|
|
|
|
class nsIContent;
|
|
|
|
class nsIFrame;
|
1999-02-05 03:55:55 +00:00
|
|
|
class nsIAtom;
|
|
|
|
class nsIStyleSheet;
|
|
|
|
class nsIStyleRule;
|
1999-03-25 06:33:25 +00:00
|
|
|
class nsStyleChangeList;
|
1999-08-05 03:09:22 +00:00
|
|
|
class nsIFrameManager;
|
1999-12-06 07:44:18 +00:00
|
|
|
class nsILayoutHistoryState;
|
1998-09-10 19:32:14 +00:00
|
|
|
|
|
|
|
// IID for the nsIStyleSet interface {a6cf9066-15b3-11d2-932e-00805f8add32}
|
|
|
|
#define NS_ISTYLE_FRAME_CONSTRUCTION_IID \
|
|
|
|
{0xa6cf9066, 0x15b3, 0x11d2, {0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}}
|
|
|
|
|
2001-01-16 22:10:04 +00:00
|
|
|
/** Interface for objects that handle frame construction based on style.
|
|
|
|
* All frame construction goes through an object that implements this interface.
|
|
|
|
* Frames are built based on the state of the content model and the style model.
|
|
|
|
* Changes to either content or style can cause changes to the frame model.
|
|
|
|
*/
|
1998-09-10 19:32:14 +00:00
|
|
|
class nsIStyleFrameConstruction : public nsISupports {
|
|
|
|
public:
|
2001-02-19 21:50:04 +00:00
|
|
|
NS_DEFINE_STATIC_IID_ACCESSOR(NS_ISTYLE_FRAME_CONSTRUCTION_IID)
|
|
|
|
|
1998-09-10 19:32:14 +00:00
|
|
|
/**
|
2001-01-16 22:10:04 +00:00
|
|
|
* Create frames for the root content element and its child content.
|
|
|
|
*
|
|
|
|
* @param aPresShell the presentation shell for which we will consturct a root frame
|
|
|
|
* @param aPresContext the presentation context
|
|
|
|
* @param aDocElement the content node to map into a root frame
|
|
|
|
* @param aFrameSubTree [OUT] the resulting frame tree (a root frame and its children)
|
|
|
|
*
|
|
|
|
* @return NS_OK
|
|
|
|
*/
|
1999-12-04 23:49:50 +00:00
|
|
|
NS_IMETHOD ConstructRootFrame(nsIPresShell* aPresShell,
|
|
|
|
nsIPresContext* aPresContext,
|
1998-12-29 03:38:16 +00:00
|
|
|
nsIContent* aDocElement,
|
|
|
|
nsIFrame*& aFrameSubTree) = 0;
|
1998-09-10 19:32:14 +00:00
|
|
|
|
2001-01-16 22:10:04 +00:00
|
|
|
/**
|
|
|
|
* Causes reconstruction of a frame hierarchy rooted by the
|
|
|
|
* document element frame. This is often called when radical style
|
|
|
|
* change precludes incremental reflow.
|
|
|
|
*
|
|
|
|
* @param aPresContext the presentation context
|
|
|
|
*
|
|
|
|
* @return NS_OK
|
|
|
|
*/
|
1999-03-01 16:57:35 +00:00
|
|
|
NS_IMETHOD ReconstructDocElementHierarchy(nsIPresContext* aPresContext) = 0;
|
1998-11-17 02:14:38 +00:00
|
|
|
|
2001-01-16 22:10:04 +00:00
|
|
|
|
|
|
|
/////////////// Content change notifications //////////////////
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Notification that content was appended in the content tree.
|
|
|
|
* This may have the side effect of creating frames for the new content.
|
|
|
|
*
|
|
|
|
* @param aPresContext the presentation context
|
|
|
|
* @param aContainer the content node into which content was appended
|
|
|
|
* @param aNewIndexInContainer the index in aContainer at which the first
|
|
|
|
* content node was appended.
|
|
|
|
* @return NS_OK
|
|
|
|
* @see nsIDocumentObserver
|
|
|
|
*/
|
1998-09-10 19:32:14 +00:00
|
|
|
NS_IMETHOD ContentAppended(nsIPresContext* aPresContext,
|
|
|
|
nsIContent* aContainer,
|
|
|
|
PRInt32 aNewIndexInContainer) = 0;
|
1998-09-18 17:18:37 +00:00
|
|
|
|
2001-01-16 22:10:04 +00:00
|
|
|
/**
|
|
|
|
* Notification that content was inserted in the content tree.
|
|
|
|
* This may have the side effect of creating frames for the new content.
|
|
|
|
*
|
|
|
|
* @param aPresContext the presentation context
|
|
|
|
* @param aContainer the content node into which content was appended
|
|
|
|
* @param aChild the content node that was inserted
|
|
|
|
* @param aNewIndexInContainer the index of aChild in aContainer
|
|
|
|
* @param aFrameState the layout history object used to initialize the new frame(s)
|
|
|
|
*
|
|
|
|
* @return NS_OK
|
|
|
|
* @see nsIDocumentObserver
|
|
|
|
*/
|
1998-09-18 17:18:37 +00:00
|
|
|
NS_IMETHOD ContentInserted(nsIPresContext* aPresContext,
|
|
|
|
nsIContent* aContainer,
|
|
|
|
nsIContent* aChild,
|
1999-12-06 07:44:18 +00:00
|
|
|
PRInt32 aIndexInContainer,
|
|
|
|
nsILayoutHistoryState* aFrameState) = 0;
|
1998-09-25 05:13:06 +00:00
|
|
|
|
2001-01-16 22:10:04 +00:00
|
|
|
/**
|
|
|
|
* Notification that content was replaced in the content tree.
|
|
|
|
* This may have the side effect of creating frames for the new content.
|
|
|
|
*
|
|
|
|
* @param aPresContext the presentation context
|
|
|
|
* @param aContainer the content node into which content was appended
|
|
|
|
* @param aOldChild the content node that was replaced
|
|
|
|
* @param aNewChild the new content node that replaced aOldChild
|
|
|
|
* @param aNewIndexInContainer the index of aNewChild in aContainer
|
|
|
|
*
|
|
|
|
* @return NS_OK
|
|
|
|
* @see nsIDocumentObserver
|
|
|
|
*/
|
1998-09-25 22:47:00 +00:00
|
|
|
NS_IMETHOD ContentReplaced(nsIPresContext* aPresContext,
|
|
|
|
nsIContent* aContainer,
|
|
|
|
nsIContent* aOldChild,
|
|
|
|
nsIContent* aNewChild,
|
|
|
|
PRInt32 aIndexInContainer) = 0;
|
|
|
|
|
2001-01-16 22:10:04 +00:00
|
|
|
/**
|
|
|
|
* Notification that content was inserted in the content tree.
|
|
|
|
* This may have the side effect of changing the frame tree
|
|
|
|
*
|
|
|
|
* @param aPresContext the presentation context
|
|
|
|
* @param aContainer the content node into which content was appended
|
|
|
|
* @param aChild the content node that was inserted
|
|
|
|
* @param aNewIndexInContainer the index of aChild in aContainer
|
|
|
|
*
|
|
|
|
* @return NS_OK
|
|
|
|
* @see nsIDocumentObserver
|
|
|
|
*/
|
1998-09-25 05:13:06 +00:00
|
|
|
NS_IMETHOD ContentRemoved(nsIPresContext* aPresContext,
|
|
|
|
nsIContent* aContainer,
|
|
|
|
nsIContent* aChild,
|
|
|
|
PRInt32 aIndexInContainer) = 0;
|
1998-09-29 23:41:59 +00:00
|
|
|
|
2001-01-16 22:10:04 +00:00
|
|
|
/**
|
|
|
|
* Notification that content was changed in the content tree.
|
|
|
|
* This may have the side effect of changing the frame tree
|
|
|
|
*
|
|
|
|
* @param aPresContext the presentation context
|
|
|
|
* @param aContent the content node that was changed
|
|
|
|
* @param aSubContent a hint to the frame system about the change
|
|
|
|
*
|
|
|
|
* @return NS_OK
|
|
|
|
* @see nsIDocumentObserver
|
|
|
|
*/
|
1998-09-29 23:41:59 +00:00
|
|
|
NS_IMETHOD ContentChanged(nsIPresContext* aPresContext,
|
|
|
|
nsIContent* aContent,
|
|
|
|
nsISupports* aSubContent) = 0;
|
|
|
|
|
2001-01-16 22:10:04 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Notification that the state of a content node has changed.
|
|
|
|
* (ie: gained or lost focus, became active or hovered over)
|
|
|
|
*
|
|
|
|
* @param aPresContext the presentation context
|
|
|
|
* @param aContent1 the content node whose state was changed
|
|
|
|
* @param aContent2 an optional second content node whose state
|
|
|
|
* has also changed. The meaning of aContent2
|
|
|
|
* depends on the type of state change.
|
|
|
|
*
|
|
|
|
* @return NS_OK
|
|
|
|
* @see nsIDocumentObserver
|
|
|
|
*/
|
1999-04-20 00:02:22 +00:00
|
|
|
NS_IMETHOD ContentStatesChanged(nsIPresContext* aPresContext,
|
|
|
|
nsIContent* aContent1,
|
|
|
|
nsIContent* aContent2) = 0;
|
1999-02-27 07:15:09 +00:00
|
|
|
|
2001-01-16 22:10:04 +00:00
|
|
|
/**
|
|
|
|
* Notification that an attribute was changed for a content node
|
|
|
|
* This may have the side effect of changing the frame tree
|
|
|
|
*
|
|
|
|
* @param aPresContext the presentation context
|
|
|
|
* @param aContent the content node on which an attribute was changed
|
|
|
|
* @param aNameSpaceID the name space for the changed attribute
|
|
|
|
* @param aAttribute the attribute that was changed
|
|
|
|
* @param aHint a hint about the effect of the change
|
|
|
|
* see nsStyleConsts.h for legal values
|
|
|
|
* any of the consts of the form NS_STYLE_HINT_*
|
|
|
|
*
|
|
|
|
* @return NS_OK
|
|
|
|
* @see nsIDocumentObserver
|
|
|
|
*/
|
1998-09-29 23:41:59 +00:00
|
|
|
NS_IMETHOD AttributeChanged(nsIPresContext* aPresContext,
|
|
|
|
nsIContent* aContent,
|
1999-10-15 23:16:45 +00:00
|
|
|
PRInt32 aNameSpaceID,
|
1998-09-29 23:41:59 +00:00
|
|
|
nsIAtom* aAttribute,
|
|
|
|
PRInt32 aHint) = 0;
|
1998-11-26 01:24:52 +00:00
|
|
|
|
2001-01-16 22:10:04 +00:00
|
|
|
|
|
|
|
/////////////// Style change notifications //////////////////
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A StyleRule has just been modified within a style sheet.
|
|
|
|
*
|
|
|
|
* @param aDocument The document being observed
|
|
|
|
* @param aStyleSheet the StyleSheet that contians the rule
|
|
|
|
* @param aStyleRule the rule that was modified
|
|
|
|
* @param aHint some possible info about the nature of the change.
|
|
|
|
* see nsStyleConsts for hint values
|
|
|
|
*
|
|
|
|
* @return NS_OK
|
|
|
|
* @see nsIDocumentObserver
|
|
|
|
*/
|
1998-11-26 01:24:52 +00:00
|
|
|
NS_IMETHOD StyleRuleChanged(nsIPresContext* aPresContext,
|
|
|
|
nsIStyleSheet* aStyleSheet,
|
|
|
|
nsIStyleRule* aStyleRule,
|
|
|
|
PRInt32 aHint) = 0; // See nsStyleConsts fot hint values
|
2001-01-16 22:10:04 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* A StyleRule has just been added to a style sheet.
|
|
|
|
* This method is called automatically when the rule gets
|
|
|
|
* added to the sheet. The style sheet passes this
|
|
|
|
* notification to the document. The notification is passed on
|
|
|
|
* to all of the document observers.
|
|
|
|
*
|
|
|
|
* @param aDocument The document being observed
|
|
|
|
* @param aStyleSheet the StyleSheet that has been modified
|
|
|
|
* @param aStyleRule the rule that was added
|
|
|
|
*
|
|
|
|
* @return NS_OK
|
|
|
|
* @see nsIDocumentObserver
|
|
|
|
*/
|
1998-11-26 01:24:52 +00:00
|
|
|
NS_IMETHOD StyleRuleAdded(nsIPresContext* aPresContext,
|
|
|
|
nsIStyleSheet* aStyleSheet,
|
|
|
|
nsIStyleRule* aStyleRule) = 0;
|
2001-01-16 22:10:04 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* A StyleRule has just been removed from a style sheet.
|
|
|
|
* This method is called automatically when the rule gets
|
|
|
|
* removed from the sheet. The style sheet passes this
|
|
|
|
* notification to the document. The notification is passed on
|
|
|
|
* to all of the document observers.
|
|
|
|
*
|
|
|
|
* @param aDocument The document being observed
|
|
|
|
* @param aStyleSheet the StyleSheet that has been modified
|
|
|
|
* @param aStyleRule the rule that was removed
|
|
|
|
*
|
|
|
|
* @return NS_OK
|
|
|
|
* @see nsIDocumentObserver
|
|
|
|
*/
|
1998-11-26 01:24:52 +00:00
|
|
|
NS_IMETHOD StyleRuleRemoved(nsIPresContext* aPresContext,
|
|
|
|
nsIStyleSheet* aStyleSheet,
|
|
|
|
nsIStyleRule* aStyleRule) = 0;
|
2001-01-16 22:10:04 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Method that actually handles style changes for effected frames.
|
|
|
|
* Note: this may not need to be a public method. Use with extreme caution.
|
|
|
|
*
|
|
|
|
* @param aRestyleArray A list of effected frames.
|
|
|
|
* @param aPresContext The presentation context.
|
|
|
|
*
|
|
|
|
* @return NS_OK
|
|
|
|
*/
|
1999-03-25 06:33:25 +00:00
|
|
|
NS_IMETHOD ProcessRestyledFrames(nsStyleChangeList& aRestyleArray,
|
|
|
|
nsIPresContext* aPresContext) = 0;
|
1999-02-04 17:03:46 +00:00
|
|
|
|
2001-01-16 22:10:04 +00:00
|
|
|
/////////////// misc methods //////////////////////
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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.
|
|
|
|
* For HTML, the content object associated with aFrame should either be a IMG
|
|
|
|
* element or an OBJECT element.
|
|
|
|
* This may have the side effect of changing the frame tree.
|
|
|
|
*
|
|
|
|
* @param aPresShell the presentation shell
|
|
|
|
* @param aPresContext the presentation context
|
|
|
|
* @param aFrame the frame constructed for the replaced element
|
|
|
|
*
|
|
|
|
* @return NS_OK
|
|
|
|
*/
|
|
|
|
NS_IMETHOD CantRenderReplacedElement(nsIPresShell* aPresShell,
|
1999-12-04 23:49:50 +00:00
|
|
|
nsIPresContext* aPresContext,
|
1999-02-04 17:03:46 +00:00
|
|
|
nsIFrame* aFrame) = 0;
|
1999-02-24 04:03:50 +00:00
|
|
|
|
2001-01-16 22:10:04 +00:00
|
|
|
/**
|
|
|
|
* Request to create a continuing frame
|
|
|
|
*
|
|
|
|
* @param aPresShell the presentation shell
|
|
|
|
* @param aPresContext the presentation context
|
|
|
|
* @param aFrame the frame for which we need a continuation
|
|
|
|
* @param aParentFrame the parent of aFrame
|
|
|
|
* @param aContinuingFrame [OUT] the resulting frame
|
|
|
|
*
|
|
|
|
* @return NS_OK
|
|
|
|
*/
|
|
|
|
NS_IMETHOD CreateContinuingFrame(nsIPresShell* aPresShell,
|
1999-12-04 23:49:50 +00:00
|
|
|
nsIPresContext* aPresContext,
|
1999-02-24 04:03:50 +00:00
|
|
|
nsIFrame* aFrame,
|
|
|
|
nsIFrame* aParentFrame,
|
|
|
|
nsIFrame** aContinuingFrame) = 0;
|
1999-07-02 04:46:19 +00:00
|
|
|
|
2001-01-16 22:10:04 +00:00
|
|
|
/** Request to find the primary frame associated with a given content object.
|
|
|
|
* This is typically called by the pres shell when there is no mapping in
|
|
|
|
* the pres shell hash table
|
|
|
|
*
|
|
|
|
* @param aPresContext the presentation context
|
|
|
|
* @param aFrameManager the frame manager for the frame being sought
|
|
|
|
* @param aContent the content node for which we seek a frame
|
|
|
|
* @param aFrame [OUT] the resulting frame, if any. may be null,
|
|
|
|
* indicating that no frame maps aContent
|
|
|
|
* @param aHint an optional hint used to make the search for aFrame faster
|
|
|
|
*/
|
1999-08-05 03:09:22 +00:00
|
|
|
NS_IMETHOD FindPrimaryFrameFor(nsIPresContext* aPresContext,
|
|
|
|
nsIFrameManager* aFrameManager,
|
|
|
|
nsIContent* aContent,
|
2001-01-16 22:10:04 +00:00
|
|
|
nsIFrame** aFrame,
|
|
|
|
nsFindFrameHint* aHint=nsnull) = 0;
|
1998-09-10 19:32:14 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* nsIStyleFrameConstruction_h___ */
|