diff options
Diffstat (limited to 'layout/style/CSSStyleSheet.cpp')
-rw-r--r-- | layout/style/CSSStyleSheet.cpp | 20 |
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); } } } |