diff options
Diffstat (limited to 'layout/style/StyleSheet.h')
-rw-r--r-- | layout/style/StyleSheet.h | 23 |
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 |