summaryrefslogtreecommitdiffstats
path: root/layout/style/CSSStyleSheet.cpp
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/CSSStyleSheet.cpp
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/CSSStyleSheet.cpp')
-rw-r--r--layout/style/CSSStyleSheet.cpp20
1 files changed, 14 insertions, 6 deletions
diff --git a/layout/style/CSSStyleSheet.cpp b/layout/style/CSSStyleSheet.cpp
index 71ca6e3f2..43d47100d 100644
--- a/layout/style/CSSStyleSheet.cpp
+++ b/layout/style/CSSStyleSheet.cpp
@@ -694,7 +694,7 @@ nsMediaList::GetMediaText(nsAString& aMediaText)
// nsCOMPtr<nsIDocument>
#define BEGIN_MEDIA_CHANGE(sheet, doc) \
if (sheet) { \
- doc = sheet->GetOwningDocument(); \
+ doc = sheet->GetAssociatedDocument(); \
} \
mozAutoDocUpdate updateBatch(doc, UPDATE_STYLE, true); \
if (sheet) { \
@@ -864,7 +864,8 @@ struct ChildSheetListBuilder {
void SetParentLinks(CSSStyleSheet* aSheet) {
aSheet->mParent = parent;
- aSheet->SetOwningDocument(parent->mDocument);
+ aSheet->SetAssociatedDocument(parent->mDocument,
+ parent->mDocumentAssociationMode);
}
static void ReparentChildList(CSSStyleSheet* aPrimarySheet,
@@ -872,7 +873,8 @@ struct ChildSheetListBuilder {
{
for (CSSStyleSheet *child = aFirstChild; child; child = child->mNext) {
child->mParent = aPrimarySheet;
- child->SetOwningDocument(aPrimarySheet->mDocument);
+ child->SetAssociatedDocument(aPrimarySheet->mDocument,
+ aPrimarySheet->mDocumentAssociationMode);
}
}
};
@@ -1359,16 +1361,22 @@ CSSStyleSheet::GetParentSheet() const
}
void
-CSSStyleSheet::SetOwningDocument(nsIDocument* aDocument)
-{ // not ref counted
+CSSStyleSheet::SetAssociatedDocument(nsIDocument* aDocument,
+ DocumentAssociationMode aAssociationMode)
+{
+ MOZ_ASSERT_IF(!aDocument, aAssociationMode == NotOwnedByDocument);
+
+ // not ref counted
mDocument = aDocument;
+ mDocumentAssociationMode = aAssociationMode;
+
// Now set the same document on all our child sheets....
// XXXbz this is a little bogus; see the XXX comment where we
// declare mFirstChild.
for (CSSStyleSheet* child = mInner->mFirstChild;
child; child = child->mNext) {
if (child->mParent == this) {
- child->SetOwningDocument(aDocument);
+ child->SetAssociatedDocument(aDocument, aAssociationMode);
}
}
}