1998-04-13 20:24:54 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
*
|
|
|
|
* The contents of this file are subject to the Netscape Public License
|
|
|
|
* Version 1.0 (the "NPL"); you may not use this file except in
|
|
|
|
* compliance with the NPL. You may obtain a copy of the NPL at
|
|
|
|
* http://www.mozilla.org/NPL/
|
|
|
|
*
|
|
|
|
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* NPL.
|
|
|
|
*
|
|
|
|
* The Initial Developer of this code under the NPL is Netscape
|
|
|
|
* Communications Corporation. Portions created by Netscape are
|
|
|
|
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
|
|
|
* Reserved.
|
|
|
|
*/
|
|
|
|
#ifndef nsStyleSet_h___
|
|
|
|
#define nsStyleSet_h___
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include "nsISupports.h"
|
|
|
|
#include "nslayout.h"
|
|
|
|
|
|
|
|
class nsIAtom;
|
|
|
|
class nsIStyleRule;
|
|
|
|
class nsIStyleSheet;
|
|
|
|
class nsIStyleContext;
|
|
|
|
class nsIPresContext;
|
|
|
|
class nsIContent;
|
|
|
|
class nsIFrame;
|
1998-09-10 19:32:14 +00:00
|
|
|
class nsIDocument;
|
1998-04-13 20:24:54 +00:00
|
|
|
|
|
|
|
|
|
|
|
// IID for the nsIStyleSet interface {e59396b0-b244-11d1-8031-006008159b5a}
|
|
|
|
#define NS_ISTYLE_SET_IID \
|
|
|
|
{0xe59396b0, 0xb244, 0x11d1, {0x80, 0x31, 0x00, 0x60, 0x08, 0x15, 0x9b, 0x5a}}
|
|
|
|
|
|
|
|
class nsIStyleSet : public nsISupports {
|
|
|
|
public:
|
1998-09-02 02:00:24 +00:00
|
|
|
// Style sheets are ordered, most significant first
|
|
|
|
// NOTE: this is the reverse of the way documents store the sheets
|
1998-04-13 20:24:54 +00:00
|
|
|
virtual void AppendOverrideStyleSheet(nsIStyleSheet* aSheet) = 0;
|
|
|
|
virtual void InsertOverrideStyleSheetAfter(nsIStyleSheet* aSheet,
|
|
|
|
nsIStyleSheet* aAfterSheet) = 0;
|
|
|
|
virtual void InsertOverrideStyleSheetBefore(nsIStyleSheet* aSheet,
|
|
|
|
nsIStyleSheet* aBeforeSheet) = 0;
|
|
|
|
virtual void RemoveOverrideStyleSheet(nsIStyleSheet* aSheet) = 0;
|
|
|
|
virtual PRInt32 GetNumberOfOverrideStyleSheets() = 0;
|
|
|
|
virtual nsIStyleSheet* GetOverrideStyleSheetAt(PRInt32 aIndex) = 0;
|
|
|
|
|
1999-01-23 07:01:02 +00:00
|
|
|
// the ordering of document style sheets is given by the document
|
|
|
|
virtual void AddDocStyleSheet(nsIStyleSheet* aSheet, nsIDocument* aDocument) = 0;
|
1998-04-13 20:24:54 +00:00
|
|
|
virtual void RemoveDocStyleSheet(nsIStyleSheet* aSheet) = 0;
|
|
|
|
virtual PRInt32 GetNumberOfDocStyleSheets() = 0;
|
|
|
|
virtual nsIStyleSheet* GetDocStyleSheetAt(PRInt32 aIndex) = 0;
|
|
|
|
|
|
|
|
virtual void AppendBackstopStyleSheet(nsIStyleSheet* aSheet) = 0;
|
|
|
|
virtual void InsertBackstopStyleSheetAfter(nsIStyleSheet* aSheet,
|
|
|
|
nsIStyleSheet* aAfterSheet) = 0;
|
|
|
|
virtual void InsertBackstopStyleSheetBefore(nsIStyleSheet* aSheet,
|
|
|
|
nsIStyleSheet* aBeforeSheet) = 0;
|
|
|
|
virtual void RemoveBackstopStyleSheet(nsIStyleSheet* aSheet) = 0;
|
|
|
|
virtual PRInt32 GetNumberOfBackstopStyleSheets() = 0;
|
|
|
|
virtual nsIStyleSheet* GetBackstopStyleSheetAt(PRInt32 aIndex) = 0;
|
|
|
|
|
1998-05-18 21:03:10 +00:00
|
|
|
// get a style context for a non-pseudo frame
|
1998-04-13 20:24:54 +00:00
|
|
|
virtual nsIStyleContext* ResolveStyleFor(nsIPresContext* aPresContext,
|
|
|
|
nsIContent* aContent,
|
1998-11-03 20:16:23 +00:00
|
|
|
nsIStyleContext* aParentContext,
|
1998-06-05 05:58:20 +00:00
|
|
|
PRBool aForceUnique = PR_FALSE) = 0;
|
1998-04-13 20:24:54 +00:00
|
|
|
|
1998-05-18 21:03:10 +00:00
|
|
|
// get a style context for a pseudo-frame (ie: tag = NS_NewAtom(":FIRST-LINE");
|
|
|
|
virtual nsIStyleContext* ResolvePseudoStyleFor(nsIPresContext* aPresContext,
|
1998-11-03 20:16:23 +00:00
|
|
|
nsIContent* aParentContent,
|
1998-05-18 21:03:10 +00:00
|
|
|
nsIAtom* aPseudoTag,
|
1998-11-03 20:16:23 +00:00
|
|
|
nsIStyleContext* aParentContext,
|
1998-06-05 05:58:20 +00:00
|
|
|
PRBool aForceUnique = PR_FALSE) = 0;
|
1998-05-18 21:03:10 +00:00
|
|
|
|
|
|
|
// This funtions just like ResolvePseudoStyleFor except that it will
|
|
|
|
// return nsnull if there are no explicit style rules for that
|
|
|
|
// pseudo element
|
|
|
|
virtual nsIStyleContext* ProbePseudoStyleFor(nsIPresContext* aPresContext,
|
1998-11-03 20:16:23 +00:00
|
|
|
nsIContent* aParentContent,
|
1998-05-18 21:03:10 +00:00
|
|
|
nsIAtom* aPseudoTag,
|
1998-11-03 20:16:23 +00:00
|
|
|
nsIStyleContext* aParentContext,
|
1998-06-05 05:58:20 +00:00
|
|
|
PRBool aForceUnique = PR_FALSE) = 0;
|
1998-05-18 21:03:10 +00:00
|
|
|
|
1998-12-29 03:38:16 +00:00
|
|
|
// Create frames for the root content element and its child content
|
|
|
|
NS_IMETHOD ConstructRootFrame(nsIPresContext* aPresContext,
|
|
|
|
nsIContent* aDocElement,
|
|
|
|
nsIFrame*& aFrameSubTree) = 0;
|
1998-09-10 19:32:14 +00:00
|
|
|
|
1998-11-17 02:14:38 +00:00
|
|
|
// Causes reconstruction of a frame hierarchy rooted by the
|
|
|
|
// frame aFrameSubTree. This is often called when radical style
|
|
|
|
// change precludes incremental reflow.
|
|
|
|
NS_IMETHOD ReconstructFrames(nsIPresContext* aPresContext,
|
|
|
|
nsIContent* aContent,
|
|
|
|
nsIFrame* aParentFrame,
|
|
|
|
nsIFrame* aFrameSubTree) = 0;
|
|
|
|
|
1998-09-10 19:32:14 +00:00
|
|
|
// Notifications of changes to the content mpodel
|
|
|
|
NS_IMETHOD ContentAppended(nsIPresContext* aPresContext,
|
|
|
|
nsIContent* aContainer,
|
|
|
|
PRInt32 aNewIndexInContainer) = 0;
|
|
|
|
NS_IMETHOD ContentInserted(nsIPresContext* aPresContext,
|
|
|
|
nsIContent* aContainer,
|
|
|
|
nsIContent* aChild,
|
|
|
|
PRInt32 aIndexInContainer) = 0;
|
|
|
|
NS_IMETHOD ContentReplaced(nsIPresContext* aPresContext,
|
|
|
|
nsIContent* aContainer,
|
|
|
|
nsIContent* aOldChild,
|
|
|
|
nsIContent* aNewChild,
|
|
|
|
PRInt32 aIndexInContainer) = 0;
|
|
|
|
NS_IMETHOD ContentRemoved(nsIPresContext* aPresContext,
|
|
|
|
nsIContent* aContainer,
|
|
|
|
nsIContent* aChild,
|
|
|
|
PRInt32 aIndexInContainer) = 0;
|
|
|
|
|
1998-09-29 23:41:59 +00:00
|
|
|
NS_IMETHOD ContentChanged(nsIPresContext* aPresContext,
|
|
|
|
nsIContent* aContent,
|
|
|
|
nsISupports* aSubContent) = 0;
|
|
|
|
NS_IMETHOD AttributeChanged(nsIPresContext* aPresContext,
|
|
|
|
nsIContent* aChild,
|
|
|
|
nsIAtom* aAttribute,
|
|
|
|
PRInt32 aHint) = 0; // See nsStyleConsts fot hint values
|
|
|
|
|
1998-11-26 01:24:52 +00:00
|
|
|
// Style change notifications
|
|
|
|
NS_IMETHOD StyleRuleChanged(nsIPresContext* aPresContext,
|
|
|
|
nsIStyleSheet* aStyleSheet,
|
|
|
|
nsIStyleRule* aStyleRule,
|
|
|
|
PRInt32 aHint) = 0; // See nsStyleConsts fot hint values
|
|
|
|
NS_IMETHOD StyleRuleAdded(nsIPresContext* aPresContext,
|
|
|
|
nsIStyleSheet* aStyleSheet,
|
|
|
|
nsIStyleRule* aStyleRule) = 0;
|
|
|
|
NS_IMETHOD StyleRuleRemoved(nsIPresContext* aPresContext,
|
|
|
|
nsIStyleSheet* aStyleSheet,
|
|
|
|
nsIStyleRule* aStyleRule) = 0;
|
1998-04-13 20:24:54 +00:00
|
|
|
|
|
|
|
virtual void List(FILE* out = stdout, PRInt32 aIndent = 0) = 0;
|
1998-06-26 05:49:01 +00:00
|
|
|
virtual void ListContexts(nsIStyleContext* aRootContext, FILE* out = stdout, PRInt32 aIndent = 0) = 0;
|
1998-04-13 20:24:54 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
extern NS_LAYOUT nsresult
|
|
|
|
NS_NewStyleSet(nsIStyleSet** aInstancePtrResult);
|
|
|
|
|
|
|
|
#endif /* nsIStyleSet_h___ */
|