2015-05-03 22:32:37 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2014-04-12 12:18:54 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#include "mozilla/dom/StyleSheetList.h"
|
|
|
|
|
|
|
|
#include "mozilla/dom/StyleSheetListBinding.h"
|
2018-04-16 16:18:48 +03:00
|
|
|
#include "nsINode.h"
|
2014-04-12 12:18:54 +04:00
|
|
|
|
2020-11-04 20:04:01 +03:00
|
|
|
namespace mozilla::dom {
|
2014-04-12 12:18:54 +04:00
|
|
|
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_0(StyleSheetList)
|
|
|
|
|
|
|
|
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(StyleSheetList)
|
|
|
|
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
|
2017-12-18 00:29:10 +03:00
|
|
|
NS_INTERFACE_MAP_ENTRY(nsIMutationObserver)
|
2018-01-11 11:17:56 +03:00
|
|
|
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
2014-04-12 12:18:54 +04:00
|
|
|
NS_INTERFACE_MAP_END
|
|
|
|
|
|
|
|
NS_IMPL_CYCLE_COLLECTING_ADDREF(StyleSheetList)
|
|
|
|
NS_IMPL_CYCLE_COLLECTING_RELEASE(StyleSheetList)
|
|
|
|
|
2019-02-26 01:05:29 +03:00
|
|
|
/* virtual */
|
|
|
|
JSObject* StyleSheetList::WrapObject(JSContext* aCx,
|
|
|
|
JS::Handle<JSObject*> aGivenProto) {
|
2018-06-26 00:20:54 +03:00
|
|
|
return StyleSheetList_Binding::Wrap(aCx, this, aGivenProto);
|
2014-04-12 12:18:54 +04:00
|
|
|
}
|
|
|
|
|
2017-12-18 00:29:10 +03:00
|
|
|
void StyleSheetList::NodeWillBeDestroyed(const nsINode* aNode) {
|
2017-12-21 01:29:21 +03:00
|
|
|
mDocumentOrShadowRoot = nullptr;
|
2017-12-18 00:29:10 +03:00
|
|
|
}
|
|
|
|
|
2017-12-21 01:29:21 +03:00
|
|
|
StyleSheetList::StyleSheetList(DocumentOrShadowRoot& aScope)
|
|
|
|
: mDocumentOrShadowRoot(&aScope) {
|
|
|
|
mDocumentOrShadowRoot->AsNode().AddMutationObserver(this);
|
2017-12-18 00:29:10 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
StyleSheetList::~StyleSheetList() {
|
2017-12-21 01:29:21 +03:00
|
|
|
if (mDocumentOrShadowRoot) {
|
|
|
|
mDocumentOrShadowRoot->AsNode().RemoveMutationObserver(this);
|
2017-12-18 00:29:10 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-11-04 20:04:01 +03:00
|
|
|
} // namespace mozilla::dom
|