From 1bfec862ce946a0bb8dd7aa750f4df84a523706a Mon Sep 17 00:00:00 2001 From: "peterl%netscape.com" Date: Thu, 26 Nov 1998 01:24:52 +0000 Subject: [PATCH] added change notification support --- content/base/public/nsIDocument.h | 11 +++++ content/base/public/nsIDocumentObserver.h | 48 +++++++++++++++++++ content/base/public/nsIStyleRule.h | 3 ++ layout/base/public/nsIDocument.h | 11 +++++ layout/base/public/nsIDocumentObserver.h | 48 +++++++++++++++++++ .../base/public/nsIStyleFrameConstruction.h | 12 +++++ layout/base/public/nsIStyleRule.h | 3 ++ layout/base/public/nsIStyleSet.h | 12 ++++- layout/style/nsIStyleRule.h | 3 ++ 9 files changed, 150 insertions(+), 1 deletion(-) diff --git a/content/base/public/nsIDocument.h b/content/base/public/nsIDocument.h index 2e86ba6ad64..ea063dcf3dd 100644 --- a/content/base/public/nsIDocument.h +++ b/content/base/public/nsIDocument.h @@ -35,6 +35,7 @@ class nsIStreamListener; class nsIStreamObserver; class nsIStyleSet; class nsIStyleSheet; +class nsIStyleRule; class nsIURL; class nsIURLGroup; class nsIViewManager; @@ -188,6 +189,16 @@ public: nsIContent* aChild, PRInt32 aIndexInContainer) = 0; + // Observation hooks for style data to propogate notifications + // to document observers + NS_IMETHOD StyleRuleChanged(nsIStyleSheet* aStyleSheet, + nsIStyleRule* aStyleRule, + PRInt32 aHint) = 0; // See nsStyleConsts fot hint values + NS_IMETHOD StyleRuleAdded(nsIStyleSheet* aStyleSheet, + nsIStyleRule* aStyleRule) = 0; + NS_IMETHOD StyleRuleRemoved(nsIStyleSheet* aStyleSheet, + nsIStyleRule* aStyleRule) = 0; + /** * Returns the Selection Object */ diff --git a/content/base/public/nsIDocumentObserver.h b/content/base/public/nsIDocumentObserver.h index 72311cf023b..9990724fa47 100644 --- a/content/base/public/nsIDocumentObserver.h +++ b/content/base/public/nsIDocumentObserver.h @@ -22,6 +22,7 @@ class nsIContent; class nsIPresShell; class nsIStyleSheet; +class nsIStyleRule; class nsString; class nsIDocument; @@ -204,6 +205,53 @@ public: PRBool aDisabled) = 0; /** + * A StyleRule has just been modified within a style sheet. + * This method is called automatically when the rule gets + * modified. 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 contians the rule + * @param aStyleRule the rule that was modified + * @param aHint some possible info about the nature of the change + */ + NS_IMETHOD StyleRuleChanged(nsIDocument *aDocument, + nsIStyleSheet* aStyleSheet, + nsIStyleRule* aStyleRule, + PRInt32 aHint) = 0; // See nsStyleConsts fot hint values + + /** + * 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 + */ + NS_IMETHOD StyleRuleAdded(nsIDocument *aDocument, + nsIStyleSheet* aStyleSheet, + nsIStyleRule* aStyleRule) = 0; + + /** + * 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 + */ + NS_IMETHOD StyleRuleRemoved(nsIDocument *aDocument, + nsIStyleSheet* aStyleSheet, + nsIStyleRule* aStyleRule) = 0; + + /** * The document is in the process of being destroyed. * This method is called automatically during document * destruction. diff --git a/content/base/public/nsIStyleRule.h b/content/base/public/nsIStyleRule.h index 51bb23560a7..314f899a3ed 100644 --- a/content/base/public/nsIStyleRule.h +++ b/content/base/public/nsIStyleRule.h @@ -23,6 +23,7 @@ #include "nslayout.h" #include "nsISupports.h" +class nsIStyleSheet; class nsIStyleContext; class nsIPresContext; class nsIContent; @@ -36,6 +37,8 @@ public: NS_IMETHOD Equals(const nsIStyleRule* aRule, PRBool& aResult) const = 0; NS_IMETHOD HashValue(PRUint32& aValue) const = 0; + NS_IMETHOD GetStyleSheet(nsIStyleSheet*& aSheet) const = 0; + // Strength is an out-of-band weighting, useful for mapping CSS ! important NS_IMETHOD GetStrength(PRInt32& aStrength) = 0; diff --git a/layout/base/public/nsIDocument.h b/layout/base/public/nsIDocument.h index 2e86ba6ad64..ea063dcf3dd 100644 --- a/layout/base/public/nsIDocument.h +++ b/layout/base/public/nsIDocument.h @@ -35,6 +35,7 @@ class nsIStreamListener; class nsIStreamObserver; class nsIStyleSet; class nsIStyleSheet; +class nsIStyleRule; class nsIURL; class nsIURLGroup; class nsIViewManager; @@ -188,6 +189,16 @@ public: nsIContent* aChild, PRInt32 aIndexInContainer) = 0; + // Observation hooks for style data to propogate notifications + // to document observers + NS_IMETHOD StyleRuleChanged(nsIStyleSheet* aStyleSheet, + nsIStyleRule* aStyleRule, + PRInt32 aHint) = 0; // See nsStyleConsts fot hint values + NS_IMETHOD StyleRuleAdded(nsIStyleSheet* aStyleSheet, + nsIStyleRule* aStyleRule) = 0; + NS_IMETHOD StyleRuleRemoved(nsIStyleSheet* aStyleSheet, + nsIStyleRule* aStyleRule) = 0; + /** * Returns the Selection Object */ diff --git a/layout/base/public/nsIDocumentObserver.h b/layout/base/public/nsIDocumentObserver.h index 72311cf023b..9990724fa47 100644 --- a/layout/base/public/nsIDocumentObserver.h +++ b/layout/base/public/nsIDocumentObserver.h @@ -22,6 +22,7 @@ class nsIContent; class nsIPresShell; class nsIStyleSheet; +class nsIStyleRule; class nsString; class nsIDocument; @@ -204,6 +205,53 @@ public: PRBool aDisabled) = 0; /** + * A StyleRule has just been modified within a style sheet. + * This method is called automatically when the rule gets + * modified. 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 contians the rule + * @param aStyleRule the rule that was modified + * @param aHint some possible info about the nature of the change + */ + NS_IMETHOD StyleRuleChanged(nsIDocument *aDocument, + nsIStyleSheet* aStyleSheet, + nsIStyleRule* aStyleRule, + PRInt32 aHint) = 0; // See nsStyleConsts fot hint values + + /** + * 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 + */ + NS_IMETHOD StyleRuleAdded(nsIDocument *aDocument, + nsIStyleSheet* aStyleSheet, + nsIStyleRule* aStyleRule) = 0; + + /** + * 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 + */ + NS_IMETHOD StyleRuleRemoved(nsIDocument *aDocument, + nsIStyleSheet* aStyleSheet, + nsIStyleRule* aStyleRule) = 0; + + /** * The document is in the process of being destroyed. * This method is called automatically during document * destruction. diff --git a/layout/base/public/nsIStyleFrameConstruction.h b/layout/base/public/nsIStyleFrameConstruction.h index 49ecf4e2304..c4255567bf1 100644 --- a/layout/base/public/nsIStyleFrameConstruction.h +++ b/layout/base/public/nsIStyleFrameConstruction.h @@ -74,6 +74,18 @@ public: nsIContent* aContent, nsIAtom* aAttribute, PRInt32 aHint) = 0; + + // 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; }; #endif /* nsIStyleFrameConstruction_h___ */ diff --git a/layout/base/public/nsIStyleRule.h b/layout/base/public/nsIStyleRule.h index 51bb23560a7..314f899a3ed 100644 --- a/layout/base/public/nsIStyleRule.h +++ b/layout/base/public/nsIStyleRule.h @@ -23,6 +23,7 @@ #include "nslayout.h" #include "nsISupports.h" +class nsIStyleSheet; class nsIStyleContext; class nsIPresContext; class nsIContent; @@ -36,6 +37,8 @@ public: NS_IMETHOD Equals(const nsIStyleRule* aRule, PRBool& aResult) const = 0; NS_IMETHOD HashValue(PRUint32& aValue) const = 0; + NS_IMETHOD GetStyleSheet(nsIStyleSheet*& aSheet) const = 0; + // Strength is an out-of-band weighting, useful for mapping CSS ! important NS_IMETHOD GetStrength(PRInt32& aStrength) = 0; diff --git a/layout/base/public/nsIStyleSet.h b/layout/base/public/nsIStyleSet.h index 08769a514ae..a728f3e1dbb 100644 --- a/layout/base/public/nsIStyleSet.h +++ b/layout/base/public/nsIStyleSet.h @@ -132,7 +132,17 @@ public: nsIAtom* aAttribute, PRInt32 aHint) = 0; // See nsStyleConsts fot hint values - // xxx style rules enumeration + // 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; virtual void List(FILE* out = stdout, PRInt32 aIndent = 0) = 0; virtual void ListContexts(nsIStyleContext* aRootContext, FILE* out = stdout, PRInt32 aIndent = 0) = 0; diff --git a/layout/style/nsIStyleRule.h b/layout/style/nsIStyleRule.h index 51bb23560a7..314f899a3ed 100644 --- a/layout/style/nsIStyleRule.h +++ b/layout/style/nsIStyleRule.h @@ -23,6 +23,7 @@ #include "nslayout.h" #include "nsISupports.h" +class nsIStyleSheet; class nsIStyleContext; class nsIPresContext; class nsIContent; @@ -36,6 +37,8 @@ public: NS_IMETHOD Equals(const nsIStyleRule* aRule, PRBool& aResult) const = 0; NS_IMETHOD HashValue(PRUint32& aValue) const = 0; + NS_IMETHOD GetStyleSheet(nsIStyleSheet*& aSheet) const = 0; + // Strength is an out-of-band weighting, useful for mapping CSS ! important NS_IMETHOD GetStrength(PRInt32& aStrength) = 0;