summaryrefslogtreecommitdiffstats
path: root/layout/style/StyleSheet.h
diff options
context:
space:
mode:
authorMatt A. Tobin <email@mattatobin.com>2020-04-17 05:46:23 -0400
committerMatt A. Tobin <email@mattatobin.com>2020-04-17 05:46:23 -0400
commit2e2190a5044943bde31679996afdc3558d22231b (patch)
tree898dd347d142825ae8b7db30b6172a2a1271a2b3 /layout/style/StyleSheet.h
parentea3a2ce279f92457bfd6168f97b106be193ea740 (diff)
downloadUXP-2e2190a5044943bde31679996afdc3558d22231b.tar
UXP-2e2190a5044943bde31679996afdc3558d22231b.tar.gz
UXP-2e2190a5044943bde31679996afdc3558d22231b.tar.lz
UXP-2e2190a5044943bde31679996afdc3558d22231b.tar.xz
UXP-2e2190a5044943bde31679996afdc3558d22231b.zip
Bug 1332353 - Make it clearer when a stylesheet is really owned by its mDocument
Tag #1375
Diffstat (limited to 'layout/style/StyleSheet.h')
-rw-r--r--layout/style/StyleSheet.h23
1 files changed, 21 insertions, 2 deletions
diff --git a/layout/style/StyleSheet.h b/layout/style/StyleSheet.h
index 863f6d22f..7a1a71466 100644
--- a/layout/style/StyleSheet.h
+++ b/layout/style/StyleSheet.h
@@ -95,8 +95,22 @@ public:
inline bool HasRules() const;
// style sheet owner info
- nsIDocument* GetOwningDocument() const { return mDocument; }
- inline void SetOwningDocument(nsIDocument* aDocument);
+ enum DocumentAssociationMode {
+ // OwnedByDocument means mDocument owns us (possibly via a chain of other
+ // stylesheets).
+ OwnedByDocument,
+ // NotOwnedByDocument means we're owned by something that might have a
+ // different lifetime than mDocument.
+ NotOwnedByDocument
+ };
+ nsIDocument* GetAssociatedDocument() const { return mDocument; }
+ bool IsOwnedByDocument() const {
+ return mDocumentAssociationMode == OwnedByDocument;
+ }
+ // aDocument must not be null.
+ inline void SetAssociatedDocument(nsIDocument* aDocument,
+ DocumentAssociationMode aMode);
+ inline void ClearAssociatedDocument();
nsINode* GetOwnerNode() const { return mOwningNode; }
inline StyleSheet* GetParentSheet() const;
@@ -206,6 +220,11 @@ protected:
const StyleBackendType mType;
bool mDisabled;
+
+ // mDocumentAssociationMode determines whether mDocument directly owns us (in
+ // the sense that if it's known-live then we're known-live). Always
+ // NotOwnedByDocument when mDocument is null.
+ DocumentAssociationMode mDocumentAssociationMode;
};
} // namespace mozilla