mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-05 23:38:38 +09:00
Bug 1332353 - Make it clearer when a stylesheet is really owned by its mDocument
Tag #1375
This commit is contained in:
parent
db34da8e01
commit
5d444ef68a
13 changed files with 83 additions and 38 deletions
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue